/* A field command console: slate panels, brass accents, a phosphor radio. */
:root {
  color-scheme: dark;
  --bg: #0b1013;
  --panel: #171d21;
  --panel-2: #1f272c;
  --edge: #313c43;
  --edge-hi: #46545c;
  --text: #e4e9e2;
  --muted: #8d9a96;
  --brass: #e8b23a;
  --brass-dim: #8a6a22;
  --phosphor: #9fe6c8;
  --warn: #f0a04a;
  --west: #4da3ff;
  --east: #ff6b4a;
  font: 14px/1.4 system-ui, "Segoe UI", "Noto Sans Hebrew", "Heebo", "Rubik", "Arial Hebrew", sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); overflow: hidden; }
body.side-0 { --mine: var(--west); --theirs: var(--east); }
body.side-1 { --mine: var(--east); --theirs: var(--west); }

main { display: flex; height: 100%; }
#stage { flex: 1; min-inline-size: 0; display: flex; flex-direction: column; }
#map-wrap { flex: 1; position: relative; min-block-size: 0; overflow: hidden; }
#map { display: block; cursor: grab; touch-action: none; }
#map.dragging { cursor: grabbing; }

.panel {
  background: linear-gradient(var(--panel-2), var(--panel));
  border: 1px solid var(--edge);
  border-block-start-color: var(--edge-hi);
  padding: .55rem .7rem;
}
h1 { margin: 0; font-size: 1.05rem; letter-spacing: .14em; text-transform: uppercase; color: var(--brass); }
h2 {
  margin: 0 0 .45rem; font-size: .7rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
  display: flex; align-items: center; gap: .5rem;
}
h2::before { content: ""; inline-size: .5rem; block-size: .5rem; background: var(--brass); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); flex: none; }

button {
  font: inherit; color: var(--text); background: #263037; border: 1px solid var(--edge-hi);
  padding: .3rem .7rem; cursor: pointer;
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
}
button:hover:not(:disabled) { background: #33404a; }
button:disabled { opacity: .4; cursor: not-allowed; }
button.primary { background: var(--brass); color: #1a1405; border-color: #f6d27a; font-weight: 700; }
button.primary:hover:not(:disabled) { background: #f4c552; }

/* ---- map furniture ---- */
#zoom { position: absolute; inset-block-start: .6rem; left: .6rem; display: flex; flex-direction: column; gap: .3rem; }
#zoom button { inline-size: 2rem; block-size: 2rem; padding: 0; font-size: 1.05rem; background: #171d21cc; }
#orders {
  position: absolute; display: flex; flex-direction: column; gap: .4rem; padding: .5rem .6rem;
  background: #10161af2; border: 1px solid var(--brass-dim); transform: translate(-50%, 12px); z-index: 3;
}
#orders[hidden] { display: none; }
#orders strong { font-size: .8rem; color: var(--brass); text-align: center; unicode-bidi: plaintext; }
#orders div { display: flex; gap: .35rem; }

/* ---- radio console ---- */
#radio { block-size: 13.5rem; display: flex; flex-direction: column; border-inline: 0; border-block-end: 0; }
#log {
  flex: 1; overflow-y: auto; list-style: none; margin: 0; padding: .45rem .6rem;
  display: flex; flex-direction: column; gap: .2rem;
  background: #0a100f repeating-linear-gradient(#0000 0 2px, #ffffff05 2px 3px);
  border: 1px solid #22302c; color: var(--phosphor);
  font-size: .88rem; font-variant-numeric: tabular-nums; letter-spacing: .01em;
}
#log li { display: flex; gap: .6rem; align-items: baseline; }
#log time { color: #4f6f64; font-size: .75rem; flex: none; }
#log .who { flex: none; font-weight: 700; min-inline-size: 4.6rem; }
#log .text { unicode-bidi: plaintext; text-align: start; overflow-wrap: anywhere; }
#log .player .who { color: #ffffff; }
#log .operator .who { color: #d2b1ff; }
#log .squad .who { color: var(--mine); }
#log .system { color: #6f8d83; font-style: italic; }
#log .warn { color: var(--warn); }
#send { display: flex; gap: .5rem; padding-block-start: .5rem; }
#text {
  flex: 1; min-inline-size: 0; font: inherit; color: var(--text); background: #0a100f;
  border: 1px solid var(--edge-hi); padding: .45rem .6rem;
}
#text:focus { outline: 1px solid var(--brass); }
#ptt { touch-action: none; user-select: none; -webkit-user-select: none; }
#ptt.live { background: var(--warn); color: #0a100f; }
#ptt.busy { opacity: .6; }
#speak.off { color: var(--muted); text-decoration: line-through; }
#voice-status { margin: .35rem 0 0; font-size: .85em; color: #6f8d83; }
#voice-status.warn { color: var(--warn); }

