@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(1680px, calc((100svh - 64px) * 16 / 9), calc(100vw - 16px)); }
#stage { position: relative; width: 100%; aspect-ratio: 16 / 9; 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: linear-gradient(90deg, #031013a8 0%, #03101330 35%, transparent 62%); }
.menu-title { position: absolute; top: 20%; left: 6%; margin: 0; color: #fff5d9; font: 64px/1.15 Laserian, Impact, sans-serif; text-shadow: 0 3px 0 #142c2f, 0 5px 20px #000; }
.menu-title span { display: block; color: #82eaff; font-size: 48px; margin-top: 14px; }
.menu-actions { position: absolute; bottom: 15%; left: 6%; width: 264px; max-width: 38%; display: grid; gap: 10px; }
.menu-secondary { display: flex; gap: 10px; }
.menu-secondary .secondary { flex: 1; }
.menu-secondary .secondary { white-space: nowrap; }
.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; }
#cover-status { margin-top: 7px; display: flex; align-items: center; gap: 5px; color: #acffce; font-size: 10px; font-weight: bold; }
#cover-status svg { width: 15px; height: 15px; }
.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; bottom: 12px; left: 50%; transform: translateX(-50%); width: 540px; max-width: calc(100% - 24px); display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; 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) * 16 / 9)); height: auto; flex-shrink: 0; }
#game-shell:fullscreen .game-toolbar { width: min(600px, 100vw); flex-shrink: 0; }
#touch-controls { position: absolute; bottom: 70px; 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: 100vw; }
  .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 { bottom: 6px; gap: 3px; width: 260px; max-width: calc(100% - 12px); }
  #weapons button { grid-template-columns: 1fr; }
  #weapons button span { display: none; }
  .menu-actions { bottom: 8%; gap: 5px; }
  #play { min-height: 45px; font-size: 20px; }
  .menu-secondary .icon-button, .menu-secondary .secondary { height: 40px; min-height: 40px; }
}
@media (max-width: 1100px) {
  .menu-title { font-size: 42px; top: 16%; }
  .menu-title span { font-size: 30px; margin-top: 8px; }
  .menu-actions { bottom: 12%; width: 230px; }
}
@media (max-height: 650px) and (orientation: landscape) {
  body { padding: 0; }
  #game-shell { width: min(100vw, calc((100svh - 36px) * 16 / 9)); }
  .game-toolbar { height: 36px; }
  .game-toolbar .icon-button { height: 32px; }
  .menu-title { font-size: 32px; top: 12%; }
  .menu-title span { font-size: 24px; margin-top: 5px; }
  .menu-actions { bottom: 10%; width: 180px; gap: 6px; }
  #play { min-height: 40px; font-size: 19px; }
  .menu-secondary .secondary, .menu-secondary .icon-button { min-height: 36px; height: 36px; font-size: 12px; }
  .menu-secondary .secondary { font-size: 10px; padding: 6px 8px; gap: 5px; }
  .menu-secondary .secondary svg { width: 16px; height: 16px; }
  .shaded { position: fixed; z-index: 20; }
  .settings-dialog { grid-template-columns: 1fr 1fr; gap: 8px 20px; max-width: 600px; padding: 14px 20px; }
  .settings-dialog h2 { grid-column: 1 / -1; font-size: 22px; }
  .settings-dialog .slider-label { align-self: center; font-size: 12px; }
  .settings-dialog input[type="range"] { margin: 0; }
  .toggle-label { grid-column: 1 / -1; margin: 3px 0; }
}
@media (max-width: 600px) and (orientation: portrait) {
  .menu-title { font-size: 22px; top: 12%; }
  .menu-title span { font-size: 19px; margin-top: 3px; }
  .menu-actions { bottom: 9%; width: 150px; max-width: 41%; }
  #play { font-size: 14px; min-height: 32px; padding: 4px; }
  .menu-secondary { gap: 5px; }
  .menu-secondary .secondary { min-height: 29px; height: 29px; font-size: 9px; padding: 4px; gap: 4px; }
  .menu-secondary .icon-button { min-height: 29px; height: 29px; width: 30px; flex-basis: 30px; padding: 5px; }
  .menu-secondary svg { width: 14px; height: 14px; }
  .shaded { position: fixed; z-index: 20; padding: 12px; }
  #score { font-size: 17px; }
  #hud { inset: 6px; }
  .eyebrow, #wave { font-size: 8px; }
  .status-block { width: 80px; }
  #weapons button { height: 30px; padding: 3px; }
  #weapons b { font-size: 7px; }
  #weapons em { font-size: 10px; }
  #touch-controls { bottom: 43px; left: 6px; right: 6px; }
  #touch-controls button { width: 37px; height: 37px; flex-basis: 37px; }
  #cover-status { font-size: 8px; margin-top: 3px; }
  .loading-screen { gap: 10px; }
  .loading-screen h1 { font-size: 18px; }
  .loading-screen p { font-size: 10px; margin: 0; }
}
@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; }
}
