/* ===================================================================
   운빨 디펜스 듀얼 — "NEON OBSIDIAN"
   딥 그래파이트 프리미엄 + 시안 액센트 + (행동할 때만) 네온 도파민.
   모바일 우선 · 무(無)스크롤 · GPU(transform/opacity) 모션 · 모션 감소 존중.
   =================================================================== */

/* ── 디자인 토큰 ─────────────────────────────────────────────────── */
:root {
  /* 표면 */
  --bg: #07090F;
  --bg-grad-top: #0B0E17;
  --bg-grad-bot: #06080D;
  --panel: #11141E;
  --panel2: #171B28;
  --panel-3: #1E2433;
  --glass: rgba(22, 27, 40, 0.66);
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.12);
  --scrim: rgba(4, 6, 11, 0.66);

  /* 텍스트 */
  --text: #EDF0F6;
  --text-2: #AEB6C8;
  --muted: #6E7793;
  --faint: #454C61;

  /* 액센트(브랜드 == 태초) */
  --accent: #36D6E7;
  --accent-bright: #6FE8F4;
  --accent-dim: #1B95A3;
  --accent-glow: rgba(54, 214, 231, 0.30);
  --on-accent: #04141A;
  --primary: #36D6E7;     /* 구 호환 */
  --primary-d: #1B95A3;

  /* 기능색 */
  --gold: #E9B949;
  --gold-bright: #F2CD6B;
  --gold-dim: #8A6D27;
  --ok: #34D399;
  --secondary: #4C8DFF;
  --secondary-d: #2563EB;
  --danger: #F2616B;
  --danger-d: #7A2127;
  --warn: #E9B949;

  /* 등급 칩 */
  --r-common: #8A93A6;
  --r-rare: #4C8DFF;
  --r-epic: #F2544A;
  --r-legend: #F0A94B;
  --r-primordial: #36D6E7;

  /* 그라데이션 */
  --grad-accent: linear-gradient(180deg, #6FE8F4, #36D6E7);
  --grad-danger: linear-gradient(90deg, #F2849B, #F2616B);
  --grad-gold: linear-gradient(180deg, #F2CD6B, #E9B949);

  /* 라운드 */
  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 20px;
  --r-pill: 999px;

  /* 엘리베이션(하드-레그 그림자 없음) */
  --e1: 0 1px 0 rgba(255,255,255,.04) inset, 0 1px 2px rgba(0,0,0,.4);
  --e2: inset 0 1px 0 rgba(255,255,255,.20), 0 4px 16px rgba(0,0,0,.5);
  --e3: inset 0 1px 0 rgba(255,255,255,.08), 0 16px 48px rgba(0,0,0,.62);
  --glow-accent: 0 0 18px -2px var(--accent-glow);
  --glow-gold: 0 0 14px -2px rgba(233,185,73,.5);

  /* 모션 */
  --dur-1: 120ms;
  --dur-2: 200ms;
  --dur-3: 280ms;
  --dur-4: 420ms;
  --ease-standard: cubic-bezier(.4, 0, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-in: cubic-bezier(.4, 0, 1, 1);
  --ease-spring: cubic-bezier(.34, 1.4, .5, 1);

  /* 세이프 에어리어 */
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);

  /* 폰트 — 본문/한글=Pretendard, 수치/라틴 HUD=각진 테크체(Chakra Petch) */
  --font-ui: "Pretendard Variable", "Pretendard", -apple-system, BlinkMacSystemFont,
    "Apple SD Gothic Neo", system-ui, sans-serif;
  --font-num: "Chakra Petch", "Pretendard Variable", "Pretendard", ui-monospace, "SF Mono", monospace;
}

/* touch-action: manipulation → iOS Safari 더블탭 확대 제거(핀치/스크롤/연타는 유지). 캔버스는 아래서 none. */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
[hidden] { display: none !important; }

/* ── 무스크롤 백스톱 ─────────────────────────────────────────────── */
html, body {
  margin: 0; padding: 0; height: 100%; width: 100%;
  position: fixed; overflow: hidden; overscroll-behavior: none;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px; font-weight: 500; line-height: 1.5;
  background: radial-gradient(120% 80% at 50% -10%, var(--bg-grad-top), var(--bg-grad-bot)) fixed, var(--bg);
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
/* ── 수치 리드아웃: 각진 테크 디스플레이체 + 고정폭 숫자(값 변동 시 흔들림 없는 HUD 가독성) ── */
.hp-label, .wave-pill, .wave-pill b, .time, .gold-val, .opp-nums, .opp-nums b,
.ooc-stat .v, .stat .v, .vs-score, .vs-stat b, .hof-score, .hof-medal.num,
.room-code, .join-row input {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1;
}
/* 미세 스캔라인(정적, UI 뒤) */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(255,255,255,.012) 3px 4px);
  opacity: .5;
}

#app {
  position: relative; z-index: 1;
  height: 100vh; height: 100svh; height: 100dvh;
  width: 100%; max-width: 480px; margin-inline: auto; overflow: hidden;
}

/* ── 화면 전환 ─────────────────────────────────────────────────── */
.screen { display: none; height: 100%; width: 100%; flex-direction: column; min-height: 0; }
.screen.active { display: flex; animation: screen-in var(--dur-3) var(--ease-out); }
#screen-game.active { display: grid; grid-template-rows: auto 1fr auto; gap: 8px;
  padding: max(6px, var(--sat)) max(8px, var(--sar)) max(6px, var(--sab)) max(8px, var(--sal));
  overflow: hidden; }
.hidden { display: none !important; }
@keyframes screen-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.muted { color: var(--muted); }
.small { font-size: 12px; }
:focus-visible { outline: none; box-shadow: 0 0 0 1px var(--accent), 0 0 0 4px var(--accent-glow); }
b, .tabnum, #my-hp, #gold, #wave, #time, #opp-hp, #opp-wave, #opp-gold, #opp-towers,
.room-code, .stat .v { font-variant-numeric: tabular-nums; }

