/* ===========================================================================
   CryptoWar — battlefield fire-control instrumentation
   Palette is deliberately three-way (two team colours + one materiel amber)
   rather than the usual single-accent-on-black, so team identity and economy
   never compete for the same colour.
   =========================================================================== */

:root {
  --void: #090d11;
  --steel: #141b22;
  --steel-hi: #1d2831;
  --edge: #2b3a46;
  --chalk: #e3e9ee;
  --dust: #7a8b9a;
  --dim: #4d5c69;

  --blue: #3e9bff;
  --blue-deep: #14568f;
  --red: #ff4d5e;
  --red-deep: #8f1f2b;
  --brass: #e9b44c;
  --brass-deep: #8a6520;
  --good: #64d99a;

  --display: 'Bahnschrift', 'Franklin Gothic Medium', 'Arial Narrow', 'Helvetica Neue', sans-serif;
  --mono: ui-monospace, 'Cascadia Mono', 'Consolas', 'SF Mono', Menlo, monospace;
  --body: system-ui, -apple-system, 'Segoe UI', sans-serif;

  --hud-pad: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--void);
  color: var(--chalk);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
}

body { user-select: none; }

button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }

:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

.hidden { display: none !important; }

#game {
  position: fixed;
  inset: 0;
  display: block;
  cursor: crosshair;
}

#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

/* ---------------------------------------------------------------------------
   SIGNATURE: Territory Ledger
   One strip that is the map, the score, the zone control and the payout.
   --------------------------------------------------------------------------- */

#ledger-wrap {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 10px 18px 0;
}

.ledger-side {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--display);
  letter-spacing: 0.08em;
}
.ledger-side.red { flex-direction: row; }

.ledger-team { font-size: 13px; opacity: 0.72; }
.ledger-count {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.ledger-side.blue { color: var(--blue); }
.ledger-side.red { color: var(--red); }

#ledger {
  position: relative;
  width: min(720px, 52vw);
  height: 30px;
  background: #070a0d;
  border: 1px solid var(--edge);
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.7);
}

#ledger-track {
  position: absolute;
  inset: 2px;
  display: flex;
  gap: 2px;
}

.zone-seg {
  position: relative;
  flex: 1;
  background: #10161c;
  overflow: hidden;
  transition: background 260ms ease;
}
.zone-seg.blue { background: linear-gradient(180deg, #1e5a8f 0%, #0f2f4c 100%); }
.zone-seg.red  { background: linear-gradient(180deg, #8f2530 0%, #4c1219 100%); }
.zone-seg.contested {
  background:
    repeating-linear-gradient(135deg, #2a343d 0 6px, #1a222a 6px 12px);
}

/* Zone value stamp — only shown once a zone has been banked */
.zone-seg .stamp {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.04em;
  color: rgba(233,180,76,0.0);
  transition: color 400ms ease;
}
.zone-seg.banked .stamp { color: rgba(233,180,76,0.85); }

@keyframes zoneFlash {
  0%   { box-shadow: inset 0 0 0 2px var(--brass); filter: brightness(2.2); }
  100% { box-shadow: inset 0 0 0 0 rgba(233,180,76,0); filter: brightness(1); }
}
.zone-seg.flash { animation: zoneFlash 900ms ease-out; }

#ledger-front {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 2px;
  background: var(--chalk);
  box-shadow: 0 0 10px rgba(255,255,255,0.8);
  transform: translateX(-1px);
  transition: left 120ms linear;
  pointer-events: none;
}
#front-flag {
  position: absolute;
  top: -9px; left: 50%;
  width: 0; height: 0;
  transform: translateX(-50%);
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 7px solid var(--chalk);
}

#clock {
  position: absolute;
  top: 46px; left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}
#timer {
  font-family: var(--mono);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  color: var(--chalk);
  text-shadow: 0 2px 6px #000;
}
#phase {
  font-family: var(--display);
  font-size: 9px;
  letter-spacing: 0.24em;
  color: var(--dust);
}

/* ---------------------------------------------------------------------------
   Ground in play — the zone pot, accumulating while you fight for it
   --------------------------------------------------------------------------- */

#pot {
  position: absolute;
  top: 78px; left: var(--hud-pad);
  width: 176px;
  padding: 9px 11px 8px;
  background: rgba(9, 13, 17, 0.82);
  border-left: 2px solid var(--brass);
}

.pot-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 3px;
}
.pot-label {
  font-family: var(--display);
  font-size: 8.5px;
  letter-spacing: 0.2em;
  color: var(--dim);
}
#pot-mult {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--brass-deep);
}

