/* Robot Prospectors web edition. Shared white / brass / Saturn styling. */
:root {
  --bg: #07090d;
  --panel: #11141b;
  --panel-2: #191d26;
  --line: #2a2f3b;
  --brass: #c99a45;
  --brass-light: #f1cf7e;
  --text: #f4f1ea;
  --muted: #a9a59b;
  --teal: #18a493;
  --gold: #f2b01e;
  --red: #e2463a;
  --purple: #8e5cc9;
  --saturnite: #f2860b;
  --metal: #aebbc2;
  --ore: #e2a55d;
  --radius: 10px;
  --font: "Futura", "Avenir Next", "Century Gothic", "Trebuchet MS", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 700px at 70% -10%, #1a1626 0%, var(--bg) 60%);
  color: var(--text);
  font: 14px/1.4 var(--font);
  display: flex; flex-direction: column;
}
button {
  font: inherit; color: var(--text); background: var(--panel-2);
  border: 1px solid var(--brass); border-radius: 7px; padding: 6px 11px; cursor: pointer;
}
button:hover:not(:disabled) { background: #262b37; border-color: var(--brass-light); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--brass); color: #16110a; font-weight: 700; border-color: var(--brass-light); }
button.primary:hover:not(:disabled) { background: var(--brass-light); }
button.danger { border-color: var(--red); }
button.small { padding: 3px 8px; font-size: 12px; }
.eyebrow { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--brass-light); }
h2, h3, h4 { margin: 0; letter-spacing: .06em; text-transform: uppercase; }
h3 { font-size: 13px; color: var(--brass-light); }
h4 { font-size: 11px; color: var(--muted); margin-top: 10px; margin-bottom: 4px; }

