:root {
  --bg: #07090d;
  --panel: #0e131b;
  --panel-2: #141b26;
  --edge: #1e2836;
  --ink: #e8f1ff;
  --muted: #7d8ba3;
  --accent: #38e1ff;
  --danger: #ff5f57;
  --fog: #0b0f16;
  --known: #182231;
  --known-2: #1f2b3c;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  background: radial-gradient(120% 80% at 50% 0%, #0d141d 0%, var(--bg) 60%);
  color: var(--ink);
  font: 15px/1.45 ui-sans-serif, -apple-system, "SF Pro Text", Inter, system-ui, sans-serif;
  overscroll-behavior: none;
}

.app {
  max-width: 560px;
  margin: 0 auto;
  padding: 10px 12px 150px;
  min-height: 100%;
}

/* The board is the game, so it gets whatever height is left after the two
   things that must stay legible above it. */
.gamewrap .boardwrap {
  padding: 4px;
}

.gamewrap svg.board {
  max-height: calc(100vh - 300px);
  margin: 0 auto;
}

.boot {
  padding: 40vh 0;
  text-align: center;
  letter-spacing: 0.5em;
  color: var(--muted);
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 650;
  letter-spacing: -0.01em;
}

a {
  color: var(--accent);
}

.wordmark {
  font-weight: 700;
  letter-spacing: 0.34em;
  font-size: 19px;
}

.sub {
  color: var(--muted);
  font-size: 13px;
}

.mono {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.row.wrap {
  flex-wrap: wrap;
}

.spread {
  justify-content: space-between;
}

.grow {
  flex: 1;
  min-width: 0;
}

button,
.btn {
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  background: var(--panel-2);
  border: 1px solid var(--edge);
  border-radius: 11px;
  padding: 11px 15px;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease, border-color 0.15s ease;
}

button:active {
  transform: scale(0.97);
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #04222b;
}

button.danger {
  background: #2a1216;
  border-color: #50222a;
  color: #ffb4ae;
}

button.ghost {
  background: transparent;
}

button:disabled {
  opacity: 0.45;
  cursor: default;
}

button.sm {
  padding: 7px 11px;
  font-size: 13px;
  border-radius: 9px;
}

input,
select {
  font: inherit;
  color: var(--ink);
  background: var(--panel-2);
  border: 1px solid var(--edge);
  border-radius: 11px;
  padding: 11px 13px;
  width: 100%;
}

input::placeholder {
  color: #55617a;
}

label.field {
  display: block;
  margin-bottom: 10px;
}

label.field > span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--edge);
  font-size: 12px;
  color: var(--muted);
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
}

/* Colour alone can't carry six players; every marker has a shape too. */
.glyph {
  width: 10px;
  height: 10px;
  flex: none;
  display: inline-block;
}