.pot-value {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-bottom: 6px;
}
#pot-total {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--brass);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.pot-value small {
  font-family: var(--display);
  font-size: 8px;
  letter-spacing: 0.16em;
  color: var(--brass-deep);
}

#pot-progress {
  height: 3px;
  background: #0a0f14;
  margin-bottom: 6px;
  overflow: hidden;
}
#pot-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--brass-deep), var(--brass));
  transition: width 220ms linear;
}

.pot-share {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--dust);
  font-variant-numeric: tabular-nums;
}
#pot-yours { color: var(--chalk); font-weight: 700; }

#pot-hint {
  margin-top: 4px;
  font-family: var(--display);
  font-size: 8px;
  letter-spacing: 0.12em;
  color: var(--dim);
}
#pot.pushing { border-left-color: var(--good); }
#pot.pushing #pot-hint { color: var(--good); }
#pot.pushing #pot-yours { color: var(--good); }

/* ---------------------------------------------------------------------------
   Killfeed
   --------------------------------------------------------------------------- */

#killfeed {
  position: absolute;
  top: 78px; right: var(--hud-pad);
  list-style: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  max-width: 320px;
}
#killfeed li {
  font-family: var(--mono);
  font-size: 11px;
  padding: 3px 8px;
  background: rgba(9,13,17,0.72);
  border-right: 2px solid var(--edge);
  white-space: nowrap;
  animation: feedIn 180ms ease-out;
}
@keyframes feedIn { from { opacity: 0; transform: translateX(12px); } }
#killfeed .kf-blue { color: var(--blue); }
#killfeed .kf-red { color: var(--red); }
#killfeed .kf-verb { color: var(--dim); padding: 0 5px; }
#killfeed li.kf-you { border-right-color: var(--brass); background: rgba(40,30,8,0.8); }

/* ---------------------------------------------------------------------------
   Minimap
   --------------------------------------------------------------------------- */

#minimap {
  position: absolute;
  right: var(--hud-pad);
  bottom: 92px;
  background: rgba(7,10,13,0.82);
  border: 1px solid var(--edge);
  image-rendering: pixelated;
}

/* ---------------------------------------------------------------------------
   Objective nudge — tells you the one thing worth doing right now
   --------------------------------------------------------------------------- */

#objective {
  position: absolute;
  top: 96px; left: 50%;
  transform: translateX(-50%);
  font-family: var(--display);
  font-size: 13px;
  letter-spacing: 0.14em;
  padding: 6px 16px;
  background: rgba(9,13,17,0.78);
  border-left: 2px solid var(--brass);
  color: var(--brass);
  white-space: nowrap;
}

/* ---------------------------------------------------------------------------
   Bottom bar
   --------------------------------------------------------------------------- */

#bottom {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: var(--hud-pad);
}

#vitals { display: flex; flex-direction: column; gap: 6px; width: 260px; }

#hp-wrap {
  position: relative;
  height: 22px;
  background: #0a0f14;
  border: 1px solid var(--edge);
  overflow: hidden;
}
#hp-bar {
  position: absolute; inset: 0;
  width: 100%;
  background: linear-gradient(180deg, #4fbf82, #2a8f5b);
  transition: width 120ms linear, background 200ms;
}
#hp-bar.hurt { background: linear-gradient(180deg, #e0b447, #a37a19); }
#hp-bar.critical { background: linear-gradient(180deg, #ff5f6d, #a41d2a); }
#shield-bar {
  position: absolute; top: 0; bottom: 0; left: 0;
  width: 0%;
  background: repeating-linear-gradient(90deg, rgba(160,220,255,0.85) 0 3px, rgba(120,190,240,0.6) 3px 6px);
  transition: width 120ms linear;
}
#hp-text {
  position: absolute;
  right: 7px; top: 50%;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 3px #000;
}

#stamina-wrap {
  height: 3px;
  background: #0a0f14;
  border: 1px solid #1b242c;
}
#stamina-bar {
  height: 100%;
  width: 100%;
  background: var(--dust);
  transition: width 100ms linear;
}
#stamina-bar.spent { background: var(--brass-deep); }

#class-tag {
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--dust);
}

/* --- Shop / requisition --- */

#shop {
  display: flex;
  gap: 6px;
  pointer-events: auto;
}

.req {
  position: relative;
  width: 84px;
  padding: 7px 6px 6px;
  background: rgba(20,27,34,0.9);
  border: 1px solid var(--edge);
  border-top: 2px solid var(--edge);
  text-align: left;
  transition: border-color 140ms, transform 90ms, background 140ms;
}
.req:hover:not(:disabled) { border-top-color: var(--brass); background: rgba(30,40,49,0.95); }
.req:active:not(:disabled) { transform: translateY(1px); }
.req:disabled { opacity: 0.42; cursor: not-allowed; }

