/* Boardgame Forge shell — the BOBG "lamplit war table" look, shared by every game. Games add their own ui.css. */
:root {
  --bg: #111416; --panel: #191d20; --panel-2: #20262a; --line: #2e373c;
  --ink: #ebe5d8; --muted: #9ba3a4; --brass: #c8963e; --brass-hi: #ecc36f; --danger: #d4573f; --ok: #73b884;
  --p0: #4a86ef; --p1: #f0c53a; --p2: #e4573f; --p3: #e36fc0; --p4: #5bbf73; --p5: #9a74e0;
  --display: "Alegreya SC", "Palatino Linotype", Palatino, Georgia, serif;
  --body: "Alegreya Sans", "Gill Sans", "Trebuchet MS", system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
* { scrollbar-width: thin; scrollbar-color: #c8963e66 transparent; }
html, body, button, input, select { font-variant-numeric: lining-nums; font-feature-settings: "lnum" 1; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.42; padding: 0 16px 72px; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, [tabindex]:focus-visible, a:focus-visible { outline: 2px solid var(--brass-hi); outline-offset: 2px; }

/* ---- How the table feels under the mouse (lessons from BOBG; tools/ui-check.js checks every game for these) ----
 * The table, the header and the side panel are a picture of a game, not a document: no text cursor and no
 * drag-selection anywhere on them, including card text, labels, scores and SVG text. Text stays selectable where
 * people read or copy it: the log, dialogs (rules, saves), inputs, and the raw state of a game without ui.js.
 * The pointing hand means "clicking this does something": anything with data-key, buttons, links. Things that only
 * show more on hover keep the arrow. Games don't need to set cursor: pointer on [data-key] themselves. */
header.top, .board, .side { cursor: default; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
.board svg text, .board svg tspan { cursor: inherit; }
[data-key], [data-toggle], .board [role="button"] { cursor: pointer; }
.board button:disabled, .board [aria-disabled="true"] { cursor: default; }
.board .generic, .board .generic * { cursor: auto; -webkit-user-select: text; user-select: text; }
/* clicking a card or piece doesn't leave a focus outline; moving around with the keyboard still shows one */
.board :focus:not(:focus-visible), .side :focus:not(:focus-visible) { outline: none; }
a { color: var(--brass-hi); }
h1, h2, h3 { font-family: var(--display); font-weight: 700; margin: 0; letter-spacing: .02em; text-wrap: balance; }
.eyebrow { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }

header.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 6; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin: 0 -16px 14px; padding: 12px 16px; background: var(--bg); border-bottom: 1px solid var(--brass); box-shadow: 0 6px 18px #0008; }
header.top h1 { font-size: 26px; color: var(--brass-hi); font-weight: 800; }
header.top .sub { color: var(--muted); font-size: 14px; }
.netinfo { font-size: 13px; color: var(--muted); }
.netinfo b { color: var(--brass-hi); letter-spacing: .08em; }
.netinfo .err { color: var(--danger); }
.tools { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; }
.game-toggles { display: flex; flex-wrap: wrap; gap: 8px; margin-right: 12px; }   /* a gap between view toggles and game actions, as in BOBG */
.btn.toggle[aria-pressed="true"] { background: #2a2416; border-color: var(--brass); color: var(--brass-hi); }
.btn { background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px; text-decoration: none; color: var(--ink); display: inline-block; }
.btn:hover:not(:disabled) { border-color: var(--brass); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.primary { background: var(--brass); color: #1a1408; border-color: var(--brass); font-weight: 700; }
.btn.primary:hover:not(:disabled) { background: var(--brass-hi); }
.btn.small { padding: 4px 9px; font-size: 14px; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }
.board { min-height: 300px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; overflow: auto; }
.side { display: grid; gap: 14px; position: sticky; top: 90px; }
@media (max-width: 900px) { .side { position: static; } }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.panel h2 { font-size: 18px; color: var(--brass-hi); margin-bottom: 8px; }
.prompt.mine { border-color: var(--brass); box-shadow: 0 0 0 1px var(--brass) inset; }
.prompt .ptext { font-weight: 700; margin-bottom: 10px; }
.prompt .hint { color: var(--muted); font-size: 14px; }
.opt-list { display: grid; gap: 6px; }
.opt-list .btn { text-align: left; }
.neterr { color: var(--danger); font-size: 14px; margin-top: 8px; }

.players { display: grid; gap: 8px; }
.pl { display: grid; grid-template-columns: 12px 1fr; gap: 2px 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); }
.pl.turn { border-color: var(--brass); }
.pl .dot { width: 12px; height: 12px; border-radius: 50%; }
.pl .nm { font-weight: 700; display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.pl .tag { font-weight: 400; color: var(--muted); font-size: 13px; }
.pl .extra { grid-column: 2; color: var(--muted); font-size: 14px; }
.youtag { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #1a1408; background: var(--brass-hi); border-radius: 4px; padding: 0 5px; }
.away { opacity: .55; }

footer.chron { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; background: var(--bg); border-top: 1px solid var(--line); padding: 8px 16px calc(8px + env(safe-area-inset-bottom, 0px)); max-height: 50vh; overflow: auto; }
footer.chron summary { cursor: pointer; color: var(--muted); font-size: 14px; }
footer.chron .last { color: var(--ink); margin-left: 8px; }
#log { display: grid; gap: 2px; font-size: 14px; color: var(--muted); padding-top: 6px; }
#log .r { color: var(--brass); font-size: 12px; margin-right: 6px; }

.overlay { position: fixed; inset: 0; background: #08090bcc; display: grid; place-items: center; padding: 16px; z-index: 10; }
.dialog { background: var(--panel); border: 1px solid var(--brass); border-radius: 12px; padding: 20px 22px; width: min(560px, 100%); max-height: calc(90vh / var(--forge-zoom, 1)); overflow-y: auto; display: grid; gap: 12px; align-content: start; }
/* a game that scales the page (CSS zoom on body, e.g. Oh my Goods! on big screens) sets --forge-zoom on <html> to the
   same factor, so dialogs still fit the window: vh units are scaled by the zoom too */
.dialog.rulesdlg { width: min(760px, 100%); }
.dialog details { border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); }
.dialog details > summary { cursor: pointer; padding: 9px 12px; font-family: var(--display); font-weight: 700; color: var(--brass-hi); list-style-position: inside; }
.dialog details > summary small { font-family: var(--body); font-weight: 400; color: var(--muted); margin-left: 6px; }
.dialog details[open] > summary { border-bottom: 1px solid var(--line); }
.dialog details > .dt-body { padding: 10px 12px; }
.dialog h2 { font-size: 24px; color: var(--brass-hi); }
.dialog p { margin: 0; color: var(--muted); }
.dialog label { display: grid; gap: 4px; font-size: 14px; color: var(--muted); }
.dialog label.check { display: flex; gap: 8px; align-items: flex-start; }
.dialog label.check input { margin-top: 3px; }
.dialog select, .dialog input:not([type=checkbox]) { font: inherit; background: var(--panel-2); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row > label { flex: 1; min-width: 140px; }
.seatgrid { display: grid; gap: 6px; }
.seatgrid .seat { display: grid; grid-template-columns: 12px 90px 1fr; gap: 10px; align-items: center; }
.seatgrid .seat .dot { width: 12px; height: 12px; border-radius: 50%; }
.lobby-h { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 4px 0 -4px; }
.lobby-list { display: grid; gap: 6px; }
.lobby-row { display: flex; align-items: center; gap: 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.lobby-row .grow { flex: 1; min-width: 0; }
.lobby-row .code { font-weight: 700; letter-spacing: .08em; color: var(--brass-hi); margin-right: 6px; }
.lobby-row .meta { color: var(--muted); font-size: 14px; }
.lobby-empty { color: var(--muted); font-size: 14px; }
.bigcode { font-family: var(--display); font-size: 28px; letter-spacing: .12em; color: var(--brass-hi); }
.codebox { display: flex; gap: 8px; }
.codebox input { flex: 1; text-transform: uppercase; letter-spacing: .1em; }
.scores { display: grid; gap: 4px; }
.scores .srow { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.scores .srow.win { color: var(--brass-hi); font-weight: 700; }
.rules ol { margin: 0; padding-left: 20px; display: grid; gap: 6px; }

/* the generic board, for games that have no ui.js yet */
.generic h3 { font-size: 16px; color: var(--brass-hi); margin: 12px 0 6px; }
.generic h3:first-child { margin-top: 0; }
.generic pre { margin: 0; white-space: pre-wrap; word-break: break-word; font-size: 12px; color: var(--muted); font-family: ui-monospace, Menlo, monospace; }
.generic .note { color: var(--muted); font-size: 14px; }

/* game picker */
.picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-top: 8px; }
.gamecard { display: grid; gap: 8px; align-content: start; padding: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; color: var(--ink); text-decoration: none; }
.gamecard:hover { border-color: var(--brass); }
.gamecard h2 { font-size: 22px; color: var(--brass-hi); }
.gamecard .meta { color: var(--muted); font-size: 14px; }

/* a full table (UI.layout 'full'): the game draws its own action panel and players, across the whole width */
body.forge-full main.layout { display: block; }
body.forge-full aside.side { display: none; }
body.forge-full #board { background: none; border: 0; border-radius: 0; padding: 0; min-height: 0; overflow: visible; }
#board.forge-hidden { visibility: hidden; }

/* ---- start-of-game intro (shell.js showIntro; modelled on BOBG's briefing) ---- */
.dialog.intro { width: min(980px, 100%); gap: 16px; border-color: var(--line); border-top: 3px solid var(--brass); }
.intro .in-kicker { font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: -10px; }
.intro h2 { font-size: 26px; color: var(--brass-hi); text-wrap: balance; }
.intro .in-lead { margin: 0; color: var(--muted); line-height: 1.5; max-width: 75ch; }
.intro .in-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px 28px; align-items: start; }
.intro .in-col { display: grid; gap: 16px; align-content: start; min-width: 0; }
@media (max-width: 860px) { .intro .in-grid { grid-template-columns: minmax(0, 1fr); } }
.intro section { display: grid; gap: 7px; align-content: start; }
.intro h3 { font-family: var(--body); font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--brass-hi); }
.intro p, .intro li { margin: 0; line-height: 1.5; }
.intro section p { color: var(--ink); }
.intro .in-rules { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; }
.intro .in-players { display: grid; gap: 5px; }
.intro .in-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 7px 11px; background: var(--panel-2); border: 1px solid var(--line); border-left: 4px solid var(--pc); border-radius: 7px; }
.intro .in-name { font-family: var(--display); font-weight: 700; font-size: 17px; }
.intro .in-color { color: var(--muted); font-size: 14px; }
.intro .in-note { margin-left: auto; font-size: 14px; color: var(--muted); }
.intro .in-note b { color: var(--ink); font-weight: 600; }
.intro .in-tag { font-size: 10.5px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; border-radius: 4px; padding: 2px 6px 1px; line-height: 1.2; border: 1px solid var(--line); color: var(--muted); }
.intro .in-tag.first { color: #1a1408; background: var(--brass-hi); border-color: var(--brass-hi); }
.intro .in-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.intro .in-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; padding: 3px 9px; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--line); }
.intro .in-warn { color: var(--danger); font-weight: 700; }
.intro .in-go { justify-content: flex-end; }