/* ── 공통 버튼 ───────────────────────────────────────────────────── */
.btn {
  display: block; width: 100%; padding: 14px 16px; margin: 0;
  border: 1px solid transparent; border-radius: var(--r-md);
  font-size: 15px; font-weight: 700; font-family: inherit;
  cursor: pointer; position: relative; overflow: hidden;
  transition: transform var(--dur-1) var(--ease-spring), filter var(--dur-2), box-shadow var(--dur-2);
}
.btn:active { transform: scale(.97); filter: brightness(.96); }
.btn-primary { background: linear-gradient(180deg, rgba(255,255,255,.26), rgba(255,255,255,0) 45%), var(--grad-accent);
  color: var(--on-accent); box-shadow: var(--e2), 0 8px 24px -10px var(--accent-glow); }
.btn-secondary { background: var(--panel2); color: var(--secondary); border-color: rgba(76,141,255,.4); }
.btn-line { background: var(--panel2); color: var(--accent); border-color: var(--line-strong); }
.btn-ghost { background: transparent; color: var(--muted); font-weight: 600; }
.btn:disabled { opacity: .4; filter: saturate(.4) brightness(.7); box-shadow: none; cursor: default; }

/* ── 로비 ─────────────────────────────────────────────────────── */
.lobby-inner {
  height: 100%; display: flex; flex-direction: column; min-height: 0;
  padding: max(14px, var(--sat)) 16px max(12px, var(--sab));
  gap: clamp(8px, 2.2vh, 14px);
}
.lobby-head { flex: 0 0 auto; text-align: center; position: relative; }
/* 히어로 앰비언트 글로우 — 상단 여백을 '의도된 분위기'로 채움(로비엔 라이브 캔버스 없음 → 모션 OK) */
.lobby-head::before {
  content: ""; position: absolute; left: 50%; top: -8%; z-index: -1; pointer-events: none;
  width: min(360px, 90vw); aspect-ratio: 1; transform: translateX(-50%);
  background: radial-gradient(circle at 50% 42%, rgba(54,214,231,.20), rgba(54,214,231,.05) 42%, transparent 66%);
  animation: hero-breathe 6.5s var(--ease-standard) infinite;
}
@keyframes hero-breathe { 0%,100% { opacity: .55; transform: translateX(-50%) scale(1); } 50% { opacity: 1; transform: translateX(-50%) scale(1.06); } }
.logo-mark { display: block; width: clamp(56px, 12vh, 80px); height: auto; margin: 0 auto;
  filter: drop-shadow(0 6px 18px rgba(0,0,0,.5)) drop-shadow(0 0 16px rgba(54,214,231,.28)); animation: logo-float 4s var(--ease-standard) infinite; }
.logo { font-size: clamp(28px, 7.8vw, 37px); font-weight: 900; letter-spacing: -.03em; line-height: 1.04; margin: 8px 0 0;
  animation: logo-float 4s var(--ease-standard) infinite; }
.logo span { color: var(--accent); position: relative; text-shadow: 0 0 18px var(--accent-glow), 0 0 44px rgba(54,214,231,.22); }
@keyframes logo-float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }
.tagline { color: var(--text-2); margin: 7px 0 0; font-size: 13px; letter-spacing: .01em; }

.invite-banner {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: var(--r-md); padding: 10px 12px; box-shadow: var(--e1);
  animation: slide-down var(--dur-3) var(--ease-out);
}
.invite-banner b { color: var(--accent); letter-spacing: 2px; }
.invite-banner .btn { width: auto; padding: 9px 14px; margin: 0; }
@keyframes slide-down { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ── 인앱 브라우저 경고 배너(상단 고정) ─────────────────────────── */
.inapp-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 80;
  width: 100%; max-width: 480px; margin-inline: auto;
  display: flex; align-items: center; gap: 8px;
  padding: max(8px, var(--sat)) 12px 8px;
  background: linear-gradient(180deg, #2A2410, var(--panel));
  border-bottom: 1px solid rgba(233,185,73,.5);
  box-shadow: 0 6px 20px rgba(0,0,0,.5);
  animation: slide-down var(--dur-3) var(--ease-out);
}
.inapp-banner[hidden] { display: none; }
.inapp-msg { flex: 1 1 auto; font-size: 12px; font-weight: 700; color: var(--warn); line-height: 1.35; }
.inapp-open {
  flex: 0 0 auto; padding: 8px 12px; border-radius: var(--r-pill); border: 0; cursor: pointer;
  font-size: 12px; font-weight: 800; background: var(--grad-gold); color: #2A2410; white-space: nowrap;
}
.inapp-x {
  flex: 0 0 auto; width: 28px; height: 28px; border-radius: var(--r-pill); cursor: pointer;
  border: 1px solid var(--line); background: transparent; color: var(--text-2); font-size: 13px;
}

.lobby-cards { flex: 1 1 auto; min-height: 0; overflow: hidden; display: flex; flex-direction: column; justify-content: center; gap: clamp(8px, 2.2vh, 14px); }
.card {
  flex: 0 0 auto; position: relative; background: linear-gradient(180deg, var(--panel2), var(--panel));
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg); padding: clamp(13px, 2.6vh, 17px);
  box-shadow: var(--e1), 0 16px 40px -22px rgba(0,0,0,.72); overflow: hidden;
}
/* 상단 1px 하이라이트(상단광) — 유리질 깊이감 */
.card::after { content: ""; position: absolute; inset: 0 0 auto; height: 50%; border-radius: inherit;
  background: linear-gradient(180deg, rgba(255,255,255,.035), transparent); pointer-events: none; }