.req-key {
  position: absolute;
  top: 4px; right: 5px;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--dim);
}
.req-name {
  display: block;
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: 0.06em;
  line-height: 1.15;
  margin-bottom: 3px;
  min-height: 26px;
}
.req-cost {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--brass);
  font-variant-numeric: tabular-nums;
}
.req.team-good .req-cost::after {
  content: '·TEAM';
  color: var(--dim);
  font-size: 8px;
  margin-left: 3px;
}
.req-cool {
  position: absolute;
  left: 0; bottom: 0;
  height: 2px;
  background: var(--brass);
  width: 0%;
}
.req.affordable .req-name { color: var(--chalk); }
.req:not(.affordable) .req-cost { color: var(--dim); }

/* --- Right stack --- */

#right-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  width: 260px;
}

#war-readout {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 3px 10px;
  background: rgba(20,15,4,0.8);
  border-right: 2px solid var(--brass);
}
#war-amount {
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 700;
  color: var(--brass);
  font-variant-numeric: tabular-nums;
}
#war-symbol {
  font-family: var(--display);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--brass-deep);
}

#ammo {
  display: flex;
  align-items: baseline;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 8px #000;
}
#ammo-mag { font-size: 30px; font-weight: 700; line-height: 1; }
#ammo-sep { font-size: 18px; color: var(--dim); margin: 0 3px; }
#ammo-size { font-size: 16px; color: var(--dust); }
#ammo.empty #ammo-mag { color: var(--red); }

#reload-hint {
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--brass);
  animation: blink 700ms steps(2, end) infinite;
}
@keyframes blink { 50% { opacity: 0.25; } }

/* --- Toasts & earn stream --- */

#toasts {
  position: absolute;
  bottom: 118px; left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}
.toast {
  font-family: var(--display);
  font-size: 12px;
  letter-spacing: 0.1em;
  padding: 6px 14px;
  background: rgba(9,13,17,0.9);
  border-left: 2px solid var(--dust);
  animation: toastIn 200ms ease-out;
}
.toast.error { border-left-color: var(--red); color: #ffc2c8; }
.toast.good { border-left-color: var(--good); color: #c4f2d9; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

/* Earn ticks float up beside the WAR readout — the economy as telemetry */
#earn-stream {
  position: absolute;
  right: 22px; bottom: 150px;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
  gap: 2px;
}
.earn {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--brass);
  text-shadow: 0 2px 6px #000;
  animation: earnFloat 1600ms ease-out forwards;
}
.earn small { color: var(--dim); margin-left: 5px; font-size: 9px; letter-spacing: 0.1em; }
@keyframes earnFloat {
  0% { opacity: 0; transform: translateY(8px); }
  18% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-26px); }
}

/* ---------------------------------------------------------------------------
   Death
   --------------------------------------------------------------------------- */

#death {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: radial-gradient(circle at 50% 45%, rgba(90,10,16,0.32), rgba(5,7,9,0.72));
  z-index: 8;
  pointer-events: none;
}
.death-label {
  font-family: var(--display);
  font-size: 46px;
  letter-spacing: 0.3em;
  color: #ff7a85;
  text-shadow: 0 6px 30px rgba(0,0,0,0.9);
}
.death-timer {
  font-family: var(--mono);
  font-size: 38px;
  color: var(--chalk);
  font-variant-numeric: tabular-nums;
}
.ghost-btn {
  pointer-events: auto;
  margin-top: 10px;
  padding: 8px 18px;
  font-family: var(--display);
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--brass);
  background: rgba(20,15,4,0.7);
  border: 1px solid var(--brass-deep);
  transition: background 140ms, border-color 140ms;
}
.ghost-btn:hover { background: rgba(45,33,8,0.9); border-color: var(--brass); }

/* ---------------------------------------------------------------------------
   Scoreboard
   --------------------------------------------------------------------------- */

