/* Defend the City. A civil-defense broadcast for a city being eaten by a man. */
:root {
  --signal: #f2c230; --alarm: #e0412f; --amber: #f29a38; --slate: #16202a; --glass: rgba(18, 27, 35, .62); --paper: #edeae2; --muted: #b9bdb5;
  --display: 'Big Shoulders Display', 'Arial Narrow', sans-serif; --stencil: 'Big Shoulders Stencil Display', 'Big Shoulders Display', 'Arial Narrow', sans-serif; --text: 'Public Sans', system-ui, sans-serif;
}
body { font-family: var(--text); background: var(--slate); }
.stencil { font-family: var(--stencil); font-weight: 900; text-transform: uppercase; letter-spacing: .01em; line-height: .84; margin: 0; }

/* ---------- Menu ---------- */
.welcome { position: fixed; left: clamp(20px, 5vw, 72px); bottom: clamp(24px, 7vh, 80px); width: min(520px, calc(100vw - 40px)); padding: 0; background: none; border: 0; box-shadow: none; z-index: 4; }
body:not(.exploring)::before { content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 3; background: linear-gradient(90deg, rgba(14, 20, 26, .78) 0%, rgba(14, 20, 26, .45) 34%, transparent 62%), linear-gradient(0deg, rgba(14, 20, 26, .6), transparent 40%); }
.welcome h1 { font-size: clamp(76px, 11vw, 150px); color: var(--paper); margin: 0 0 22px; text-shadow: 0 6px 40px rgba(0, 0, 0, .35); letter-spacing: -.005em; }
.welcome .pitch { font-size: 19px; line-height: 1.5; color: var(--paper); margin: 0 0 30px; max-width: 30ch; }
.menu-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.go, .quiet { font-family: var(--display); font-weight: 700; font-size: 22px; letter-spacing: .02em; text-transform: uppercase; min-height: 54px; padding: 10px 26px; border-radius: 3px; }
.go { background: var(--signal); color: #1c1a12; border: 0; }
.go:hover:not(:disabled) { background: #ffd54d; }
.quiet { background: transparent; color: var(--paper); border: 1.5px solid rgba(237, 234, 226, .45); }
.quiet:hover:not(:disabled) { background: rgba(237, 234, 226, .1); border-color: var(--paper); }
.go span, .quiet span { margin: 0; }
.welcome .load-track { margin-top: 22px; max-width: 360px; height: 2px; background: rgba(255, 255, 255, .12); }
.welcome .load-track > div { background: var(--signal); }
.welcome .load-status { font-size: 13px; color: var(--muted); margin: 10px 0 0; }
.keys { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 20px; margin: 28px 0 0; max-width: 460px; padding-top: 20px; border-top: 1px solid rgba(237, 234, 226, .18); }
.keys div { margin: 0; }
.keys dt { font-family: var(--display); font-weight: 700; font-size: 16px; color: var(--signal); letter-spacing: .03em; }
.keys dd { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.best { font-size: 14px; color: var(--muted); margin: 18px 0 0; }
.best b { color: var(--paper); font-weight: 600; }
body.loaded .welcome .load-track, body.loaded .welcome .load-status { display: none; }

/* ---------- Mode switches ---------- */
#hud { display: none; }
body.defend.exploring #hud { display: block; }
body.defend .brand, body.defend #settings-toggle, body.defend .flight-toggle, body.defend .flight-hud, body.defend .telemetry, body.defend .compass, body.defend #explore-hint, body.defend .vignette { display: none !important; }
body.defend.cinematic #hud, body.defend.cinematic #reticle, body.defend.game-over #hud, body.defend.game-over #reticle, body.cinematic .giant-label { display: none !important; }
body.defend .topbar { justify-content: flex-end; top: auto; bottom: 18px; right: 20px; left: auto; z-index: 8; }
body.defend.exploring .topbar { display: none; }
body.defend #sightings .giant-label:not(.hostile-label) { display: none !important; }

/* ---------- HUD ---------- */
#hud section { position: fixed; z-index: 5; color: var(--paper); text-shadow: 0 1px 8px rgba(0, 0, 0, .5); }
#city-status { left: 24px; top: 22px; width: 250px; }
.integrity { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 6px 10px; }
.integrity span { font-size: 13px; color: var(--muted); }
.integrity strong { font-family: var(--display); font-weight: 700; font-size: 26px; }
.bar { grid-column: 1 / -1; height: 5px; background: rgba(255, 255, 255, .14); overflow: hidden; }
.bar i { display: block; height: 100%; width: 100%; background: var(--paper); transition: width .35s; }
#landmarks { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 6px; }
#landmarks li { display: flex; align-items: center; gap: 10px; font-size: 14px; }
#landmarks li i { width: 10px; height: 10px; border-radius: 50%; background: #6fc58a; box-shadow: 0 0 0 3px rgba(111, 197, 138, .18); flex: none; }
#landmarks li.s1 i { background: var(--amber); box-shadow: 0 0 0 3px rgba(242, 154, 56, .25); animation: pulse 1s infinite alternate; }
#landmarks li.s2 { color: rgba(237, 234, 226, .45); text-decoration: line-through; text-decoration-color: var(--alarm); }
#landmarks li.s2 i { background: var(--alarm); box-shadow: none; }
@keyframes pulse { to { opacity: .45; } }
#wave-block { left: 50%; top: 20px; transform: translateX(-50%); text-align: center; }
#wave-num { display: block; font-family: var(--display); font-weight: 700; font-size: 30px; letter-spacing: .02em; text-transform: uppercase; }
#giants-left { font-size: 14px; color: var(--muted); }
#score-block { right: 24px; top: 22px; text-align: right; }
#score-block span { font-size: 13px; color: var(--muted); display: block; }
#score { font-family: var(--display); font-weight: 700; font-size: 38px; line-height: 1; font-variant-numeric: tabular-nums; }
.score-pop { position: absolute; right: 0; top: 56px; font-family: var(--display); font-weight: 900; font-size: 26px; color: var(--signal); animation: rise 1.6s ease-out forwards; }
@keyframes rise { from { transform: translateY(0); opacity: 1; } to { transform: translateY(-30px); opacity: 0; } }
#dispatch { left: 24px; bottom: 26px; width: min(460px, 42vw); display: flex; flex-direction: column-reverse; gap: 8px; }
#dispatch p { margin: 0; padding: 8px 12px 9px 14px; font-size: 15px; line-height: 1.4; background: var(--glass); backdrop-filter: blur(10px); border-left: 3px solid var(--signal); opacity: 0; transform: translateX(-12px); transition: opacity .35s, transform .35s; text-shadow: none; }
#dispatch p.in { opacity: 1; transform: none; }
#dispatch p.old { opacity: .5; }
#arms { right: 24px; bottom: 26px; width: 250px; }
.meter { display: grid; grid-template-columns: 70px 1fr; align-items: center; gap: 10px; margin-bottom: 9px; font-size: 13px; }
.meter span { color: var(--muted); }
.meter .bar { grid-column: auto; height: 6px; }
#hull .bar i { background: #8fd3a3; } #hull.low .bar i { background: var(--alarm); animation: pulse .4s infinite alternate; }
#heat .bar i { background: var(--signal); transition: width .08s; } #heat.hot .bar i { background: var(--alarm); }
#heat.hot span::after { content: ' (cooling)'; color: var(--alarm); }
.rocket-row { display: grid; grid-template-columns: 70px 1fr 20px; align-items: center; gap: 10px; font-size: 13px; }
.rocket-row span { color: var(--muted); }
#rockets { display: flex; gap: 4px; }
#rockets i { width: 9px; height: 18px; border: 1.5px solid rgba(237, 234, 226, .35); border-radius: 5px 5px 1px 1px; }
#rockets i.full { background: var(--paper); border-color: var(--paper); }
#rocket-ready { width: 16px; height: 16px; border-radius: 50%; background: conic-gradient(rgba(255, 255, 255, .15) calc(var(--cd, 0) * 360deg), var(--signal) 0); }
.hint { margin: 12px 0 0; font-size: 12px; color: var(--muted); }
.foot-arms { display: none; }
body.on-foot .foot-arms { display: flex; flex-wrap: wrap; gap: 12px 26px; }
body.on-foot .heli-arms { display: none; }
.ord { display: grid; grid-template-columns: auto auto; column-gap: 8px; align-items: baseline; }
.ord strong { font-family: var(--display); font-weight: 700; font-size: 40px; line-height: 1; grid-row: span 2; }
.ord span { font-size: 14px; }
.ord kbd { font-family: var(--text); font-size: 11px; color: var(--muted); border: 0; padding: 0; letter-spacing: 0; }
.foot-arms .hint { flex-basis: 100%; margin: 0; }
#heli-cd { margin: 10px 0 0; font-family: var(--display); font-weight: 700; font-size: 20px; color: var(--signal); }

/* Reticle and hit feedback */
body.defend #reticle { left: 50%; top: 50%; width: 0; height: 0; background: none; }
#reticle i { display: none; }
body.defend #reticle i { display: block; position: absolute; background: rgba(255, 255, 255, .9); box-shadow: 0 0 3px rgba(0, 0, 0, .6); }
body.defend #reticle i:nth-child(1), body.defend #reticle i:nth-child(2) { width: 9px; height: 2px; top: -1px; }
body.defend #reticle i:nth-child(1) { left: -16px; } body.defend #reticle i:nth-child(2) { left: 7px; }
body.defend #reticle i:nth-child(3), body.defend #reticle i:nth-child(4) { width: 2px; height: 9px; left: -1px; }
body.defend #reticle i:nth-child(3) { top: -16px; } body.defend #reticle i:nth-child(4) { top: 7px; }
body.on-foot #reticle i { opacity: .5; }
#hitmark { position: fixed; left: 50%; top: 50%; width: 26px; height: 26px; margin: -13px 0 0 -13px; pointer-events: none; opacity: 0; z-index: 6; background: linear-gradient(45deg, transparent 44%, #fff 44%, #fff 56%, transparent 56%), linear-gradient(-45deg, transparent 44%, #fff 44%, #fff 56%, transparent 56%); -webkit-mask: radial-gradient(circle, transparent 5px, #000 6px); mask: radial-gradient(circle, transparent 5px, #000 6px); }
#hitmark.on, #hitmark.head, #hitmark.big { animation: hit .22s ease-out; }
#hitmark.head { background: linear-gradient(45deg, transparent 42%, var(--alarm) 42%, var(--alarm) 58%, transparent 58%), linear-gradient(-45deg, transparent 42%, var(--alarm) 42%, var(--alarm) 58%, transparent 58%); }
#hitmark.big { width: 40px; height: 40px; margin: -20px 0 0 -20px; animation-duration: .4s; }
@keyframes hit { 0% { opacity: 1; transform: scale(1.3); } 100% { opacity: 0; transform: scale(1); } }

/* Giant name tags and off-screen arrows */
.hostile-label { position: fixed; left: 0; top: 0; min-width: 150px; padding: 0; background: none; border: 0; color: var(--paper); text-align: center; pointer-events: none; will-change: transform; z-index: 4; }
.hostile-label b { display: block; font-family: var(--display); font-weight: 700; font-size: 17px; letter-spacing: .04em; text-transform: uppercase; text-shadow: 0 1px 6px rgba(0, 0, 0, .7); margin-bottom: 4px; }
.hostile-label span { display: block; height: 5px; background: rgba(0, 0, 0, .45); outline: 1px solid rgba(255, 255, 255, .25); }
.hostile-label span i { display: block; height: 100%; background: var(--alarm); transition: width .15s; }
.hostile-label.angry b { color: var(--signal); }
.hostile-label.angry b::after { content: ' is angry'; font-weight: 500; text-transform: none; }
.hostile-label.boss { min-width: 260px; } .hostile-label.boss b { font-size: 22px; color: var(--signal); } .hostile-label.boss span { height: 8px; }
.giant-arrow { position: fixed; left: 0; top: 0; width: 34px; height: 34px; z-index: 5; pointer-events: none; }
.giant-arrow::before { content: ''; position: absolute; inset: 7px 4px; background: var(--alarm); clip-path: polygon(100% 50%, 0 0, 22% 50%, 0 100%); filter: drop-shadow(0 0 4px rgba(0, 0, 0, .6)); }
.giant-arrow.boss::before { background: var(--signal); }
.giant-arrow span { position: absolute; left: -12px; top: 36px; width: 60px; text-align: center; font-family: var(--display); font-weight: 700; font-size: 14px; color: var(--paper); text-shadow: 0 1px 4px #000; }

/* ---------- Cards ---------- */
#title-card { position: fixed; left: 0; right: 0; bottom: 15vh; text-align: center; z-index: 6; pointer-events: none; color: var(--paper); animation: titleIn 2.4s ease-out both; }
#title-card h1 { font-size: clamp(80px, 13vw, 190px); letter-spacing: .02em; text-shadow: 0 8px 60px rgba(0, 0, 0, .45); }
#title-card p { font-size: 18px; margin: 18px 0 0; opacity: .85; }
#title-card.out { opacity: 0; transition: opacity 1.4s; }
@keyframes titleIn { from { opacity: 0; letter-spacing: .12em; } to { opacity: 1; } }
#wave-card { position: fixed; left: 50%; top: 28vh; transform: translateX(-50%); text-align: center; z-index: 6; pointer-events: none; color: var(--paper); width: min(900px, 92vw); opacity: 0; }
#wave-card.in { animation: cardIn .7s cubic-bezier(.2, .8, .2, 1) forwards; }
#wave-card.out { animation: cardOut .6s ease-in forwards; }
.wc-kicker { font-family: var(--display); font-weight: 700; font-size: 26px; color: var(--signal); letter-spacing: .06em; text-transform: uppercase; text-shadow: 0 2px 12px rgba(0, 0, 0, .5); }
#wave-card h2 { font-size: clamp(64px, 9vw, 128px); margin: 6px 0 14px; text-shadow: 0 6px 40px rgba(0, 0, 0, .45); }
#wave-card p { font-size: 18px; margin: 0; text-shadow: 0 1px 10px rgba(0, 0, 0, .7); }
@keyframes cardIn { from { opacity: 0; transform: translate(-50%, 18px) scale(1.04); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes cardOut { from { opacity: 1; } to { opacity: 0; transform: translate(-50%, -10px); } }
#pause-card { position: fixed; inset: 0; z-index: 9; display: grid; place-content: center; text-align: center; background: rgba(14, 20, 26, .55); color: var(--paper); gap: 14px; }
#pause-card h2 { font-size: 110px; }
#pause-card p { margin: 0 0 10px; font-size: 17px; }
#pause-card button { justify-self: center; }
#end-card { position: fixed; left: clamp(20px, 6vw, 90px); top: 50%; transform: translateY(-50%); z-index: 9; width: min(560px, calc(100vw - 40px)); color: var(--paper); opacity: 0; transition: opacity 1s; }
#end-card.in { opacity: 1; }
#end-card h2 { font-size: clamp(70px, 9vw, 124px); }
.end-sub { font-size: 18px; margin: 16px 0 26px; max-width: 34ch; line-height: 1.5; }
.end-score-wrap { display: flex; align-items: baseline; gap: 16px; }
.end-score { font-family: var(--display); font-weight: 900; font-size: 64px; color: var(--signal); line-height: 1; }
.end-best { font-size: 14px; color: var(--muted); }
.end-stats { display: grid; grid-template-columns: repeat(5, auto); gap: 18px; margin: 24px 0; padding: 18px 0; border-top: 1px solid rgba(237, 234, 226, .2); border-bottom: 1px solid rgba(237, 234, 226, .2); }
.end-stats b { display: block; font-family: var(--display); font-weight: 700; font-size: 30px; }
.end-stats span { font-size: 12px; color: var(--muted); }
.end-landmarks { list-style: none; padding: 0; margin: 0 0 28px; display: grid; gap: 5px; font-size: 14px; }
.end-landmarks li { display: flex; justify-content: space-between; max-width: 360px; }
.end-landmarks em { font-style: normal; color: #6fc58a; } .end-landmarks .s1 em { color: var(--amber); } .end-landmarks .s2 em { color: var(--alarm); }
body.game-over::after { content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 8; background: linear-gradient(90deg, rgba(14, 20, 26, .8), rgba(14, 20, 26, .3) 55%, transparent); }

/* Touch */
#touch-arms { position: fixed; right: 18px; bottom: 150px; display: flex; flex-direction: column; gap: 10px; z-index: 6; }
#touch-arms button { min-width: 86px; min-height: 60px; font-family: var(--display); font-weight: 700; font-size: 18px; background: rgba(18, 27, 35, .7); border-radius: 50px; touch-action: none; user-select: none; }
#touch-arms button[data-arm="fire"] { background: var(--signal); color: #1c1a12; border: 0; min-height: 76px; }

@media (max-width: 760px) {
  .keys { display: none; }
  .welcome .pitch { font-size: 16px; margin-bottom: 22px; }
  #city-status { width: 170px; left: 14px; top: 14px; } #landmarks li { font-size: 12px; } .integrity strong { font-size: 20px; }
  #wave-block { top: 70vh; } #wave-num { font-size: 22px; }
  #score-block { right: 14px; top: 14px; } #score { font-size: 28px; }
  #dispatch { left: 14px; bottom: 16px; width: calc(100vw - 150px); } #dispatch p { font-size: 13px; }
  #arms { right: 14px; bottom: 16px; width: 120px; } .hint, .meter span, .rocket-row span { display: none; } .meter, .rocket-row { grid-template-columns: 1fr; }
  .end-stats { grid-template-columns: repeat(3, auto); }
}
@media (prefers-reduced-motion: reduce) { #wave-card.in, #wave-card.out, #title-card, .score-pop { animation-duration: .01s !important; } }
body:not(.exploring) .brand, body:not(.exploring) .flight-toggle, body:not(.exploring) .telemetry, body:not(.exploring) .compass, body:not(.exploring) #settings-toggle { display: none !important; }

/* Canopy cracks spread as the hull takes damage. */
#canopy { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }
#canopy g { opacity: 0; transition: opacity .15s; }
#canopy path, #canopy circle { fill: none; stroke: rgba(235, 245, 255, .55); stroke-width: 1.6; vector-effect: non-scaling-stroke; filter: drop-shadow(0 0 1px rgba(0, 0, 0, .6)); }
#canopy[data-cracks="1"] .c1, #canopy[data-cracks="2"] .c1, #canopy[data-cracks="2"] .c2, #canopy[data-cracks="3"] g { opacity: 1; }
body.on-foot #canopy { display: none; }

#gpu-card { position: fixed; inset: 0; z-index: 20; display: grid; place-content: center; gap: 16px; text-align: center; background: rgba(14, 20, 26, .9); color: var(--paper); }
#gpu-card h2 { font-size: 90px; } #gpu-card p { margin: 0; font-size: 17px; max-width: 42ch; } #gpu-card button { justify-self: center; }