.card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px; z-index: 1; }
.card-bot::before { background: var(--grad-accent); box-shadow: 0 0 12px rgba(54,214,231,.5); }
.card-friend::before { background: linear-gradient(90deg, var(--secondary), #6aa6ff); box-shadow: 0 0 12px rgba(76,141,255,.45); }
.card h2 { margin: 0 0 2px; font-size: 16.5px; font-weight: 800; letter-spacing: -.01em; }
.card .tag { font-size: 11px; font-weight: 700; color: var(--secondary); background: rgba(76,141,255,.14);
  border: 1px solid rgba(76,141,255,.3); border-radius: var(--r-xs); padding: 1px 6px; margin-left: 4px; vertical-align: middle; }
.card p { margin: 0 0 10px; font-size: 13px; }

.difficulty { position: relative; display: flex; gap: 0; margin-bottom: 12px; background: var(--panel2);
  border: 1px solid var(--line); border-radius: var(--r-pill); padding: 3px; }
.seg-thumb { position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc((100% - 6px) / 3);
  background: var(--grad-accent); border-radius: var(--r-pill);
  box-shadow: var(--glow-accent), inset 0 1px 0 rgba(255,255,255,.35);
  transition: transform var(--dur-2) var(--ease-out); z-index: 0; }
.diff-btn { position: relative; z-index: 1; flex: 1; padding: 9px 0; border: none; background: transparent;
  color: var(--muted); font-weight: 700; font-size: 14px; font-family: inherit; cursor: pointer;
  transition: color var(--dur-2); }
.diff-btn.active { color: var(--on-accent); font-weight: 800; }

.join-row { display: flex; gap: 8px; margin-top: 8px; }
.join-row input {
  flex: 1; min-width: 0; padding: 12px; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--panel2); color: var(--text); font-size: 18px; letter-spacing: .18em;
  text-align: center; text-transform: uppercase; font-weight: 800; font-family: inherit; min-height: 48px;
  transition: border-color var(--dur-2), box-shadow var(--dur-2);
}
.join-row input::placeholder { letter-spacing: normal; font-weight: 600; color: var(--faint); }
.join-row input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.join-row .btn { width: auto; padding: 0 18px; margin: 0; }

.lobby-foot { flex: 0 0 auto; display: flex; gap: 8px; }
.foot-btn { flex: 1; height: 42px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md);
  color: var(--text-2); font-weight: 700; font-size: 13px; font-family: inherit; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px; }
.foot-btn:active { transform: scale(.98); }
#hof-trigger { color: var(--gold); }
.rules-trigger .chev { font-size: 16px; transition: transform var(--dur-2); }

@media (max-height: 600px) {
  .tagline { display: none; }
  .lobby-inner { gap: 7px; }
  .card p { margin-bottom: 7px; font-size: 12px; }
  .logo-mark { width: 46px; }
}

/* ── 대기실 ───────────────────────────────────────────────────── */
.waiting-inner {
  height: 100%; min-height: 0; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(8px, 2vh, 12px); padding: max(18px, var(--sat)) 20px max(16px, var(--sab)); text-align: center;
}
.waiting-inner h2 { font-size: 22px; font-weight: 700; margin: 0; }
.code-wrap { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.code-label { font-size: 12px; color: var(--muted); }
.room-code { font-size: 40px; font-weight: 800; letter-spacing: .22em; color: var(--accent); text-indent: .22em; }
.room-code.flash { animation: code-ok var(--dur-4) var(--ease-out); }
@keyframes code-ok { 0% { color: var(--ok); transform: scale(1.06); } 100% { color: var(--accent); transform: none; } }
.qr { width: min(160px, 28dvh, 52vw); aspect-ratio: 1; height: auto; flex-shrink: 1; border-radius: var(--r-md);
  background: #fff; padding: 8px; box-shadow: var(--e2); }
.waiting-btns { display: flex; gap: 8px; }
.waiting-btns .btn { width: auto; padding: 11px 16px; margin: 0; }
.spinner { width: 32px; height: 32px; border: 2.5px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#waiting-status { max-width: 34ch; margin: 0; font-size: 13px; }
#waiting-debug { color: var(--faint); margin: 0; }
.waiting-foot { margin-top: auto; width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 4px; }
@media (max-height: 620px) { .qr, .spinner, #waiting-debug { display: none; } }

/* ── 게임: 상단 HUD (프리미엄 리드아웃) ────────────────────────── */
.topbar { display: flex; flex-direction: column; gap: 5px; padding: 4px 4px 2px; }
.topbar-main { display: flex; align-items: stretch; gap: 8px; }

/* 공통 칩: 글래스 패널 + 인셋 하이라이트 + 미세 엘리베이션 */
.hud-chip { display: flex; align-items: center; gap: 9px; padding: 6px 11px;
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,0)), var(--panel2);
  border: 1px solid var(--line); border-radius: var(--r-sm); box-shadow: var(--e1); }
.hud-ic { font-size: 15px; line-height: 1; flex-shrink: 0; opacity: .92;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.4)); }
.hud-lbl { font-size: 9px; font-weight: 800; letter-spacing: .14em; color: var(--muted);
  text-transform: uppercase; }

/* 기지 HP 칩 */
.hp-chip { flex: 1; min-width: 0; }
.hp-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.hp-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; line-height: 1; }
.hp-label { font-weight: 800; font-size: 14px; color: var(--text); min-width: 3ch; text-align: right; } /* 3자리 예약 → HP 변동 시 폭 불변 */
.hp-bar { position: relative; height: 8px; background: rgba(0,0,0,.5); border-radius: var(--r-pill);
  overflow: hidden; box-shadow: inset 0 1px 2px rgba(0,0,0,.55), 0 0 0 1px rgba(0,0,0,.35); }
.hp-bar.small { height: 6px; }
.hp-ghost { position: absolute; inset: 0 auto 0 0; height: 100%; width: 100%; background: var(--danger);
  opacity: .45; transition: width .5s var(--ease-out); }