#scoreboard {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(5,7,9,0.7);
  z-index: 9;
  pointer-events: none;
}
.sb-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  width: min(880px, 92vw);
  background: var(--edge);
  border: 1px solid var(--edge);
}
.sb-col { background: rgba(12,17,22,0.97); padding: 14px 16px; }
.sb-col h3 {
  font-family: var(--display);
  font-size: 13px;
  letter-spacing: 0.24em;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--edge);
}
.sb-col[data-team="blue"] h3 { color: var(--blue); }
.sb-col[data-team="red"] h3 { color: var(--red); }
.sb-col table { width: 100%; border-collapse: collapse; }
.sb-col td {
  font-family: var(--mono);
  font-size: 11px;
  padding: 3px 0;
  color: var(--dust);
  font-variant-numeric: tabular-nums;
}
.sb-col td.sb-name { color: var(--chalk); width: 55%; }
.sb-col tr.is-bot td.sb-name::after {
  content: 'BOT';
  font-size: 8px;
  letter-spacing: 0.1em;
  color: var(--dim);
  border: 1px solid var(--dim);
  padding: 0 3px;
  margin-left: 6px;
}
.sb-col tr.is-you td { color: var(--brass); }
.sb-col td.num { text-align: right; width: 15%; }

/* ---------------------------------------------------------------------------
   Join / briefing
   --------------------------------------------------------------------------- */

#join {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    linear-gradient(180deg, rgba(6,9,12,0.86), rgba(6,9,12,0.94)),
    radial-gradient(ellipse at 50% 0%, rgba(62,155,255,0.10), transparent 60%);
  z-index: 20;
  overflow-y: auto;
  padding: 20px;
}

#join-panel {
  width: min(600px, 100%);
  background: rgba(15,21,27,0.96);
  border: 1px solid var(--edge);
  border-top: 3px solid var(--brass);
  padding: 22px 26px 20px;
  box-shadow: 0 30px 90px rgba(0,0,0,0.7);
}

.brief-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--edge);
}
.brief-mark { display: flex; align-items: center; gap: 12px; }
.mark-glyph {
  font-size: 24px;
  color: var(--brass);
  letter-spacing: -3px;
}
#join-panel h1 {
  font-family: var(--display);
  font-size: 32px;
  letter-spacing: 0.02em;
  line-height: 1;
}
#join-panel h1 span { color: var(--brass); }
.brief-sub {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--dust);
  letter-spacing: 0.04em;
  margin-top: 4px;
}
.brief-live {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--dust);
  white-space: nowrap;
}
.live-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 8px var(--good);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.35; } }

.field-label {
  display: block;
  font-family: var(--display);
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--dim);
  margin-bottom: 6px;
}

#callsign {
  width: 100%;
  padding: 11px 12px;
  margin-bottom: 16px;
  font-family: var(--mono);
  font-size: 15px;
  background: #0a0f14;
  border: 1px solid var(--edge);
  color: var(--chalk);
  outline: none;
  transition: border-color 140ms;
}
#callsign:focus { border-color: var(--brass); }
#callsign::placeholder { color: var(--dim); }

#class-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  margin-bottom: 16px;
}
.class-btn {
  padding: 9px 6px;
  background: #0e141a;
  border: 1px solid var(--edge);
  border-bottom: 2px solid var(--edge);
  text-align: center;
  transition: border-color 140ms, background 140ms, transform 90ms;
}
.class-btn:hover { background: #16202a; }
.class-btn.selected {
  border-bottom-color: var(--brass);
  background: #1a232c;
}
.class-name {
  display: block;
  font-family: var(--display);
  font-size: 12px;
  letter-spacing: 0.1em;
  margin-bottom: 4px;
}
.class-btn.selected .class-name { color: var(--brass); }
.class-stat {
  display: block;
  font-family: var(--mono);
  font-size: 8.5px;
  color: var(--dim);
  line-height: 1.35;
}
#class-blurb {
  font-family: var(--body);
  font-size: 11.5px;
  color: var(--dust);
  margin: -10px 0 16px;
  min-height: 15px;
}

