/* NamVx — thẻ người chơi. Nền bàn gaming chuyển động, thẻ vàng góc cạnh. */

@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/bevietnam-400-vi.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/bevietnam-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/bevietnam-600-vi.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/bevietnam-600-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Cormorant Garamond";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/cormorant-700-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --gold: #b5893d;
  --gold-light: #e8d5a3;
  --ink: #f4ecd8;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: #07080c; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--ink);
  font-family: "Be Vietnam Pro", "Noto Sans", sans-serif;
  background: #07080c;
}
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.scene { position: fixed; inset: 0; z-index: 0; background: #07080c; }
.scene-photo, .scene-shade, .scene-sweep, .scene-sparks { position: absolute; inset: 0; }
.scene-photo { overflow: hidden; }
.scene-photo img {
  position: absolute;
  inset: -6%;
  width: 112%;
  height: 112%;
  object-fit: cover;
  object-position: 68% center;
}
.scene-shade {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(181, 137, 61, 0.2), transparent 46%),
    linear-gradient(180deg, rgba(7, 8, 12, 0.28), rgba(7, 8, 12, 0.55));
  pointer-events: none;
}
.scene-sweep {
  background: linear-gradient(105deg, transparent 30%, rgba(232, 213, 163, 0.05) 46%, rgba(232, 213, 163, 0.28) 50%, rgba(181, 137, 61, 0.08) 54%, transparent 70%);
  pointer-events: none;
}
.scene-sparks, .tap-fx { width: 100%; height: 100%; pointer-events: none; }
.tap-fx { position: fixed; inset: 0; z-index: 4; }