.hp-fill { position: absolute; inset: 0 auto 0 0; height: 100%; width: 100%; border-radius: inherit;
  background: linear-gradient(90deg, #16a34a, #34D399 68%, #6FE8F4);
  box-shadow: 0 0 8px -1px rgba(52,211,153,.5); transition: width var(--dur-1) var(--ease-out); }
.hp-fill::after { content: ""; position: absolute; inset: 0 0 50% 0; border-radius: inherit;
  background: linear-gradient(180deg, rgba(255,255,255,.32), rgba(255,255,255,0)); }
.hp-fill.enemy { background: var(--grad-danger); box-shadow: 0 0 8px -1px rgba(242,97,107,.45); }
.hp-ghost.enemy { background: #FBB6C1; opacity: .55; }
.hp-bar.low .hp-fill { animation: hp-pulse .9s var(--ease-standard) infinite;
  background: linear-gradient(90deg, #b91c1c, var(--danger)); box-shadow: 0 0 9px -1px rgba(242,97,107,.6); }
@keyframes hp-pulse { 0%,100% { opacity: 1; } 50% { opacity: .6; } }

/* 웨이브(중앙 강조) + 경과 시간 */
.wave-box { display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; flex-shrink: 0; }
.wave-pill { display: inline-flex; align-items: baseline; gap: 5px; padding: 3px 12px;
  background: linear-gradient(180deg, rgba(54,214,231,.15), rgba(54,214,231,.03));
  border: 1px solid rgba(54,214,231,.34); border-radius: var(--r-pill);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08); }
.wave-k { font-size: 9px; font-weight: 800; letter-spacing: .16em; color: var(--accent-dim);
  text-transform: uppercase; }
.wave-pill b { font-size: 16px; font-weight: 800; color: var(--accent-bright);
  display: inline-block; min-width: 2ch; text-align: center; } /* 2자리 예약 → 웨이브 증가 시 폭 불변 */
.wave-pill.bump { animation: wave-bump var(--dur-4) var(--ease-spring); }
@keyframes wave-bump { 0% { transform: scale(1); } 40% { transform: scale(1.16); box-shadow: var(--glow-accent); } 100% { transform: scale(1); } }
.time { font-size: 10px; margin-top: 2px; color: var(--muted); font-weight: 700; letter-spacing: .04em; }

/* 골드 칩 + 사운드 */
.top-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.gold-chip { gap: 6px; border-color: rgba(233,185,73,.28);
  background: linear-gradient(180deg, rgba(233,185,73,.11), rgba(233,185,73,.02)), var(--panel2); }
/* 고정폭 예약(~4글자) — 골드는 main.js fmtGold 로 항상 ≤4글자(k/M)로 표기되어 이 폭 안에 고정 → 자릿수가 폭주해도 상단 HUD 가 흔들리지 않음(tabular-nums 전제). */
.gold-val { font-weight: 900; color: var(--gold-bright); font-size: 17px; min-width: 38px; text-align: right;
  text-shadow: 0 0 10px rgba(233,185,73,.28); }
.gold-chip.pop { animation: gold-pop 220ms var(--ease-spring); }
@keyframes gold-pop { 0% { transform: scale(1); } 45% { transform: scale(1.12); } 100% { transform: scale(1); } }
.icon-dot { position: relative; width: 32px; height: 32px; border-radius: var(--r-sm); background: var(--panel2);
  border: 1px solid var(--line); color: var(--text-2); font-size: 14px; cursor: pointer; flex-shrink: 0;
  display: grid; place-items: center; box-shadow: var(--e1); }
/* 44px+ 터치 히트 영역(시각 크기는 유지) */
.icon-dot::before, .opp-close::before, .sheet-close::before { content: ""; position: absolute; inset: -8px; }
.icon-dot[aria-pressed="true"] { color: var(--accent); border-color: rgba(54,214,231,.4); }

/* ── 게임: 보드 ──────────────────────────────────────────────── */
.board-area { position: relative; min-height: 0; overflow: hidden; border-radius: var(--r-md); }
#main-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.board-area.low { box-shadow: inset 0 0 0 1px rgba(242,97,107,.4), inset 0 0 40px -8px rgba(242,97,107,.55); }

.board-flash { position: absolute; inset: 0; border-radius: var(--r-md); pointer-events: none; }
.board-flash.hit { animation: leak-flash .35s var(--ease-out); }
@keyframes leak-flash {
  0% { box-shadow: inset 0 0 0 2px var(--danger), inset 0 0 48px 2px rgba(242,97,107,.6); }
  100% { box-shadow: inset 0 0 0 0 transparent, inset 0 0 0 0 transparent; }
}

/* ── Lv.6 특수 스킬 해금 연출 — 보드 위 1회성 리빌(드물게 발동; GPU transform/opacity 중심) ── */
.skill-unlock { position: absolute; inset: 0; z-index: 16; display: flex; flex-direction: column;
  align-items: center; justify-content: center; pointer-events: none; opacity: 0; }
.skill-unlock.show { animation: su-fade 1.9s var(--ease-out) forwards; }
@keyframes su-fade { 0% { opacity: 0; } 9% { opacity: 1; } 76% { opacity: 1; } 100% { opacity: 0; } }
.skill-unlock::before { content: ""; position: absolute; width: 78%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow), rgba(54,214,231,.06) 45%, transparent 68%); }
.skill-unlock.show::before { animation: su-glow 1.5s var(--ease-out) forwards; }
@keyframes su-glow { 0% { opacity: 0; transform: scale(.5); } 28% { opacity: 1; } 100% { opacity: 0; transform: scale(1.25); } }
.su-ring { position: absolute; width: 46px; height: 46px; border-radius: 50%;
  border: 2px solid var(--accent-bright); box-shadow: 0 0 24px var(--accent-glow); opacity: 0; }
.skill-unlock.show .su-ring { animation: su-ring 1.15s var(--ease-out) forwards; }
.skill-unlock.show .su-ring2 { animation-delay: .16s; }
@keyframes su-ring { 0% { transform: scale(.3); opacity: .95; border-width: 3px; } 100% { transform: scale(7.5); opacity: 0; border-width: .5px; } }
.su-core { position: relative; text-align: center; transform: scale(.6); opacity: 0; }
.skill-unlock.show .su-core { animation: su-core .95s var(--ease-spring) forwards; }
@keyframes su-core { 0% { transform: scale(.6); opacity: 0; } 55% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
.su-kicker { font-family: var(--font-num); font-size: 13px; font-weight: 700; letter-spacing: .4em;
  text-indent: .4em; color: var(--accent-bright); text-shadow: 0 0 16px var(--accent-glow); }
.su-title { font-size: clamp(26px, 8.5vw, 36px); font-weight: 900; letter-spacing: -.02em; margin-top: 4px;
  color: #EAFBFE; text-shadow: 0 0 26px var(--accent), 0 0 52px var(--accent-glow), 0 2px 8px rgba(0,0,0,.5); }
.su-sub { font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-top: 7px; letter-spacing: .01em; }

.wave-banner { position: absolute; top: 16%; left: 50%; transform: translateX(-50%) scale(.8);
  font-weight: 900; font-size: clamp(24px, 8vw, 34px); letter-spacing: .04em; color: var(--accent);
  text-shadow: 0 2px 18px var(--accent-glow); opacity: 0; pointer-events: none; white-space: nowrap; }
.wave-banner.show { animation: wave-banner 1.1s var(--ease-out); }
@keyframes wave-banner {
  0% { opacity: 0; transform: translateX(-50%) scale(.7); }
  20% { opacity: 1; transform: translateX(-50%) scale(1.05); }
  70% { opacity: 1; transform: translateX(-50%) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) scale(1); }
}

/* 전멸 배너 */
.nuke-banner { position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%) scale(.7);
  font-weight: 900; font-size: clamp(30px, 11vw, 52px); letter-spacing: .02em; color: #FFF4D6;
  text-shadow: 0 0 24px rgba(233,185,73,.8), 0 2px 10px rgba(0,0,0,.6); opacity: 0; pointer-events: none; white-space: nowrap; }
.nuke-banner.show { animation: nuke-banner 1.2s var(--ease-out); }
@keyframes nuke-banner {
  0% { opacity: 0; transform: translate(-50%,-50%) scale(.5) rotate(-6deg); }
  18% { opacity: 1; transform: translate(-50%,-50%) scale(1.12) rotate(2deg); }
  68% { opacity: 1; transform: translate(-50%,-50%) scale(1) rotate(0); }
  100% { opacity: 0; transform: translate(-50%,-50%) scale(1.05); }
}

/* 봇 격파 → 생존 모드 배너(전멸 배너 키프레임 재사용) */
.bot-defeat-banner { position: absolute; top: 38%; left: 50%; transform: translate(-50%, -50%) scale(.7);
  font-weight: 900; font-size: clamp(20px, 6.5vw, 34px); letter-spacing: .02em; color: var(--gold-bright);
  text-shadow: 0 0 24px rgba(233,185,73,.85), 0 2px 10px rgba(0,0,0,.6); opacity: 0; pointer-events: none; white-space: nowrap; }
.bot-defeat-banner.show { animation: nuke-banner 1.5s var(--ease-out); }

/* 상단 영구 생존 배지(웨이브 칩 옆, 레이아웃 시프트 없음) */
.survival-badge { display: inline-block; margin-left: 5px; padding: 1px 6px; font-size: 10px; font-weight: 800;
  letter-spacing: .04em; color: var(--gold); background: rgba(233,185,73,.14); border: 1px solid var(--gold-dim);
  border-radius: var(--r-xs); vertical-align: middle; opacity: 0; transform: scale(.7);
  transition: opacity var(--dur-2), transform var(--dur-2) var(--ease-spring); }
.survival-badge.show { opacity: 1; transform: scale(1); animation: surv-pulse 2.4s var(--ease-standard) infinite; }
@keyframes surv-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(233,185,73,0); } 50% { box-shadow: 0 0 8px 0 rgba(233,185,73,.5); } }