#side-row { display: flex; gap: 5px; margin-bottom: 20px; }
.side-btn {
  flex: 1;
  padding: 10px 4px;
  background: #0e141a;
  border: 1px solid var(--edge);
  border-bottom: 2px solid var(--edge);
  font-family: var(--display);
  font-size: 12px;
  letter-spacing: 0.12em;
  transition: background 140ms, border-color 140ms;
}
.side-btn small {
  display: block;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0;
  color: var(--dim);
  margin-top: 3px;
}
.side-btn:hover { background: #16202a; }
.side-btn.selected { background: #1a232c; }
.side-btn.selected[data-team="auto"] { border-bottom-color: var(--brass); color: var(--brass); }
.side-btn.selected[data-team="blue"] { border-bottom-color: var(--blue); color: var(--blue); }
.side-btn.selected[data-team="red"] { border-bottom-color: var(--red); color: var(--red); }

#btn-deploy {
  width: 100%;
  padding: 15px;
  font-family: var(--display);
  font-size: 19px;
  letter-spacing: 0.3em;
  color: #16130a;
  background: linear-gradient(180deg, #f0c05e, #cf9a2c);
  border-bottom: 3px solid var(--brass-deep);
  transition: filter 140ms, transform 90ms;
}
#btn-deploy:hover { filter: brightness(1.09); }
#btn-deploy:active { transform: translateY(2px); border-bottom-width: 1px; }

#join-foot {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px 18px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--edge);
}
.foot-col {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  align-content: start;
}
.foot-k { font-family: var(--display); font-size: 9px; letter-spacing: 0.14em; color: var(--dim); }
.foot-v { font-family: var(--mono); font-size: 9.5px; color: var(--dust); }

.disclaimer {
  margin-top: 14px;
  font-size: 10.5px;
  line-height: 1.55;
  color: var(--dim);
}

/* ---------------------------------------------------------------------------
   After-action report — reads as a supply manifest, not a victory screen
   --------------------------------------------------------------------------- */

#aar {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(5,7,9,0.88);
  z-index: 18;
  padding: 20px;
  overflow-y: auto;
}
.aar-panel {
  width: min(760px, 100%);
  background: rgba(15,21,27,0.98);
  border: 1px solid var(--edge);
  border-top: 3px solid var(--brass);
  padding: 22px 26px;
}
.aar-eyebrow {
  font-family: var(--display);
  font-size: 9.5px;
  letter-spacing: 0.3em;
  color: var(--dim);
}
.aar-head { padding-bottom: 14px; border-bottom: 1px solid var(--edge); margin-bottom: 16px; }
#aar-title {
  font-family: var(--display);
  font-size: 28px;
  letter-spacing: 0.06em;
  margin-top: 5px;
}
#aar-title.blue { color: var(--blue); }
#aar-title.red { color: var(--red); }
#aar-title.draw { color: var(--dust); }
#aar-sub { font-family: var(--mono); font-size: 11px; color: var(--dust); margin-top: 5px; }

.aar-body { display: grid; grid-template-columns: 1.25fr 1fr; gap: 22px; }

.manifest-head {
  display: flex;
  justify-content: space-between;
  font-family: var(--display);
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--dim);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--edge);
  margin-bottom: 8px;
}
#aar-lines, #aar-mods { list-style: none; }
#aar-lines li, #aar-mods li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--mono);
  font-size: 12px;
  padding: 3px 0;
  font-variant-numeric: tabular-nums;
}
#aar-lines li span:first-child { color: var(--dust); }
#aar-lines li span:last-child { color: var(--chalk); }
#aar-mods li span:first-child { color: var(--dim); }
#aar-mods li span:last-child { color: var(--brass); }
.manifest-rule { height: 1px; background: var(--edge); margin: 8px 0; }
.manifest-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 2px solid var(--edge);
  font-family: var(--display);
  font-size: 13px;
  letter-spacing: 0.18em;
  color: var(--dust);
}
#aar-total {
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 700;
  color: var(--brass);
  letter-spacing: 0;
}

.aar-side { display: flex; flex-direction: column; gap: 16px; }
.pool-label {
  display: block;
  font-family: var(--display);
  font-size: 9px;
  letter-spacing: 0.22em;
  color: var(--dim);
  margin-bottom: 8px;
}
.pool-card { background: #0d1319; border: 1px solid var(--edge); padding: 12px; }
.pool-split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pool-split div { display: flex; flex-direction: column; gap: 2px; }
.pool-split span {
  font-family: var(--mono);
  font-size: 17px;
  color: var(--chalk);
  font-variant-numeric: tabular-nums;
}
.pool-split small { font-family: var(--display); font-size: 8px; letter-spacing: 0.1em; color: var(--dim); line-height: 1.3; }
.pool-note { margin-top: 10px; font-size: 10.5px; line-height: 1.5; color: var(--dust); }

.top-earners ol { list-style: none; counter-reset: te; }
.top-earners li {
  counter-increment: te;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  padding: 3px 0;
  color: var(--dust);
  font-variant-numeric: tabular-nums;
}
.top-earners li::before {
  content: counter(te);
  color: var(--dim);
  width: 16px;
}
.top-earners li span:first-of-type { flex: 1; color: var(--chalk); }
.top-earners li span:last-of-type { color: var(--brass); }
.top-earners li.is-you span:first-of-type { color: var(--brass); }

/* ---------------------------------------------------------------------------
   Season ledger
   --------------------------------------------------------------------------- */

#season {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(5,7,9,0.9);
  z-index: 19;
  padding: 20px;
  overflow-y: auto;
}
.season-panel {
  width: min(560px, 100%);
  background: rgba(15,21,27,0.98);
  border: 1px solid var(--edge);
  border-top: 3px solid var(--brass);
  padding: 20px 24px;
}
.season-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--edge);
  margin-bottom: 12px;
}
.season-head h2 {
  font-family: var(--display);
  font-size: 21px;
  letter-spacing: 0.04em;
  margin-top: 4px;
}
#season-list { list-style: none; counter-reset: sl; max-height: 300px; overflow-y: auto; }
#season-list li {
  counter-increment: sl;
  display: grid;
  grid-template-columns: 22px 1fr auto auto;
  gap: 10px;
  align-items: baseline;
  font-family: var(--mono);
  font-size: 12px;
  padding: 5px 0;
  border-bottom: 1px solid rgba(43,58,70,0.4);
  font-variant-numeric: tabular-nums;
}
#season-list li::before { content: counter(sl); color: var(--dim); font-size: 10px; }
.sl-name { color: var(--chalk); overflow: hidden; text-overflow: ellipsis; }
.sl-wallet { color: var(--dim); font-size: 9.5px; }
.sl-pts { color: var(--brass); font-weight: 700; }
#season-list li.is-you .sl-name { color: var(--brass); }

