:root {
  color-scheme: dark;
  --ink: #f7f7fb;
  --muted: #9694a8;
  --panel: #0b0b13;
  --line: rgba(255, 255, 255, 0.12);
  --cyan: #49f8ff;
  --magenta: #ff3fd2;
  --lime: #b7ff42;
  --amber: #ffd65a;
  --page-width: 1180px;
  background: #050509;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 72% 24%, rgba(122, 84, 255, 0.13), transparent 30rem),
    radial-gradient(circle at 12% 44%, rgba(73, 248, 255, 0.07), transparent 26rem),
    #050509;
}

button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
a { color: inherit; }

.page-shell {
  width: min(100%, 1440px);
  min-height: 100vh;
  margin: 0 auto;
  overflow: hidden;
}

.site-header,
.site-footer,
.hero {
  width: min(calc(100% - 48px), var(--page-width));
  margin-inline: auto;
}

.site-header {
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: white;
  text-decoration: none;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.brand-mark {
  width: 32px;
  height: 8px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--cyan), #8a5cff 50%, var(--magenta));
  box-shadow: 0 0 18px rgba(73, 248, 255, 0.45);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.save-state {
  color: #777488;
  font-size: 11px;
}

.language-button {
  width: 42px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: white;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
}

.hero {
  min-height: 760px;
  display: grid;
  grid-template-columns: minmax(300px, 0.88fr) minmax(420px, 1.12fr);
  align-items: center;
  gap: clamp(36px, 7vw, 96px);
  padding: 72px 0 88px;
}

.hero-copy { align-self: center; }

.eyebrow {
  margin: 0 0 20px;
  color: var(--cyan);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.24em;
}

h1 {
  margin: 0;
  font-size: clamp(50px, 6.5vw, 92px);
  line-height: 0.96;
  letter-spacing: -0.065em;
  word-break: keep-all;
}

h1 span { display: block; }

.gradient-text {
  padding-bottom: 0.08em;
  color: transparent;
  background: linear-gradient(90deg, var(--cyan), #fff 48%, var(--magenta));
  background-clip: text;
  -webkit-background-clip: text;
}

.hero-description {
  max-width: 560px;
  margin: 28px 0 0;
  color: #a8a6b7;
  font-size: 16px;
  line-height: 1.75;
  word-break: keep-all;
}

.game-column {
  width: min(100%, 430px);
  justify-self: end;
}

.game-device {
  --tone-color: var(--cyan);
  position: relative;
  padding: 2px;
  border: 1px solid color-mix(in srgb, var(--tone-color) 52%, white 14%);
  border-radius: 30px;
  background: #050509;
  box-shadow:
    0 42px 90px rgba(0, 0, 0, 0.5),
    0 0 34px color-mix(in srgb, var(--tone-color) 18%, transparent);
}

.arena {
  position: relative;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border-radius: 25px;
  background: #03050e;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: manipulation;
  cursor: pointer;
  outline: none;
}

#gameCanvas:focus-visible { box-shadow: 0 0 0 3px var(--tone-color) inset; }

.app-hud {
  position: absolute;
  z-index: 2;
  inset: 0 0 auto;
  padding: 20px 18px 0;
  pointer-events: none;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.85);
}

.app-hud-top {
  display: grid;
  grid-template-columns: 1fr 1fr 34px;
  align-items: start;
  gap: 12px;
}

.app-metric { display: grid; gap: 1px; }
.app-metric:nth-child(2) { text-align: center; }
.app-metric span { color: rgba(255, 255, 255, 0.58); font-size: 8px; font-weight: 800; }
.app-metric strong { font-size: 18px; font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }

.pause-button {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  color: white;
  background: rgba(5, 7, 17, 0.58);
  cursor: pointer;
  pointer-events: auto;
}

.pause-button span { width: 3px; height: 11px; border-radius: 2px; background: currentColor; }
.pause-button:disabled { opacity: 0.35; cursor: default; }

.stage-progress-row {
  margin-top: 12px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 9px;
  font-weight: 800;
}

.stage-progress-track {
  height: 4px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.14);
}

.stage-progress-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--tone-color);
  box-shadow: 0 0 9px var(--tone-color);
  transition: width 180ms ease;
}

.flow-label {
  min-height: 14px;
  margin-top: 8px;
  color: var(--tone-color);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-align: center;
}