/* top bar */
.topbar {
  display: flex; align-items: center; gap: 18px; padding: 8px 16px;
  border-bottom: 1px solid var(--line); background: #0c0e14; flex-wrap: wrap;
}
.brand { display: flex; flex-direction: column; min-width: 210px; }
.brand strong { font-size: 18px; letter-spacing: .04em; }
.phase { font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--brass-light); }
.market { display: flex; gap: 8px; }
.price { display: flex; align-items: center; gap: 6px; padding: 3px 9px; border: 1px solid var(--line); border-radius: 20px; font-size: 12px; }
.price b { font-size: 15px; }
.cube { display: inline-block; width: 12px; height: 12px; border-radius: 2px; border: 1px solid #0007; vertical-align: -1px; }
.dice { display: flex; gap: 6px; margin-left: auto; min-height: 36px; align-items: center; }
.die {
  width: 34px; height: 34px; border-radius: 7px; display: grid; place-items: center;
  background: var(--text); color: #111; font-weight: 800; font-size: 16px; position: relative;
  box-shadow: inset 0 -3px 0 #0003;
}
.die.d12 { background: #f1cf7e; clip-path: polygon(50% 0, 95% 25%, 95% 75%, 50% 100%, 5% 75%, 5% 25%); border-radius: 0; }
.die.rolling { animation: tumble .12s linear infinite; }
@keyframes tumble { 0% { transform: rotate(-12deg); } 50% { transform: rotate(12deg) translateY(-2px); } 100% { transform: rotate(-12deg); } }
.tools { display: flex; gap: 6px; position: relative; }
.tools button[aria-pressed="true"] { background: #2c2617; }
.menu {
  position: absolute; right: 0; top: 38px; z-index: 20; display: flex; flex-direction: column; gap: 4px;
  background: var(--panel); border: 1px solid var(--brass); border-radius: var(--radius); padding: 6px; min-width: 190px;
}
.menu[hidden] { display: none; }
.menu button { text-align: left; border-color: transparent; }

/* table layout */
.table { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 12px; padding: 12px; min-height: 0; }
.board-wrap { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
#board { width: 100%; height: auto; max-height: calc(100vh - 190px); border-radius: 8px; background: #000; user-select: none; }
.side { display: flex; flex-direction: column; gap: 10px; min-height: 0; overflow: auto; padding-right: 2px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.panel.turn { border-color: var(--brass); }

/* board svg */
.hit { fill: transparent; cursor: pointer; }
.hit:hover { fill: rgba(255,255,255,.06); }
.station-hit { fill: transparent; cursor: pointer; }
.station-free { fill: rgba(241,207,126,.18); stroke: var(--brass-light); stroke-width: 5; stroke-dasharray: 14 8; pointer-events: none; }
.sel { fill: none; stroke: var(--brass-light); stroke-width: 7; pointer-events: none; }
.hover-link-halo { stroke: #000c; stroke-width: 12; stroke-linecap: round; pointer-events: none; }
.hover-link { stroke: #fff; stroke-width: 6; stroke-dasharray: 14 10; stroke-linecap: round; pointer-events: none; }
.hover-zone-halo { fill: none; stroke: #000c; stroke-width: 13; pointer-events: none; }
.hover-zone { fill: rgba(255,255,255,.22); stroke: #fff; stroke-width: 7; pointer-events: none; animation: link-glow 1.4s ease-in-out infinite; }
@keyframes link-glow { 50% { fill: rgba(255,255,255,.08); stroke-opacity: .6; } }
.target { pointer-events: none; stroke-width: 6; }
.target.r0 { fill: rgba(24,164,147,.28); stroke: #39d6c2; }
.target.r1 { fill: rgba(242,176,30,.28); stroke: #ffd257; }
.target.r2 { fill: rgba(226,70,58,.30); stroke: #ff6d5e; }
.target-label { font: 700 22px var(--font); fill: #fff; paint-order: stroke; stroke: #000; stroke-width: 5px; pointer-events: none; }
.path-zone { fill: rgba(242,134,11,.18); stroke: var(--saturnite); stroke-width: 6; pointer-events: none; }
.rad-row { fill: rgba(142,92,201,.20); pointer-events: none; }
.mission-zone { fill: none; stroke: #b98cf0; stroke-width: 6; stroke-dasharray: 18 10; pointer-events: none; }
.link-label { font: 700 17px var(--font); fill: #fff; paint-order: stroke; stroke: #000; stroke-width: 5px; pointer-events: none; }
.badge-text { font: 800 26px var(--font); fill: #fff; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.chip { cursor: pointer; }
.chip-text { font: 800 21px var(--font); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.chip.spent { opacity: .5; }
.token { cursor: pointer; }
.res-text { font: 800 17px var(--font); fill: #fff; paint-order: stroke; stroke: #000; stroke-width: 4px; dominant-baseline: central; pointer-events: none; }
.zone-pulse { animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

/* team strip */
.teams { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 8px; }
.team-card {
  background: var(--panel); border: 1px solid var(--line); border-left: 5px solid var(--tc); border-radius: var(--radius);
  padding: 8px 10px; display: grid; gap: 4px; font-size: 12px;
}
.team-card.active { border-color: var(--tc); box-shadow: 0 0 0 1px var(--tc), 0 0 18px -6px var(--tc); }
.team-card header { display: flex; justify-content: space-between; align-items: center; }
.team-card .name { font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--tc); }
.team-card .stats { display: flex; gap: 10px; flex-wrap: wrap; color: var(--muted); }
.team-card .stats b { color: var(--text); }
.start-token { font-size: 10px; letter-spacing: .1em; color: #16110a; background: var(--brass-light); border-radius: 10px; padding: 1px 7px; font-weight: 800; }

/* turn panel */
.turn-head { display: flex; align-items: center; gap: 10px; }
.turn-head .swatch { width: 14px; height: 14px; border-radius: 50%; background: var(--tc); box-shadow: 0 0 10px var(--tc); }
.turn-head .who { font-size: 20px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--tc); }
.turn p { margin: 8px 0 10px; color: var(--muted); }
.turn .primary { width: 100%; padding: 10px; font-size: 15px; letter-spacing: .06em; text-transform: uppercase; }

/* selection panel */
.zone-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.pill { display: inline-block; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; padding: 2px 8px; border-radius: 12px; font-weight: 800; color: #111; }
.pill.r0 { background: var(--teal); } .pill.r1 { background: var(--gold); } .pill.r2 { background: var(--red); color: #fff; }
.facts { margin: 6px 0 0; padding: 0; list-style: none; color: var(--muted); font-size: 12.5px; }
.facts li { padding: 2px 0; }
.facts b { color: var(--text); }
.robots { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.robot-btn { display: flex; align-items: center; gap: 5px; padding: 4px 8px; border-color: var(--line); font-size: 12px; }
.robot-btn.on { border-color: var(--brass-light); background: #2c2617; }
.robot-btn .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--tc); }
.robot-btn .st { color: var(--muted); font-size: 11px; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.actions button { font-size: 12.5px; }
.tag { font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-left: 4px; }
.hint { color: var(--muted); font-size: 12px; margin: 6px 0 0; }
.reason { color: #ff9d8f; font-size: 12px; margin-top: 6px; min-height: 1em; }
label.check { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); margin-top: 6px; }

/* mat panel */
.mat-head { display: flex; justify-content: space-between; align-items: center; }
.credits { font-size: 26px; font-weight: 800; }
.credits small { font-size: 11px; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; margin-left: 4px; }
.track { display: grid; gap: 3px; margin-top: 4px; }
.track .bar { display: grid; gap: 2px; }
.track .cell { height: 12px; border-radius: 3px; background: #262a34; position: relative; }
.track .cell.on { background: var(--fill); }
.track .cell.mile { outline: 2px solid var(--purple); outline-offset: -2px; }
.track .label { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.bays { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.bay {
  aspect-ratio: 1; border-radius: 6px; background: #f4f1ea; color: #111; border: 2px solid var(--brass);
  display: grid; place-items: center; font-weight: 800; padding: 0; position: relative;
}
.bay:disabled { opacity: 1; cursor: default; }
.bay.damaged { background: #23262e; border-color: #555; color: #888; }
.bay.damaged::after { content: "✕"; position: absolute; font-size: 22px; color: #777; }
.bay .res { width: 55%; height: 55%; border-radius: 4px; border: 2px solid #0006; }
.bay svg { width: 70%; height: 70%; }
.counts { display: flex; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 12px; margin-top: 4px; }
.counts b { color: var(--text); font-size: 14px; }
.cards-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; }

/* log */
.log summary { cursor: pointer; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--brass-light); }
.log ol { list-style: none; margin: 8px 0 0; padding: 0; max-height: 260px; overflow: auto; font-size: 12px; display: flex; flex-direction: column-reverse; }
.log li { padding: 3px 0; border-bottom: 1px solid #1f232c; color: #cfcac0; }
.log li .rd { color: var(--muted); font-size: 10px; margin-right: 6px; }
.log li.bad { color: #ffb1a6; } .log li.good { color: #a8f0c8; } .log li.eruption { color: #ffc27a; }
.log li.neural, .log li.mission { color: #d4b8ff; } .log li.alert { color: #fff; font-weight: 700; } .log li.turn { color: var(--brass-light); }

/* toasts & modal */
.toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; z-index: 50; pointer-events: none; }
.toast { background: #1d2230; border: 1px solid var(--brass); border-radius: 8px; padding: 8px 14px; box-shadow: 0 8px 24px #0009; animation: rise .2s ease-out; max-width: 560px; }
.toast.error { border-color: var(--red); background: #2a1514; }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } }
dialog {
  background: var(--panel); color: var(--text); border: 2px solid var(--brass); border-radius: 14px;
  padding: 22px; max-width: min(720px, 94vw); width: 100%; box-shadow: 0 30px 80px #000c;
}
dialog::backdrop { background: rgba(3,4,8,.75); backdrop-filter: blur(2px); }
dialog h2 { font-size: 20px; color: var(--brass-light); margin-bottom: 8px; }
dialog .row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
dialog ul { padding-left: 18px; }
dialog img.ref { width: 100%; border-radius: 8px; }
dialog.wide { max-width: min(1200px, 96vw); }
.card {
  background: #f4f1ea; color: #15120c; border-radius: 12px; padding: 18px; border: 3px solid var(--brass);
  max-width: 360px; margin: 10px auto;
}
.card .deck { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: #6d5a2d; }
.card h3 { color: #15120c; font-size: 18px; margin: 4px 0 8px; }
.card .pts { font-weight: 800; margin-top: 10px; }
.setup-teams { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 14px 0; }
.setup-team { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px; border: 2px solid var(--line); border-radius: 12px; background: var(--panel-2); }
.setup-team img { width: 72px; height: 72px; border-radius: 50%; }
.setup-team.on { border-color: var(--tc); box-shadow: 0 0 16px -4px var(--tc); }
.setup-team:not(.on) img { filter: grayscale(1) brightness(.6); }
.score-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 13px; }
.score-table th, .score-table td { padding: 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.score-table td.num { text-align: right; font-weight: 800; }
.obj { display: flex; gap: 6px; align-items: flex-start; font-size: 12px; margin: 2px 0; }
.obj small { color: var(--muted); }
.report { display: grid; gap: 6px; }
.report .line { padding: 6px 10px; background: var(--panel-2); border-radius: 8px; }

@media (max-width: 1100px) {
  .table { grid-template-columns: 1fr; }
  #board { max-height: none; }
  .setup-teams { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .topbar { gap: 8px; padding: 8px; }
  .brand { min-width: 0; }
  .table { padding: 8px; }
  .dice { margin-left: 0; }
}

/* account gate: the table stays hidden until the player signs in */
body.locked .topbar, body.locked .table { display: none; }
.gate { flex: 1; display: grid; place-items: center; padding: 24px 16px; }
.gate-card {
  width: min(440px, 100%); background: var(--panel); border: 1px solid var(--brass);
  border-radius: 14px; padding: 26px 24px; box-shadow: 0 20px 60px #0009;
}
.gate h1 { margin: 4px 0 2px; font-size: 24px; letter-spacing: .05em; text-transform: uppercase; }
.gate h1 small { display: block; font-size: 12px; letter-spacing: .14em; color: var(--muted); }
.gate-lede { color: var(--muted); margin: 6px 0 16px; }
.gate-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.gate-tabs button { flex: 1; }
.gate-tabs button[aria-selected="true"] { background: var(--brass); color: #16110a; font-weight: 700; }
.gate-note { min-height: 0; margin: 0 0 10px; font-size: 13px; color: var(--muted); }
.gate-note:empty { display: none; }
.gate-note.error { color: #ff8a80; }
.gate-note.ok { color: var(--brass-light); }
.gate form, #acctForm { display: flex; flex-direction: column; gap: 12px; }
.gate label, #acctForm label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.gate input[type=email], .gate input[type=password], .gate input[type=text] {
  font: inherit; font-size: 15px; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 7px; padding: 9px 10px; text-transform: none; letter-spacing: 0;
}
.gate input:focus { outline: 2px solid var(--brass); outline-offset: 1px; }
.pw { display: flex; gap: 6px; }
.pw input { flex: 1; min-width: 0; }
.gate fieldset, #acctForm fieldset { border: 1px solid var(--line); border-radius: 9px; padding: 8px 12px 10px; margin: 0; }
.gate legend, #acctForm legend { padding: 0 6px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--brass-light); }
.topics { display: flex; flex-direction: column; gap: 8px; }
label.check { flex-direction: row !important; align-items: flex-start; gap: 10px !important; text-transform: none !important; letter-spacing: 0 !important; cursor: pointer; }
label.check input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--brass); flex: none; }
label.check b { display: block; color: var(--text); font-size: 14px; }
label.check small { display: block; color: var(--muted); font-size: 12px; }
.fine { color: var(--muted); font-size: 12px; margin: 0; }
button.link { background: none; border: 0; color: var(--brass-light); text-decoration: underline; padding: 2px; align-self: flex-start; }
button.link:hover:not(:disabled) { background: none; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
#acctDialog { width: min(460px, 94vw); }
.acct-email { margin: 0; overflow-wrap: anywhere; }
.gate[hidden], .gate [hidden], #acctForm [hidden] { display: none !important; }
#acctStatus:empty { display: none; }
@media (prefers-reduced-motion: reduce) { .hover-zone { animation: none; } }

/* New-game rule choices */
.rule-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0 4px; }
.rule-choice { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px 12px; margin: 0; min-width: 0; }
.rule-choice legend { padding: 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--brass); }
@media (max-width: 640px) { .rule-choices { grid-template-columns: 1fr; } }