.season-wallet { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--edge); }
.wallet-copy { font-size: 11px; line-height: 1.55; color: var(--dust); margin-bottom: 10px; }
.wallet-row { display: flex; gap: 6px; }
#wallet-input {
  flex: 1;
  padding: 9px 10px;
  font-family: var(--mono);
  font-size: 12px;
  background: #0a0f14;
  border: 1px solid var(--edge);
  color: var(--chalk);
  outline: none;
}
#wallet-input:focus { border-color: var(--brass); }
#wallet-attach {
  padding: 9px 18px;
  font-family: var(--display);
  font-size: 12px;
  letter-spacing: 0.12em;
  color: #16130a;
  background: linear-gradient(180deg, #f0c05e, #cf9a2c);
}
#wallet-attach:hover { filter: brightness(1.08); }
.wallet-status { margin-top: 8px; font-family: var(--mono); font-size: 10.5px; color: var(--dust); min-height: 14px; }
.wallet-status.ok { color: var(--good); }
.wallet-status.err { color: #ff8a94; }

/* ---------------------------------------------------------------------------
   Responsive
   --------------------------------------------------------------------------- */

@media (max-width: 780px) {
  #ledger { width: 46vw; }
  #minimap { width: 160px; height: 68px; bottom: 130px; }
  .aar-body { grid-template-columns: 1fr; }
  #class-grid { grid-template-columns: repeat(3, 1fr); }
  #bottom { flex-wrap: wrap; justify-content: center; gap: 10px; }
  #vitals, #right-stack { width: auto; }
  #shop { order: 3; width: 100%; justify-content: center; flex-wrap: wrap; }
  #killfeed { max-width: 200px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------------------------------------------------------------------------
   Smart wallet
   --------------------------------------------------------------------------- */

#wallet-connect {
  width: 100%;
  padding: 13px;
  font-family: var(--display);
  font-size: 14px;
  letter-spacing: 0.14em;
  color: #16130a;
  background: linear-gradient(180deg, #f0c05e, #cf9a2c);
  border-bottom: 3px solid var(--brass-deep);
  transition: filter 140ms, transform 90ms;
}
#wallet-connect:hover { filter: brightness(1.08); }
#wallet-connect:active { transform: translateY(2px); border-bottom-width: 1px; }
#wallet-connect:disabled { opacity: 0.5; cursor: wait; }

.wallet-manual { margin-top: 10px; }
.wallet-manual summary {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--dim);
  cursor: pointer;
  list-style: none;
}
.wallet-manual summary::-webkit-details-marker { display: none; }
.wallet-manual summary::before { content: '▸ '; }
.wallet-manual[open] summary::before { content: '▾ '; }
.wallet-manual summary:hover { color: var(--dust); }
.wallet-manual .wallet-row { margin-top: 8px; }

.wallet-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: #0d1319;
  border: 1px solid var(--edge);
  font-family: var(--mono);
  font-size: 12px;
  margin-bottom: 10px;
}
.wallet-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 8px var(--good);
  flex: none;
}
#wallet-addr { flex: 1; color: var(--chalk); }
.link-btn {
  font-family: var(--display);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  color: var(--dim);
  text-decoration: underline;
}
.link-btn:hover { color: var(--dust); }

