:root {
  color-scheme: dark;
  font-family: "Arial Narrow", "Roboto Condensed", Arial, sans-serif;
  background: #071322;
  color: #eef7ff;
  --navy: #071322;
  --panel: #0c1c2d;
  --panel-light: #12283b;
  --cyan: #45e6f4;
  --amber: #ffbf5b;
  --muted: #91a8ba;
  --line: rgba(165, 208, 230, .17);
}

* { box-sizing: border-box; }

html, body { width: 100%; min-width: 320px; min-height: 100%; margin: 0; }

body {
  min-height: 100vh;
  min-height: 100svh;
  background-color: var(--navy);
  background-image: radial-gradient(ellipse at 50% 8%, #112944 0, transparent 52%),
    radial-gradient(circle at 12% 72%, rgba(69, 230, 244, .07) 0 1px, transparent 2px),
    radial-gradient(circle at 86% 28%, rgba(255, 191, 91, .08) 0 1px, transparent 2px);
  overflow: hidden;
}

button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }
[hidden] { display: none !important; }

.site-shell {
  width: min(100% - 32px, 1180px);
  height: 100vh;
  height: 100svh;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

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

.brand-lockup { display: flex; align-items: center; gap: 12px; }
.brand-mark { color: var(--cyan); font-size: 30px; text-shadow: 0 0 16px rgba(69, 230, 244, .65); }
.brand-lockup h1 { margin: 0; font-size: 22px; letter-spacing: .18em; font-weight: 900; cursor: default; user-select: none; }
.brand-tagline { margin: 4px 0 0; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .2em; }
.icon-button { min-height: 38px; padding: 8px 11px; border: 1px solid var(--line); background: rgba(12, 28, 45, .8); color: var(--cyan); letter-spacing: .1em; font-size: 10px; cursor: pointer; }
.icon-button span:first-child { margin-right: 7px; font-size: 16px; vertical-align: -1px; }
.icon-button[aria-pressed="true"] { color: var(--muted); }

#main-content { width: 100%; flex: 1; display: grid; place-items: start center; min-height: 0; padding: 0; }
.game-frame { width: min(100%, 900px); margin: 0 auto; }
.hud { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 0 0 10px; }
.hud-stat { min-height: 68px; padding: 10px 14px; display: flex; flex-direction: column; justify-content: center; border: 1px solid var(--line); background: rgba(12, 28, 45, .9); }
.hud-label { color: var(--muted); font-size: 9px; letter-spacing: .18em; font-weight: 800; }
.hud-stat strong { margin-top: 3px; font-size: clamp(20px, 3vw, 28px); line-height: 1; letter-spacing: .05em; font-variant-numeric: tabular-nums; }
.hud-target { display: block; margin-top: 3px; color: var(--amber); font-size: clamp(6px, 1.8vw, 8px); font-weight: 900; letter-spacing: .03em; line-height: 1; text-align: center; white-space: nowrap; }
.hud-target.beaten::after { content: " ✓"; color: var(--cyan); }
.time-stat strong { color: var(--amber); }
#multiplier-value { color: var(--cyan); }
.squad-dots { display: flex; align-items: center; gap: 7px; min-height: 25px; padding-top: 6px; }
.squad-dot { width: 11px; height: 11px; border: 2px solid var(--cyan); border-radius: 50%; background: var(--cyan); box-shadow: 0 0 8px rgba(69, 230, 244, .3); }
.squad-dot.lost { border-color: #506174; background: transparent; box-shadow: none; }

.arena-wrap { position: relative; width: min(100%, calc(100svh - 230px)); max-width: 760px; aspect-ratio: 1; margin: 0 auto; padding: clamp(9px, 2vw, 18px); border: 1px solid rgba(69, 230, 244, .38); background: #091a2b; box-shadow: 0 0 55px rgba(0, 0, 0, .35), inset 0 0 0 5px rgba(69, 230, 244, .035); }
.arena-edge { position: absolute; inset: 5px; border: 1px solid rgba(69, 230, 244, .1); pointer-events: none; }
.board { position: relative; z-index: 1; width: 100%; height: 100%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(4, minmax(0, 1fr)); gap: clamp(5px, 1.2vw, 10px); }
.tile { position: relative; min-width: 0; min-height: 0; overflow: hidden; border: 1px solid rgba(151, 196, 220, .2); background: #10243a; cursor: pointer; touch-action: manipulation; transition: background-color .12s ease, border-color .12s ease, transform .12s ease; }
.tile > * { pointer-events: none; }
.tile::after { position: absolute; inset: 0; content: ""; opacity: .48; background: linear-gradient(135deg, transparent 48%, rgba(115, 175, 205, .1) 49%, rgba(115, 175, 205, .1) 51%, transparent 52%); pointer-events: none; }
.tile:hover:not(:disabled) { border-color: var(--cyan); background-color: #163149; }
.tile:disabled { cursor: default; }
.tile.struck { border-color: var(--amber); background-color: #392b27; }
.tile.struck::before { position: absolute; inset: 0; z-index: 1; content: ""; background: repeating-linear-gradient(135deg, rgba(255, 191, 91, .23) 0 4px, transparent 4px 10px); }
.tile.safe-zone { border-color: rgba(69, 230, 244, .6); }
.tile-countdown { position: absolute; z-index: 2; top: 7%; right: 7%; width: 38%; aspect-ratio: 1; display: grid; place-items: center; color: #fff3d3; font-size: clamp(10px, 1.8vw, 15px); font-weight: 900; font-variant-numeric: tabular-nums; }
.tile-countdown-ring { position: absolute; z-index: 0; inset: 0; border: 2px solid rgba(255, 191, 91, .25); border-radius: 50%; background: conic-gradient(var(--amber) var(--remaining-deg, 360deg), rgba(255, 191, 91, .15) 0); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px)); mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px)); }
.countdown-progress-0 { --remaining-deg: 0deg; }
.countdown-progress-1 { --remaining-deg: 18deg; }
.countdown-progress-2 { --remaining-deg: 36deg; }
.countdown-progress-3 { --remaining-deg: 54deg; }
.countdown-progress-4 { --remaining-deg: 72deg; }
.countdown-progress-5 { --remaining-deg: 90deg; }
.countdown-progress-6 { --remaining-deg: 108deg; }
.countdown-progress-7 { --remaining-deg: 126deg; }
.countdown-progress-8 { --remaining-deg: 144deg; }
.countdown-progress-9 { --remaining-deg: 162deg; }
.countdown-progress-10 { --remaining-deg: 180deg; }
.countdown-progress-11 { --remaining-deg: 198deg; }
.countdown-progress-12 { --remaining-deg: 216deg; }
.countdown-progress-13 { --remaining-deg: 234deg; }
.countdown-progress-14 { --remaining-deg: 252deg; }
.countdown-progress-15 { --remaining-deg: 270deg; }
.countdown-progress-16 { --remaining-deg: 288deg; }
.countdown-progress-17 { --remaining-deg: 306deg; }
.countdown-progress-18 { --remaining-deg: 324deg; }
.countdown-progress-19 { --remaining-deg: 342deg; }
.countdown-progress-20 { --remaining-deg: 360deg; }
.tile-countdown-text { position: relative; z-index: 1; padding: 2px 3px; border: 1px solid rgba(255, 191, 91, .55); border-radius: 3px; background: #392b27; line-height: 1; text-shadow: 0 1px 3px #24170e; }
.tile-countdown::after { position: absolute; z-index: 2; inset: -5px; content: ""; border: 1px dashed rgba(255, 191, 91, .7); border-radius: 50%; pointer-events: none; }
.tile-warning { position: absolute; z-index: 2; left: 10%; bottom: 9%; color: var(--amber); font-size: clamp(9px, 1.5vw, 15px); font-weight: 900; letter-spacing: .08em; }
.tile-intel { position: absolute; z-index: 3; left: 50%; top: 50%; width: 23%; aspect-ratio: 1; transform: translate(-50%, -50%) rotate(45deg); background: var(--cyan); box-shadow: 0 0 18px rgba(69, 230, 244, .9); border: 2px solid #d5fcff; }
.tile-player { position: absolute; z-index: 4; left: 50%; top: 50%; width: 39%; aspect-ratio: 1; transform: translate(-50%, -50%); display: grid; place-items: center; border: 2px solid #effcff; border-radius: 50%; background: var(--cyan); color: #082033; font-size: clamp(12px, 2.2vw, 22px); font-weight: 1000; box-shadow: 0 0 18px rgba(69, 230, 244, .55); }
.tile-player.demo { border-style: dashed; background: #a4edf2; }
.tile[aria-label*="strike"] .tile-warning { text-shadow: 0 1px 3px #24170e; }
.tile.strike-flash { animation: strike-flash .28s ease-out; }
.score-pop { position: absolute; z-index: 6; left: 50%; top: 36%; color: #e7fdff; font-size: clamp(11px, 2vw, 19px); font-weight: 1000; letter-spacing: .04em; text-shadow: 0 2px 5px #06111b, 0 0 10px rgba(69, 230, 244, .8); white-space: nowrap; }
.score-pop.show { animation: score-float .72s ease-out both; }
@keyframes strike-flash { 0% { background-color: #fff0c6; border-color: #fff; } 100% { background-color: #392b27; border-color: var(--amber); } }
@keyframes score-float { from { opacity: 1; transform: translate(-50%, 0); } to { opacity: 0; transform: translate(-50%, -24px); } }
@keyframes board-shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-2px); } }
.arena-wrap.damage { animation: board-shake .24s ease-out; }
.arena-wrap.damage .arena-edge { border-color: rgba(255, 91, 91, .95); box-shadow: inset 0 0 22px rgba(255, 43, 62, .55); }

.screen-overlay { position: absolute; z-index: 5; inset: 0; display: grid; place-items: center; padding: clamp(8px, 2vw, 18px); background: rgba(3, 10, 19, .34); }
.screen-card { width: min(100%, 440px); max-height: 100%; overflow: auto; overscroll-behavior: contain; padding: clamp(16px, 3vw, 26px); border: 1px solid rgba(69, 230, 244, .48); background: rgba(7, 19, 34, .96); box-shadow: 0 16px 50px rgba(0, 0, 0, .48); text-align: center; scrollbar-width: thin; }
.eyebrow { margin: 0 0 7px; color: var(--cyan); font-size: 9px; font-weight: 900; letter-spacing: .24em; }
.screen-card h2 { margin: 0; font-size: clamp(22px, 5vw, 38px); line-height: 1; font-weight: 1000; letter-spacing: .045em; }
.screen-copy { margin: 10px auto 15px; max-width: 340px; color: #b7c8d6; font-size: 13px; line-height: 1.4; }
.result-target { margin: 0 auto 6px; color: var(--amber); font-size: 10px; font-weight: 1000; letter-spacing: .14em; }
.result-target.target-beaten { color: var(--cyan); }
.primary-button, .secondary-button, .seed-button { min-height: 42px; border: 0; padding: 0 20px; font-size: 12px; font-weight: 1000; letter-spacing: .14em; cursor: pointer; touch-action: manipulation; }
.primary-button { background: var(--cyan); color: #062033; box-shadow: 0 0 16px rgba(69, 230, 244, .24); }
.primary-button:hover { background: #9af4fa; }
.primary-button span { margin-left: 12px; font-size: 18px; vertical-align: -1px; }
.secondary-button { border: 1px solid rgba(255, 191, 91, .75); background: transparent; color: var(--amber); }
.secondary-button:hover { background: rgba(255, 191, 91, .1); }
.seed-form { margin: 14px auto 0; max-width: 300px; }
.seed-form label, .initials-form label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 9px; font-weight: 900; letter-spacing: .16em; }
.seed-row { display: flex; justify-content: center; gap: 6px; }
.seed-row input { width: 150px; min-width: 0; height: 38px; border: 1px solid var(--line); background: #0d2032; padding: 0 10px; color: #fff; font-size: 16px; text-align: center; letter-spacing: .22em; text-transform: uppercase; }
.seed-button { min-height: 38px; padding: 0 14px; background: #18374d; color: var(--cyan); font-size: 10px; }
.seed-button:hover { background: #214964; }
.status-message { min-height: 13px; margin: 9px 0 0; color: #8fa9bb; font-size: 10px; }
.leaderboard-block { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 8px; }
.leaderboard-heading { display: flex; justify-content: space-between; color: var(--muted); font-size: 8px; letter-spacing: .14em; font-weight: 900; }
.leaderboard-list { max-height: 144px; overflow-y: auto; overscroll-behavior: contain; margin: 5px 0 0; padding: 0; list-style: none; text-align: left; scrollbar-width: thin; }
.leaderboard-list li { display: grid; grid-template-columns: 25px minmax(0, 1fr) auto; gap: 8px; min-width: 0; min-height: 18px; align-items: center; color: #d3e2ed; font-size: 10px; }
.leaderboard-list li.empty-state { display: block; text-align: center; }
.leaderboard-list .rank { color: var(--muted); }
.leaderboard-list .entry-seed { color: #8398aa; font-size: 9px; letter-spacing: .08em; text-align: right; white-space: nowrap; }
.result-card { width: min(100%, 460px); padding-top: clamp(12px, 2vw, 19px); padding-bottom: clamp(12px, 2vw, 19px); }
.result-card h2 { font-size: clamp(21px, 4vw, 31px); }
.result-card .screen-copy { margin: 6px auto 8px; }
.result-score-line { display: flex; align-items: baseline; justify-content: center; gap: 12px; margin: 8px 0; color: var(--muted); font-size: 10px; letter-spacing: .16em; }
.result-score-line strong { color: var(--amber); font-size: 29px; font-variant-numeric: tabular-nums; }
.result-facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin: 8px 0; }
.result-facts div { min-width: 0; padding: 7px 3px; border: 1px solid var(--line); background: #0b1c2d; }
.result-facts span, .result-facts strong { display: block; }
.result-facts span { color: var(--muted); font-size: 7px; letter-spacing: .09em; }
.result-facts strong { overflow: hidden; margin-top: 4px; color: #f0f8ff; font-size: 13px; text-overflow: ellipsis; }
.initials-form { margin: 8px auto; }
.result-actions { display: flex; justify-content: center; gap: 7px; margin-top: 9px; }
.result-actions button { min-height: 36px; padding: 0 12px; font-size: 9px; }
.result-card .status-message { margin-top: 5px; }

.game-footer { display: flex; justify-content: space-between; gap: 10px; padding: 10px 2px 0; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .13em; }
.game-footer i { padding: 0 4px; color: var(--cyan); font-style: normal; }
.intel-hint b { color: var(--cyan); font-size: 14px; vertical-align: -1px; }
.page-note { margin: 0 0 13px; color: #5f778a; text-align: center; font-size: 8px; font-weight: 800; letter-spacing: .2em; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 560px) {
  .site-shell { width: min(100% - 12px, 440px); }
  .masthead { min-height: 62px; }
  .brand-mark { font-size: 24px; }
  .brand-lockup { gap: 8px; }
  .brand-lockup h1 { font-size: 18px; }
  .brand-tagline { font-size: 7px; }
  .icon-button { min-height: 34px; padding: 6px 8px; font-size: 8px; }
  #main-content { padding: 0; }
  .hud { gap: 5px; margin-bottom: 7px; }
  .hud-stat { min-height: 55px; padding: 7px 8px; }
  .hud-label { font-size: 7px; }
  .hud-stat strong { font-size: 19px; }
  .squad-dots { gap: 4px; min-height: 20px; padding-top: 4px; }
  .squad-dot { width: 8px; height: 8px; border-width: 1px; }
  .arena-wrap { width: min(100%, calc(100svh - 178px)); padding: 8px; }
  .board { gap: 5px; }
  .screen-overlay { padding: 7px; }
  .screen-card { padding: 8px; }
  .attract-card .screen-copy { margin: 7px auto 9px; font-size: 11px; }
  .attract-card .primary-button { min-height: 37px; }
  .seed-form { margin-top: 9px; }
  .attract-card .leaderboard-block { margin-top: 7px; padding-top: 5px; }
  .attract-card .leaderboard-list { max-height: 88px; }
  .attract-card .leaderboard-list li { min-height: 10px; font-size: 8px; line-height: 1; }
  .result-card .result-score-line { margin: 4px 0; }
  .result-card .result-facts { margin: 4px 0; }
  .result-card .initials-form { margin: 4px auto; }
  .result-card .result-actions { margin-top: 4px; }
  .game-footer { padding-top: 7px; font-size: 7px; letter-spacing: .08em; }
  .page-note { margin-bottom: 7px; font-size: 7px; }
}

@media (max-height: 800px) and (min-width: 561px) {
  .masthead { min-height: 60px; }
  #main-content { place-items: start center; padding: 7px 0; }
  .hud-stat { min-height: 55px; }
  .arena-wrap { width: min(100%, calc(100svh - 210px)); }
  .screen-card { padding-top: 12px; padding-bottom: 12px; }
  .attract-card .leaderboard-block { margin-top: 7px; }
  .page-note { margin-bottom: 6px; }
}

@media (max-height: 700px) {
  #main-content { place-items: start center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
  .tile-countdown-ring { background: rgba(255, 191, 91, .35); }
  .tile.strike-flash { background: #fff0c6; border-color: #fff; }
  .arena-wrap.damage { animation: none; }
  .arena-wrap.damage .arena-edge { border-color: #ff5b5b; box-shadow: none; }
  .score-pop.show { color: var(--cyan); animation: none; transform: translateX(-50%); }
}