/* ---- sidebar ---- */
#sidebar {
  inline-size: 21.5rem; flex: none; display: flex; flex-direction: column; gap: 3px; padding: 3px;
  background: #0e1316; border-inline-start: 2px solid var(--brass-dim); min-block-size: 0; overflow-y: auto;
}
#sidebar header { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
#sidebar header h1 { white-space: nowrap; } /* the buttons wrap, never the name */
#controls { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .35rem; }
#controls button { font-size: .75rem; padding: .25rem .5rem; }

#treasury { display: grid; grid-template-columns: 1fr auto; gap: .5rem .8rem; align-items: center; }
#gold-box { display: flex; flex-direction: column; }
#gold-box span, dt, .bars span { font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
#gold-box strong { font-size: 1.9rem; line-height: 1.1; color: var(--brass); font-variant-numeric: tabular-nums; }
#gold-box small { color: var(--muted); }
#treasury dl { margin: 0; display: flex; flex-direction: column; gap: .3rem; }
dd { margin: 0; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.bars { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.bars label { display: flex; flex-direction: column; gap: .2rem; }
.bar { display: block; block-size: .5rem; background: #0a0e10; border: 1px solid var(--edge); }
.bar b { display: block; block-size: 100%; inline-size: 100%; background: var(--mine); transition: inline-size .3s; }
.bar.enemy b { background: var(--theirs); }

#radar-map { display: block; inline-size: 100%; border: 1px solid var(--edge-hi); cursor: crosshair; }

.panel.grow { flex: 1 0 auto; min-block-size: 6rem; }
#roster { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
#roster li {
  display: grid; grid-template-columns: 1fr auto; gap: 0 .5rem; align-items: center;
  padding: .3rem .5rem; background: #12181b; border: 1px solid var(--edge); border-inline-start: 3px solid var(--mine); cursor: pointer;
}
#roster li:hover { background: #1a2227; }
#roster li.selected { border-color: var(--brass); border-inline-start-color: var(--brass); background: #221f14; }
#roster .name { font-weight: 700; }
#roster .unit { color: var(--muted); font-size: .78rem; margin-inline-start: .4rem; font-weight: 400; }
#roster .order { grid-column: 1; color: var(--muted); font-size: .78rem; }
#roster .pips { display: flex; gap: 2px; margin-block: .2rem; }
#roster .pips i { inline-size: .42rem; block-size: .55rem; background: var(--mine); }
#roster .pips i.lost { background: #2a3237; }
#roster .tier { grid-row: 1 / span 3; grid-column: 2; display: flex; flex-direction: column; align-items: center; gap: .2rem; font-size: .7rem; color: var(--muted); }
#roster .tier button { font-size: .7rem; padding: .15rem .4rem; }
#roster .empty { cursor: default; border-inline-start-color: var(--edge); color: var(--muted); }

#build { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
#build button { display: flex; flex-direction: column; align-items: center; gap: .1rem; padding: .3rem .2rem .35rem; font-size: .74rem; line-height: 1.2; text-align: center; }
#build canvas { inline-size: 72px; block-size: 48px; }
#build .cost { color: var(--brass); font-weight: 700; font-variant-numeric: tabular-nums; }

#music { display: flex; align-items: center; gap: .5rem; }
#music[hidden] { display: none; }
#mute { inline-size: 2rem; padding: .2rem 0; }
#mute.off { color: var(--muted); text-decoration: line-through; }
#volume { inline-size: 5.5rem; accent-color: var(--brass); }
#track { flex: 1; min-inline-size: 0; font-size: .74rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; unicode-bidi: plaintext; }

footer.panel { font-size: .78rem; color: var(--muted); }
#hint { margin: .3rem 0 0; }

/* ---- menus ---- */
#overlay {
  position: fixed; inset: 0; z-index: 10; display: grid; place-items: center;
  background: radial-gradient(ellipse at 50% 40%, #1b262ccc, #05080af2);
}
#overlay[hidden] { display: none; }
#overlay .card {
  inline-size: min(30rem, 92vw); padding: 2rem 2.2rem; text-align: center;
  background: linear-gradient(#222b31, #151b1f); border: 1px solid var(--edge-hi); border-block-start: 3px solid var(--brass);
  clip-path: polygon(18px 0, 100% 0, 100% calc(100% - 18px), calc(100% - 18px) 100%, 0 100%, 0 18px);
}
#overlay h1 { font-size: 2.3rem; letter-spacing: .2em; }
#overlay p { margin: .6rem 0 0; color: var(--muted); }
#overlay-side { color: var(--mine) !important; font-weight: 700; letter-spacing: .06em; }
#overlay .row { display: flex; justify-content: center; gap: .6rem; margin-block-start: 1.4rem; }
#overlay .row button { padding: .55rem 1.3rem; }
#credits { margin-block-start: 1.2rem; font-size: .78rem; color: var(--muted); text-align: start; }
#credits[hidden] { display: none; }
#credits summary { cursor: pointer; }
#credits ul { margin: .4rem 0 0; padding-inline-start: 1.1rem; }
#credits li { unicode-bidi: plaintext; overflow-wrap: anywhere; }

/* Phones have their own layout: mobile.css. */

/* ---- help ---- */
#help { position: fixed; inset: 0; z-index: 11; display: grid; place-items: center; background: #05080ad9; }
#help[hidden] { display: none; }
#help .card {
  inline-size: min(44rem, 94vw); max-block-size: 90vh; overflow: auto; padding: 1.4rem 1.8rem;
  background: linear-gradient(#222b31, #151b1f); border: 1px solid var(--edge-hi); border-block-start: 3px solid var(--brass);
}
#help h1 { font-size: 1.3rem; letter-spacing: .12em; margin: 0; }
#help h2 { margin: 1.1rem 0 .3rem; }
#help p, #help li { color: var(--muted); font-size: .88rem; line-height: 1.5; margin: 0; }
#help ul { margin: 0; padding-inline-start: 1.1rem; }
#help .examples { list-style: none; padding: 0; display: grid; gap: .3rem; }
#help .examples li { display: grid; grid-template-columns: 11rem 1fr; gap: .6rem; align-items: baseline; }
#help code { color: var(--mine); font-size: .9rem; }
#help strong { color: var(--brass); }
#help .row { display: flex; justify-content: flex-end; margin-block-start: 1.2rem; }
footer.panel select { margin-inline-start: .4rem; font: inherit; color: inherit; background: #10161a; border: 1px solid var(--edge-hi); }
footer.panel label { display: block; margin-block-end: .3rem; }
#help .tabs { display: flex; gap: .3rem; margin-block-start: .8rem; border-block-end: 1px solid var(--edge-hi); }
#help .tabs button { padding: .35rem .9rem; border-block-end: 0; opacity: .65; }
#help .tabs button[aria-selected="true"] { opacity: 1; color: var(--brass); border-color: var(--brass); }
#help .examples li { grid-template-columns: 13rem 1fr; }
#help .examples code { cursor: pointer; }
#help .examples code:hover { text-decoration: underline; }

/* ---- purchases on their way ---- */
#roster li.deploying { cursor: default; border-inline-start-color: var(--brass); border-style: dashed; border-inline-start-style: solid; }
#roster li.deploying .name { color: var(--muted); }
#roster .deploy-bar { grid-column: 1; block-size: .3rem; margin-block: .3rem .2rem; background: #2a3237; overflow: hidden; }
#roster .deploy-bar b { display: block; block-size: 100%; inline-size: 0; background: var(--brass); transition: inline-size .12s linear; }
#build button { position: relative; overflow: hidden; }
#build button > * { position: relative; }
#build .fill { position: absolute; inset-inline: 0; inset-block-end: 0; block-size: 0; background: linear-gradient(#c9a44c22, #c9a44c55); border-block-start: 2px solid var(--brass); transition: block-size .12s linear; pointer-events: none; }
#build button:not(.deploying) .fill { border-block-start-width: 0; }
#build .left { position: absolute; inset-block-start: .2rem; inset-inline-start: .3rem; font-size: .8rem; font-weight: 700; color: var(--brass); font-variant-numeric: tabular-nums; text-shadow: 0 0 4px #000; }
#build .count { position: absolute; inset-block-start: .2rem; inset-inline-end: .3rem; min-inline-size: 1.1rem; padding: 0 .2rem; font-size: .7rem; font-weight: 700; line-height: 1.1rem; color: #0a100f; background: var(--brass); border-radius: .55rem; }
#build .count[hidden] { display: none; }
#build button.deploying:disabled, #build button.requested:disabled { opacity: 1; }
#build button.requested { animation: requested 1.1s ease-in-out infinite; }
@keyframes requested { 50% { border-color: var(--brass); box-shadow: inset 0 0 0 1px #c9a44c88, inset 0 0 14px #c9a44c33; } }
@media (prefers-reduced-motion: reduce) { #build button.requested { animation: none; border-color: var(--brass); } }

/* The result screen after a headquarters has fallen comes up slowly over the burning ruin. */
#overlay.after-finale { animation: overlay-in 1.6s ease-out; background: radial-gradient(ellipse at 50% 40%, #1b262c99, #05080ae6); }
@keyframes overlay-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { #overlay.after-finale { animation: none; } }
/* ---- who thinks for the squads (client/brains) ---- */
#brains { inline-size: min(34rem, 94vw); max-block-size: 90vh; padding: 1.4rem 1.8rem; color: inherit; background: linear-gradient(#222b31, #151b1f); border: 1px solid var(--edge-hi); border-block-start: 3px solid var(--brass); }
#brains::backdrop { background: #05080ad9; }
#brains h1 { font-size: 1.3rem; letter-spacing: .12em; margin: 0; }
#brains h2 { margin: 1.1rem 0 .3rem; }
#brains p { color: var(--muted); font-size: .88rem; line-height: 1.5; margin: .5rem 0 0; }
#brains #brains-status { color: var(--mine); font-weight: 700; }
#brains fieldset { margin: 1rem 0; padding: .6rem .9rem .9rem; border: 1px solid var(--edge-hi); }
#brains legend { padding: 0 .4rem; color: var(--brass); font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; }
#brains label { display: grid; gap: .2rem; margin-block-start: .6rem; font-size: .82rem; color: var(--muted); }
#brains label.check { display: block; }
#brains select, #brains input[type="password"] { font: inherit; color: inherit; background: #10161a; border: 1px solid var(--edge-hi); padding: .35rem .5rem; }
#brains .row { display: flex; gap: .5rem; justify-content: flex-end; margin-block-start: .8rem; }
#brains .warn { color: var(--warn); }
#brains-open.live { color: var(--brass); border-color: var(--brass); }
/* ---- lobby ---- */
#overlay .card { max-block-size: 94vh; overflow: auto; }
#overlay form, #lobby-room { margin-block-start: 1rem; text-align: start; font-size: .9rem; }
#overlay fieldset { border: 1px solid var(--edge-hi); margin: 0 0 .6rem; padding: .4rem .7rem .5rem; display: grid; gap: .25rem; }
#overlay legend { padding: 0 .3rem; color: var(--muted); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
#overlay form label { display: block; cursor: pointer; }
#overlay form select, #overlay input[type="text"] { font: inherit; color: inherit; background: #10161a; border: 1px solid var(--edge-hi); padding: .25rem .4rem; }
#overlay form select { margin-inline-start: .4rem; }
#lobby-watch { margin-block-start: .4rem; color: var(--muted); }
#lobby-level-about { display: block; flex-basis: 100%; margin-block: .2rem .5rem; color: var(--muted); font-size: .78rem; }
#lobby-join { display: flex; align-items: end; gap: .5rem; padding-block-start: .9rem; border-block-start: 1px solid var(--edge-hi); }
#lobby-join label { flex: 1; color: var(--muted); }
#lobby-join-code { display: block; inline-size: 100%; margin-block-start: .2rem; text-transform: uppercase; letter-spacing: .3em; font-weight: 700; }
#lobby-code { font-size: 1.7rem; letter-spacing: .3em; color: var(--brass); }
#lobby-share { display: flex; gap: .4rem; }
#lobby-link { flex: 1; min-inline-size: 0; }
#lobby-seats { list-style: none; margin: .7rem 0 0; padding: 0; display: grid; gap: .3rem; }
#lobby-seats li { display: flex; gap: .5rem; align-items: baseline; padding: .4rem .6rem; background: #10161a; border: 1px solid var(--edge-hi); border-inline-start: 3px solid var(--edge-hi); }
#lobby-seats li.mine { border-inline-start-color: var(--brass); }
#lobby-seats li.ready .status { color: var(--mine); }
#lobby-seats .who { color: var(--brass); font-size: .78rem; }
#lobby-seats .status { margin-inline-start: auto; color: var(--muted); }
#lobby-note { font-size: .74rem; line-height: 1.45; }
#lobby-error { color: var(--warn) !important; font-weight: 700; }
#overlay [hidden] { display: none !important; }
#lobby-note code { white-space: nowrap; unicode-bidi: isolate; direction: ltr; color: var(--brass); }
#overlay select { max-inline-size: 100%; min-inline-size: 0; text-overflow: ellipsis; }
#lobby-host { border-color: var(--brass); }
#lobby-host legend { color: var(--brass); }
#lobby-host p { margin: 0 0 .5rem; font-size: .8rem; text-align: start; }
#lobby-host input { inline-size: 100%; padding: .5rem .6rem; font: inherit; color: inherit; background: #10161a; border: 1px solid var(--brass); }
