/* SANDTABLE — shared battle-page chrome */
:root {
  --ink: #0d0d0d;
  --bone: #d8d3c8;
  --bone-dim: #8f8a80;
  --bone-faint: #5a564f;
  --sideA: #3987e5;
  --sideA-hi: #86b6ef;
  --sideB: #C14E24;
  --sideB-hi: #e8875a;
  --hair: rgba(216, 211, 200, 0.14);
  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --mono: ui-monospace, 'SFMono-Regular', Menlo, Consolas, 'Liberation Mono', monospace;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  background: var(--ink);
  color: var(--bone);
  font-family: var(--serif);
  overflow: hidden;
}
#field { position: fixed; inset: 0; display: block; cursor: grab; touch-action: none; }
#field.dragging { cursor: grabbing; }

.hud { position: fixed; z-index: 5; pointer-events: none; }
.hud > * { pointer-events: auto; }

/* ---- title block ---- */
#masthead { top: 24px; left: 28px; max-width: 380px; }
#masthead .crumb {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.22em;
  color: var(--bone-faint); text-transform: uppercase; text-decoration: none;
}
#masthead .crumb:hover { color: var(--sideB-hi); }
#masthead h1 {
  font-size: clamp(34px, 5vw, 56px); font-weight: 400;
  letter-spacing: 0.06em; line-height: 1.05; margin: 4px 0 6px;
  text-wrap: balance;
}
#masthead .sub {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em;
  color: var(--bone-dim); text-transform: uppercase;
}

/* ---- fallen tracker: one compact card, fixed columns, nothing overlaps ---- */
#muster {
  top: 24px; right: 28px;
  background: rgba(13, 13, 13, 0.66);
  border: 1px solid var(--hair);
  padding: 10px 14px 9px;
  font-family: var(--mono);
  min-width: 216px;
}
#muster .mhead {
  font-size: 9px; letter-spacing: 0.26em; color: var(--bone-faint);
  text-transform: uppercase; margin-bottom: 7px;
}
#muster .mrow {
  display: grid;
  grid-template-columns: 8px 1fr auto auto;
  align-items: baseline; gap: 8px;
  font-variant-numeric: tabular-nums;
  margin-bottom: 4px;
}
#muster .mrow i { width: 8px; height: 8px; align-self: center; }
#muster .mrow.a i { background: var(--sideA); }
#muster .mrow.b i { background: var(--sideB); }
#muster .mrow span { font-size: 10px; letter-spacing: 0.14em; color: var(--bone-dim); }
#muster .mrow b { font-size: 17px; font-weight: 400; text-align: right; }
#muster .mrow.a b { color: var(--sideA-hi); }
#muster .mrow.b b { color: var(--sideB-hi); }
#muster .mrow em { font-style: normal; font-size: 9.5px; color: var(--bone-faint); }
#muster .mnote {
  font-size: 9px; letter-spacing: 0.16em; color: var(--bone-faint);
  text-transform: uppercase; margin-top: 6px;
}

/* ---- narration ---- */
#narration {
  left: 28px; bottom: 96px; width: min(380px, calc(100vw - 56px));
  background: rgba(13, 13, 13, 0.72);
  border-left: 2px solid var(--sideB);
  padding: 14px 18px 12px;
  backdrop-filter: blur(3px);
}
#narration .phase-eyebrow {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.22em;
  color: var(--sideB-hi); text-transform: uppercase;
}
#narration h2 { font-size: 19px; font-weight: 400; margin: 5px 0 7px; letter-spacing: 0.02em; }
#narration p { font-size: 14px; line-height: 1.5; color: var(--bone); max-width: 62ch; }
#narration .cite {
  font-family: var(--mono); font-size: 9.5px; color: var(--bone-faint);
  letter-spacing: 0.1em; margin-top: 8px;
}