/* ── 게임: 도크(상대 칩 + 컨트롤 + 힌트) ───────────────────────── */
/* chip↔controls 간격을 넓혀 뽑기 연타 중 오탭 방지 */
.dock { display: flex; flex-direction: column; gap: 6px; }
.dock .opp-chip { margin-bottom: 6px; }

/* 칩 = 비클릭 컨테이너(스탯/HP). 확대는 우측 미니보드 버튼만 담당(오탭 방지). */
.opp-chip {
  position: relative; display: flex; align-items: center; gap: 9px; width: 100%; height: 48px;
  padding: 5px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md);
  overflow: hidden; color: var(--text); text-align: left;
  transition: filter var(--dur-1), border-color var(--dur-2);
}
.opp-chip.alarm { animation: chip-alarm 1.2s var(--ease-standard) infinite; }
@keyframes chip-alarm { 0%,100% { border-color: var(--line); } 50% { border-color: var(--danger); } }
.opp-chip.recoil { animation: chip-recoil .22s var(--ease-standard); }
@keyframes chip-recoil { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
.opp-chip.flash { animation: chip-flash .3s var(--ease-out); }
@keyframes chip-flash { 0% { filter: brightness(1.5); } 100% { filter: brightness(1); } }
.opp-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; justify-content: center; }
/* 우측 미니보드 — 이 작은 보드(+⤢)만 탭하면 상대 보드 확대 */
.opp-mini-btn { position: relative; flex-shrink: 0; display: flex; align-items: center; gap: 4px;
  background: none; border: none; padding: 3px; margin: -3px 0; cursor: pointer; color: var(--accent);
  border-radius: var(--r-sm); transition: transform var(--dur-1) var(--ease-standard), background var(--dur-2); }
.opp-mini-btn:active { transform: scale(.92); background: rgba(255,255,255,.06); }
/* 봇 격파 후: 칩/미니보드 딤 + 탭 비활성 */
.opp-chip.defeated { filter: brightness(.55) saturate(.4); opacity: .72; }
.opp-chip.defeated.alarm { animation: none; }
.opp-mini-btn.defeated { opacity: .5; cursor: default; }
.opp-mini-btn.defeated:active { transform: none; background: none; }
.mini-canvas { width: 36px; height: 36px; flex-shrink: 0; border-radius: var(--r-xs);
  border: 1px solid rgba(54,214,231,.45); display: block; }