.glyph.circle { border-radius: 50%; }
.glyph.square { border-radius: 1px; }
.glyph.diamond { clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.glyph.triangle { clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.glyph.pentagon { clip-path: polygon(50% 0, 100% 38%, 82% 100%, 18% 100%, 0 38%); }
.glyph.cross { clip-path: polygon(38% 0,62% 0,62% 38%,100% 38%,100% 62%,62% 62%,62% 100%,38% 100%,38% 62%,0 62%,0 38%,38% 38%); }

.dead {
  opacity: 0.42;
  text-decoration: line-through;
}

/* ── board ─────────────────────────────────────────────────────────────── */

.boardwrap {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 16px;
  padding: 8px;
  margin-bottom: 12px;
  touch-action: manipulation;
}

svg.board {
  display: block;
  width: 100%;
  height: auto;
}

.hex {
  fill: var(--fog);
  stroke: #0f141d;
  stroke-width: 1;
  transition: fill 0.25s ease;
}

.hex.known {
  fill: var(--known);
  stroke: #243143;
}

.hex.known.alt {
  fill: var(--known-2);
}

.hex.pick {
  cursor: pointer;
}

/* Everything you can't walk to lets the tap through to the firing line
   underneath — that is what makes the two-tap commit unambiguous. */
.hex.through {
  pointer-events: none;
}

.hex.rock {
  fill: #2b3242;
  stroke: #3d4759;
  stroke-width: 1.5;
}

.hex.scanning {
  fill: #17313a;
  stroke: #2f7f92;
  stroke-dasharray: 3 3;
}

.coord {
  fill: #4a5568;
  font: 600 11px ui-monospace, Menlo, monospace;
  letter-spacing: 0.05em;
  pointer-events: none;
  user-select: none;
}

/* A contact is a read from last turn, not a live feed — it should look like a
   ping that is already going stale. */
.contact-ring {
  fill: none;
  stroke-width: 2;
  stroke-dasharray: 4 4;
  opacity: 0.9;
  animation: ping 2.6s ease-out infinite;
}

@keyframes ping {
  0% { transform: scale(0.72); opacity: 0.95; }
  70% { transform: scale(1.12); opacity: 0.25; }
  100% { transform: scale(0.72); opacity: 0.95; }
}

.contact-ring,
.expose-ping {
  transform-box: fill-box;
  transform-origin: center;
}

.expose-ping {
  fill: none;
  stroke-width: 3;
  animation: ping 1.6s ease-out infinite;
}

/* Range is an overlay, not terrain: outline only, so a hex you could walk to
   still looks exactly as unknown as it is. */
.hex.inrange {
  stroke: #3c6f8e;
  stroke-width: 1.4;
  stroke-dasharray: 3 3;
}

.hex.onpath {
  fill: #375f84;
  stroke: #7fd0ff;
  stroke-width: 1.5;
}

.hex.gain {
  fill: #24455c;
  stroke: #2f6a86;
}

.trail {
  fill: none;
  stroke-linecap: round;
  stroke-width: 5;
}

.axisghost {
  fill: none;
  stroke-width: 6;
  stroke-linecap: round;
  opacity: 0.3;
  pointer-events: none; /* the hit strokes under the floor own the tap */
}

.axisghost.on {
  opacity: 0.9;
  filter: drop-shadow(0 0 5px currentColor);
}

.axishit {
  fill: none;
  stroke: transparent;
  stroke-width: 24;
  stroke-linecap: round;
  cursor: pointer;
}

.hex.onaxis {
  fill: #2b4a5e;
  stroke: #5ea9c9;
  stroke-width: 1.5;
}

.marker {
  pointer-events: none;
}

.me-ring {
  fill: none;
  stroke-width: 2.5;
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.9;
  }
  50% {
    opacity: 0.25;
  }
}

.corpse {
  stroke-width: 2.5;
  stroke-linecap: round;
  opacity: 0.75;
}

/* ── hud ───────────────────────────────────────────────────────────────── */

.hud {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.hud .card {
  flex: 1;
  margin: 0;
  padding: 9px 11px;
  text-align: center;
}

.hud .big {
  font-size: 19px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.hud .lbl {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.doom-2 {
  border-color: #6b3a18 !important;
  background: #1d1206 !important;
}

.doom-2 .big {
  color: #ffb454;
}

.doom-3 {
  border-color: #6b1c22 !important;
  background: #1d0709 !important;
  animation: alarm 1.2s ease-in-out infinite;
}

@keyframes alarm {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 95, 87, 0);
  }
  50% {
    box-shadow: 0 0 18px 0 rgba(255, 95, 87, 0.35);
  }
}

/* ── action bar ────────────────────────────────────────────────────────── */

.actionbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, rgba(7, 9, 13, 0) 0%, var(--bg) 22%);
  padding: 18px 14px calc(14px + env(safe-area-inset-bottom));
}

.actionbar .inner {
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.actionbar .hint {
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
  min-height: 17px;
}

.actionbar .row button {
  flex: 1;
}

.log {
  font-size: 13px;
  color: var(--muted);
}

.log b {
  color: var(--ink);
  font-weight: 600;
}

.log li {
  margin-bottom: 4px;
}

ul.clean {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 108px;
  background: var(--panel-2);
  border: 1px solid var(--edge);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13.5px;
  z-index: 40;
  max-width: 90vw;
  text-align: center;
}

.banner {
  text-align: center;
  padding: 18px;
  border-radius: 14px;
  margin-bottom: 12px;
  border: 1px solid var(--edge);
  background: var(--panel);
}

.banner.win {
  border-color: #1d6b4a;
  background: #071a12;
}

.banner.doom {
  border-color: #6b1c22;
  background: #1a0709;
}

.banner .headline {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.skip {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 12px;
  font-size: 12px;
  color: var(--muted);
  background: rgba(7, 9, 13, 0.15);
  z-index: 5;
}

/* ── the daily reveal ──────────────────────────────────────────────────────
   The turn resolved while you were away; it should land as an event, not as a
   board that quietly differs from the one you left. */

.trail.fresh {
  stroke-dasharray: 1400;
  stroke-dashoffset: 1400;
  animation: gust 0.85s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
  filter: drop-shadow(0 0 6px currentColor);
}

@keyframes gust {
  to {
    stroke-dashoffset: 0;
  }
}

.corpse-g.fresh {
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  animation: punch 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) 0.75s forwards;
}

@keyframes punch {
  from {
    opacity: 0;
    transform: scale(2.6);
  }
  to {
    opacity: 0.75;
    transform: scale(1);
  }
}


/* ── the reveal bar ────────────────────────────────────────────────────────
   While the turn is replaying, the action bar steps aside: nothing to commit
   until you have seen what happened. */

.revealbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, rgba(7, 9, 13, 0) 0%, var(--bg) 30%);
  padding: 22px 14px calc(14px + env(safe-area-inset-bottom));
  cursor: pointer;
}

.revealbar .inner {
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
}

.revealbar .hint {
  color: var(--ink);
  font-weight: 600;
  font-size: 14px;
}
