/* Deliberately one dark "deep space" look. Board left, story right; controls along the bottom. */
:root {
  /* colors sampled from the Rhodium art (Moon Base, tiles, coins) */
  --bg: #100e47; --panel: #1b1960; --line: #2f2c7a; --fg: #ece9f7; --muted: #a59fcb;
  --space: #17155a; --asteroid: #23206b; --luna: #9993a8; --safe: rgba(135, 171, 194, .16);
  --si: #4fd2ff; --me: #f0b25a; --rh: #ff4fa3;
  --p0: #6ec6ff; --p1: #ffcf5a; --p2: #8ee6a8; --p3: #ff7eb6; --p4: #c79bff;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif; --mono: ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.45 var(--font); }
header { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); }
header h1 { font-size: 22px; margin: 0 12px 0 0; letter-spacing: .18em; font-weight: 300; font-stretch: condensed; text-transform: uppercase; }
header img.art { height: 44px; border-radius: 4px; }
header a { color: var(--muted); }
select, button { background: var(--panel); color: var(--fg); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; font: inherit; }
button:hover { border-color: var(--muted); cursor: pointer; }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--p0); outline-offset: 1px; }
main { display: grid; grid-template-columns: minmax(0, 1fr) 360px; height: calc(100% - 110px); min-height: 420px; }
@media (max-width: 860px) { main { grid-template-columns: 1fr; height: auto; } }
#boardwrap { overflow: auto; border-right: 1px solid var(--line); }
#board { display: block; margin: auto; }
aside { padding: 12px 16px; overflow: auto; display: grid; gap: 14px; align-content: start; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 6px; }
#story { font-size: 15px; min-height: 3em; }
#story .who { font-weight: 600; }
.player { display: grid; grid-template-columns: 12px 1fr auto; gap: 8px; align-items: center; padding: 4px 0; }
.player.turn { background: rgba(255,255,255,.04); border-radius: 6px; }
.dot { width: 12px; height: 12px; border-radius: 50%; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--muted); }
.vp { font-family: var(--mono); font-weight: 600; }
.score { display: inline-flex; gap: 10px; align-items: center; }
.mil { display: inline-flex; align-items: center; gap: 4px; min-width: 4.5em; justify-content: flex-end;
       font-family: var(--mono); font-weight: 700; font-size: 15px; color: var(--me); font-variant-numeric: tabular-nums; }
.mil .unit { font-size: 10px; font-weight: 400; color: var(--muted); margin-left: 2px; }
#log { font-family: var(--mono); font-size: 12px; max-height: 220px; overflow: auto; color: var(--muted); }
#log div.now { color: var(--fg); }
footer { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--line); }
footer input[type=range] { flex: 1 1 200px; }
.legend { display: flex; flex-wrap: wrap; gap: 10px; color: var(--muted); font-size: 12px; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; background: var(--c); }
#boardwrap { position: relative; }
#zoom { display: none; position: sticky; float: right; top: 8px; margin: 8px; z-index: 2; }
details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary .label::after { content: " ▾"; }
details:not([open]) > summary .label::after { content: " ▸"; }

/* Phones: board on top fitted to the screen, story under it, big controls pinned to the bottom */
@media (max-width: 860px) {
  header { padding: 8px 12px; gap: 8px; }
  header .legend, header a { display: none; }
  header h1 { font-size: 18px; }
  header img.art { height: 34px; }
  header label { flex: 1 1 100%; }
  header select { width: 100%; }
  main { display: block; height: auto; }
  #boardwrap { border-right: 0; border-bottom: 1px solid var(--line); max-height: 58vh; touch-action: pan-x pan-y pinch-zoom; }
  #zoom { display: inline-block; }
  #boardwrap.fit #board { width: 100%; height: auto; max-height: 58vh; }
  aside { padding: 12px 12px 150px; gap: 10px; }
  #story { font-size: 16px; }
  footer { position: fixed; left: 0; right: 0; bottom: 0; background: var(--panel); z-index: 5;
           padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px)); gap: 6px; }
  footer button { min-height: 44px; min-width: 44px; font-size: 16px; flex: 1 1 0; }
  footer input[type=range] { flex: 1 1 100%; order: -1; height: 32px; }
  footer label, footer #pos { font-size: 12px; }
  .hide-phone { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media (prefers-reduced-motion: reduce) { button.go { animation: none; } }
.legend .gem::before { content: none; }
.legend .gem i { font-style: normal; color: var(--muted); }
/* A mined-out asteroid: gray and dim, so it's clear there's nothing left */
#board image.spent { opacity: .28; }   /* dim, no CSS filter: filters are slow in iPhone Safari */
#board .spent-veil { fill: #3a3850; opacity: .55; pointer-events: none; }
/* The safe zone around Luna: no fights there */
#board .safe-zone { fill: rgba(127, 215, 255, .07); stroke: #7fd7ff; stroke-width: 3; stroke-dasharray: 10 6; pointer-events: none; }
#board .safe-tag { pointer-events: none; }
#board .safe-tag rect { fill: #17155a; stroke: #7fd7ff; stroke-width: 1.5; }
#board .safe-tag text { fill: #7fd7ff; font-size: 10px; font-weight: 700; letter-spacing: .06em; }