.opp-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 11px; }
.opp-conn-wrap { display: flex; align-items: center; gap: 4px; color: var(--text-2); flex-shrink: 0; font-weight: 600; }
.conn-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.conn-dot.online { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.opp-nums { display: flex; gap: 7px; color: var(--muted); min-width: 0; overflow: hidden; white-space: nowrap; }
.opp-nums b { color: var(--text); font-weight: 700; margin-left: 1px; }
.opp-hpbar { position: relative; height: 5px; border-radius: var(--r-pill); background: rgba(0,0,0,.45); overflow: hidden; }
.opp-expand { flex-shrink: 0; font-size: 15px; color: var(--accent); opacity: .7; }
.opp-cta { position: absolute; right: 100%; top: 50%; transform: translateY(-50%); margin-right: 6px;
  font-size: 10px; color: var(--faint); white-space: nowrap; pointer-events: none; animation: cta-fade 4s var(--ease-standard) forwards; }
@keyframes cta-fade { 0%,60% { opacity: 1; } 100% { opacity: 0; } }

.controls { display: flex; gap: 8px; }
.ctrl-btn {
  flex: 1; min-height: 56px; border: 1px solid transparent; border-radius: var(--r-md);
  font-size: 16px; font-weight: 800; font-family: inherit; cursor: pointer; position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  transition: transform var(--dur-1) var(--ease-spring), filter var(--dur-2);
}
.ctrl-btn .ce { font-size: 19px; display: inline-block; }
.ctrl-btn small { font-size: 11px; font-weight: 700; background: rgba(0,0,0,.18); padding: 2px 7px;
  border-radius: var(--r-pill); letter-spacing: .02em; }
.ctrl-btn.draw { background: var(--grad-accent); color: var(--on-accent); box-shadow: var(--e2); }
/* 뽑기: 시각 크기는 그대로(::before 는 투명) 두고 "눌리는 영역"만 ~40px 확장 → 빗나간 연타가
   버튼에 잡혀(=preventDefault) 더블탭 확대를 막는다. overflow 를 풀어야 ::before 히트영역이 안 잘림.
   - 위(-40): 버튼이 화면 좌하단이라 실질 여유가 가장 큰 방향(도크 빈 공간) → 빗나간 탭의 주 착지점을 흡수.
   - 좌/아래(-40): 화면(#screen-game overflow:hidden) 가장자리까지만 유효(여백 ~6~8px), 그 밖은 자동 클립.
   - 오른쪽(-4): '몹 보내기' 침범 방지 — 버튼 사이 8px 간격의 절반만 확장(보내기 영역과 여유 유지). */
.ctrl-btn.draw { overflow: visible; }
.ctrl-btn.draw::before { content: ""; position: absolute; top: -40px; right: -4px; bottom: -40px; left: -40px; }
.ctrl-btn.send { background: var(--panel2); color: var(--danger); border-color: rgba(242,97,107,.4); }
.ctrl-btn.send small { background: rgba(242,97,107,.16); }
/* 생존 모드 종료 버튼(금색) + 2탭 무장 상태 강조 */
.ctrl-btn.end { background: var(--panel2); color: var(--gold); border-color: rgba(233,185,73,.45); }
.ctrl-btn.end.arm { background: linear-gradient(90deg, var(--gold-dim), var(--gold-bright)); color: #1A1206;
  border-color: var(--gold-bright); animation: end-arm-pulse .6s var(--ease-standard) infinite; }
@keyframes end-arm-pulse { 0%,100% { filter: brightness(1); } 50% { filter: brightness(1.18); } }
.ctrl-btn:active { transform: scale(.97); filter: brightness(.95); }
.ctrl-btn:disabled { opacity: .42; filter: saturate(.4) brightness(.7); box-shadow: none; cursor: default; }
/* 뽑기 버튼 상시 글로우 — box-shadow 애니(매 프레임 페인트, 발열↑) 대신 정적 글로우 의사요소의
   opacity 만 펄스(컴포지터 처리 → 거의 무비용). 룩은 동일. ::before 는 히트영역, ::after 는 글로우. */
.ctrl-btn.draw::after { content: ""; position: absolute; inset: 0; border-radius: inherit;
  box-shadow: var(--glow-accent); opacity: 0; pointer-events: none;
  animation: glow-pulse 2.6s var(--ease-standard) infinite; }
.ctrl-btn.draw:disabled::after { animation: none; opacity: 0; }
@keyframes glow-pulse { 0%,100% { opacity: 0; } 50% { opacity: 1; } }
.ctrl-btn.shake { animation: btn-shake .22s var(--ease-standard); }
@keyframes btn-shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-4px); } 60% { transform: translateX(4px); } }
.ctrl-btn .ce.spin { animation: die-spin var(--dur-3) var(--ease-out); }
@keyframes die-spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }

/* ── Lv.6 스페셜 버튼 — 만렙 유닛 선택 시 화면 중앙에 크게 등장 ─────── */
.meteor-btn {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(.84);
  z-index: 16; display: inline-flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 16px 28px; border-radius: var(--r-lg);
  font-family: inherit; font-size: 18px; font-weight: 800; letter-spacing: .01em; color: #FFF1E6; cursor: pointer;
  background: linear-gradient(180deg, #FF7A2C, #E0431E); border: 1.5px solid rgba(255,210,150,.8);
  box-shadow: 0 12px 34px rgba(224,67,30,.5); opacity: 0; pointer-events: none;
  transition: opacity var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-spring); }
