:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #f8fbff;
  background: #02040b;
  font-synthesis: none;
  --cyan: #67efff;
  --mint: #66f2c6;
  --violet: #9d6cff;
  --pink: #ff4a9f;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(ellipse at 14% 3%, rgba(31, 202, 255, .2), transparent 35rem),
    radial-gradient(ellipse at 90% 0%, rgba(143, 73, 255, .22), transparent 38rem),
    linear-gradient(155deg, #030713 0%, #080b1b 48%, #02040c 100%);
}
body::before {
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: "";
  opacity: .34;
  background-image: linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.014) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom, #000, transparent 72%);
}

button { font: inherit; }
.game-shell { width: min(1180px, 100%); max-width: 100vw; margin: 0 auto; padding: clamp(14px, 2.6vw, 30px); overflow: hidden; }
.game-header, .score-strip, footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.game-header { padding-inline: 3px; }
.brand-lockup { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-lockup img { width: 56px; height: 56px; object-fit: contain; filter: drop-shadow(0 0 16px rgba(87,225,255,.24)); }
.brand-lockup h1 { margin: -2px 0 0; font-size: clamp(1.35rem, 4vw, 2.15rem); letter-spacing: .14em; font-style: italic; text-shadow: 0 0 28px rgba(103,239,255,.18); }
.eyebrow, .panel-tag { color: #78efff; font-size: .67rem; font-weight: 900; letter-spacing: .2em; }
.header-actions { display: flex; align-items: center; gap: 9px; }
.status-label { padding: 8px 10px; border: 1px solid rgba(125, 236, 255, .2); border-radius: 999px; color: #a9f7ff; background: rgba(56,189,232,.05); font-size: .62rem; font-weight: 900; letter-spacing: .12em; }
.icon-button, .primary-button, .touch-controls button {
  border: 1px solid rgba(112, 224, 255, .4);
  border-radius: 10px;
  color: #f8fbff;
  background: linear-gradient(180deg, rgba(20, 30, 57, .96), rgba(8, 13, 31, .96));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.07), 0 8px 24px rgba(0,0,0,.25);
  font-size: .75rem;
  font-weight: 900;
  letter-spacing: .08em;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.icon-button { padding: 10px 13px; }
.icon-button[aria-pressed="false"] { color: #8791a6; border-color: rgba(137, 146, 167, .25); }
.score-strip {
  position: relative;
  margin: 20px 0 12px;
  padding: 12px clamp(10px, 3vw, 28px);
  overflow: hidden;
  border: 1px solid rgba(130, 235, 255, .2);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(13, 23, 47, .9), rgba(5, 10, 26, .92));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 14px 40px rgba(0,0,0,.22);
}
.score-strip::after { position: absolute; inset: auto 0 0; height: 1px; content: ""; background: linear-gradient(90deg, transparent, var(--cyan), var(--violet), transparent); opacity: .65; }
.score-strip div { position: relative; display: grid; flex: 1 1 0; min-width: 68px; text-align: center; }
.score-strip div + div::before { position: absolute; left: 0; top: 15%; width: 1px; height: 70%; content: ""; background: linear-gradient(transparent, rgba(130,235,255,.18), transparent); }
.score-strip span { color: #7e8fae; font-size: .61rem; font-weight: 800; letter-spacing: .14em; }
.score-strip strong { margin-top: 2px; font-size: clamp(1.15rem, 4vw, 1.8rem); font-variant-numeric: tabular-nums; text-shadow: 0 0 20px rgba(104,236,255,.18); }
.arena-wrap {
  position: relative;
  isolation: isolate;
  width: 100%;
  overflow: hidden;
  border: 1px solid rgba(84, 218, 255, .38);
  border-radius: 20px;
  background: #030611;
  box-shadow: 0 30px 90px rgba(0,0,0,.58), 0 0 52px rgba(0,205,255,.08), inset 0 0 0 1px rgba(255,255,255,.025);
}
.arena-wrap::before { position: absolute; inset: 0; z-index: 2; pointer-events: none; content: ""; border-radius: inherit; box-shadow: inset 0 0 70px rgba(1,3,10,.64), inset 0 0 0 4px rgba(3,8,20,.38); }
.arena-wrap::after { position: absolute; inset: 0; z-index: 2; pointer-events: none; content: ""; opacity: .14; background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(140,232,255,.1) 4px); mix-blend-mode: screen; }
canvas { display: block; width: 100%; max-width: 100%; height: auto; touch-action: none; user-select: none; }
.arena-chrome { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.corner { position: absolute; width: 32px; height: 32px; border-color: rgba(111,239,255,.78); filter: drop-shadow(0 0 7px rgba(71,229,255,.48)); }
.corner-nw { left: 13px; top: 13px; border-left: 2px solid; border-top: 2px solid; }
.corner-ne { right: 13px; top: 13px; border-right: 2px solid; border-top: 2px solid; }
.corner-sw { left: 13px; bottom: 13px; border-left: 2px solid; border-bottom: 2px solid; }
.corner-se { right: 13px; bottom: 13px; border-right: 2px solid; border-bottom: 2px solid; }
.telemetry { position: absolute; top: 16px; color: rgba(155,237,255,.64); font: 800 9px/1 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .14em; text-shadow: 0 0 10px rgba(80,226,255,.5); }
.telemetry-left { left: 57px; }
.telemetry-right { right: 57px; }
.game-panel {
  position: absolute;
  inset: 50% auto auto 50%;
  z-index: 5;
  width: min(590px, calc(100% - 30px));
  transform: translate(-50%, -50%);
  padding: clamp(22px, 5vw, 42px);
  text-align: center;
  border: 1px solid rgba(115, 227, 255, .34);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(76,226,255,.06), transparent 28%), linear-gradient(315deg, rgba(153,91,255,.08), transparent 36%), rgba(4, 8, 21, .92);
  box-shadow: 0 28px 90px rgba(0,0,0,.72), 0 0 0 1px rgba(145,240,255,.04), inset 0 1px 0 rgba(255,255,255,.07);
  backdrop-filter: blur(14px);
}
.game-panel::before, .game-panel::after { position: absolute; top: 14px; width: 55px; height: 1px; content: ""; background: linear-gradient(90deg, transparent, var(--cyan)); }
.game-panel::before { left: 14px; }
.game-panel::after { right: 14px; transform: scaleX(-1); }
.mission-lockup { position: relative; display: grid; place-items: center; width: 64px; height: 64px; margin: -8px auto 12px; border: 1px solid rgba(107,238,255,.44); border-radius: 50%; color: #fff; background: radial-gradient(circle, rgba(97,238,255,.18), rgba(5,12,29,.9) 64%); box-shadow: 0 0 30px rgba(75,222,255,.2), inset 0 0 18px rgba(117,105,255,.2); }
.mission-lockup::before, .mission-lockup::after { position: absolute; inset: 7px; content: ""; border: 1px dashed rgba(141,119,255,.55); border-radius: inherit; }
.mission-lockup::after { inset: -6px; border-color: rgba(99,239,218,.18); }
.mission-lockup span { font-size: 25px; font-weight: 1000; font-style: italic; text-shadow: -3px 0 0 #734fff, 3px 0 0 #24e9ff; }
.mission-lockup i { position: absolute; left: 50%; bottom: -11px; width: 86px; height: 1px; transform: translateX(-50%); background: linear-gradient(90deg, transparent, #65eeff, transparent); }
.result-lockup { width: 52px; height: 52px; margin-bottom: 9px; }
.result-lockup span { font-size: 20px; }
.game-panel h2 { margin: 9px 0; font-size: clamp(1.7rem, 4.8vw, 2.65rem); letter-spacing: -.03em; text-shadow: 0 0 28px rgba(97,238,255,.13); }
.game-panel > p { margin: 0 auto 18px; max-width: 480px; color: #b9c6da; line-height: 1.55; }
.key-guide { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 0 auto 22px; color: #8f9cb4; font-size: .63rem; font-weight: 800; letter-spacing: .07em; }
.key-guide span { display: flex; align-items: center; gap: 4px; }
kbd { min-width: 25px; padding: 4px 6px; border: 1px solid rgba(124, 235, 255, .26); border-bottom-width: 3px; border-radius: 6px; color: #c3faff; background: linear-gradient(180deg, rgba(80,139,201,.18), rgba(17,31,58,.5)); box-shadow: inset 0 1px 0 rgba(255,255,255,.08); font-family: inherit; font-size: .61rem; }
.primary-button {
  position: relative;
  padding: 14px 22px;
  overflow: hidden;
  border: 0;
  color: #020711;
  background: linear-gradient(110deg, #86f466 0%, #55edcf 42%, #55d6ff 100%);
  box-shadow: 0 12px 34px rgba(75, 226, 211, .24), inset 0 1px 0 rgba(255,255,255,.54);
}
.primary-button::after { position: absolute; inset: 0; content: ""; transform: translateX(-120%) skewX(-22deg); background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent); transition: transform .45s ease; }
.primary-button:hover::after { transform: translateX(120%) skewX(-22deg); }
.primary-button:hover { filter: brightness(1.08); transform: translateY(-1px); }
.primary-button:focus-visible, .icon-button:focus-visible, .touch-controls button:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.hidden { display: none; }
.result-stats { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 0 0 20px; }
.result-stats span { min-width: 112px; padding: 9px 11px; border: 1px solid rgba(113, 234, 255, .17); border-radius: 8px; color: #8996ad; background: linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.015)); font-size: .67rem; }
.result-stats strong { display: block; color: #8ff7e5; font-size: 1rem; }
.wave-callout {
  position: absolute;
  left: 50%; top: 17%; z-index: 4;
  transform: translate(-50%, -10px) scale(.95);
  opacity: 0;
  pointer-events: none;
  color: #fff;
  font-size: clamp(1.2rem, 4vw, 2.1rem);
  font-weight: 1000;
  font-style: italic;
  letter-spacing: .11em;
  text-shadow: 0 0 18px #16e5ff, 0 4px 0 rgba(0,0,0,.35);
  transition: opacity .16s ease, transform .2s ease;
}
.wave-callout.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.danger-flash { position: absolute; inset: 0; z-index: 4; pointer-events: none; box-shadow: inset 0 0 90px 22px rgba(255, 41, 119, 0); transition: box-shadow .12s ease; }
.danger-flash.show { box-shadow: inset 0 0 90px 22px rgba(255, 41, 119, .52); }
.touch-controls { display: none; grid-template-columns: 1fr 1.15fr 1fr; gap: 8px; margin-top: 10px; touch-action: none; }
.touch-controls button { position: relative; min-height: 56px; padding: 10px; overflow: hidden; }
.touch-controls button::before { position: absolute; inset: 5px; content: ""; pointer-events: none; border: 1px solid rgba(255,255,255,.04); border-radius: 6px; }
.touch-controls .fire-button { border-color: rgba(139, 252, 214, .55); color: #07111b; background: linear-gradient(115deg, #7ef3d1, #62ddff); box-shadow: 0 8px 26px rgba(77, 225, 215, .18), inset 0 1px rgba(255,255,255,.45); }
.touch-controls button.active { transform: translateY(2px); filter: brightness(1.2); }
footer { padding: 13px 3px 0; color: #738199; font-size: .75rem; }
footer p { margin: 0; }
footer strong { color: #cbd5e8; }

@media (pointer: coarse), (max-width: 760px) { .touch-controls { display: grid; } }

@media (max-width: 620px) {
  .game-shell { padding: 11px; }
  .brand-lockup img { width: 43px; height: 43px; }
  .game-header { gap: 6px; }
  .brand-lockup { min-width: 0; gap: 8px; }
  .brand-lockup h1 { font-size: 1.05rem; letter-spacing: .08em; }
  .brand-lockup .eyebrow { font-size: .54rem; letter-spacing: .13em; }
  .status-label { display: none; }
  .icon-button { flex: 0 1 auto; padding: 8px 6px; font-size: .53rem; white-space: nowrap; }
  .score-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px; margin-top: 14px; padding-inline: 5px; }
  .score-strip div { min-width: 0; }
  .score-strip span { font-size: .49rem; letter-spacing: .06em; }
  .score-strip strong { font-size: 1.08rem; }
  .game-panel { padding: 14px 13px; }
  .mission-lockup { width: 45px; height: 45px; margin-bottom: 7px; }
  .mission-lockup span { font-size: 18px; }
  .game-panel h2 { margin: 6px 0; font-size: 1.34rem; }
  .game-panel > p { margin-bottom: 10px; overflow-wrap: anywhere; font-size: .76rem; line-height: 1.35; }
  .panel-tag { font-size: .55rem; }
  .key-guide { display: none; }
  .primary-button { padding: 10px 13px; font-size: .67rem; }
  .result-stats { margin-bottom: 10px; }
  .result-stats span { min-width: 82px; padding: 5px 7px; }
  .telemetry { top: 10px; font-size: 6px; }
  .telemetry-left { left: 35px; }
  .telemetry-right { right: 35px; }
  .corner { width: 20px; height: 20px; }
  .corner-nw, .corner-ne { top: 8px; }
  .corner-sw, .corner-se { bottom: 8px; }
  .corner-nw, .corner-sw { left: 8px; }
  .corner-ne, .corner-se { right: 8px; }
  .touch-controls { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) minmax(0, 1fr); }
  .touch-controls button { min-width: 0; padding-inline: 4px; font-size: .65rem; }
  footer { align-items: flex-start; flex-direction: column; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