.game-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: rgba(3, 5, 14, 0.66);
  backdrop-filter: blur(7px);
  opacity: 0;
  visibility: hidden;
  transform: scale(1.02);
  transition: opacity 180ms ease, transform 180ms ease, visibility 180ms;
}

.game-overlay.is-visible { opacity: 1; visibility: visible; transform: scale(1); }
.overlay-panel {
  width: min(100%, 320px);
  padding: 30px 24px 26px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 24px;
  background: rgba(7, 10, 25, 0.9);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
.overlay-kicker { margin: 0 0 12px; color: var(--cyan); font-size: 10px; font-weight: 900; letter-spacing: 0.17em; }
.game-overlay h2 { margin: 0; font-size: clamp(28px, 7vw, 42px); letter-spacing: -0.04em; }
.overlay-panel > p:not(.overlay-kicker) { max-width: 320px; margin: 15px 0 0; color: #bab8c8; font-size: 14px; line-height: 1.6; }

.overlay-panel > .overlay-hint { margin-top: 14px; color: #858294; font-size: 11px; font-weight: 700; line-height: 1.5; }
.overlay-hint[hidden] { display: none; }
.overlay-panel > .overlay-hint + #overlayDescription { margin-top: 5px; }

.tone-demo { margin-top: 25px; display: flex; align-items: center; justify-content: center; gap: 20px; }
.tone-demo[hidden] { display: none; }
.demo-core { width: 34px; height: 34px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 20px var(--cyan); }
.demo-gate { position: relative; width: 64px; height: 12px; border: 2px solid var(--magenta); border-radius: 99px; box-shadow: 0 0 18px var(--magenta); }
.demo-gate::after { content: ""; position: absolute; inset: 50% auto auto 50%; width: 8px; height: 8px; border-radius: 50%; background: var(--magenta); transform: translate(-50%, -50%); box-shadow: 0 0 10px var(--magenta); }
.demo-arrow { color: #6f6c80; }

.overlay-panel.has-downloads { width: min(100%, 370px); padding: 24px 20px 20px; }
.overlay-panel.has-downloads h2 { font-size: clamp(24px, 6vw, 34px); }
.download-panel { margin-top: 20px; }
.download-panel[hidden] { display: none; }
.download-panel h3 { margin: 0 0 12px; color: white; font-size: 14px; }
.download-panel > p { margin: 10px 0 0; color: #817e91; font-size: 9px; line-height: 1.45; }
.store-downloads { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.store-card {
  min-width: 0;
  padding: 12px 8px;
  display: grid;
  justify-items: center;
  gap: 5px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  color: white;
  background: rgba(255, 255, 255, 0.035);
  text-decoration: none;
}
.store-card[aria-disabled="true"] { color: #747184; cursor: not-allowed; filter: grayscale(1); }
.store-card.is-ready { border-color: color-mix(in srgb, var(--tone-color) 55%, white 10%); background: color-mix(in srgb, var(--tone-color) 8%, transparent); }
.store-card.is-ready:hover { transform: translateY(-1px); filter: brightness(1.08); }
.store-card strong { font-size: 12px; }
.store-card small { min-height: 25px; font-size: 8px; line-height: 1.45; }
.qr-placeholder {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 4px solid currentColor;
  border-radius: 6px;
  font: 900 9px/1 ui-monospace, monospace;
  letter-spacing: .08em;
}

.overlay-panel.has-downloads .primary-button { margin-top: 16px; padding-block: 11px; }

.primary-button {
  border: 0;
  color: #061014;
  background: var(--tone-color);
  cursor: pointer;
  font-weight: 900;
}

.primary-button {
  min-width: 170px;
  margin-top: 28px;
  padding: 14px 22px;
  border-radius: 999px;
  box-shadow: 0 10px 34px color-mix(in srgb, var(--tone-color) 25%, transparent);
}

.primary-button:hover { filter: brightness(1.08); transform: translateY(-1px); }
.live-status { width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.tone-guide {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: 28px;
  display: flex;
  gap: 9px;
  transform: translateX(-50%);
  pointer-events: none;
}

.tone-guide i {
  width: 36px;
  height: 6px;
  border-radius: 99px;
  background: var(--tone);
  box-shadow: 0 0 9px color-mix(in srgb, var(--tone) 58%, transparent);
  opacity: 0.28;
  transform: scaleX(0.88);
  transition: opacity 100ms ease, transform 100ms ease;
}

.tone-guide i:nth-child(1) { --tone: var(--cyan); }
.tone-guide i:nth-child(2) { --tone: var(--magenta); }
.tone-guide i:nth-child(3) { --tone: var(--lime); }
.tone-guide i.is-active { opacity: 1; transform: scaleX(1.18); }

.game-caption {
  margin: 10px 4px 2px;
  color: #8f8ca1;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: center;
}

.status-toast {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 43%;
  padding: 8px 13px;
  border: 1px solid currentColor;
  border-radius: 999px;
  color: white;
  background: rgba(6, 7, 15, 0.82);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  opacity: 0;
  transform: translate(-50%, 10px) scale(0.9);
  transition: opacity 130ms ease, transform 130ms ease;
  pointer-events: none;
}

.status-toast.is-visible { opacity: 1; transform: translate(-50%, 0) scale(1); }

.stage-rail {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.stage-button {
  min-width: 0;
  min-height: 52px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: #777589;
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.25;
  word-break: keep-all;
}

.stage-button.is-current { border-color: var(--cyan); color: var(--cyan); background: rgba(73, 248, 255, 0.08); }
.stage-button.is-complete::after { content: " ✓"; color: var(--lime); }
.stage-button.is-impossible { color: #ff6b82; }
.stage-button.is-impossible.is-current { border-color: #ff6b82; color: #ff9aaa; background: rgba(255, 70, 98, 0.11); }
.stage-button:disabled { cursor: not-allowed; opacity: 0.33; }

.site-footer {
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-top: 1px solid var(--line);
  color: #6f6c7d;
  font-size: 11px;
}

.site-footer nav { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; }
.site-footer a { text-underline-offset: 4px; }
.site-footer a:hover, .footer-button:hover { color: white; }

.footer-button {
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.analytics-consent {
  position: fixed;
  z-index: 20;
  inset: auto 16px max(16px, env(safe-area-inset-bottom));
  pointer-events: none;
}

.analytics-consent[hidden] { display: none; }

.analytics-consent-card {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 20px 22px;
  border: 1px solid rgba(73, 248, 255, 0.34);
  border-radius: 20px;
  background: rgba(8, 9, 19, 0.97);
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.62), 0 0 28px rgba(73, 248, 255, 0.08);
  pointer-events: auto;
}

.analytics-consent-kicker {
  margin: 0 0 7px;
  color: var(--cyan);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.17em;
}

.analytics-consent h2 { margin: 0; font-size: 18px; letter-spacing: -0.025em; }
.analytics-consent-card > p:not(.analytics-consent-kicker) { margin: 8px 0 0; color: #a8a6b7; font-size: 12px; line-height: 1.55; }
.analytics-consent-card > .analytics-consent-status { color: #777488; font-size: 10px; }

.analytics-consent-actions {
  margin-top: 14px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}

.analytics-choice {
  padding: 9px 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  color: white;
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  font-size: 11px;
  font-weight: 850;
}

.analytics-choice:hover { filter: brightness(1.12); }
.analytics-choice.is-primary { border-color: transparent; color: #061014; background: var(--cyan); }
.analytics-consent-actions a { margin-left: auto; color: #8d8a9c; font-size: 10px; text-underline-offset: 4px; }
.analytics-consent-actions a:hover { color: white; }

@media (max-width: 920px) {
  .hero { grid-template-columns: 1fr; padding-top: 62px; }
  .hero-copy { text-align: center; }
  .hero-description { margin-inline: auto; }
  .game-column { justify-self: center; }
}

@media (max-width: 640px) {
  .site-header, .site-footer, .hero { width: min(calc(100% - 28px), var(--page-width)); }
  .site-header { min-height: 70px; }
  .brand { font-size: 11px; letter-spacing: 0.11em; }
  .brand-mark { width: 25px; }
  .save-state { display: none; }
  .hero { gap: 44px; padding: 50px 0 72px; }
  h1 { font-size: clamp(45px, 14vw, 72px); }
  .hero-description { font-size: 14px; }
  .game-device { padding: 2px; border-radius: 24px; }
  .game-overlay { padding: 25px; }
  .site-footer { padding: 26px 0; flex-direction: column; align-items: flex-start; }
  .analytics-consent { inset-inline: 10px; }
  .analytics-consent-card { padding: 17px; border-radius: 17px; }
  .analytics-consent h2 { font-size: 16px; }
  .analytics-consent-card > p:not(.analytics-consent-kicker) { font-size: 11px; }
  .analytics-consent-actions a { width: 100%; margin: 3px 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}