.meteor-btn.show { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
/* 준비 완료: 정적 글로우(애니 box-shadow 회피 → 발열↓, power-perf 예산 준수) */
.meteor-btn.ready { box-shadow: 0 12px 38px rgba(224,67,30,.6), 0 0 26px 2px rgba(255,170,100,.6); }
.meteor-btn:active { transform: translate(-50%, -50%) scale(.95); }
.meteor-btn:disabled { cursor: default; color: #E7C6AE; filter: saturate(.55) brightness(.82);
  background: linear-gradient(180deg, #6B4533, #4A2A1E); border-color: rgba(255,210,150,.22); box-shadow: none; }
.meteor-ico { font-size: 30px; line-height: 1; }
/* 쿨다운 링: --cd(0→1, 1=준비) 만큼 차오르는 테두리 */
.meteor-btn::before {
  content: ""; position: absolute; inset: -4px; border-radius: inherit; padding: 4px; pointer-events: none;
  background: conic-gradient(rgba(255,214,160,.95) calc(var(--cd, 1) * 360deg), rgba(255,255,255,.12) 0);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; }
.meteor-btn.fired { animation: meteor-fire .42s var(--ease-out); }
@keyframes meteor-fire { 0% { transform: translate(-50%,-50%) scale(1); } 35% { transform: translate(-50%,-50%) scale(1.16); } 100% { transform: translate(-50%,-50%) scale(1); } }

.hint { text-align: center; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; padding: 0 4px; transition: color var(--dur-2); }
.hint.flash { color: var(--accent); }
@media (max-height: 600px) { .hint { display: none; } }

/* ── 게임: 상대 보드 확대 오버레이 ─────────────────────────────── */
.opp-overlay { position: absolute; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; }
.opp-backdrop { position: absolute; inset: 0; background: var(--scrim); opacity: 0;
  transition: opacity var(--dur-3) var(--ease-out); }
@supports (backdrop-filter: blur(8px)) { .opp-backdrop { backdrop-filter: blur(8px) saturate(1.1); background: rgba(4,6,11,.5); } }
.opp-overlay.open .opp-backdrop { opacity: 1; }
.opp-card {
  position: relative; z-index: 1; width: min(86vw, 380px); max-height: 86dvh;
  background: var(--glass); border: 1px solid var(--line-strong); border-radius: var(--r-lg);
  box-shadow: var(--e3); padding: 14px; display: flex; flex-direction: column; gap: 12px;
  opacity: 0; transform: scale(.9); transform-origin: center;
  transition: transform var(--dur-3) var(--ease-spring), opacity var(--dur-3) var(--ease-out);
}
@supports (backdrop-filter: blur(14px)) { .opp-card { backdrop-filter: blur(14px) saturate(1.1); } }
.opp-overlay.open .opp-card { opacity: 1; transform: none; }
.ooc-head { display: flex; align-items: center; justify-content: space-between; }
.ooc-title { font-size: 15px; font-weight: 700; }
.badge { background: var(--panel2); border: 1px solid var(--line); border-radius: var(--r-xs);
  padding: 1px 8px; font-size: 12px; font-weight: 600; margin-left: 4px; }
.opp-close { position: relative; width: 32px; height: 32px; border-radius: var(--r-pill); background: var(--panel2);
  border: 1px solid var(--line); color: var(--text-2); font-size: 14px; cursor: pointer; }
.ooc-canvas-wrap { display: flex; justify-content: center; }
.opp-big-canvas { height: clamp(180px, 52dvh, 460px); aspect-ratio: 5 / 9; width: auto;
  border-radius: var(--r-md); display: block; background: var(--bg); }
.ooc-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ooc-stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 8px 10px; display: flex; align-items: center; justify-content: space-between; }
.ooc-stat .k { font-size: 12px; color: var(--muted); }
.ooc-stat .v { font-size: 17px; font-weight: 800; color: var(--text); }

/* ── 규칙 바텀시트 ─────────────────────────────────────────────── */
.sheet { position: absolute; inset: 0; z-index: 40; }
.sheet-backdrop { position: absolute; inset: 0; background: var(--scrim); opacity: 0;
  transition: opacity var(--dur-3) var(--ease-out); }
.sheet.open .sheet-backdrop { opacity: 1; }
/* 불투명 패널(블러 X) — 슬라이드는 순수 GPU 합성 transform 이라 60fps. 블러를 매 프레임 재래스터하면 버벅임. */
.sheet-card { position: absolute; left: 0; right: 0; bottom: 0; max-height: 72dvh;
  background: linear-gradient(180deg, #1A1F2E, #11141E); border-top: 1px solid var(--line-strong); border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: var(--e3); padding: 8px 18px max(18px, var(--sab)); display: flex; flex-direction: column; gap: 8px;
  transform: translateY(100%); transition: transform var(--dur-3) var(--ease-spring); overflow: hidden;
  will-change: transform; contain: layout paint; }
.sheet.open .sheet-card { transform: translateY(0); }
.sheet-handle { width: 40px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: 4px auto 2px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; font-size: 16px; font-weight: 700; }
.sheet-close { position: relative; width: 30px; height: 30px; border-radius: var(--r-pill); background: var(--panel2);
  border: 1px solid var(--line); color: var(--text-2); font-size: 13px; cursor: pointer; }
.rules-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px;
  overflow-y: auto; }
.rules-list li { display: flex; gap: 10px; font-size: 14px; line-height: 1.45; }
.rules-list .ri { flex-shrink: 0; font-size: 18px; width: 24px; text-align: center; }
.rules-list b { color: var(--accent); }
.rarity-legend-cap { margin: 10px 0 0; }
.rarity-legend { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 4px; }
.rarity-legend .rl { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: var(--r-pill);
  border: 1px solid currentColor; }
.rl.r0 { color: var(--r-common); } .rl.r1 { color: var(--r-rare); } .rl.r2 { color: var(--r-epic); }
.rl.r3 { color: var(--r-legend); } .rl.r4 { color: var(--r-primordial); background: rgba(54,214,231,.1); }

/* ── 명예의 전당 ──────────────────────────────────────────────── */
.hof-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px;
  flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.hof-row { display: flex; align-items: center; gap: 12px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 10px 12px; }
.hof-row.r1 { border-color: rgba(233,185,73,.55); background: linear-gradient(90deg, rgba(233,185,73,.10), var(--panel)); }
.hof-medal { font-size: 22px; width: 30px; text-align: center; flex-shrink: 0; }
.hof-medal.num { font-size: 14px; font-weight: 800; color: var(--muted); }
.hof-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.hof-name { font-weight: 800; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.hof-meta { font-size: 11px; color: var(--muted); }
.hof-score { font-weight: 900; color: var(--accent); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.hof-empty { color: var(--muted); text-align: center; padding: 20px 0; }

/* 명예의 전당 등록 다이얼로그 */
/* 상단 쪽 정렬 → iOS 키보드가 입력창을 가리지 않게 */
.reg-overlay { position: absolute; inset: 0; z-index: 45; display: flex; align-items: flex-start; justify-content: center;
  padding: clamp(40px, 14vh, 130px) 20px 20px; }
.reg-backdrop { position: absolute; inset: 0; background: var(--scrim); }
@supports (backdrop-filter: blur(8px)) { .reg-backdrop { backdrop-filter: blur(8px); background: rgba(4,6,11,.55); } }
.reg-card { position: relative; z-index: 1; width: min(86vw, 340px); background: var(--glass);
  border: 1px solid var(--line-strong); border-radius: var(--r-lg); box-shadow: var(--e3); padding: 22px 20px;
  text-align: center; display: flex; flex-direction: column; gap: 10px; animation: emoji-in var(--dur-4) var(--ease-spring); }
@supports (backdrop-filter: blur(14px)) { .reg-card { backdrop-filter: blur(14px); } }
.reg-emoji { font-size: 44px; }
.reg-title { margin: 0; font-size: 20px; font-weight: 800; color: var(--gold); }
.reg-sub { margin: 0; font-size: 13px; color: var(--text-2); }
.reg-input { width: 100%; padding: 12px; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--panel2); color: var(--text); font-size: 16px; font-weight: 700; text-align: center; font-family: inherit; }
.reg-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); outline: none; }
.reg-btns { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.reg-btns .btn { width: 100%; }

/* ── 결과 ─────────────────────────────────────────────────────── */
.over-inner { position: relative; height: 100%; min-height: 0; overflow: hidden;
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: clamp(10px, 2vh, 14px); padding: max(20px, var(--sat)) 20px max(20px, var(--sab));
  animation: over-in var(--dur-4) var(--ease-out); }
@keyframes over-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.result-burst { position: absolute; top: 28%; left: 50%; width: 260px; height: 260px; margin: -130px 0 0 -130px;
  border-radius: 50%; background: radial-gradient(circle, var(--accent-glow), transparent 65%); opacity: 0; pointer-events: none; }
.result-burst.show { animation: burst 1s var(--ease-out); }
@keyframes burst { 0% { opacity: .9; transform: scale(.3); } 100% { opacity: 0; transform: scale(1.4); } }
.result-emoji { font-size: clamp(48px, 12vh, 72px); animation: emoji-in var(--dur-4) var(--ease-spring); }
@keyframes emoji-in { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); } }
#result-title { font-size: 28px; font-weight: 800; letter-spacing: -.01em; margin: 0; }
.over-inner.lose .result-emoji { filter: grayscale(.4); }
.over-inner.lose #result-title { color: var(--text-2); }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: clamp(6px, 1.5vh, 10px);
  width: 100%; max-width: 360px; }
