towerdef/public/css/style.css
Claude b4ae6cb57d Difficulty picker (Easy/Normal/Hard) and a balance pass
Difficulty:
- TD.DIFFICULTIES (starting credits, lives, enemy hp/shield, kill reward), validated
  create-room / newgame option, state carries it; solo menu picker and co-op lobby
  picker (44px segmented control, reachable on every layout), HUD/room/end-screen
  labels, best-wave record per map AND difficulty (Normal keeps the legacy key),
  Play again keeps the running game's difficulty for host and guest

Balance (12 bot runs, deterministic, 48/48 games replay identically in QA):
- Normal ~71% bot wins at wave 30 (was 94%), Easy 100%, Hard 25% on open
- credits tamed: reward growth 3% -> 2% per wave, clear bonus 10+2n -> 10+n, hp scaling
  eased, Rootkit pays 60 (was 100) but is tougher, flyers slower; unspent credits at
  wave 30: 1309 -> 335
- IDS Sniper is now a slow heavy hitter (essential, no longer sufficient: IDS-only
  dies by wave 7); Mortar, Arc and Filter buffed
- Orbital Uplink price step per owned unit 30% (buy and upgrade)
- remaining imbalances documented in docs/BALANCE.md

Tests: difficulty (19) and balance (8) unit suites, 14-difficulty e2e, layout matrix
reachability of the picker. 156 unit tests, 17 e2e scenarios.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tb8pW2KAN4oFkh1aK1BfD8
2026-10-10 23:41:21 +00:00

447 lines
34 KiB
CSS

