@font-face {
  font-family: Raleway;
  src: url("./assets/fonts/raleway.woff2") format("woff2");
  font-style: normal;
  font-weight: 500 900;
  font-display: swap;
}
@font-face {
  font-family: Space Grotesk;
  src: url("./assets/fonts/space-grotesk.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --page: #f3f5fe;
  --paper: #fff;
  --lilac: #e2e8fb;
  --border: #cdd6f1;
  --ink: #10131e;
  --quiet: #3d4664;
  --blue: #304bd1;
  --blue-hover: #2337ad;
  --accent: #4f6ce5;
  --mint: #d6f4e5;
  --green: #145b3f;
  --danger: #8b2035;
  --display: Raleway, system-ui, sans-serif;
  --numbers: "Space Grotesk", system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; background: var(--page); scrollbar-color: #acb9e9 var(--page); }
body { margin: 0; color: var(--ink); font: 600 16px/1.45 var(--display); }
button, input { font: inherit; }
button, a, canvas { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
button { color: inherit; }
button:not(:disabled) { cursor: pointer; }
button:disabled { opacity: .68; cursor: wait; }
a { color: inherit; text-underline-offset: 4px; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }
::selection { background: var(--lilac); color: var(--ink); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.shell { width: min(1180px, 100%); margin: 0 auto; padding-inline: max(20px, env(safe-area-inset-left)) max(20px, env(safe-area-inset-right)); }
.masthead { display: flex; min-height: 75px; align-items: center; justify-content: space-between; gap: 10px; }
.wordmark { display: flex; gap: 9px; align-items: center; text-decoration: none; }
.wordmark-mark { width: 29px; height: 29px; object-fit: contain; }
.wordmark-name { width: 136px; height: auto; }
.masthead-actions { display: flex; align-items: center; gap: 15px; }
.best-record { font-size: .84rem; white-space: nowrap; color: var(--quiet); }
.best-record strong { margin-inline-start: .28rem; font: 700 .94rem var(--numbers); color: var(--blue); }
.icon-button {
  display: inline-grid; width: 44px; height: 44px; padding: 0; place-items: center; border-radius: 10px;
  border: 1px solid var(--border); background: var(--paper);
}
.icon-button:hover { color: var(--blue); background: var(--lilac); }
.icon-button svg { width: 20px; height: 20px; }
.audio-muted, #sound[aria-pressed="true"] .audio-waves { display: none; }
#sound[aria-pressed="true"] .audio-muted { display: inline; }

.cabinet { border: 1px solid var(--border); border-radius: 16px; background: var(--paper); }
.stage {
  position: relative; isolation: isolate; display: grid; min-height: clamp(498px, 73svh, 660px);
  overflow: clip; border-radius: 15px 15px 0 0;
  background: #dddff0 url("./assets/arena.webp") 50% 52% / cover no-repeat;
}
.stage::before { position: absolute; inset: 0; z-index: -1; content: ""; }
.stage[data-mode="menu"]::before { background: linear-gradient(90deg, #f4f6ff 5%, #f4f6ffef 30%, #edf0ff6e 59%, #f4f6ff00 83%); }
.stage[data-mode="play"]::before, .stage[data-mode="pause"]::before, .stage[data-mode="victory"]::before {
  background: linear-gradient(180deg, #f9faff90, #f9faff00 26%, #18254800 61%, #18254837 100%);
}
.stage[data-mode="result"]::before { background: #f3f5fee8; }
.menu { position: relative; display: grid; align-content: center; padding: 60px clamp(34px, 6.3vw, 86px); }
.menu-copy { z-index: 1; max-width: 37rem; }
h1, h2, p { margin: 0; }
h1, h2 { font-weight: 890; letter-spacing: -.038em; }
h1 { font-size: clamp(4rem, 8.25vw, 6rem); line-height: .94; }
h1 span, h1 em { display: block; }
h1 em { color: var(--blue); font-style: normal; }
.intro { margin-top: 24px; max-width: 31ch; color: var(--quiet); font-size: clamp(1.05rem, 2vw, 1.27rem); }
.challenge-note { margin-top: 15px; color: var(--blue); max-width: 44ch; font-weight: 780; }
.menu-illustration { position: absolute; inset: 6% 2% 1% 59%; pointer-events: none; }
.menu-illustration img { position: absolute; object-fit: contain; filter: drop-shadow(5px 16px 18px #141d4540); }
.menu-inspector { width: 69%; height: 91%; bottom: 4%; left: 14%; }
.menu-sheet { width: 33%; right: 0; bottom: 14%; transform: rotate(10deg); }
.menu-note { width: 27%; left: 0; bottom: 12%; transform: rotate(-12deg); }
.action-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.menu .action-row { margin-top: 24px; }
.button {
  display: inline-flex; min-height: 48px; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 17px; border: 1px solid transparent; border-radius: 10px;
  font-weight: 820; line-height: 1.18; text-decoration: none;
}
.button svg { width: 19px; height: 19px; }
.button-primary { background: var(--blue); color: var(--paper); }
.button-primary:hover { background: var(--blue-hover); }
.button-secondary { background: var(--paper); color: var(--blue); border-color: #bfcaf0; }
.button-secondary:hover { background: var(--lilac); }
.button:active { transform: translateY(1px); }
.text-button { min-height: 44px; padding: 0; border: 0; color: var(--blue); background: transparent; font-weight: 820; font-size: .87rem; text-align: start; }
.text-button:hover { text-decoration: underline; }
.start-status, .dialog-status { color: var(--blue); font-size: .9rem; }
.start-status:not(:empty), .dialog-status:not(:empty) { margin-top: 12px; }
.bezel {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 57px;
  padding: 0 18px; gap: 8px; border-top: 1px solid var(--border);
}
.game-meta { color: var(--quiet); font-size: .81rem; white-space: nowrap; }
.prize-status { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0 10px; }
.prize-teaser { color: var(--quiet); font-size: .79rem; text-align: center; }
.prize-teaser.is-active { color: var(--green); }
.invite-button { justify-self: end; white-space: nowrap; }
.footer {
  display: grid; justify-items: center; gap: 2px; color: var(--quiet); font-size: .85rem;
  padding: 8px 0 max(16px, env(safe-area-inset-bottom));
}
.footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 clamp(12px, 3vw, 24px); }
.footer a { display: inline-flex; min-height: 44px; align-items: center; text-decoration: none; }
.footer img { display: block; width: auto; height: clamp(12px, 2.15vw, 15px); }
.footer a:hover img { opacity: .8; }
.company-info {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 3px 11px;
  text-align: center; font-style: normal;
}

#arena { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; touch-action: none; }
#arena:focus-visible { outline: 2px solid var(--blue); outline-offset: -3px; }
.hud {
  position: absolute; top: 13px; inset-inline: 14px; display: grid; align-items: start;
  grid-template-columns: 1fr auto 1fr; gap: 8px; pointer-events: none;
}
.hud-score, .hud-time, .hud-combo {
  width: max-content; min-width: 66px; min-height: 53px; padding: 6px 12px 7px;
  border-radius: 11px; background: #ffffffed;
}
.hud span { color: var(--quiet); font-size: .73rem; font-weight: 820; }
.hud strong { display: block; color: var(--ink); font: 700 clamp(1.45rem, 3.3vw, 2.25rem)/1 var(--numbers); font-variant-numeric: tabular-nums; }
.hud-time { min-width: 106px; text-align: center; }
.hud-actions { display: flex; align-items: start; justify-content: end; gap: clamp(5px, 1.4vw, 14px); }
.hud-actions .icon-button { pointer-events: auto; }
.hud-combo { text-align: end; }
.hud-combo strong { color: var(--blue); }
.wave-list { display: flex; align-items: center; justify-content: center; gap: 4px; margin: 1px 0 4px; }
.wave-list i { width: 15px; height: 3px; border-radius: 2px; background: var(--border); }
.wave-list i.is-filled { background: var(--blue); }
.wave-timer { position: absolute; bottom: 0; width: 100%; height: 4px; background: var(--border); pointer-events: none; }
.wave-timer i { display: block; width: 100%; height: 100%; transform: scaleX(var(--progress, 1)); transform-origin: left; background: var(--blue); }
.danger-signal, .fine-signal {
  position: absolute; top: 100px; left: 50%; transform: translateX(-50%); width: max-content;
  max-width: calc(100% - 16px); padding: 7px 13px; border-radius: 8px;
  color: var(--paper); background: var(--danger); font-size: .9rem; font-weight: 850; text-align: center; pointer-events: none;
}
.fine-signal { background: #fff0f2; color: var(--danger); border: 1px solid #d896a4; }
.fine-signal:not([hidden]) + .danger-signal { top: 143px; }
.center-callout {
  position: absolute; top: 44%; left: 50%; width: max-content; max-width: calc(100% - 25px);
  transform: translate(-50%, -50%); color: var(--blue); background: #ffffffeb; border-radius: 14px;
  padding: .25em .4em; font: 900 clamp(2rem, 7vw, 5rem)/1 var(--display);
  letter-spacing: -.04em; text-align: center; pointer-events: none;
}

.pause-layer, .result { display: grid; place-items: center; position: relative; min-width: 0; text-align: center; }
.pause-layer { align-content: center; gap: 15px; padding: 62px 16px 30px; background: #f3f5fedf; }
.result { padding: 34px 18px 25px; }
.result-inner { width: min(100%, 495px); }
.pause-layer h2, .result h2 { font-size: clamp(2rem, 6vw, 3.3rem); line-height: 1; }
.result-detail { margin-top: 9px; color: var(--quiet); }
.result-score { margin: 12px 0 14px; color: var(--blue); line-height: 1; }
.result-score strong { font: 700 clamp(4rem, 11vw, 6.1rem)/.94 var(--numbers); letter-spacing: -.035em; }
.result-score span { display: block; font-size: .91rem; margin-top: 6px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0 auto; gap: 7px; border-block: 1px solid var(--border); padding-block: 11px; }
.stats dt { color: var(--quiet); font-size: .85rem; }
.stats dd { margin: 1px 0 0; font: 700 1.65rem/1.15 var(--numbers); }
.result-challenge, .reward { margin-top: 12px; }
.result-challenge { color: var(--quiet); font-size: .95rem; }
.reward p { color: var(--quiet); font-size: .95rem; }
.reward.is-earned p { color: var(--green); }
.reward .button { margin-top: 6px; }
.result-actions { justify-content: center; margin: 17px auto 4px; }

dialog { width: min(520px, calc(100% - 22px)); max-height: calc(100% - 24px); overflow: auto; border: 1px solid var(--border); border-radius: 15px; padding: clamp(20px, 5vw, 34px); color: var(--ink); background: var(--paper); }
dialog::backdrop { background: #18254883; }
dialog h2 { padding-right: 38px; font-size: clamp(1.85rem, 6vw, 2.62rem); line-height: 1.03; }
dialog p, dialog .button-primary { margin-top: 12px; }
dialog p { color: var(--quiet); }
.dialog-close { position: absolute; top: 12px; right: 12px; font: 700 1.6rem/1 var(--numbers); }
.target-guide { display: grid; padding: 0; list-style: none; margin: 14px 0; }
.target-guide li { display: flex; gap: 12px; align-items: center; min-height: 57px; border-top: 1px solid var(--border); }
.target-guide li:last-child { border-bottom: 1px solid var(--border); }
.target-guide img { object-fit: contain; padding: 4px; flex-shrink: 0; }
.target-guide strong, .target-guide span { display: block; }
.target-guide span, .key-hint { color: var(--quiet); font-size: .84rem; }
kbd { color: var(--ink); font: 700 .86rem var(--numbers); }
.share-options { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.share-options .button { margin: 0; }
dialog input { display: block; width: 100%; min-height: 46px; margin-top: 6px; border: 1px solid #aebce6; border-radius: 7px; padding: 8px 11px; color: var(--ink); background: var(--page); caret-color: var(--blue); }
#share-url { margin-top: 12px; }
#claim-form { margin-top: 16px; }
#claim-form .key-hint { margin-top: 6px; }
#coupon code { display: block; margin: 15px 0; padding: 10px 12px; overflow-wrap: anywhere; border-radius: 7px; background: var(--mint); color: var(--green); font: 700 clamp(1.05rem, 5vw, 1.55rem) var(--numbers); text-align: center; }
#coupon .button { margin: 0; }
.claim-support { display: inline-flex; align-items: center; }

@media (max-width: 720px) {
  .shell { padding-inline: max(10px, env(safe-area-inset-left)) max(10px, env(safe-area-inset-right)); }
  .masthead { min-height: 63px; padding-inline: 3px; }
  .masthead-actions { gap: 9px; }
  .wordmark { gap: 7px; }
  .wordmark-mark { width: 26px; height: 26px; }
  .wordmark-name { width: 114px; }
  .stage { min-height: clamp(479px, 67svh, 640px); background-position: 50% 48%; }
  .stage[data-mode="menu"]::before { background: linear-gradient(180deg, #f3f5fe 10%, #f3f5feef 27%, #f3f5fe89 56%, #f3f5fe06 86%); }
  .stage[data-mode="play"], .stage[data-mode="pause"], .stage[data-mode="victory"] { min-height: min(760px, calc(100svh - 60px)); }
  .menu { padding: 31px clamp(18px, 5.4vw, 34px) 205px; align-content: start; }
  h1 { font-size: clamp(2.85rem, 12.15vw, 5.15rem); }
  .intro { margin-top: 15px; }
  .menu .action-row { margin-top: 18px; gap: 7px; }
  .menu .button { padding-inline: .82rem; }
  .menu-illustration { inset: auto 3% 0 37%; height: 49%; }
  .menu-inspector { height: 89%; width: 84%; left: 10%; bottom: 0; }
  .menu-sheet { width: 37%; bottom: 9%; }
  .menu-note { width: 35%; bottom: 10%; left: -4%; }
  .hud { inset-inline: 8px; top: 9px; gap: 5px; }
  .hud-score, .hud-combo { min-width: 54px; padding-inline: 7px; }
  .hud-time { min-width: 87px; padding-inline: 7px; }
  .bezel { grid-template-columns: auto 1fr; gap: 0 7px; padding: 2px 9px 3px; }
  .prize-status { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; margin-bottom: 5px; }
  .prize-teaser { text-align: start; }
  .invite-button { grid-column: 2; grid-row: 1; }
}
@media (pointer: coarse) and (orientation: landscape) and (max-height: 500px) {
  .stage[data-mode="play"], .stage[data-mode="pause"], .stage[data-mode="victory"] { min-height: 100svh; }
}
@media (hover: none) { #arena { cursor: default; } }
@media (prefers-reduced-motion: reduce) { .button:active { transform: none; } }