/* ---- timeline console ---- */
#console {
  left: 28px; right: 28px; bottom: 24px;
  display: flex; align-items: center; gap: 14px;
  font-family: var(--mono);
}
#console button {
  background: rgba(13, 13, 13, 0.6); border: 1px solid var(--hair); color: var(--bone);
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em;
  padding: 6px 12px; cursor: pointer;
}
#console button:hover { border-color: var(--bone-dim); }
#console button:focus-visible { outline: 1px solid var(--sideA-hi); outline-offset: 2px; }
#console button.hidden { display: none; }
#timeline { flex: 1; position: relative; height: 34px; cursor: pointer; }
#timeline .rail {
  position: absolute; left: 0; right: 0; top: 16px; height: 2px;
  background: var(--hair);
}
#timeline .fill {
  position: absolute; left: 0; top: 16px; height: 2px; width: 0%;
  background: linear-gradient(90deg, var(--sideA), var(--sideB-hi));
}
#timeline .tick {
  position: absolute; top: 12px; width: 1px; height: 10px;
  background: var(--bone-faint);
}
#timeline .ticklabel {
  position: absolute; top: -6px; transform: translateX(-50%);
  font-size: 8.5px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--bone-faint); white-space: nowrap;
}
#timeline .ticklabel.active { color: var(--bone); }
#clock { font-size: 11px; color: var(--bone-dim); font-variant-numeric: tabular-nums; min-width: 44px; text-align: right; }

/* ---- compass & scale ---- */
#compass {
  right: 28px; bottom: 96px; text-align: right;
  font-family: var(--mono); font-size: 9.5px; color: var(--bone-faint);
  letter-spacing: 0.14em;
}
#kmbar { border-top: 1px solid var(--bone-faint); margin-top: 4px; padding-top: 3px; }

/* ---- aftermath: a report, not a roadblock — the table stays explorable ---- */
#aftermath {
  right: 28px; bottom: 150px; width: min(340px, calc(100vw - 56px));
  background: rgba(13, 13, 13, 0.88); border: 1px solid var(--hair);
  border-top: 2px solid var(--sideB);
  padding: 16px 18px 14px;
  display: none;
}
#aftermath.show { display: block; }
#aftermath h3 { font-size: 20px; font-weight: 400; letter-spacing: 0.04em; margin-bottom: 8px; padding-right: 22px; }
#aftermath p { font-size: 13px; line-height: 1.5; color: var(--bone); margin-bottom: 8px; }
#aftermath .tally {
  font-family: var(--mono); font-size: 10.5px; line-height: 1.8;
  font-variant-numeric: tabular-nums; color: var(--bone-dim);
  border-top: 1px solid var(--hair); border-bottom: 1px solid var(--hair);
  padding: 7px 0; margin: 9px 0;
}
#aftermath .tally b { color: var(--bone); font-weight: 400; }
#aftermath .explore {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.1em;
  color: var(--bone-faint); text-transform: uppercase; margin-bottom: 10px;
}
#aftermath button {
  background: none; border: 1px solid var(--hair); color: var(--bone);
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em;
  padding: 7px 14px; cursor: pointer; text-transform: uppercase;
}
#aftermath button:hover { border-color: var(--sideB-hi); color: var(--sideB-hi); }
#aftclose {
  position: absolute; top: 8px; right: 10px; border: none !important;
  font-size: 14px !important; padding: 2px 6px !important;
  color: var(--bone-faint) !important;
}
#aftclose:hover { color: var(--bone) !important; }

@media (max-width: 760px) {
  #masthead { left: 16px; top: 14px; }
  #muster { right: 16px; top: 14px; min-width: 178px; padding: 8px 10px 7px; }
  #muster .mrow b { font-size: 14px; }
  #narration { left: 16px; bottom: 86px; padding: 10px 14px 9px; }
  #narration p { font-size: 12.5px; }
  #console { left: 16px; right: 16px; bottom: 16px; }
  #timeline .ticklabel { display: none; }
  #compass { display: none; }
  #aftermath { right: 16px; bottom: 86px; }
}
