@font-face { font-family: Laserian; src: url('../fonts/LASER4.TTF') format('truetype'); font-display: swap; }
:root { color-scheme: dark; font-family: Arial, sans-serif; color: #fff; background: #080c0d; --green: #79ff00; }
* { box-sizing: border-box; letter-spacing: 0; }
html, body { margin: 0; min-height: 100%; }
body { display: grid; place-items: center; min-height: 100svh; padding: 8px; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; color: white; }
button:disabled { opacity: .4; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
[hidden] { display: none !important; }
#game-shell { width: min(600px, calc((100svh - 70px) * 2 / 3), calc(100vw - 16px)); }
#stage { position: relative; width: 100%; aspect-ratio: 2 / 3; overflow: hidden; background: #000; isolation: isolate; }
#game { display: block; width: 100%; height: 100%; touch-action: none; outline: none; }
#stage[data-mode="playing"] #game { cursor: none; }
.overlay { position: absolute; inset: 0; z-index: 5; }
.loading-screen { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; background: #000; }
.loading-screen h1 { font: 28px Laserian, Impact, sans-serif; text-align: center; margin: 0 20px; }
.loading-screen h1 span { color: #61dcff; }
.loading-screen progress { accent-color: var(--green); height: 8px; width: 60%; border: 0; }
.loading-screen p { font-size: 13px; color: #c5d5d6; text-align: center; max-width: 80%; }
.menu { background: url('assets/menu.png') center / 100% 100% no-repeat; }
.menu-actions { position: absolute; bottom: 4.5%; left: 50%; transform: translateX(-50%); width: 242px; max-width: 76%; display: grid; gap: 10px; }
.menu-secondary { display: flex; gap: 10px; }
.menu-secondary .secondary { flex: 1; }
.primary, .secondary { min-height: 46px; padding: 10px 18px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; border: 2px solid #000; border-radius: 5px; font: 18px Laserian, Impact, sans-serif; text-shadow: -1px -1px #000, 1px -1px #000, -1px 1px #000, 1px 1px #000; }
.primary { background: #65db00; box-shadow: 0 0 0 1px #adff66, 0 0 20px #72ff0029, inset 0 1px #ccff96; }
.primary:hover { background: #7aee13; }
#play { min-height: 52px; font-size: 23px; }
.secondary { background: #152324e6; border-color: #648b80; font-size: 15px; }
.secondary:hover { background: #253d38; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 42px; width: 42px; height: 42px; padding: 9px; color: #fff; background: #0a171adb; border: 1px solid #69817d; border-radius: 4px; text-decoration: none; }
.icon-button:hover { background: #2a453b; border-color: var(--green); }
svg { width: 21px; height: 21px; stroke-width: 2; pointer-events: none; flex-shrink: 0; }
.menu-secondary .icon-button { height: 46px; flex-basis: 46px; }
#hud { position: absolute; inset: 14px 14px auto; display: flex; gap: 12px; align-items: flex-start; pointer-events: none; text-shadow: 0 2px 3px #000, 1px 0 #000, -1px 0 #000; }
#hud button { pointer-events: auto; margin-left: 3px; }
.score-block { min-width: 72px; margin-right: auto; display: grid; gap: 1px; }
.eyebrow { font-size: 10px; font-weight: bold; }
#score { font: 27px Laserian, Arial, sans-serif; font-variant-numeric: tabular-nums; }
.status-block { width: 110px; display: grid; gap: 4px; }
.status-block .eyebrow { display: flex; justify-content: space-between; }
meter { height: 9px; width: 100%; border: 1px solid #dbe3db; border-radius: 0; background: #09130f; }
meter::-webkit-meter-bar { background: #09130f; border: none; border-radius: 0; }
meter::-webkit-meter-optimum-value { background: #87ed71; }
#wave { font-size: 10px; color: #ecf2e4; }
#weapons { position: absolute; inset: auto 10px 12px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; z-index: 2; }
#weapons button { position: relative; min-width: 0; height: 44px; display: grid; grid-template-columns: 14px 1fr; grid-template-rows: 1fr 1fr; gap: 1px 3px; padding: 5px; border: 1px solid #5a7470; border-radius: 3px; background: #061517e8; }
#weapons button span { grid-row: 1 / 3; align-self: center; color: #a2b6b2; font-size: 11px; }
#weapons b { font-size: 9px; font-weight: 700; align-self: end; }
#weapons em { font-size: 13px; font-style: normal; color: #eaf5ec; }
#weapons button[aria-pressed="true"] { border-color: var(--weapon-color); background: #20312bed; box-shadow: inset 0 -2px var(--weapon-color), 0 0 12px #c9ffff15; }
#weapons button[aria-pressed="true"] b { color: var(--weapon-color); }
#weapons button:disabled { opacity: .64; }
.shaded { display: flex; align-items: center; justify-content: center; padding: 18px; background: #020a0cbb; backdrop-filter: blur(4px); overflow-y: auto; }
.dialog { width: 100%; max-width: 400px; max-height: 100%; overflow-y: auto; padding: 24px; border: 2px solid var(--green); border-radius: 6px; background: #071112d9; box-shadow: 0 0 26px #80ff0029; text-align: center; }
.dialog h2 { font: 30px Laserian, Impact, sans-serif; margin: 0 0 23px; color: #fff; line-height: 1.2; overflow-wrap: anywhere; }
.settings-dialog { display: grid; gap: 15px; }
.settings-dialog h2 { margin-bottom: 6px; }
.slider-label { display: flex; justify-content: space-between; font: 15px Laserian, Arial, sans-serif; }
output { font-family: Arial, sans-serif; font-weight: bold; }
input[type="range"] { accent-color: var(--green); width: 100%; height: 24px; margin: 0 0 10px; cursor: pointer; }
.toggle-label { display: flex; align-items: center; justify-content: space-between; gap: 14px; font-size: 12px; margin: 0 0 12px; }
input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--green); }
.score-dialog { padding: 20px 24px; }
.score-dialog h2 { margin-bottom: 12px; }
.score-dialog h2.game-over { color: #ff2525; text-shadow: 0 0 16px #ff000055, 1px 2px #000; }
#run-summary { display: grid; gap: 6px; margin-bottom: 14px; }
#run-summary span { font: 11px Laserian, Arial, sans-serif; }
#final-score { font: 29px Laserian, Arial, sans-serif; }
#run-details { color: #bcd1c9; font-size: 11px; }
#score-form { margin: 12px 0 18px; }
#score-form label { display: block; font: 12px Laserian, Arial, sans-serif; margin-bottom: 10px; }
.name-row { display: flex; gap: 8px; }
#player-name { width: 100%; min-width: 0; height: 44px; border: 1px solid #81b190; background: #0009; padding: 5px 12px; color: white; text-transform: uppercase; font: 22px Arial, sans-serif; text-align: center; border-radius: 3px; }
#submit-score { flex: 0 0 48px; min-height: 44px; padding: 8px; }
#top10-label { font: 18px Laserian, Arial, sans-serif; color: var(--green); margin: 8px 0 9px; }
#leaderboard { list-style: none; padding: 0; margin: 0; font: 15px Arial, sans-serif; font-variant-numeric: tabular-nums; }
#leaderboard li { display: grid; grid-template-columns: 24px 1fr auto; gap: 8px; text-align: left; align-items: center; min-height: 26px; border-bottom: 1px solid #d8ffd810; }
#leaderboard .rank { color: #8fa999; font-size: 12px; }
#leaderboard li:first-child { color: #d7ffa7; }
#leaderboard .entry-score { text-align: right; }
#score-status { color: #c7d7cf; font-size: 11px; line-height: 1.4; margin: 11px 0; min-height: 15px; }
#scores-back { width: 100%; }
#fade { position: absolute; inset: 0; background: #000; z-index: 10; pointer-events: none; opacity: 0; }
.game-toolbar { display: flex; align-items: center; justify-content: space-between; height: 48px; gap: 16px; }
.game-toolbar span { font-size: 10px; font-weight: bold; color: #94a6a1; }
.game-toolbar .icon-button { background: transparent; border: none; }
#game-shell:fullscreen { width: 100%; height: 100%; background: #000; display: flex; align-items: center; justify-content: center; flex-direction: column; }
#game-shell:fullscreen #stage { width: min(100vw, calc((100dvh - 48px) * 2 / 3)); height: auto; flex-shrink: 0; }
#game-shell:fullscreen .game-toolbar { width: min(600px, 100vw); flex-shrink: 0; }
#touch-controls { position: absolute; bottom: 12%; left: 12px; right: 12px; display: flex; align-items: center; justify-content: space-between; pointer-events: none; }
#touch-controls button { width: 46px; height: 46px; pointer-events: auto; touch-action: none; background: #071418b0; }
.touch-move { display: flex; gap: 9px; }
.sr-only { 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: 460px) {
  body { padding: 0; }
  #game-shell { width: min(100vw, calc((100svh - 48px) * 2 / 3)); }
  .shaded { padding: 10px; }
  .dialog { padding: 16px; }
  .dialog h2 { font-size: 24px; }
  #hud { inset: 10px 10px auto; gap: 7px; }
  #score { font-size: 23px; }
  .status-block { width: 87px; }
  #hud .icon-button { width: 35px; height: 35px; flex-basis: 35px; padding: 7px; }
  #leaderboard { font-size: 13px; }
  #leaderboard li { min-height: 21px; }
  #run-summary { gap: 4px; margin-bottom: 8px; }
  #final-score { font-size: 23px; }
  #score-form { margin: 10px 0; }
  #weapons { inset: auto 6px 6px; gap: 3px; }
  #weapons button { grid-template-columns: 1fr; }
  #weapons button span { display: none; }
  .menu-actions { bottom: 3%; gap: 8px; }
  #play { min-height: 45px; font-size: 20px; }
  .menu-secondary .icon-button, .menu-secondary .secondary { height: 40px; min-height: 40px; }
}
@media (prefers-reduced-motion: reduce) { .shaded { backdrop-filter: none; } }
@media (max-width: 360px) {
  .score-dialog { padding: 12px; }
  .score-dialog h2 { font-size: 20px; margin-bottom: 8px; white-space: nowrap; }
  #run-summary { margin-bottom: 6px; gap: 2px; }
  #run-summary span { font-size: 9px; }
  #final-score { font-size: 21px; }
  #run-details { font-size: 10px; }
  #score-form { margin: 8px 0; }
  #score-form label { font-size: 10px; margin-bottom: 6px; }
  #player-name, #submit-score { height: 38px; min-height: 38px; }
  #top10-label { font-size: 16px; margin: 6px 0; }
  #leaderboard li { min-height: 18px; }
  #score-status { margin: 7px 0; font-size: 10px; }
  #scores-back { font-size: 14px; min-height: 40px; }
}