.stage {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 68px 14px 24px;
}
.card {
  width: min(100%, 460px);
  padding: 18px 16px 16px;
  background: rgba(8, 10, 14, 0.9);
  border: 1px solid rgba(232, 213, 163, 0.55);
  clip-path: polygon(18px 0, 100% 0, 100% calc(100% - 18px), calc(100% - 18px) 100%, 0 100%, 0 18px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
.top { margin: 0 0 2px; }
.ecg {
  position: relative;
  height: 46px;
  container-type: inline-size;
}
.ecg-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}
.ecg-base,
.ecg-tail,
.ecg-head {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.ecg-base {
  stroke: rgba(232, 213, 163, 0.28);
  stroke-width: 1.25;
}
.ecg-tail {
  stroke: rgba(243, 226, 186, 0.55);
  stroke-width: 1.5;
  stroke-dasharray: 210 390;
  filter: drop-shadow(0 0 3px rgba(232, 213, 163, 0.45));
}
.ecg-head {
  stroke: #f6edd4;
  stroke-width: 1.75;
  stroke-dasharray: 28 572;
  filter: drop-shadow(0 0 4px rgba(232, 213, 163, 0.95));
}
.marquee {
  position: absolute;
  inset: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}
.marquee-track {
  display: flex;
  width: max-content;
  will-change: transform;
}
.marquee-track span {
  flex: none;
  width: 50cqw;
  display: flex;
  align-items: center;
  justify-content: center;
}
.marquee-track b {
  display: inline-block;
  padding: 2px 8px 1px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.16em;
  line-height: 1.2;
  font-style: normal;
  color: #f4e7c6;
  text-shadow: 0 0 8px rgba(232, 213, 163, 0.4);
  background: rgba(8, 10, 14, 0.84);
  clip-path: polygon(5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%, 0 5px);
}
.identity { display: flex; gap: 14px; align-items: center; margin-top: 12px; }
.portrait-frame {
  position: relative;
  width: 92px;
  height: 112px;
  flex: none;
  cursor: pointer;
  --ring-pad: 3px;
  --ring-glow-op: 0.4;
  --ring-glow-scale: 1;
}
.portrait-frame:focus-visible {
  outline: 1px solid rgba(232, 213, 163, 0.8);
  outline-offset: 3px;
}
.note-hint {
  position: absolute;
  z-index: 2;
  right: 5px;
  bottom: 5px;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  color: #1a1208;
  background: rgba(232, 213, 163, 0.9);
  clip-path: polygon(4px 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%, 0 4px);
  pointer-events: none;
}
.note-hint svg { width: 12px; height: 12px; }
.portrait-frame.is-playing .note-hint { opacity: 0; }
.ring,
.ring-glow {
  position: absolute;
  inset: calc(var(--ring-pad) * -1);
  padding: var(--ring-pad);
  pointer-events: none;
  clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
}
.ring { z-index: 1; }
.ring-glow {
  z-index: 0;
  opacity: var(--ring-glow-op);
  transform: scale(var(--ring-glow-scale));
  filter: blur(6px);
  will-change: transform, opacity;
}
.ring-spin {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 240%;
  height: 240%;
  will-change: transform;
  background: conic-gradient(
    from 0deg,
    rgba(244, 228, 186, 0.96) 0deg,
    rgba(226, 186, 176, 0.5) 32deg,
    rgba(176, 204, 206, 0.28) 78deg,
    rgba(232, 213, 163, 0.14) 140deg,
    rgba(232, 213, 163, 0.05) 210deg,
    rgba(232, 213, 163, 0.05) 300deg,
    rgba(232, 213, 163, 0.28) 340deg,
    rgba(244, 228, 186, 0.96) 360deg
  );
}
.portrait {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
}
.name { margin: 0; font-family: "Cormorant Garamond", serif; font-size: 46px; line-height: 0.85; font-weight: 700; }
.tag { margin: 4px 0 0; color: var(--gold-light); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; }
.interests {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.chip {
  min-width: 0;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 8px;
  color: var(--gold-light);
  font-size: 12px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  background: rgba(232, 213, 163, 0.05);
  border: 1px solid rgba(232, 213, 163, 0.5);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  transition: background-color 0.2s ease, filter 0.2s ease, transform 0.12s ease;
}
.chip svg { width: 15px; height: 15px; flex: none; }
.chip:hover,
.chip:focus-visible,
.chip.is-pressed {
  background: rgba(232, 213, 163, 0.16);
  filter: drop-shadow(0 0 7px rgba(232, 213, 163, 0.65));
}
.chip.is-pressed { transform: scale(0.97); }
.intro { margin: 12px 0 0; font-size: 14px; line-height: 1.5; color: rgba(244, 236, 216, 0.88); }
.list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.row { display: flex; gap: 6px; }
.hit {
  flex: 1;
  min-width: 0;
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  text-decoration: none;
  color: inherit;
  background: rgba(232, 213, 163, 0.05);
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.hit svg { width: 18px; height: 18px; color: var(--gold-light); flex: none; }
.k { display: block; font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold-light); }
.v { font-size: 13px; }
.copy {
  width: 42px;
  color: var(--gold-light);
  transition: transform 0.12s ease;
}
.copy svg { width: 16px; height: 16px; }
.copy .icon-check { display: none; }
.copy.is-done .icon-copy { display: none; }
.copy.is-done .icon-check { display: block; }
.copy.is-done { background: var(--gold-light); color: #1a1208; }
.save {
  margin-top: 10px;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 13px;
  color: #1a1208;
  background: linear-gradient(90deg, #c6a15a, #e8d5a3);
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
  transition: transform 0.12s ease, filter 0.12s ease;
}
.save svg { width: 16px; height: 16px; }
.hit.is-pressed, .copy.is-pressed, .save.is-pressed { transform: scale(0.96); }
.hit.is-pressed, .copy.is-pressed { box-shadow: 0 0 18px rgba(232, 213, 163, 0.45); }
.save.is-pressed { filter: brightness(1.08); }
.footnote { margin: 10px 0 0; text-align: center; font-size: 12px; color: rgba(232, 213, 163, 0.82); }

.toast {
  position: fixed; z-index: 5; left: 50%;
  bottom: max(16px, calc(env(safe-area-inset-bottom) + 10px));
  transform: translateX(-50%) translateY(8px);
  opacity: 0; pointer-events: none; margin: 0;
  padding: 10px 14px; border-radius: 999px;
  background: rgba(8, 10, 14, 0.92);
  border: 1px solid rgba(232, 213, 163, 0.55);
  color: var(--gold-light); font-size: 13px;
}
.toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (min-width: 520px) {
  .interests { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .chip { padding: 6px 4px; gap: 4px; font-size: 11.5px; }
}
@media (min-width: 900px) {
  .scene-photo img { object-position: center center; }
  .name { font-size: 56px; }
}

@media (prefers-reduced-motion: no-preference) {
  .scene-photo img { animation: ken 28s ease-in-out infinite alternate; }
  .scene-sweep { animation: sweep 9s ease-in-out infinite; }
  .chip { animation: chip-in 0.55s ease backwards; }
  .chip:nth-child(2) { animation-delay: 0.08s; }
  .chip:nth-child(3) { animation-delay: 0.16s; }
  .chip:nth-child(4) { animation-delay: 0.24s; }
  .ring-spin { animation: ring-turn 7s linear infinite; }
  .portrait-frame.is-live .ring-spin { animation-duration: 3.5s; }
  .portrait-frame.is-playing:not(.is-live) .ring-glow { animation: ring-breathe 1.2s ease-in-out infinite; }
  .marquee-track { animation: marquee 14s linear infinite; }
  .ecg-tail { animation: ecg-draw 3.6s linear infinite; }
  .ecg-head { animation: ecg-head 3.6s linear infinite; }
}
@keyframes ken {
  from { transform: scale(1.12) translate3d(2.2%, 1%, 0); }
  to { transform: scale(1.24) translate3d(-3.2%, -2%, 0); }
}
@keyframes sweep {
  0% { transform: translateX(-32%); }
  50% { transform: translateX(32%); }
  100% { transform: translateX(-32%); }
}
@keyframes chip-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes ring-turn {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}
@keyframes ring-breathe {
  0%, 100% { opacity: 0.38; transform: scale(1); }
  14% { opacity: 0.82; transform: scale(1.05); }
  28% { opacity: 0.42; transform: scale(1); }
  44% { opacity: 0.68; transform: scale(1.03); }
  62% { opacity: 0.38; transform: scale(1); }
}
@keyframes marquee {
  from { transform: translateX(-50%); }
  to { transform: translateX(0); }
}
@keyframes ecg-draw {
  from { stroke-dashoffset: 0; }
  to { stroke-dashoffset: -600; }
}
@keyframes ecg-head {
  from { stroke-dashoffset: 182; }
  to { stroke-dashoffset: -418; }
}
@media (prefers-reduced-motion: reduce) {
  .scene-photo img, .scene-sweep, .chip, .ring-spin, .marquee-track { animation: none; }
  .ecg-tail, .ecg-head { animation: none; stroke-dasharray: none; opacity: 0; }
  .ecg-base { stroke: rgba(232, 213, 163, 0.85); stroke-width: 1.5; }
}