.wallet-figures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}
.wallet-figures div { display: flex; flex-direction: column; gap: 2px; }
.wallet-figures span {
  font-family: var(--mono);
  font-size: 18px;
  color: var(--brass);
  font-variant-numeric: tabular-nums;
}
.wallet-figures small {
  font-family: var(--display);
  font-size: 8px;
  letter-spacing: 0.12em;
  color: var(--dim);
}
.ghost-btn.wide { width: 100%; margin-top: 0; }
.ghost-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------------------------------------------------------------------------
   Optional registration
   --------------------------------------------------------------------------- */

.season-register {
  margin-top: 16px;
  padding: 14px;
  background: #0d1319;
  border: 1px solid var(--edge);
  border-left: 2px solid var(--dim);
}
.season-register.secured { border-left-color: var(--good); }

.acct-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--display);
  font-size: 12px;
  letter-spacing: 0.14em;
}
.acct-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--dim);
  flex: none;
}
.acct-status.guest .acct-dot { background: var(--brass); box-shadow: 0 0 8px var(--brass); }
.acct-status.guest { color: var(--brass); }
.acct-status.secured .acct-dot { background: var(--good); box-shadow: 0 0 8px var(--good); }
.acct-status.secured { color: var(--good); }

.acct-sub {
  margin: 6px 0 12px;
  font-size: 11px;
  line-height: 1.55;
  color: var(--dust);
}

.reg-steps { list-style: none; counter-reset: rs; display: flex; flex-direction: column; gap: 8px; }
.reg-step {
  counter-increment: rs;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: #0a0f14;
  border: 1px solid var(--edge);
}
.reg-step::before {
  content: counter(rs);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
  width: 14px;
  flex: none;
}
.reg-body { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.reg-title {
  font-family: var(--display);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--chalk);
}
.reg-desc { font-size: 10.5px; line-height: 1.45; color: var(--dim); }

.reg-btn {
  flex: none;
  padding: 8px 14px;
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: #16130a;
  background: linear-gradient(180deg, #f0c05e, #cf9a2c);
  border-bottom: 2px solid var(--brass-deep);
  transition: filter 140ms, transform 90ms;
}
.reg-btn:hover:not(:disabled) { filter: brightness(1.08); }
.reg-btn:active:not(:disabled) { transform: translateY(1px); border-bottom-width: 1px; }
.reg-btn:disabled { opacity: 0.5; cursor: wait; }

.reg-done {
  display: none;
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--good);
  flex: none;
}
.reg-step.done { border-color: rgba(100,217,154,0.32); }
.reg-step.done .reg-btn { display: none; }
.reg-step.done .reg-done { display: inline; }
.reg-step.done .reg-title { color: var(--dust); }

/* Post-match nudge — offered only once there is something worth keeping */
.aar-secure {
  margin-top: 14px;
  padding: 11px 13px;
  background: rgba(20,15,4,0.6);
  border-left: 2px solid var(--brass);
  display: flex;
  align-items: center;
  gap: 12px;
}
.aar-secure p { flex: 1; font-size: 11.5px; line-height: 1.5; color: var(--dust); }
.aar-secure strong { color: var(--brass); }

/* Secondary entry point to the season ledger from the join screen. The panel
   holds account security, which nobody will find behind a keyboard shortcut. */
.join-secondary {
  width: 100%;
  margin-top: 8px;
  padding: 10px;
  font-family: var(--display);
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--dust);
  background: transparent;
  border: 1px solid var(--edge);
  transition: color 140ms, border-color 140ms;
}
.join-secondary:hover { color: var(--brass); border-color: var(--brass-deep); }

#war-readout { pointer-events: auto; cursor: pointer; transition: filter 140ms; }
#war-readout:hover { filter: brightness(1.25); }
#war-readout::after {
  content: 'L';
  font-family: var(--mono);
  font-size: 8px;
  color: var(--brass-deep);
  border: 1px solid var(--brass-deep);
  padding: 0 3px;
  margin-left: 6px;
}

/* ---------------------------------------------------------------------------
   Join-screen identity strip — makes "play anonymously" an explicit state
   rather than something you infer from the absence of a login button.
   --------------------------------------------------------------------------- */

.identity {
  margin: 4px 0 14px;
  padding: 10px 12px;
  background: #0d1319;
  border: 1px solid var(--edge);
  border-left: 2px solid var(--brass);
}
.identity.secured { border-left-color: var(--good); }

.identity-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--display);
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--brass);
}
.identity.secured .identity-head { color: var(--good); }
.identity-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  flex: none;
  align-self: center;
}
#join-identity-points {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--chalk);
  letter-spacing: 0;
}
#join-identity-sub {
  margin-top: 5px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--dust);
}