.stat-grid .stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 10px 8px; text-align: center; box-shadow: var(--e1); }
.stat .v { font-size: 20px; font-weight: 800; color: var(--text); }
.stat.accent .v { color: var(--accent); }
.stat .k { font-size: 11px; color: var(--muted); margin-top: 2px; }
/* 1대1 친구전: 나 vs 친구 점수 비교(결과 화면) */
.vs-block { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 10px 12px; box-shadow: var(--e1); }
.vs-title { font-size: 12px; font-weight: 800; color: var(--muted); text-align: center; }
.vs-rows { display: flex; flex-direction: column; gap: 6px; }
.vs-row { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: var(--r-sm);
  background: var(--panel2); border: 1px solid var(--line); font-size: 13px; transition: border-color var(--dur-2); }
.vs-row .vs-name { font-weight: 800; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vs-row.me .vs-name { color: var(--accent); }
.vs-row .vs-stat { color: var(--muted); font-size: 12px; flex-shrink: 0; }
.vs-row .vs-stat b { color: var(--text); }
.vs-row .vs-score { font-weight: 800; color: var(--text); min-width: 56px; text-align: right; flex-shrink: 0; }
.vs-row.lead { border-color: var(--gold-bright); background: linear-gradient(90deg, rgba(233,185,73,.12), var(--panel2)); }
.vs-row.lead .vs-score { color: var(--gold-bright); }
.vs-block .btn { font-size: 13px; padding: 8px; }
.over-btns { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 8px; }
/* 게임 종료 직후 5초간 결과 화면 버튼 잠금(연타 잔여 탭으로 인한 의도치 않은 이탈 방지) */
.over-btns.locked { pointer-events: none; }
.over-btns.locked .btn { opacity: .42; filter: saturate(.5) brightness(.8); }
.over-lock-note { display: none; text-align: center; font-size: 12px; font-weight: 700;
  color: var(--text-2); font-variant-numeric: tabular-nums; }
.over-lock-note.show { display: block; animation: fade-in var(--dur-2) var(--ease-out); }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ── 토스트 ───────────────────────────────────────────────────── */
.toast {
  position: absolute; left: 50%; bottom: calc(var(--sab) + 96px); transform: translateX(-50%) translateY(12px);
  z-index: 50; background: var(--glass); color: var(--text); padding: 10px 16px 10px 18px;
  border-radius: var(--r-pill); border: 1px solid var(--line-strong); box-shadow: var(--e3);
  font-weight: 700; font-size: 14px; opacity: 0; transition: opacity var(--dur-2), transform var(--dur-2) var(--ease-out);
  pointer-events: none; white-space: nowrap; max-width: 86vw; overflow: hidden; text-overflow: ellipsis;
}
/* 토스트는 인게임 힌트로 반복 노출 → 살아있는 캔버스를 매 프레임 가우시안 블러하면 발열↑.
   backdrop-filter 제거하고 불투명 var(--glass) 배경만 사용(모달/시트의 정적 블러는 유지). */
.toast::before { content: ""; position: absolute; left: 8px; top: 50%; transform: translateY(-50%);
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.toast.t-success::before { background: var(--ok); }
.toast.t-warn::before { background: var(--gold); }
.toast.t-danger::before { background: var(--danger); }
.toast.t-info::before { background: var(--accent); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── 모션 감소 존중 ───────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; }
  .logo, .logo-mark, .ctrl-btn.draw::after { animation: none !important; }
}
