/* The detection test page (shared/detect.html), the same on every MaB game: plain, neutral styles. */
:root {
  --bg: #121417; --panel: #1b1e23; --line: #2c3138; --text: #e7e9ec; --dim: #8b939c;
  --on: #5fd38d; --wait: #f2c14e; --off: #ff6b6b; --accent: #5aa9ff;
  --p0: #5aa9ff; --p1: #ff8a5a;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; }
h1 { font-size: 20px; margin: 0; }
h1 a { color: inherit; text-decoration: none; }
h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); margin: 0 0 8px; }
h3 { margin: 0 0 8px; font-size: 15px; }
button, select, input { font: inherit; color: var(--text); background: #262b31; border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; }
button { cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--accent); color: #08121f; border-color: var(--accent); font-weight: 600; }
button.on { border-color: var(--accent); background: #203246; }
.dim { color: var(--dim); } .small { font-size: 12px; }
.grow { flex: 1; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin: 10px 0; }
label { display: grid; gap: 4px; color: var(--dim); font-size: 13px; }

.bar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.pill { padding: 3px 10px; border-radius: 999px; font-size: 13px; border: 1px solid currentColor; }
.pill.on { color: var(--on); } .pill.wait { color: var(--wait); } .pill.off { color: var(--off); }

.setup { display: grid; place-items: center; padding: 24px 16px; }
.setup[hidden] { display: none; }
.setup-inner { width: min(720px, 100%); }
.races { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.race-pick { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.race-btns { display: grid; gap: 6px; }
.race-btns button { text-align: left; }
.race-btns small { display: block; color: var(--dim); font-size: 12px; }

.game { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 440px); gap: 14px; padding: 14px 16px; }
.game[hidden] { display: none; }
.board-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.board-wrap { position: relative; display: grid; place-items: center; }
#board { width: 100%; max-width: calc(100vh - 150px); aspect-ratio: 1; }
#board.sim { cursor: crosshair; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.throw-fx { position: absolute; pointer-events: none; }
.visit { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.slot { background: var(--panel); border: 1px dashed var(--line); border-radius: 8px; padding: 8px; min-height: 64px; }
.slot.hit { border-style: solid; }
.slot b { display: block; font-size: 18px; }
.slot span { font-size: 12px; color: var(--dim); }
.side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.card.grow { flex: 1; min-height: 140px; display: flex; flex-direction: column; }
.turn { font-size: 16px; }
.turn .who { font-weight: 700; }
.players { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.player { font-size: 13px; }
.player h3 { display: flex; justify-content: space-between; }
.player.active { outline: 2px solid var(--accent); }
.player .kv { display: grid; grid-template-columns: auto 1fr; gap: 1px 8px; }
.player .kv span:nth-child(odd) { color: var(--dim); }
.map { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; font-size: 11px; }
.zone { border: 1px solid var(--line); border-radius: 6px; padding: 4px; min-height: 92px; }
.zone .zn { color: var(--dim); }
.zone .p0 { color: var(--p0); } .zone .p1 { color: var(--p1); }
.zone.fight { border-color: var(--off); }
.log { flex: 1; min-height: 0; max-height: 40vh; overflow: auto; margin: 0; padding: 0; list-style: none; font: 12px/1.5 ui-monospace, monospace; }
.log .p0 { color: var(--p0); } .log .p1 { color: var(--p1); } .log .sys { color: var(--dim); }

/* MaB Games studio badge (same markup in every MaB game; links to the portal) */
.mab-badge { display: inline-flex; align-items: center; gap: 8px; margin-top: 24px; padding: 6px 8px; color: var(--dim); text-decoration: none; font-weight: 600; font-size: 15px; line-height: 1; letter-spacing: .08em; text-transform: uppercase; transition: color .2s; }
.mab-badge b { font-weight: 600; text-transform: none; letter-spacing: .04em; color: var(--text); }
.mab-badge i { font-style: normal; letter-spacing: .14em; }
.mab-mark { width: 24px; height: 24px; flex: none; color: var(--text); }
.mab-badge:hover, .mab-badge:focus-visible { color: var(--text); }
.mab-badge:hover b { text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 900px) {
  .game { grid-template-columns: 1fr; }
  #board { max-width: 100%; }
  .races { grid-template-columns: 1fr; }
}
/* Detection test page layout (on top of base.css). */
.detect { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; padding: 16px; min-height: calc(100vh - 56px); }
.board-box { min-height: 0; display: flex; align-items: center; justify-content: center; }
.detect #board { width: 100%; height: 100%; max-height: calc(100vh - 90px); aspect-ratio: 1; }
.detect .side { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.detect .card h2 { display: flex; justify-content: space-between; align-items: center; }
.detect .row { margin: 0 0 6px; gap: 6px; }
.detect input { flex: 1; min-width: 0; }
.small-btn { padding: 2px 8px; font-size: 12px; }
.detect .visit { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.detect .slot { text-align: center; min-height: 58px; }
.total { margin-top: 8px; text-align: right; color: var(--dim); }
.total b { color: var(--text); font-size: 20px; }
.hint { color: var(--wait); font-size: 12px; margin: 4px 0 0; }
.code { font-family: ui-monospace, monospace; font-size: 20px; letter-spacing: .12em; color: var(--accent); }
.detect .log li.dart { color: var(--text); } .detect .log li.fix { color: var(--wait); } .detect .log li.takeout { color: var(--accent); } .detect .log li.status { color: var(--dim); }
.raw { max-height: 160px; overflow: auto; font-size: 11px; background: #0c0e10; padding: 6px; border-radius: 4px; white-space: pre-wrap; word-break: break-all; }
p { margin: 4px 0; }
@media (max-width: 820px) { .detect { grid-template-columns: 1fr; } .detect #board { max-height: 70vw; } }