/* Netwall - styles. Dark "network operations" theme. Mobile-first: portrait phones, landscape phones, desktop.
*
* Layout modes (see main.js layoutApp for the JS half):
* wide stage | side panel (320px). Desktop and tablets in landscape. Tower actions live in the side panel.
* stacked top bar / stage / side panel. Portrait phones and narrow windows: (orientation: portrait), (max-width: 760px) and (min-height: 521px)
* short stage | narrow side panel, one-row top bar. Landscape phones: (orientation: landscape) and (max-height: 520px)
* compact #app[data-ui="compact"]: stacked OR short OR a coarse pointer. Here the selected tower's actions float over the
* stage as a bar (placed on the half of the stage away from the tower), and every target is at least 44px.
* Everything that has to be reachable (primary buttons, tower actions, room code) is positioned, never scrolled to.
*/
:root {
--bg: #070b16;
--panel: #0c1322;
--panel2: #111b30;
--line: #1d2c4c;
--text: #d3e6ff;
--dim: #8ea6cc;
--cyan: #4de3ff;
--amber: #ffd24d;
--red: #ff5c7a;
--green: #35e0a1;
--side-w: 320px;
--safe-t: env(safe-area-inset-top, 0px);
--safe-r: env(safe-area-inset-right, 0px);
--safe-b: env(safe-area-inset-bottom, 0px);
--safe-l: env(safe-area-inset-left, 0px);
--btn: 40px;
--tile-h: 66px;
--bar-h: 54px;
--nudge-h: 52px; /* the build bar is this much taller than the tower bar: it has a row of nudge buttons */
--aspect: 26 / 16;
--font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
--mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.35 var(--font);
overflow: hidden; overscroll-behavior: none; -webkit-text-size-adjust: 100%;
-webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
input { -webkit-user-select: text; user-select: text; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
svg.ic { width: 1.25em; height: 1.25em; flex: none; }
/* ---------------------------------------------------------------- layout */
#app {
position: fixed; inset: 0; height: 100dvh;
display: grid;
grid-template-columns: minmax(0, 1fr) var(--side-w);
grid-template-rows: auto minmax(0, 1fr);
grid-template-areas: "top top" "stage side";
padding: var(--safe-t) var(--safe-r) var(--safe-b) var(--safe-l); /* the one place the safe-area insets are applied */
background:
radial-gradient(1200px 600px at 20% -10%, #0f1f3d 0%, transparent 60%),
radial-gradient(900px 500px at 100% 110%, #1b1035 0%, transparent 55%), var(--bg);
}
#topbar { grid-area: top; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; padding: 6px 10px; background: rgba(8, 13, 26, .85); border-bottom: 1px solid var(--line); }
#stage { grid-area: stage; position: relative; min-width: 0; min-height: 0; overflow: hidden; touch-action: none; }
#side > * { flex: none; }
/* (no transform / filter / mask / contain on #side or #info: the tower action bar is position:fixed inside them) */
#side { grid-area: side; display: flex; flex-direction: column; gap: 10px; padding: 10px; overflow-y: auto; border-left: 1px solid var(--line); background: rgba(8, 13, 26, .7); }
#board { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
/* stacked: portrait phones and narrow windows. main.js sets --stage-h so the stage hugs the board (no dead bands) and the side panel gets the rest */
@media (orientation: portrait), (max-width: 760px) and (min-height: 521px) {
#app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto var(--stage-h, 56dvh) minmax(0, 1fr); grid-template-areas: "top" "stage" "side"; }
#stage { width: 100%; }
#side { border-left: 0; border-top: 1px solid var(--line); padding: 0 10px 8px; gap: 8px; }
}
/* landscape phones: short viewport, narrow side panel */
@media (orientation: landscape) and (max-height: 520px) {
:root { --side-w: 236px; --btn: 40px; --tile-h: 58px; }
#topbar { padding: 3px 8px; gap: 4px 6px; flex-wrap: nowrap; }
#side { gap: 6px; padding: 6px; }
}
@media (orientation: landscape) and (min-width: 761px) and (max-width: 1000px) and (min-height: 521px) { :root { --side-w: 270px; } }
/* ---------------------------------------------------------------- top bar */
.stat { display: flex; align-items: center; gap: 6px; padding: 0 10px; height: var(--btn); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; font-family: var(--mono); font-size: 16px; white-space: nowrap; }
.stat b { font-weight: 700; letter-spacing: .02em; }
.stat small { color: var(--dim); }
.stat .lbl { color: var(--dim); font-size: 11px; letter-spacing: .12em; }
#statLives { color: var(--red); }
#statGold { color: var(--amber); }
#statLives.low { border-color: var(--red); box-shadow: 0 0 0 2px rgba(255, 92, 122, .35); background: #2a0e18; animation: pulse 0.8s infinite; } /* static cue first, the pulse is extra */
@keyframes pulse { 50% { background: #4a1426; } }
.spacer { flex: 1 1 8px; }
button.chip { gap: 6px; padding: 0 10px; border-radius: 10px; background: var(--panel); font-family: var(--mono); font-size: 13px; color: var(--cyan); }
button.chip .share { width: 1.1em; height: 1.1em; opacity: .85; }
button.chip:hover { background: #15233f; }
.chip #netPing { color: var(--dim); }
.chip.bad #netPing { color: var(--red); }
.chip.waiting { border-color: var(--amber); color: var(--amber); animation: glow 1.4s infinite; } /* alone in the room: tap to invite */
button { min-height: var(--btn); border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; touch-action: manipulation; transition: background .12s, border-color .12s, transform .05s; }
button:hover { border-color: #35538a; background: #15233f; }
button:active { transform: translateY(1px); }
button:disabled { opacity: 1; cursor: default; color: #8da3c8; background: #0c1426; border-color: #172540; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
button.icon { min-width: var(--btn); padding: 0 8px; font-family: var(--mono); font-size: 13px; }
button.icon.toggle[aria-pressed="true"] { background: #0f3550; border-color: var(--cyan); color: var(--cyan); }
button#btnPause[aria-pressed="true"] { background: #3a2c08; border-color: var(--amber); color: var(--amber); }
button.primary { background: linear-gradient(#1b7a96, #135872); border-color: #2fb4d6; color: #eaffff; font-weight: 600; }
button.primary:hover { background: linear-gradient(#1b7a96, #135872); border-color: #8fe6ff; }
button.danger { color: var(--red); }
button.big { min-height: calc(var(--btn) + 6px); font-size: 16px; padding: 0 20px; }
button.link { background: none; border: 0; color: var(--dim); text-decoration: underline; min-height: 36px; padding: 0 8px; }
button.link:hover { color: var(--text); background: none; }
button.floating { position: absolute; right: 8px; bottom: 8px; background: rgba(12, 19, 34, .85); }
#btnWave { white-space: nowrap; min-width: 0; } /* long label ("Wave 12 · 28s") shrinks with an ellipsis instead of wrapping or pushing Sound off screen */
#btnWaveText { overflow: hidden; text-overflow: ellipsis; }
#btnWave.attn { animation: glow 1.4s infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 4px rgba(77, 227, 255, .25); } }
@media (orientation: portrait), (max-width: 760px) and (min-height: 521px) {
#topbar { padding: 6px 8px; }
.stat { padding: 0 8px; font-size: 15px; }
#btnWave { flex: 1 1 130px; }
.spacer { display: none; }
button.chip { margin-left: auto; font-size: 12.5px; padding: 0 8px; }
.chip #netPing { display: none; }
}
/* ---------------------------------------------------------------- stage overlays */
.hint { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 20px); padding: 6px 12px; border-radius: 999px; background: rgba(8, 13, 26, .92); border: 1px solid var(--line); font-family: var(--mono); font-size: 13px; pointer-events: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hint.ok { color: var(--green); border-color: #1c6a55; }
.hint.bad { color: var(--red); border-color: #6a2336; }
.hint.info { color: var(--cyan); }
/* paused: the board is dimmed and the pill is a button that resumes */
#stage.paused::after { content: ""; position: absolute; inset: 0; background: rgba(4, 7, 14, .5); pointer-events: none; z-index: 1; }
.paused-tag { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 8px 22px 8px 16px; min-height: 52px; border-radius: 999px; background: rgba(8, 13, 26, .94); border: 2px solid var(--amber); color: var(--amber); font-weight: 800; letter-spacing: .24em; font-size: 17px; z-index: 2; }
.paused-tag:hover { background: rgba(30, 24, 8, .96); border-color: var(--amber); }
.paused-tag span { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.paused-tag small { font-size: 11px; letter-spacing: .08em; font-weight: 600; color: #e8d9a0; }
.paused-tag .ic { width: 1.5em; height: 1.5em; }
.banner { position: absolute; left: 0; right: 0; top: 34%; text-align: center; pointer-events: none; font-weight: 800; font-size: clamp(22px, 5vw, 44px); letter-spacing: .14em; color: var(--cyan); text-shadow: 0 0 24px rgba(77, 227, 255, .6); opacity: 0; transform: scale(.96); transition: opacity .3s, transform .3s; }
.banner.show { opacity: 1; transform: none; }
.banner.boss { color: var(--red); text-shadow: 0 0 24px rgba(255, 92, 122, .7); }
/* toasts sit under the route hint at the top, and drop below the action bar when that one is at the top (never behind it, never on the server) */
#toasts { position: absolute; left: 0; right: 0; top: 46px; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; z-index: 5; }
#app[data-ui="compact"][data-bar="top"] #toasts { top: calc(var(--bar-h) + 18px); }
#app[data-ui="compact"][data-bar="top"][data-conf] #toasts { top: calc(var(--bar-h) + var(--nudge-h) + 18px); }
.toast { padding: 7px 14px; background: rgba(8, 13, 26, .96); border: 1px solid var(--line); border-radius: 10px; font-size: 14px; animation: toast 2.6s forwards; max-width: calc(100% - 24px); text-align: center; }
.toast.bad { border-color: #6a2336; color: #ffb3c1; }
.toast.good { border-color: #1c6a55; color: #aef5d6; }
@keyframes toast { 0% { opacity: 0; transform: translateY(-8px); } 8% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; } }
/* touch build bar: cancel, the route text (what the hint pill shows on desktop), and Build. Same slot and size as the tower action bar. */
.confirm { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); width: min(calc(100% - 16px), 480px); height: calc(var(--bar-h) + var(--nudge-h)); display: flex; flex-wrap: wrap; align-content: center; align-items: center; gap: 6px 8px; padding: 5px; border-radius: 14px; background: rgba(8, 13, 26, .96); border: 1px solid #2c4372; box-shadow: 0 6px 22px rgba(0, 0, 0, .5); z-index: 3; }
.confirm.top { bottom: auto; top: 8px; }
.confirm button { min-height: 44px; flex: none; }
.confirm .primary.big { min-width: 112px; padding: 0 12px; font-size: 15px; }
.chint { flex: 1 1 0; min-width: 0; text-align: center; font-family: var(--mono); font-size: 12.5px; line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
/* nudge row: one cell left / up / down / right, for fine aim when a cell is only 12 to 20 px (the arrow is the up icon turned) */
.nudge { flex: 1 1 100%; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.nudge button { width: 100%; padding: 0; }
/* a stage wide enough for it (tablets, landscape phones) keeps the build bar one row: cancel, route text, arrows, Build */
#app[data-barrows="1"] { --nudge-h: 0px; }
#app[data-barrows="1"] .confirm { flex-wrap: nowrap; }
#app[data-barrows="1"] #confirmHint { order: 1; }
#app[data-barrows="1"] .nudge { order: 2; flex: 0 0 auto; grid-template-columns: repeat(4, 44px); gap: 4px; }
#app[data-barrows="1"] #btnConfirmBuild { order: 3; }
/* a stage too short for two rows (320x568): one row, no route text in the bar (it goes to the pill at the top) and a check-only Build, so the bar leaves the board free */
#app[data-barrows="0"] { --nudge-h: 0px; }
#app[data-barrows="0"] .confirm { flex-wrap: nowrap; gap: 4px; justify-content: space-between; }
#app[data-barrows="0"] #confirmHint, #app[data-barrows="0"] #confirmText { display: none; }
#app[data-barrows="0"] .nudge { order: 2; flex: 0 0 auto; grid-template-columns: repeat(4, 44px); gap: 4px; }
#app[data-barrows="0"] #btnConfirmBuild { order: 3; min-width: 44px; padding: 0; }
#app[data-barrows="0"][data-bar="top"] .hint { top: calc(var(--bar-h) + 16px); }
.nudge [data-dx="-1"] .ic { transform: rotate(-90deg); } .nudge [data-dx="1"] .ic { transform: rotate(90deg); } .nudge [data-dy="1"] .ic { transform: rotate(180deg); }
.chint.ok { color: var(--green); } .chint.bad { color: var(--red); } .chint.info { color: var(--cyan); }
#app[data-ui="compact"][data-bar="bottom"] #btnFit { bottom: auto; top: 8px; } /* keep the reset-zoom button out from under the bar */
.reconnect { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 12px; background: rgba(5, 8, 16, .78); z-index: 4; font-size: 16px; padding: 0 16px; text-align: center; }
.spinner { width: 22px; height: 22px; flex: none; border: 3px solid var(--line); border-top-color: var(--cyan); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
/* offline: the rest of the HUD looks dead too (only the menu and the room chip stay usable) */
#app.offline #side, #app.offline #topbar > :not(#btnMenu):not(#netChip) { opacity: .45; pointer-events: none; }
/* ---------------------------------------------------------------- side panel: palette */
#side h4 { margin: 0 0 6px; font-size: 11px; letter-spacing: .14em; color: var(--dim); text-transform: uppercase; font-weight: 600; }
#palette { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
#palette.many { grid-template-columns: repeat(4, minmax(0, 1fr)); } /* more than 6 towers */
.tbtn { position: relative; flex-direction: column; gap: 2px; padding: 6px 4px 5px; min-height: var(--tile-h); text-align: center; line-height: 1.15; }
.tbtn canvas { width: 34px; height: 34px; pointer-events: none; }
.tbtn .nm { font-size: 11.5px; color: var(--text); }
.tbtn .cost { font-family: var(--mono); font-size: 12px; color: var(--amber); }
.tbtn .key { position: absolute; top: 3px; left: 5px; font-family: var(--mono); font-size: 11px; color: #9db4d8; }
.tbtn.sel { border-color: var(--cyan); background: #0f3550; box-shadow: inset 0 0 0 1px var(--cyan); }
.tbtn.poor .nm { color: #9fb2d4; }
.tbtn.poor .cost { color: #ff8fa3; }
.tbtn.poor canvas { opacity: .6; }
@media (pointer: coarse) { .tbtn .key { display: none; } }
/* scroll affordance: main.js sets data-more="start|end|both" on a palette that has hidden tiles; the edge fades out */
#palette[data-more="end"] { -webkit-mask-image: linear-gradient(var(--fade-dir, to right), #000 calc(100% - 30px), transparent); mask-image: linear-gradient(var(--fade-dir, to right), #000 calc(100% - 30px), transparent); }
#palette[data-more="start"] { -webkit-mask-image: linear-gradient(var(--fade-dir, to right), transparent, #000 30px); mask-image: linear-gradient(var(--fade-dir, to right), transparent, #000 30px); }
#palette[data-more="both"] { -webkit-mask-image: linear-gradient(var(--fade-dir, to right), transparent, #000 30px, #000 calc(100% - 30px), transparent); mask-image: linear-gradient(var(--fade-dir, to right), transparent, #000 30px, #000 calc(100% - 30px), transparent); }
/* stacked: one scrolling row of tiles pinned to the top of the side panel (thumb reach), wrapping grid when there is room */
@media (orientation: portrait), (max-width: 760px) and (min-height: 521px) {
#palette { position: sticky; top: 0; z-index: 2; margin: 0 -10px; padding: 8px 10px 6px; background: #0a101f; display: flex; overflow-x: auto; gap: 6px; scrollbar-width: none; scroll-snap-type: x proximity; scroll-padding: 0 10px; overscroll-behavior-x: contain; }
#palette::-webkit-scrollbar { display: none; }
.tbtn { flex: 0 0 76px; min-height: 72px; scroll-snap-align: start; }
#palette.many { grid-template-columns: none; }
}
@media (min-width: 640px) and (orientation: portrait), (min-width: 640px) and (max-width: 760px) and (min-height: 521px) {
#palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); overflow: visible; mask-image: none; -webkit-mask-image: none; }
#palette.many { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
.tbtn { flex: none; }
}
/* short landscape: a few rows of tiles in the narrow column; a long palette scrolls vertically with a fade */
@media (orientation: landscape) and (max-height: 520px) {
#palette { gap: 4px; max-height: calc(var(--tile-h) * 3.5 + 12px); overflow-y: auto; scrollbar-width: none; overscroll-behavior: contain; --fade-dir: to bottom; }
#palette::-webkit-scrollbar { display: none; }
#palette.many { gap: 3px; }
.tbtn { padding: 3px 2px; }
.tbtn canvas { width: 26px; height: 26px; }
}
/* ---------------------------------------------------------------- side panel: info, actions, wave, players */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
#info:empty { display: none; }
.info-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.info-head canvas { width: 38px; height: 38px; flex: none; }
.info-head .nm { font-weight: 700; }
.info-head .lv { color: var(--dim); font-size: 12px; font-family: var(--mono); }
.info .desc { color: var(--dim); font-size: 13px; margin: 2px 0 6px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-family: var(--mono); font-size: 12.5px; margin-bottom: 8px; }
.kvp { display: contents; }
.kvp span:first-child { color: var(--dim); }
.kv .up { color: var(--green); }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.actions button { flex: 1 1 auto; font-size: 14px; min-width: 0; white-space: nowrap; }
.actions .cost { font-family: var(--mono); color: var(--amber); }
.actions .mv { overflow: hidden; text-overflow: ellipsis; }
.actions [data-act="close"] { display: none; }
/* wide layout: the actions stay at the bottom edge of the side panel even when a tall palette pushes them down */
#app:not([data-ui="compact"]) .actions { position: sticky; bottom: 0; background: var(--panel); padding-top: 6px; margin-top: -2px; }
.byline { font-size: 11.5px; color: var(--dim); margin-top: 6px; display: flex; align-items: center; gap: 6px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
/* compact UI: the tower actions are a bar over the stage, on the half away from the tower (data-bar, set by main.js layoutBars) */
#app[data-ui="compact"] #info .actions {
position: fixed; z-index: 6; flex-wrap: nowrap; gap: 6px; padding: 5px; height: var(--bar-h);
left: calc(var(--st-l, 0px) + var(--st-w, 100vw) / 2); transform: translateX(-50%); width: min(calc(var(--st-w, 100vw) - 16px), 480px);
top: calc(var(--st-t, 0px) + var(--st-h, 120px) - var(--bar-h) - 8px);
border-radius: 14px; background: rgba(8, 13, 26, .96); border: 1px solid #2c4372; box-shadow: 0 6px 22px rgba(0, 0, 0, .5);
}
#app[data-ui="compact"][data-bar="top"] #info .actions { top: calc(var(--st-t, 0px) + 8px); }
#app[data-ui="compact"] #info .actions button { min-height: 44px; padding: 0 8px; gap: 5px; flex: 1 1 0; font-size: 14px; }
#app[data-ui="compact"] #info .actions [data-act="up"] { flex-grow: 1.1; }
#app[data-ui="compact"] #info .actions [data-act="mode"] { flex-grow: 1.4; }
#app[data-ui="compact"] #info .actions [data-act="close"] { display: inline-flex; flex: 0 0 44px; min-width: 44px; padding: 0; }
#app[data-ui="compact"][data-barw="s"] #info .actions [data-act="up"] .w, #app[data-ui="compact"][data-barw="s"] #info .actions [data-act="mode"] .w { display: none; }
#app[data-ui="compact"] #info .panel { padding: 8px 10px; }
#app[data-ui="compact"] .kv { display: flex; flex-wrap: wrap; gap: 2px 14px; margin-bottom: 4px; }
#app[data-ui="compact"] .kvp { display: inline-flex; gap: 6px; }
#app[data-ui="compact"] .info .desc { font-size: 12.5px; margin: 0 0 4px; }
#app[data-ui="compact"] .info-head { margin-bottom: 4px; }
#app[data-ui="compact"] .info-head canvas { width: 32px; height: 32px; }
#nextwave .panel { padding: 8px 10px; }
#side h4 .dtag { margin-left: auto; padding: 0 6px; border: 1px solid var(--line); border-radius: 6px; font-size: 10px; letter-spacing: .1em; font-weight: 700; color: var(--dim); } /* the game's difficulty, quietly */
#side h4 .dtag[data-d="easy"] { color: var(--green); border-color: #1c6a55; }
#side h4 .dtag[data-d="hard"] { color: var(--red); border-color: #6a2336; }
#nextwave h4, #players h4 { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 8px; }
.wv { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-family: var(--mono); font-size: 12.5px; }
.wv .e { display: inline-flex; align-items: center; gap: 4px; }
.wv .e i { width: 12px; height: 12px; display: inline-block; background: var(--c); flex: none; } /* shape per enemy kind, not just a colour (see .sh-*) */
.wv .e i.sh-ping, .wv .e i.sh-worm { border-radius: 50%; }
.wv .e i.sh-trojan { clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0 50%); }
.wv .e i.sh-spam { clip-path: polygon(0 20%, 60% 20%, 60% 0, 100% 50%, 60% 100%, 60% 80%, 0 80%); }
.wv .e i.sh-spoof, .wv .e i.sh-ghost { clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); } /* (the kind key is "ghost": this used to be a plain square) */
.wv .e i.sh-daemon { clip-path: polygon(34% 0, 66% 0, 66% 34%, 100% 34%, 100% 66%, 66% 66%, 66% 100%, 34% 100%, 34% 66%, 0 66%, 0 34%, 34% 34%); } /* healer: a plus */
.wv .e i.sh-proxy { clip-path: polygon(0 4%, 100% 4%, 100% 58%, 50% 100%, 0 58%); } /* shielded: a shield */
.wv .e i.sh-botnet { clip-path: polygon(18% 0, 50% 32%, 82% 0, 100% 18%, 68% 50%, 100% 82%, 82% 100%, 50% 68%, 18% 100%, 0 82%, 32% 50%, 0 18%); } /* swarm drone: an X */
.wv .e i.sh-rootkit { clip-path: polygon(30% 0, 70% 0, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0 70%, 0 30%); width: 14px; height: 14px; }
.wv .tag { padding: 1px 6px; border-radius: 6px; font-size: 11px; border: 1px solid; }
.wv .tag.air { color: #e29bff; border-color: #5b3a73; }
.wv .tag.boss { color: var(--red); border-color: #6a2336; }
/* stacked / short: while a tower or build type is selected the wave panel makes room for its stats */
#app[data-ui="compact"] #info:not(:empty) ~ #nextwave { display: none; }
#players .pl { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 13.5px; }
#players .pl .off { color: var(--dim); font-size: 12px; }
#players .pl .you { color: var(--dim); font-size: 12px; }
#players .actions { margin-top: 6px; }
/* ---------------------------------------------------------------- overlays (menu, lobby, help, end)
* .card is a flex column: .card-body scrolls, .card-foot (the primary buttons) is always visible. */
.overlay { position: absolute; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; padding: max(14px, var(--safe-t)) max(14px, var(--safe-r)) max(14px, var(--safe-b)) max(14px, var(--safe-l)); background: rgba(4, 7, 14, .78); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); overflow: hidden; }
.card { width: min(560px, 100%); max-height: 100%; min-height: 0; display: flex; flex-direction: column; overflow: hidden; border-radius: 18px; background: linear-gradient(#0f1830, #0a1124); border: 1px solid #25396a; box-shadow: 0 20px 60px rgba(0, 0, 0, .6), 0 0 0 1px rgba(77, 227, 255, .06); }
.card.wide { width: min(680px, 100%); }
.card-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 20px 20px 10px; }
.card-foot { flex: none; padding: 10px 20px 14px; border-top: 1px solid #1a2a50; background: #0a1124; }
.card-foot > .row:first-child, .card-foot > .opts + .row { margin-top: 0; }
.card h1 { margin: 0; font-size: clamp(30px, 8vw, 46px); letter-spacing: .26em; font-weight: 800; color: #eaffff; text-shadow: 0 0 22px rgba(77, 227, 255, .55); }
.card h2 { margin: 0 0 8px; font-size: 24px; }
.card h3 { margin: 0 0 6px; font-size: 14px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.logo { display: flex; align-items: center; gap: 14px; justify-content: center; }
.logo-mark { width: 44px; height: 44px; flex: none; background: url("../icons/icon.svg") center/contain no-repeat; filter: drop-shadow(0 0 10px rgba(77, 227, 255, .5)); }
.tag { text-align: center; color: var(--dim); margin: 6px 0 14px; }
.muted { color: var(--dim); }
.small { font-size: 13px; }
.row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.row.small { margin-top: 4px; }
.row > .big { flex: 1 1 180px; }
.opts { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-bottom: 10px; } /* the difficulty selector */
.opts:empty { display: none; }
/* segmented control (difficulty): one radiogroup of equal buttons, every one a full 44px touch target. The checked one is marked by a
* tick and a cyan frame, never by colour alone, and it is NOT .primary (the dialogs focus their first .primary button). */
.seg { display: flex; width: 100%; max-width: 380px; border: 1px solid #2c4372; border-radius: 12px; overflow: hidden; background: var(--panel); }
.seg button { position: relative; flex: 1 1 0; min-width: 0; min-height: 44px; border: 0; border-radius: 0; background: transparent; padding: 0 4px; font-size: 15px; font-weight: 600; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; line-height: 44px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button:hover { background: #15233f; color: var(--text); }
.seg button[aria-checked="true"] { background: #0f3550; color: var(--cyan); box-shadow: inset 0 0 0 2px var(--cyan); }
.seg button[aria-checked="true"]::after { content: "\2713"; position: absolute; top: 3px; right: 6px; font-size: 11px; line-height: 1; } /* the tick sits in the corner so it never takes room from the word */
.seg button:focus-visible { outline-offset: -4px; }
.diffnote { margin: 0; min-height: 2.7em; max-width: 380px; text-align: center; color: var(--dim); font-size: 12.5px; line-height: 1.3; }
.diffnote.live { min-height: 1.3em; } /* a game is running: one short line saying which difficulty it is on */
.diffnote:empty { display: none; }
@media (max-width: 480px) { .seg button { font-size: 14px; } }
@media (max-height: 640px) { .diffnote:not(.live) { display: none; } .opts { margin-bottom: 8px; } } /* small phones: the description makes way for the maps and buttons */
.msg { min-height: 1.4em; text-align: center; color: var(--amber); margin: 0 0 4px; }
.msg.bad { color: var(--red); }
.msg:empty { min-height: 0; margin: 0; }
.resume { width: 100%; margin-top: 10px; border-color: var(--cyan); color: var(--cyan); }
/* map picker: wrapping grid that copes with any number of maps (scrolls inside the card body) */
.maps { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-bottom: 4px; }
.mapcard { flex-direction: column; align-items: stretch; gap: 4px; padding: 8px; text-align: left; min-height: 0; border-radius: 12px; }
.mapcard canvas { width: 100%; aspect-ratio: 26 / 16; border-radius: 6px; background: #060a14; }
.mapcard .nm { font-weight: 700; font-size: 13.5px; min-height: 2.6em; }
.mapcard .df { font-size: 11px; color: #9db4d8; letter-spacing: .06em; }
.mapcard .df b { color: var(--amber); letter-spacing: 1px; }
.mapcard[aria-checked="true"] { border-color: var(--cyan); background: #0f3550; box-shadow: inset 0 0 0 1px var(--cyan); }
.mapcard[aria-checked="true"] .nm::before { content: "\2713\00a0"; color: var(--cyan); }
.mapdesc { text-align: center; color: var(--dim); font-size: 13px; min-height: 2.6em; margin: 6px 0 4px; }
@media (max-width: 480px) { .mapcard .df { display: none; } .mapcard .nm { font-size: 12.5px; min-height: 2.4em; } .card-body { padding: 14px 14px 8px; } .card-foot { padding: 8px 14px 12px; } }
.field { display: block; margin: 12px 0; }
.field span { display: block; font-size: 12px; color: var(--dim); margin-bottom: 4px; letter-spacing: .06em; }
input { width: 100%; min-height: var(--btn); border-radius: 10px; border: 1px solid var(--line); background: #070d1b; color: var(--text); padding: 0 12px; font: inherit; font-size: 16px; /* >=16px stops iOS zooming on focus */ }
input::placeholder { color: #8397bb; }
input.code { text-align: center; letter-spacing: .5em; font-family: var(--mono); font-size: 22px; text-transform: uppercase; padding-left: .5em; }
.joinrow { display: flex; gap: 8px; margin-top: auto; }
.joinrow input { flex: 1 1 auto; min-width: 0; }
.joinrow button { flex: 0 0 auto; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.split .col { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: 12px; background: rgba(255, 255, 255, .02); border: 1px solid var(--line); }
.split .col > button { margin-top: auto; }
.roomlist { margin-top: 12px; }
@media (max-width: 480px) { .split { grid-template-columns: 1fr; gap: 10px; } }
@media (max-height: 640px) { .lead { display: none; } .field { margin: 8px 0; } .split .col { padding: 10px; } } /* small phones: the intro text makes way for the buttons */
.howto { padding-left: 18px; margin: 10px 0 0; display: grid; gap: 8px; }
.howto li { color: #bcd3f5; }
.howto b { color: var(--text); }
.kbd-only { display: inline; } .touch-only { display: none; }
@media (pointer: coarse) { .kbd-only { display: none; } .touch-only { display: inline; } }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; margin: 10px 0 4px; font-family: var(--mono); font-size: 14px; }
.stats div { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px solid var(--line); }
.stats span { color: var(--dim); }
/* short landscape: compact menus so the title, a row of maps and the buttons all fit in 320px */
@media (orientation: landscape) and (max-height: 520px) {
.overlay { padding: max(6px, var(--safe-t)) max(8px, var(--safe-r)) max(6px, var(--safe-b)) max(8px, var(--safe-l)); }
.card-body { padding: 8px 16px 6px; }
.card-foot { padding: 6px 16px 8px; }
.card h1 { font-size: 24px; letter-spacing: .2em; }
.card h2 { font-size: 19px; margin-bottom: 4px; }
.logo { gap: 10px; } .logo-mark { width: 28px; height: 28px; }
.tag { margin: 2px 0 6px; font-size: 13px; }
.maps { display: flex; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; padding-bottom: 2px; }
.maps::-webkit-scrollbar { display: none; }
.mapcard { flex: 0 0 118px; scroll-snap-align: start; padding: 5px; gap: 2px; }
.mapcard .nm { min-height: 0; font-size: 12px; }
.mapcard .df { display: none; }
.mapdesc { min-height: 0; margin: 4px 0 0; font-size: 12px; }
.row { margin-top: 6px; gap: 8px; } .row.small { margin-top: 0; }
.row > .big { flex: 1 1 140px; }
.lead { display: none; }
.field { margin: 6px 0; display: flex; align-items: center; gap: 10px; } .field span { margin: 0; flex: none; }
.split { gap: 8px; } .split .col { padding: 6px 8px; gap: 4px; } .split .col h3 { margin-bottom: 0; font-size: 12px; }
.split .col .small { display: none; }
.resume { margin-top: 6px; }
.stats { margin: 6px 0 2px; font-size: 13px; }
.stats div { padding: 2px 0; }
.howto { gap: 5px; font-size: 13.5px; }
button.link { min-height: 32px; }
}
/* the board gets the whole stage while a menu is shown behind blurred overlays; hide HUD chrome pre-game */
#app[data-screen="menu"] #side,
#app[data-screen="menu"] #topbar > :not(#btnMenu) { visibility: hidden; }
/* reduced motion: less movement, never less information (toasts and the low-integrity cue stay visible) */
@media (prefers-reduced-motion: reduce) {
.toast { animation: none; }
#btnWave.attn, #statLives.low, .chip.waiting { animation: none; }
.banner { transition: none; }
button { transition: none; }
.spinner { animation-duration: 2.4s; }
}
/* narrow portrait phones: the room chip shrinks to its code + share icon, stats shrink so the bar stays two rows */
@media (max-width: 420px) {
button.chip > svg:first-child { display: none; }
.stat { padding: 0 7px; gap: 4px; font-size: 14px; }
.stat .lbl { font-size: 10px; letter-spacing: .06em; }
#topbar { gap: 5px 6px; padding: 5px 6px; }
}
/* small landscape phones: one slim top bar, narrower side panel */
@media (orientation: landscape) and (max-height: 520px) and (max-width: 700px) {
:root { --side-w: 200px; }
.stat .lbl { display: none; }
.stat { padding: 0 5px; font-size: 14px; }
button.icon { min-width: 36px; padding: 0 6px; }
#topbar { gap: 3px; padding: 3px 6px; }
#btnWave { padding: 0 8px; gap: 5px; }
.tbtn .nm { font-size: 10.5px; }
button.chip { padding: 0 6px; font-size: 12px; gap: 4px; } .chip #netPing { display: none; } button.chip > svg { display: none; }
}
@media (orientation: landscape) and (max-height: 520px) and (min-width: 701px) { .chip #netPing { display: none; } }
/* very small phones (320px) */
@media (max-width: 340px) {
.stat .lbl { display: none; }
.stat { padding: 0 6px; }
#btnWave { flex: 1 1 80px; padding: 0 8px; }
button.icon { min-width: 38px; padding: 0 4px; }
#topbar { gap: 4px; padding: 4px; }
}
/* touch: every target is at least 44px (declared last so no layout rule above can shrink it) */
@media (pointer: coarse) {
:root { --btn: 44px; }
button.icon { min-width: 44px; }
button.link { min-height: 44px; }
button.chip { min-width: 44px; }
}
/* Windows high contrast: selection must not depend on colours the UA replaces */
@media (forced-colors: active) {
.tbtn.sel, .mapcard[aria-checked="true"], .seg button[aria-checked="true"], button.toggle[aria-pressed="true"], button#btnPause[aria-pressed="true"] { outline: 3px solid Highlight; outline-offset: -3px; forced-color-adjust: none; background: Highlight; color: HighlightText; }
.tbtn.sel .nm, .tbtn.sel .cost, .mapcard[aria-checked="true"] .df, .mapcard[aria-checked="true"] .df b { color: HighlightText; }
.overlay { background: Canvas; }
#side { border-color: CanvasText; }
}