/* Neuro20 v6.0 — Clean Minimal-Text Visual Arcade UI + Live Auto-Playing Explosive 9:16 Video Card */
:root {
  --bg: #0A0A0D;
  --surface: #14141A;
  --surface-hover: #1E1E27;
  --line: rgba(255, 255, 255, 0.085);
  --text: #FAFAFA;
  --muted: #9393A0;
  --dim: #62626E;

  --mint: #00E599;
  --cyan: #22D3EE;
  --violet: #A855F7;
  --coral: #F43F5E;
  --amber: #F59E0B;

  --font-sans: "Pretendard Variable", Pretendard, "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Space Grotesk", "Pretendard Variable", Pretendard, "Plus Jakarta Sans", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  touch-action: manipulation;
  overflow-x: hidden;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100dvh;
  padding: 18px 20px 26px;
}

.hidden { display: none !important; }

.fx-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 60;
}

.bg-rec-canvas {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 2px;
  height: 2px;
  opacity: 0.01;
  pointer-events: none;
}

/* Header */
.topbar {
  width: 100%;
  max-width: 460px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 4px 0;
}

.brand-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 12px rgba(0, 229, 153, 0.7);
}

.brand-name {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.brand-name span { color: var(--mint); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bare-icon {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  font-size: 16px;
  transition: color 0.15s ease;
}

.bare-icon:hover { color: var(--text); }

.lang-bar { display: inline-flex; gap: 2px; }

.lang-btn {
  border: none;
  background: transparent;
  color: var(--dim);
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 7px;
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.lang-btn:hover { color: var(--muted); }
.lang-btn.active { color: var(--text); background: rgba(255, 255, 255, 0.09); }

/* Stage Progress Bar */
.stage-bar {
  width: 100%;
  max-width: 460px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 18px;
}

.sb-seg {
  height: 3.5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.sb-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--mint), var(--cyan));
  transition: width 0.3s ease;
}

/* Main Stage */
.stage {
  width: 100%;
  max-width: 460px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
}

.screen {
  display: none;
  width: 100%;
}

.screen.active {
  display: flex;
  flex-direction: column;
  animation: fadeUp 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* LANDING — SLEEK VS PILL + LIVE COUNT + ZERO-PROSE VISUAL ARCADE */
.vs-pill {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px 7px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(244, 63, 94, 0.16));
  border: 1px solid rgba(251, 191, 36, 0.45);
  color: #FDE68A;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 16px;
}

.vs-dismiss {
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.vs-dismiss:hover { background: rgba(255, 255, 255, 0.24); }

.live-count-pill {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface);
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 20px;
  font-variant-numeric: tabular-nums;
}

.live-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--mint);
  animation: liveBlink 1.8s ease-in-out infinite;
}

@keyframes liveBlink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.75); }
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(38px, 10vw, 52px);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.08;
  text-align: center;
  color: #FFFFFF;
  word-break: keep-all;
  text-wrap: balance;
  margin-bottom: 36px;
}

.steps-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 42px;
}

.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 9px;
}

.step-glyph {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2px;
  position: relative;
}

.glyph-reflex {
  background: #F43F5E;
  animation: glyphCycle 3.2s steps(1, end) infinite;
}

.glyph-pulse {
  position: absolute;
  inset: -4px;
  border-radius: 19px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  animation: glyphRing 1.6s ease-out infinite;
}