.deploy-note {
  margin-top: 6px;
  text-align: center;
  font-size: 10.5px;
  color: var(--dim);
}

/* ---------------------------------------------------------------------------
   Account choice — guest vs sign up, presented as an actual decision.
   The previous version only *described* the current state, which read as a
   fait accompli and hid registration behind what looked like a nav link.
   --------------------------------------------------------------------------- */

#acct-choice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 6px;
}

.acct-opt {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 11px 12px 12px;
  text-align: left;
  background: #0e141a;
  border: 1px solid var(--edge);
  border-bottom: 2px solid var(--edge);
  transition: background 140ms, border-color 140ms;
}
.acct-opt:hover { background: #16202a; }
.acct-opt.selected { background: #1a232c; border-bottom-color: var(--brass); }

.acct-opt-title {
  font-family: var(--display);
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--dust);
}
.acct-opt.selected .acct-opt-title { color: var(--brass); }
.acct-opt-title::before {
  content: '○ ';
  font-size: 11px;
}
.acct-opt.selected .acct-opt-title::before { content: '● '; }

.acct-opt-desc {
  font-size: 10.5px;
  line-height: 1.45;
  color: var(--dim);
}
.acct-opt-points {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--brass);
}

#signup-inline {
  padding: 10px 12px 11px;
  margin-bottom: 6px;
  background: #0d1319;
  border: 1px solid var(--edge);
  border-left: 2px solid var(--brass);
}
.signup-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.signup-row button {
  padding: 10px 6px;
  font-family: var(--display);
  font-size: 12px;
  letter-spacing: 0.1em;
  color: #16130a;
  background: linear-gradient(180deg, #f0c05e, #cf9a2c);
  border-bottom: 2px solid var(--brass-deep);
  transition: filter 140ms;
}
.signup-row button:hover { filter: brightness(1.08); }
.signup-row button:disabled { opacity: 0.5; cursor: wait; }
.signup-note { margin-top: 8px; font-size: 10px; line-height: 1.5; color: var(--dim); }

@media (max-width: 560px) {
  #acct-choice, .signup-row { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------------------
   Touch controls
   Hidden entirely on pointer devices — `.is-touch` is set by the client only
   when the browser actually reports touch support.
   --------------------------------------------------------------------------- */

#touch-actions { display: none; }

body.is-touch #touch-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: absolute;
  right: 12px;
  bottom: 132px;
  pointer-events: auto;
}
.tbtn {
  width: 56px; height: 56px;
  border-radius: 50%;
  font-family: var(--display);
  font-size: 17px;
  letter-spacing: 0.04em;
  color: var(--brass);
  background: rgba(9,13,17,0.72);
  border: 1px solid var(--brass-deep);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.tbtn:active { background: rgba(60,44,10,0.9); }
.tbtn.small { width: 56px; height: 40px; font-size: 11px; letter-spacing: 0.1em; }

/* On touch, the shop is opened deliberately rather than always occupying the
   bottom of a small screen. */
body.is-touch #shop { display: none; }
body.is-touch #shop.open {
  display: flex;
  position: absolute;
  left: 8px; right: 8px; bottom: 84px;
  justify-content: center;
  flex-wrap: wrap;
  gap: 5px;
}
body.is-touch #hint,
body.is-touch #killfeed { display: none; }

/* Phone-sized layout */
@media (max-width: 760px), (pointer: coarse) {
  #ledger { width: 54vw; height: 24px; }
  .ledger-count { font-size: 16px; }
  .ledger-team { font-size: 11px; }
  #clock { top: 38px; }
  #timer { font-size: 13px; }

  #pot { width: 132px; padding: 7px 9px; top: 62px; }
  #pot-total { font-size: 17px; }

  #minimap { width: 132px; height: 56px; bottom: 96px; right: 12px; }

  #bottom { padding: 8px 10px; gap: 8px; }
  #vitals { width: 150px; }
  #hp-wrap { height: 18px; }
  #ammo-mag { font-size: 22px; }
  #war-amount { font-size: 14px; }
  #right-stack { width: auto; }
  #objective { font-size: 10.5px; padding: 5px 10px; top: 66px; white-space: normal; max-width: 76vw; text-align: center; }

  .req { width: 72px; padding: 6px 5px; }
  .req-name { font-size: 10px; min-height: 22px; }
}

/* The F button becomes the mortar trigger while manning. */
.tbtn.armed {
  color: #16130a;
  background: linear-gradient(180deg, #ff9d5c, #e0642c);
  border-color: #ff9d5c;
  font-size: 13px;
}