@keyframes glyphCycle {
  0%   { background: #F43F5E; box-shadow: 0 0 18px rgba(244, 63, 94, 0.45); }
  20%  { background: #3B82F6; box-shadow: 0 0 18px rgba(59, 130, 246, 0.45); }
  40%  { background: #8B5CF6; box-shadow: 0 0 18px rgba(139, 92, 246, 0.45); }
  60%  { background: #F59E0B; box-shadow: 0 0 18px rgba(245, 158, 11, 0.45); }
  80%  { background: #00E599; box-shadow: 0 0 22px rgba(0, 229, 153, 0.6); }
  100% { background: #F43F5E; }
}

@keyframes glyphRing {
  0%   { opacity: 0.7; transform: scale(0.92); }
  100% { opacity: 0; transform: scale(1.24); }
}

.glyph-color, .glyph-mem {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 5px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.glyph-color i, .glyph-mem i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 5px;
}

.glyph-color .gc-base { animation: gcBaseShift 4.8s ease-in-out infinite; }
.glyph-color .gc-odd { animation: gcOddShift 4.8s ease-in-out infinite, gcOddPop 1.6s ease-in-out infinite; }

@keyframes gcBaseShift {
  0%, 100% { background: #4F63D8; }
  33%      { background: #0D9668; }
  66%      { background: #C24678; }
}

@keyframes gcOddShift {
  0%, 100% { background: #93ACFF; }
  33%      { background: #4CF0B5; }
  66%      { background: #FF8AC0; }
}

@keyframes gcOddPop {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 rgba(255,255,255,0); }
  50%      { transform: scale(1.12); box-shadow: 0 0 10px rgba(255,255,255,0.65); }
}

.glyph-mem i { background: #262632; }
.glyph-mem .gm-1 { animation: gmFlashA 3.2s ease-in-out infinite; }
.glyph-mem .gm-4 { animation: gmFlashB 3.2s ease-in-out infinite; }
.glyph-mem .gm-2 { animation: gmSubtle 3.2s ease-in-out infinite; }

@keyframes gmFlashA {
  0%, 28%  { background: var(--cyan); box-shadow: 0 0 10px rgba(34, 211, 238, 0.65); transform: scale(1.06); }
  34%, 50% { background: #262632; box-shadow: none; transform: scale(1); }
  56%, 84% { background: var(--mint); box-shadow: 0 0 10px rgba(0, 229, 153, 0.65); transform: scale(1.06); }
  92%, 100%{ background: #262632; box-shadow: none; transform: scale(1); }
}

@keyframes gmFlashB {
  0%, 28%  { background: var(--cyan); box-shadow: 0 0 10px rgba(34, 211, 238, 0.65); transform: scale(1.06); }
  34%, 64% { background: #262632; box-shadow: none; transform: scale(1); }
  70%, 88% { background: var(--mint); box-shadow: 0 0 10px rgba(0, 229, 153, 0.65); transform: scale(1.06); }
  94%, 100%{ background: #262632; box-shadow: none; transform: scale(1); }
}

@keyframes gmSubtle {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

.step-item strong {
  font-size: 14px;
  font-weight: 700;
  color: #FAFAFA;
  word-break: keep-all;
}

/* Buttons */
.btn-primary {
  width: 100%;
  border: none;
  border-radius: 16px;
  padding: 18px 24px;
  background: var(--mint);
  color: #05130D;
  font-family: var(--font-sans);
  font-size: 16.5px;
  font-weight: 800;
  letter-spacing: -0.015em;
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.15s ease;
}

.btn-glow { box-shadow: 0 10px 30px rgba(0, 229, 153, 0.28); }
.btn-primary:hover { filter: brightness(1.07); }
.btn-primary:active { transform: scale(0.975); }

.btn-compact {
  padding: 14px 16px;
  font-size: 14.5px;
  border-radius: 14px;
}

/* PER-ROUND INSTANT VISUAL INTRO */
.screen-center {
  align-items: center;
  text-align: center;
}

.intro-kicker {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--mint);
  margin-bottom: 22px;
}

.intro-visual {
  width: min(100%, 284px);
  min-height: 158px;
  padding: 14px 16px;
  border-radius: 26px;
  background: linear-gradient(180deg, #171722, #111118);
  border: 1px solid rgba(255, 255, 255, 0.11);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  position: relative;
}

.demo-r1-stage, .demo-r2-stage, .demo-r3-stage {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 11px;
}

.demo-top-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.demo-target-chip, .demo-mini-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 11.5px;
  font-weight: 800;
  color: #FFFFFF;
}

.demo-target-chip i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.demo-lv-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  color: var(--mint);
}

.demo-stream-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.demo-card {
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform 0.16s ease, opacity 0.16s ease;
}

.demo-card-side {
  width: 44px;
  height: 52px;
  opacity: 0.34;
  transform: scale(0.92);
}

.demo-card-main {
  width: 96px;
  height: 74px;
  border: 2px solid rgba(255, 255, 255, 0.18);
}

.demo-card-main.is-target {
  transform: scale(1.09);
  border-color: #FFFFFF;
}

.demo-card-txt {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 900;
  letter-spacing: -0.02em;
  position: relative;
  z-index: 2;
}

.demo-r1-ring {
  position: absolute;
  inset: -7px;
  border-radius: 22px;
  border: 3px solid transparent;
  opacity: 0;
  pointer-events: none;
}

.demo-r1-ring.pulse { animation: demoPing 0.62s ease-out; }

@keyframes demoPing {
  0% { opacity: 0.95; transform: scale(0.92); }
  100% { opacity: 0; transform: scale(1.3); }
}

.demo-bar-track {
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.demo-bar-fill {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: var(--mint);
}

.demo-bar-fill.drain { animation: demoBarDrain 0.68s linear forwards; }
.demo-bar-fill.drain-slow { animation: demoBarDrain 1.02s linear forwards; }

@keyframes demoBarDrain {
  from { width: 100%; }
  to { width: 8%; }
}

.demo-steps-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--dim);
}

.demo-steps-pill span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 24px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  opacity: 0.45;
  transition: transform 0.16s ease, opacity 0.16s ease, background 0.16s ease;
}

.demo-steps-pill span.on {
  opacity: 1;
  background: rgba(0, 229, 153, 0.18);
  box-shadow: 0 0 0 1.5px rgba(0, 229, 153, 0.55);
  transform: scale(1.1);
}

.demo-steps-pill i {
  font-style: normal;
  font-size: 11px;
  opacity: 0.5;
}

.demo-grid {
  width: 92px;
  height: 92px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.demo-c, .demo-m {
  border-radius: 7px;
  background: #252532;
  transition: background 0.18s ease, transform 0.16s ease, box-shadow 0.18s ease;
}

.demo-c.demo-odd-ping { transform: scale(1.12); box-shadow: 0 0 0 2.5px #FFFFFF, 0 0 14px rgba(255,255,255,0.6); }
.demo-m.lit { background: var(--cyan); box-shadow: 0 0 14px rgba(34, 211, 238, 0.72); transform: scale(1.06); }
.demo-m.masked { background: repeating-linear-gradient(45deg, #1b1b26 0 4px, #292938 4px 8px); }
.demo-m.ok  { background: var(--mint); box-shadow: 0 0 14px rgba(0, 229, 153, 0.72); transform: scale(1.06); }

.intro-title {
  font-family: var(--font-display);
  font-size: clamp(26px, 7.2vw, 34px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.18;
  margin-bottom: 10px;
  word-break: keep-all;
  text-wrap: balance;
}

.intro-sub {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.45;
  margin-bottom: 28px;
  word-break: keep-all;
  text-wrap: balance;
}

/* IN-GAME HUD */
.hud-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  gap: 10px;
}

.hud-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.hud-lv {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #FFFFFF;
}

.target-pin {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--surface);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  color: #FAFAFA;
  white-space: nowrap;
}

.target-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--mint);
  display: inline-block;
  box-shadow: 0 0 10px currentColor;
}

.streak-pill {
  font-size: 12.5px;
  font-weight: 800;
  color: #FDE68A;
  background: rgba(245, 158, 11, 0.16);
  border: 1px solid rgba(251, 191, 36, 0.35);
  padding: 4px 10px;
  border-radius: 999px;
  animation: popIn 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

.hud-mono {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tier-tag {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.t-easy    { background: rgba(0, 229, 153, 0.15); color: #6EE7B7; }
.t-normal  { background: rgba(34, 211, 238, 0.15); color: #67E8F9; }
.t-hard    { background: rgba(245, 158, 11, 0.18); color: #FCD34D; }
.t-extreme { background: rgba(244, 63, 94, 0.18); color: #FDA4AF; }
.t-god     { background: rgba(168, 85, 247, 0.24); color: #E9D5FF; }

.mini-dots { display: inline-flex; gap: 6px; }
.mini-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  transition: background 0.2s ease, transform 0.2s ease;
}
.mini-dots span.done { background: var(--mint); transform: scale(1.2); box-shadow: 0 0 8px rgba(0, 229, 153, 0.65); }

.timer-track {
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-bottom: 18px;
}

.timer-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--mint), var(--cyan));
}
.timer-fill.danger {
  background: var(--coral);
  box-shadow: 0 0 14px rgba(244, 63, 94, 0.7);
}

/* ROUND 1: RANDOM 6-HUE TARGET ARENA (CRITICAL: transition: none for 0ms scientific onset!) */
.reflex-pad {
  width: 100%;
  height: 334px;
  border: none;
  border-radius: 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  position: relative;
  overflow: hidden;
  transition: none;
}

.reflex-pad.hit-punch { animation: hitPunch 0.24s cubic-bezier(0.22, 1, 0.36, 1); }

@keyframes hitPunch {
  0%   { transform: scale(0.95); }
  50%  { transform: scale(1.022); }
  100% { transform: scale(1); }
}

.reflex-ring {
  position: absolute;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.7);
  opacity: 0;
  pointer-events: none;
}

.reflex-ring.burst { animation: ringBurst 0.42s ease-out forwards; }

@keyframes ringBurst {
  0%   { opacity: 0.95; transform: scale(0.45); }
  100% { opacity: 0; transform: scale(3.1); }
}

.reflex-label {
  position: relative;
  z-index: 2;
  font-family: var(--font-display);
  font-size: clamp(34px, 8.8vw, 48px);
  font-weight: 800;
  letter-spacing: -0.03em;
  word-break: keep-all;
}

.reflex-hint {
  position: relative;
  z-index: 2;
  font-size: 14.5px;
  font-weight: 600;
  opacity: 0.88;
}

.reflex-pad.state-wait  { background: var(--surface); color: var(--muted); }
.reflex-pad.hue-emerald { background: #00E599; color: #04150E; }
.reflex-pad.hue-coral   { background: #F43F5E; color: #FFFFFF; }
.reflex-pad.hue-blue    { background: #3B82F6; color: #FFFFFF; }
.reflex-pad.hue-violet  { background: #8B5CF6; color: #FFFFFF; }
.reflex-pad.hue-amber   { background: #F59E0B; color: #140E02; }
.reflex-pad.hue-pink    { background: #EC4899; color: #FFFFFF; }

.reflex-pad.state-early {
  background: #7F1D1D;
  color: #FEE2E2;
  animation: shake 0.3s ease;
}

.reflex-pad.state-result {
  background: var(--surface);
  color: var(--mint);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  50% { transform: translateX(8px); }
  75% { transform: translateX(-5px); }
}

/* ROUND 2 & 3 ARENA */
.arena-wrap {
  position: relative;
  width: 100%;
  max-width: 400px;
  margin: 0 auto 14px;
}

.arena-pop {
  position: absolute;
  left: 50%;
  top: 44%;
  transform: translate(-50%, -50%);
  z-index: 12;
  pointer-events: none;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 900;
  color: #FFFFFF;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.75), 0 0 24px rgba(0, 229, 153, 0.8);
  white-space: nowrap;
  animation: popBurst 0.52s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes popBurst {
  0%   { opacity: 0; transform: translate(-50%, -30%) scale(0.75); }
  30%  { opacity: 1; transform: translate(-50%, -55%) scale(1.1); }
  100% { opacity: 0; transform: translate(-50%, -92%) scale(1); }
}

.color-grid {
  display: grid;
  width: 100%;
  aspect-ratio: 1 / 1;
  gap: 8px;
}

.color-grid.grid-3 { grid-template-columns: repeat(3, 1fr); gap: 10px; }
.color-grid.grid-4 { grid-template-columns: repeat(4, 1fr); gap: 8px; }
.color-grid.grid-5 { grid-template-columns: repeat(5, 1fr); gap: 7px; }
.color-grid.grid-6 { grid-template-columns: repeat(6, 1fr); gap: 6px; }
.color-grid.grid-7 { grid-template-columns: repeat(7, 1fr); gap: 5px; }
.color-grid.grid-8 { grid-template-columns: repeat(8, 1fr); gap: 4px; }

.color-tile {
  border: none;
  border-radius: 10px;
  cursor: pointer;
  animation: tileWave 0.26s cubic-bezier(0.22, 1, 0.36, 1) backwards;
  animation-delay: calc(var(--i, 0) * 10ms);
  transition: transform 0.08s ease;
}

@keyframes tileWave {
  from { opacity: 0; transform: scale(0.84); }
  to { opacity: 1; transform: scale(1); }
}

.color-grid.grid-7 .color-tile,
.color-grid.grid-8 .color-tile { border-radius: 7px; }
.color-tile:active { transform: scale(0.91); }
.color-tile.correct-flash { box-shadow: 0 0 0 3.5px #FFFFFF, 0 0 24px rgba(255,255,255,0.6); transform: scale(1.08); z-index: 2; }
.color-tile.reveal-odd { box-shadow: 0 0 0 3.5px #FFFFFF; transform: scale(1.06); z-index: 2; }
.color-tile.wrong-tile { box-shadow: 0 0 0 3px var(--coral); animation: shake 0.28s ease; }

/* ROUND 3: 10-LEVEL TIMED MEMORY MATRIX */
.mem-wrap {
  position: relative;
  width: 100%;
  max-width: 390px;
  aspect-ratio: 1 / 1;
  margin: 0 auto 14px;
  perspective: 700px;
}

.mem-grid { display: grid; width: 100%; height: 100%; }
.mem-grid.mg-3 { grid-template-columns: repeat(3, 1fr); gap: 12px; }
.mem-grid.mg-4 { grid-template-columns: repeat(4, 1fr); gap: 10px; }
.mem-grid.mg-5 { grid-template-columns: repeat(5, 1fr); gap: 8px; }
.mem-grid.mg-6 { grid-template-columns: repeat(6, 1fr); gap: 6px; }
.mem-grid.mg-7 { grid-template-columns: repeat(7, 1fr); gap: 5px; }

.mem-cell {
  border: none;
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  transition: transform 0.14s cubic-bezier(0.22, 1, 0.36, 1), background 0.1s ease, box-shadow 0.14s ease;
}

.mem-grid.mg-6 .mem-cell { border-radius: 9px; }
.mem-grid.mg-7 .mem-cell { border-radius: 7px; }
.mem-cell:active { transform: scale(0.91); }
.mem-cell.lit {
  background: var(--cyan);
  box-shadow: 0 0 20px rgba(34, 211, 238, 0.55);
  animation: memFlipIn 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}
.mem-cell.picked { background: var(--mint); box-shadow: 0 0 18px rgba(0, 229, 153, 0.55); transform: scale(1.04); }
.mem-cell.clear-pulse { animation: clearFlash 0.32s ease-out; }
.mem-cell.wrong { background: var(--coral); animation: shake 0.28s ease; }
.mem-cell.missed-reveal { background: rgba(34, 211, 238, 0.35); box-shadow: inset 0 0 0 2px var(--cyan); }

@keyframes memFlipIn {
  0%   { transform: rotateY(80deg) scale(0.86); }
  100% { transform: rotateY(0deg) scale(1); }
}

@keyframes clearFlash {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.09); box-shadow: 0 0 24px rgba(0, 229, 153, 0.75); }
  100% { transform: scale(1); }
}

.mem-mask {
  position: absolute;
  inset: 0;
  border-radius: 14px;
  z-index: 5;
  opacity: 1;
  background: #0A0A0D;
  overflow: hidden;
}

.mem-mask canvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
}

.play-status {
  text-align: center;
  min-height: 22px;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
}

/* RESULT SCREEN — COMPACT VS STRIP + 1-SHOT 9:16 REVEAL CARD + 5-BUTTON SNS DOCK */
.screen-result { position: relative; }

.vs-card {
  border-radius: 16px;
  padding: 11px 14px;
  margin-bottom: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.vs-card.win  { background: linear-gradient(135deg, rgba(0, 229, 153, 0.16), rgba(34, 211, 238, 0.1)); border-color: rgba(0, 229, 153, 0.45); }
.vs-card.lose { background: linear-gradient(135deg, rgba(244, 63, 94, 0.14), rgba(245, 158, 11, 0.09)); border-color: rgba(244, 63, 94, 0.38); }
.vs-card.tie  { background: linear-gradient(135deg, rgba(34, 211, 238, 0.14), rgba(168, 85, 247, 0.1)); border-color: rgba(34, 211, 238, 0.38); }

.vs-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.vs-pair {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.vs-pair i { font-style: normal; font-size: 11px; color: var(--muted); }

.vs-verdict-inline {
  font-size: 13.5px;
  font-weight: 800;
  color: #FFFFFF;
}

.btn-vs-reply {
  width: 100%;
  border: 1px solid rgba(0, 229, 153, 0.55);
  border-radius: 12px;
  padding: 10px 14px;
  background: rgba(0, 229, 153, 0.2);
  color: #A7F3D0;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.14s ease, transform 0.1s ease;
}
.btn-vs-reply:hover { background: rgba(0, 229, 153, 0.3); }
.btn-vs-reply:active { transform: scale(0.98); }

/* CENTERPIECE: FULL-WIDTH EDGE-TO-EDGE 4:5 RESULT CARD (FILLS MOBILE 100%, ZERO CROPPING!) */
.reel-stage {
  position: relative;
  width: min(100%, 440px, calc(66dvh * 4 / 5));
  aspect-ratio: 4 / 5;
  margin: 0 auto 14px;
  border-radius: 24px;
  overflow: hidden;
  background: #07070B;
  border: 1.5px solid rgba(0, 229, 153, 0.42);
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.65), 0 0 36px rgba(0, 229, 153, 0.14);
}

.reel-stage canvas {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

/* POST-VICTORY 1-SHOT SAME-COMMUNITY RETURN PROMPT */
.vs-win-prompt {
  margin-bottom: 12px;
  padding: 14px 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(0, 229, 153, 0.2), rgba(34, 211, 238, 0.14));
  border: 1.5px solid rgba(0, 229, 153, 0.6);
  box-shadow: 0 12px 32px rgba(0, 229, 153, 0.18);
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: fadeUp 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.vs-win-prompt-text {
  font-size: 14px;
  font-weight: 800;
  color: #FFFFFF;
  text-align: center;
  line-height: 1.38;
  word-break: keep-all;
}

.vs-win-prompt-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.btn-vs-send {
  border: none;
  border-radius: 12px;
  padding: 12px 16px;
  background: var(--mint);
  color: #05130D;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.14s ease;
}
.btn-vs-send:hover { filter: brightness(1.08); }
.btn-vs-send:active { transform: scale(0.97); }

.btn-vs-close {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.btn-vs-close:hover { color: #FFFFFF; background: rgba(255, 255, 255, 0.12); }

.btn-rematch {
  background: linear-gradient(135deg, #F43F5E, #F59E0B) !important;
  color: #FFFFFF !important;
  box-shadow: 0 10px 26px rgba(244, 63, 94, 0.34);
}

/* VIBRANT 3x2 BRAND-COLORED 6-COMMUNITY SNS SHARE DOCK */
.sns-dock {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.sns-btn {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: var(--surface);
  color: #FAFAFA;
  padding: 11px 6px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: -0.01em;
  transition: filter 0.14s ease, transform 0.1s ease, background 0.14s ease;
}

.sns-btn:hover { filter: brightness(1.14); }
.sns-btn:active { transform: scale(0.95); }

.sns-btn-kakao {
  background: linear-gradient(135deg, rgba(254, 229, 0, 0.24), rgba(250, 204, 21, 0.14));
  border-color: rgba(254, 229, 0, 0.58);
  color: #FEE500;
}

.sns-btn-accent {
  background: linear-gradient(135deg, rgba(0, 229, 153, 0.22), rgba(34, 211, 238, 0.14));
  border-color: rgba(0, 229, 153, 0.52);
  color: #6EE7B7;
}

.sns-btn-ig {
  background: linear-gradient(135deg, rgba(245, 133, 41, 0.24), rgba(221, 42, 123, 0.24), rgba(129, 52, 175, 0.24));
  border-color: rgba(236, 72, 153, 0.58);
  color: #F9A8D4;
}

.sns-btn-x {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(148, 163, 184, 0.08));
  border-color: rgba(255, 255, 255, 0.42);
  color: #FFFFFF;
}

.sns-btn-threads {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.22), rgba(99, 102, 241, 0.14));
  border-color: rgba(192, 132, 252, 0.52);
  color: #E9D5FF;
}

.sns-btn-line {
  background: linear-gradient(135deg, rgba(6, 199, 85, 0.22), rgba(16, 185, 129, 0.14));
  border-color: rgba(6, 199, 85, 0.55);
  color: #4ADE80;
}

.sns-btn-copy {
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.2), rgba(59, 130, 246, 0.12));
  border-color: rgba(34, 211, 238, 0.5);
  color: #67E8F9;
}

.toast {
  margin-top: 10px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: #6EE7B7;
}

/* Citations-Only Drawer */
.method-drawer {
  margin-top: 14px;
  text-align: center;
}

.method-drawer summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--dim);
  list-style: none;
}

.method-drawer summary:hover { color: var(--muted); }

.method-body {
  margin-top: 10px;
  text-align: left;
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--muted);
  white-space: pre-line;
  padding: 13px;
  border-radius: 12px;
  background: var(--surface);
}

.footer {
  margin-top: 18px;
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: var(--dim);
}

.footer a { color: var(--dim); text-decoration: none; font-weight: 600; }
.footer a:hover { color: var(--muted); }

/* ================= v8.0 DAILY SEED, R1 QUICK RETRY, GROUP ROOM & 16:9 LIVE RAID ================= */
.app-shell {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.live-host-btn {
  display: none;
  border: 1px solid rgba(244, 63, 94, 0.52);
  background: rgba(244, 63, 94, 0.16);
  color: #FDA4AF;
  border-radius: 999px;
  padding: 5px 11px;
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}
.live-host-btn:hover { background: rgba(244, 63, 94, 0.28); color: #FFFFFF; }

@media (min-width: 900px) {
  .live-host-btn { display: inline-flex; align-items: center; gap: 5px; }
  body.live-wide .topbar, body.live-wide .stage-bar { max-width: 960px; }
  body.live-wide .app-shell {
    max-width: 960px;
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    gap: 28px;
    margin-top: 8px;
  }
}

.daily-pill, .room-pill {
  align-self: center;
  font-size: 12px;
  font-weight: 800;
  padding: 6px 13px;
  border-radius: 999px;
  margin-bottom: 12px;
}

.daily-pill {
  color: #A7F3D0;
  background: rgba(0, 229, 153, 0.12);
  border: 1px solid rgba(0, 229, 153, 0.34);
}

.room-pill {
  color: #FDE68A;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.22), rgba(168, 85, 247, 0.18));
  border: 1px solid rgba(251, 191, 36, 0.48);
}

.r1-quick-retry {
  align-self: center;
  margin-top: 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: #FAFAFA;
  border-radius: 999px;
  padding: 9px 18px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
.r1-quick-retry:hover { background: rgba(255, 255, 255, 0.16); }

.room-box {
  margin-top: 14px;
  padding: 15px;
  border-radius: 18px;
  background: linear-gradient(180deg, #161622, #12121A);
  border: 1px solid rgba(255, 255, 255, 0.11);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.room-box-title {
  font-size: 13.5px;
  font-weight: 800;
  color: #FFFFFF;
}

.room-board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.room-code-tag {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  color: #05130D;
  background: var(--mint);
  padding: 3px 9px;
  border-radius: 8px;
}

.room-board-meta {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.room-input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.room-input {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.35);
  color: #FFFFFF;
  border-radius: 12px;
  padding: 10px 12px;
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 700;
  outline: none;
}
.room-input:focus { border-color: var(--mint); }

.btn-room-primary {
  border: none;
  border-radius: 12px;
  padding: 10px 14px;
  background: linear-gradient(135deg, var(--mint), var(--cyan));
  color: #05130D;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}

.btn-room-secondary {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.06);
  color: #FAFAFA;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
.btn-room-secondary:hover { background: rgba(255, 255, 255, 0.12); }

.room-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
}

.room-empty {
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
  padding: 12px 0;
}

.room-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.room-row.is-first { background: rgba(0, 229, 153, 0.12); border-color: rgba(0, 229, 153, 0.42); }
.room-row.is-last  { background: rgba(244, 63, 94, 0.1); border-color: rgba(244, 63, 94, 0.34); }

.room-row-left { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
.room-rank { font-family: var(--font-mono); font-size: 12.5px; color: #FDE68A; min-width: 24px; }
.room-nick { font-size: 13px; font-weight: 800; color: #FFFFFF; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-row-right { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.room-row-right strong { font-size: 12.5px; font-weight: 800; color: #E8E8F4; }
.room-row-right small { font-size: 11px; font-weight: 600; color: var(--muted); }

.live-raid-panel {
  width: 100%;
  max-width: 440px;
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(180deg, #161622, #101018);
  border: 1.5px solid rgba(244, 63, 94, 0.42);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.live-raid-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.live-dot-badge { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: #FDA4AF; }
.live-round-tag { font-family: var(--font-mono); font-size: 11.5px; font-weight: 800; color: var(--mint); }
.live-raid-join { display: flex; align-items: center; gap: 14px; }
.live-qr-wrap { padding: 8px; border-radius: 14px; background: #FFFFFF; flex-shrink: 0; }
.live-qr-wrap canvas { display: block; width: 120px; height: 120px; }
.live-code-col { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.live-code-big { font-family: var(--font-mono); font-size: 36px; font-weight: 900; letter-spacing: 0.14em; color: #FFFFFF; line-height: 1; }
.live-scan-hint { font-size: 12px; color: var(--muted); line-height: 1.38; }
.live-raid-stats { display: flex; justify-content: space-between; font-size: 13px; font-weight: 800; color: #A7F3D0; }
