/* Smugglers’ Chase: the sandy West Texas board on a green felt table, with walnut panels and brass
   trim like the rails of a card table, cream text, terracotta cartel and denim police. One responsive
   screen: a single column on phones, three columns (status | board | controls) on wide screens. */
:root {
  --felt: #1d4d37; --felt-dark: #12301f; --felt-light: #2b6a4b;
  --panel: rgba(43, 29, 20, .93); --panel-edge: #9a7a44; --wood: #3a2819; --wood-line: #5a4228; --wood-deep: #1e140d;
  --ink: #f3ead6; --dim: #c2b49a;
  --mule: #e0752c; --cop: #4a7fd0; --bag: #f0c04a; --danger: #e5483d; --go: #6fd08c;
  --f-pixel: "Pixelify Sans", ui-monospace, monospace; --f-logo: "Silkscreen", var(--f-pixel); --f-ui: "Rubik", system-ui, sans-serif;
  /* derived shades: each theme below overrides the whole set */
  --bag-light: #f7dc8c; --bag-shadow: #8a6420; --on-bag: #1a1000;
  --go-light: #a6ecb8; --go-shadow: #2f6b45; --on-go: #062a14;
  --alt-light: #eeab84; --alt: #cc7e5c; --alt-shadow: #6e3a2a; --on-alt: #2a1208;
  --mule-light: #e98a45; --mule-dark: #6e3010; --cop-light: #5f93e0; --cop-dark: #1f3a6a; --cop-ink: #8fb4ee;
  --logo-1: #a3530c; --logo-2: #4a1d06; --logo-glow: rgba(255, 180, 60, .45);
  --panel-solid: #2b1d14; --scrim: rgba(8,14,10,.62); --ink-bright: #fff6d8; --ink-warm: #ffe3a6; --muted: #6b5a44; --danger-ink: #ff9a8f;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='6' height='6'%3E%3Cpath d='M0 0h1v1H0zM3 3h1v1H3z' fill='%23000' fill-opacity='.07'/%3E%3Cpath d='M3 0h1v1H3zM0 3h1v1H0z' fill='%23fff' fill-opacity='.025'/%3E%3C/svg%3E");
  --texture: var(--grain);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; color: var(--ink);
  /* felt: a soft pool of light over the table, plus a fine woven grain */
  background:
    var(--texture),
    radial-gradient(1400px 900px at 50% 10%, var(--felt-light) 0%, var(--felt) 45%, var(--felt-dark) 100%) fixed;
  background-color: var(--felt-dark); }
body { font-family: var(--f-ui); font-size: 15px; line-height: 1.4; min-height: 100vh; min-height: 100dvh;
  padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
button { font: inherit; color: inherit; cursor: pointer; }
.dim { color: var(--dim); }
.connecting { text-align: center; margin-top: 30vh; }
/* the name: a small banner word over a big gold one, CHASE lit like a brass sign (gradient letters, a stacked
   3D edge in the theme's logo colours and a soft glow); the emblem beside (small) or above (big) */
.logo { font-family: var(--f-pixel); font-weight: 700; margin: 0; line-height: .92; display: inline-grid; justify-items: center; text-align: center; }
.logo-top { display: flex; align-items: center; gap: .45em; font: 700 .3em/1.2 var(--f-ui); letter-spacing: .32em; margin-right: -.3em; color: var(--ink-warm);
  text-shadow: 0 .09em 0 var(--logo-2); }
.logo-top::before, .logo-top::after { content: ''; width: 1.6em; height: .16em; background: currentColor; box-shadow: 0 .1em 0 var(--logo-2); opacity: .8; }
.logo-main { font-family: var(--f-logo); font-weight: 400; font-size: 1em; letter-spacing: .06em; margin-right: -.06em; color: var(--bag);
  background: linear-gradient(180deg, var(--ink-bright) 0 18%, var(--bag-light) 18% 40%, var(--bag) 40% 70%, var(--bag-shadow) 70%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 .05em 0 var(--logo-1)) drop-shadow(0 .05em 0 var(--logo-2)) drop-shadow(0 0 .3em var(--logo-glow)); }
.brand { display: flex; align-items: center; gap: 10px; }
.brand .mark { image-rendering: pixelated; flex: none; filter: drop-shadow(0 4px 6px rgba(0,0,0,.35)); }
.brand-small .logo { font-size: 26px; }
.brand-small .logo-top::before, .brand-small .logo-top::after { width: .9em; }
.brand-big { flex-direction: column; gap: 12px; }
.brand-big .mark { width: clamp(60px, 18vw, 80px); height: auto; }
.brand-big .logo { font-size: clamp(54px, 17vw, 84px); }
.brand-big .logo-top { margin-bottom: .12em; }
[hidden] { display: none !important; }   /* "hidden" wins over any display rule (cards, flex rows) */
.card { background: var(--panel); border: 2px solid var(--panel-edge); border-radius: 14px; padding: 14px; display: grid; gap: 10px; align-content: start; }
.card h2 { font-family: var(--f-pixel); margin: 0; font-size: 20px; }
.card p { margin: 0; }
.lbl { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: 1px; }
.code { font-family: var(--f-pixel); color: var(--bag); letter-spacing: 3px; font-size: 22px; }
/* the connection dot, on the ⚙️'s corner: shown only while the connection is down */
#net { position: absolute; top: -4px; right: -4px; width: 12px; height: 12px; border-radius: 50%; background: var(--danger); border: 2px solid var(--panel-solid); pointer-events: none; }
#net:not(.off) { display: none; }
#net.off { animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
#toast { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--danger); color: #fff; padding: 10px 16px; border-radius: 10px; font-weight: 500; max-width: 90vw; z-index: 20; }
#toast.good { background: var(--go); color: var(--on-go); }

/* ---------- controls */
input, select { font: inherit; font-size: 18px; padding: 10px 12px; border-radius: 10px; border: 2px solid var(--panel-edge); background: var(--wood-deep); color: var(--ink); width: 100%; }
label { display: grid; gap: 4px; text-align: left; font-size: 13px; color: var(--dim); }
#s-room { font-family: var(--f-pixel); letter-spacing: 6px; text-transform: uppercase; text-align: center; font-size: 24px; }
.big { min-height: 52px; border-radius: 14px; border: 0; font-family: var(--f-pixel); font-size: 20px; letter-spacing: 1px; color: var(--on-bag); width: 100%;
  background: linear-gradient(var(--bag-light), var(--bag)); box-shadow: 0 5px 0 var(--bag-shadow); }
.big:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--bag-shadow); }
.big:disabled { opacity: .45; }
.big.alt { background: linear-gradient(var(--alt-light), var(--alt)); box-shadow: 0 5px 0 var(--alt-shadow); color: var(--on-alt); }   /* terracotta, like the houses: the second choice next to the gold one */
.big.alt:active { box-shadow: 0 2px 0 var(--alt-shadow); }
.big.lock { background: linear-gradient(var(--go-light), var(--go)); box-shadow: 0 5px 0 var(--go-shadow); position: relative; overflow: hidden; }
.big.lock::after { content: ""; position: absolute; inset: 0 auto 0 -40%; width: 30%; background: rgba(255, 255, 255, .35); transform: skewX(-20deg); animation: shine 2.8s ease-in-out infinite; }
@keyframes shine { 0%, 60% { left: -40%; } 100% { left: 130%; } }
.err { color: var(--danger); }
.link { background: none; border: 0; color: var(--dim); text-decoration: underline; padding: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border-radius: 10px; border: 2px solid var(--wood-line); background: var(--wood); padding: 8px 10px; font-size: 14px; }
.chip[aria-pressed="true"] { background: var(--bag); color: var(--on-bag); border-color: var(--bag-light); }

/* ---------- start */
.start { max-width: 440px; margin: 5vh auto 0; display: grid; gap: 14px; text-align: center; }
.start .card { text-align: left; }
/* the start page's choices: slim rows (icon, title over a line of help, a chevron), quiet glassy panels */
.choices { display: grid; grid-template-columns: 1fr; gap: 8px; }
.choice { display: grid; grid-template-columns: 34px 1fr auto; grid-template-areas: "ic b go" "ic s go"; align-items: center; column-gap: 12px; row-gap: 1px;
  text-align: left; padding: 10px 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--wood-line);
  box-shadow: 0 2px 10px rgba(0,0,0,.22); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); transition: border-color .15s, transform .1s; }
.choice::after { content: '›'; grid-area: go; font-size: 22px; line-height: 1; color: var(--dim); transition: transform .15s; }
.choice:hover { border-color: var(--panel-edge); }
.choice:active { transform: translateY(1px); }
.choice .ic { grid-area: ic; font-size: 22px; line-height: 1; justify-self: center; }
.choice b { grid-area: b; font-family: var(--f-pixel); font-weight: 600; font-size: 17px; color: var(--bag); letter-spacing: .3px; }
.choice small { grid-area: s; font-size: 12.5px; color: var(--dim); }
.choice[aria-expanded="true"] { border-color: var(--bag); }
.choice[aria-expanded="true"]::after { transform: rotate(90deg); color: var(--bag); }
.join-card { gap: 12px; }
.link.center { justify-self: center; }
.start .tag { color: var(--dim); margin: 0; }
.start .install, .start .download { justify-self: center; }
.download { text-decoration: none; color: var(--ink); display: inline-block; }
.update { display: block; margin: -4px auto 10px; max-width: 560px; text-align: center; text-decoration: none; color: var(--on-go); font-weight: 500;
  background: var(--go); border-radius: 12px; padding: 10px 14px; }
.small { font-size: 13px; }

/* ---------- lobby */
.lobby { max-width: 560px; margin: 0 auto; display: grid; gap: 12px; }
.lobby .top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.lobby .top .lead { display: flex; align-items: center; gap: 8px; }
@media (max-width: 440px) { .lobby .room-card > .lbl { display: none; } .lobby .room-card { grid-template-columns: 1fr auto; } }   /* narrow phones: the code speaks for itself, so ⚙️ fits */
.room-card { grid-template-columns: auto 1fr auto; align-items: center; padding: 8px 12px; }
.teams { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.team { text-align: left; border-radius: 12px; border: 2px solid var(--panel-edge); background: var(--wood); padding: 10px; font-family: var(--f-pixel); font-size: 16px; }
.team-col { display: grid; gap: 6px; align-content: start; }
.team-col .team { width: 100%; }
.seats { display: flex; gap: 6px; flex-wrap: wrap; }
.seats .chip:disabled { opacity: .45; }
.team ul { list-style: none; padding: 0; margin: 6px 0 0; font-family: var(--f-ui); font-size: 14px; }
.away { opacity: .45; }
.team.c[aria-pressed="true"] { border-color: var(--mule); box-shadow: 0 0 0 2px var(--mule) inset; }
.team.p[aria-pressed="true"] { border-color: var(--cop); box-shadow: 0 0 0 2px var(--cop) inset; }
.bags { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.bag { border-radius: 12px; border: 2px solid var(--bag-light); background: linear-gradient(var(--wood), var(--wood-deep)); padding: 12px 4px; display: grid; gap: 2px; }
.bag canvas { width: 48px; height: 57px; justify-self: center; image-rendering: pixelated; }
.bag small { color: var(--dim); }

/* ---------- the game: one column on phones, in play order. The side column is a wrapper
   (display: contents) so its parts can interleave with the board on a phone. Your move comes
   before the chat: when it sticks to the bottom edge on your turn, it never covers the chat. */
.game { display: grid; gap: 10px; max-width: 560px; margin: 0 auto;
  grid-template-areas: "bar" "board" "move" "chat"; }
.game .col { display: contents; }
.game .brand { grid-area: brand; } .who-card { grid-area: who; } .status { grid-area: status; } .board-wrap { grid-area: board; } .move { grid-area: move; }
.chat-slot { grid-area: chat; } .plan-tile { grid-area: plan; } .feed-card { grid-area: feed; } .teams-card { grid-area: teams; } .game .room-card { grid-area: room; }
.who-card { padding: 12px 14px; display: grid; gap: 8px; border-radius: 20px; background: linear-gradient(135deg, var(--wood-line), var(--wood)); border: 2px solid var(--panel-edge); box-shadow: 0 10px 30px rgba(0,0,0,.35); }
body[data-team="C"] .who-card { background: linear-gradient(135deg, var(--mule), var(--mule-dark)); }
body[data-team="P"] .who-card { background: linear-gradient(135deg, var(--cop), var(--cop-dark)); }
.ph-top { display: flex; justify-content: space-between; font-size: 12px; font-weight: 500; opacity: .9; letter-spacing: .5px; }
.who { display: flex; gap: 12px; align-items: center; }
.who canvas { width: 56px; height: 66px; image-rendering: pixelated; background: rgba(0, 0, 0, .25); border-radius: 14px; flex: none; }
.who strong { font-family: var(--f-pixel); font-size: 19px; display: block; line-height: 1.1; }
.who span { font-size: 13px; opacity: .92; display: block; }
.who .aka { font-style: italic; opacity: .8; }
.status { grid-template-columns: repeat(3, auto); justify-content: space-between; padding: 10px 14px; gap: 6px 14px; }
.status .hc { grid-column: 1 / -1; font-size: 13px; }
.stat { display: grid; gap: 3px; align-content: start; }
.big-num { font-family: var(--f-pixel); font-size: 26px; line-height: 1; }
.big-num small { font-size: 15px; color: var(--dim); }
.pips { display: flex; gap: 3px; flex-wrap: wrap; max-width: 140px; }
.pips i { width: 7px; height: 11px; border-radius: 2px; background: var(--ink); }
.pips i.done { background: var(--muted); }
.ph-row { font-family: var(--f-pixel); font-size: 20px; }
.phase.C .ph-row { color: var(--mule); } .phase.P .ph-row { color: var(--cop-ink); }
.b { display: inline-grid; place-items: center; width: 26px; height: 24px; margin-right: 4px; border-radius: 5px; font-weight: 700; color: var(--on-bag); background: var(--bag); box-shadow: 0 3px 0 var(--bag-shadow); }
.b.gone { background: transparent; border: 2px dashed var(--muted); color: var(--muted); box-shadow: none; }
.board-wrap { position: relative; }
.board { width: 100%; display: block; border-radius: 10px; image-rendering: pixelated; touch-action: manipulation; cursor: pointer;
  box-shadow: 0 0 0 2px var(--panel-edge), 0 20px 50px rgba(0,0,0,.45); }
.board-wrap.preview .board { cursor: default; }
.tile { background: var(--wood); border-radius: 16px; padding: 12px; display: grid; gap: 10px; box-shadow: inset 0 0 0 1px var(--wood-line); align-content: start; }
.tile h3 { margin: 0; font-size: 11px; font-weight: 500; letter-spacing: 1px; color: var(--dim); text-transform: uppercase; }
.tile p { margin: 0; }
.status-line { font-weight: 500; }
.plan { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; font-size: 13px; }
.plan li { display: flex; gap: 9px; align-items: center; }
.order { font-family: var(--f-pixel); width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; background: var(--mule); color: var(--on-bag); flex: none; }
.order.wait { background: var(--wood-line); color: var(--dim); }
.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13px; }
.feed li { display: flex; gap: 8px; } .feed li.new { color: var(--bag); }
.ft { display: grid; } .ft small { color: var(--dim); }
.roster { list-style: none; margin: 2px 0 6px; padding: 0 0 0 10px; display: grid; gap: 4px; border-left: 3px solid var(--mule); font-size: 13px; }
.roster.P { border-color: var(--cop); }
.roster li { display: grid; } .roster small { color: var(--dim); font-size: 12px; }

/* tap-for-info popup over the board */
.pop { position: absolute; z-index: 5; max-width: min(280px, 86%); background: var(--panel); border: 2px solid var(--panel-edge); border-radius: 12px; padding: 8px 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.55); backdrop-filter: blur(4px); cursor: pointer; }
.pop strong { font-family: var(--f-pixel); font-size: 16px; }
.pop .head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.pop .x { background: none; border: 0; color: var(--dim); font-size: 20px; line-height: 1; padding: 0 2px; }
.pop .aka { font-size: 13px; color: var(--bag); font-style: italic; margin-top: 2px; }
.pop ul { margin: 4px 0 0; padding: 0; list-style: none; font-size: 13px; display: grid; gap: 2px; }
.pop .k { color: var(--go); font-weight: 500; }
.pop .k::after { content: ":"; }

/* who just parked the Band: a small note at the top of the board */
.band-note { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); z-index: 4; pointer-events: none; white-space: nowrap;
  background: var(--panel); border: 2px solid var(--bag); color: var(--ink); border-radius: 999px; padding: 6px 14px; font-size: 14px; font-weight: 500;
  box-shadow: 0 6px 18px rgba(0,0,0,.45); animation: notein .3s ease-out both; }
@keyframes notein { from { transform: translate(-50%, -8px); opacity: 0; } }

/* big moments and the end of the game, over the board */
.headline, .over { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); text-align: center; z-index: 6;
  background: linear-gradient(160deg, var(--wood), var(--wood-deep)); border: 3px solid var(--bag); border-radius: 16px; padding: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.headline { width: min(320px, 76%); pointer-events: none; }
.headline.show, .over { animation: flyin .55s cubic-bezier(.2,1.4,.4,1) both; }
.headline canvas { width: 100%; height: auto; border-radius: 8px; display: block; image-rendering: pixelated; }
.headline h2, .over h2 { font-family: var(--f-pixel); margin: 8px 0 2px; font-size: clamp(20px, 5vw, 34px); color: var(--bag); text-shadow: 0 3px 0 #000; }
.headline p, .over p { margin: 4px 0; font-size: 13px; }
.headline .tag, .over .tag { font-family: var(--f-pixel); font-size: 12px; color: var(--mule); letter-spacing: 1px; }
.over { width: min(420px, 86%); }
@keyframes flyin { from { transform: translate(-50%, -50%) scale(.4); opacity: 0; } }

/* ---------- wide screens: one stack (status, chat, your move) | board */
@media (min-width: 980px) {
  .game { max-width: 1400px; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); grid-template-areas: "left board"; align-items: start; }
  .game .col { display: grid; gap: 10px; align-content: start; }
  .game .col > * { grid-area: auto; }
  .col-left { grid-area: left; } .board-wrap { grid-area: board; }
  .status { grid-template-columns: 1fr; }
  .status .hc { grid-column: auto; }
  .board { width: min(100%, calc(100dvh - 150px)); margin: 0 auto; }   /* room for the turn banner and the team key */
  .turn-banner { width: min(100%, calc(100dvh - 150px)); margin: 0 auto 6px; box-sizing: border-box; }
}
@media (prefers-reduced-motion: reduce) { .headline.show, .over, .big.lock::after, #net.off { animation: none; } }

/* ---------------------------------------------------------------- How to play */
.choice.how { width: 100%; }
.tutorial { max-width: 560px; margin: 0 auto; display: grid; gap: 12px; }
.tutorial > * { grid-area: auto; }
.tutorial .top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.tut-card h2 { margin: 6px 0 4px; }
.tut-card p { margin: 0 0 12px; line-height: 1.45; min-height: 5.8em; }
.tut-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; }
.tut-who { font-family: var(--f-pixel); font-size: 14px; padding: 2px 8px; border-radius: 8px; background: var(--wood); border: 1px solid var(--wood-line); }
.tut-who.C { color: var(--mule); border-color: var(--mule); }
.tut-who.P { color: var(--cop-ink); border-color: var(--cop); }
.tut-nav { display: flex; align-items: center; gap: 10px; }
.tut-nav .big { flex: 1; margin: 0; }
.tut-nav .chip:disabled { opacity: .4; }
.tut-dots { display: flex; gap: 3px; flex-wrap: wrap; max-width: 30%; }
.tut-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--wood-line); }
.tut-dots i.done { background: var(--dim); }
.tut-dots i.on { background: var(--bag); }
@media (min-width: 980px) {
  .tutorial { max-width: 1180px; grid-template-columns: minmax(0, 1fr) 380px; align-items: start; }
  .tutorial .top { grid-column: 1 / -1; }
  .tutorial .board-wrap { grid-column: 1; grid-row: 2; width: 100%; max-width: calc(100vh - 110px); justify-self: center; }
  .tut-card { grid-column: 2; grid-row: 2; position: sticky; top: 16px; }
}
.tut-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--dim); min-height: 0 !important; margin: 0 0 12px !important; }
.tut-legend span.C b { color: var(--mule); } .tut-legend span.P b { color: var(--cop-ink); }
.tut-legend span.on { color: var(--ink); text-decoration: underline; text-decoration-color: var(--go); text-underline-offset: 3px; }
.tut-legend small { flex-basis: 100%; }
.strip { display: flex; align-items: center; gap: 4px; margin-top: 10px; flex-wrap: wrap; }
.strip .sl { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--wood-line); display: inline-grid; place-items: center; font-size: 11px; }
.strip .sl:not(.band) { border-color: var(--mule); }
.strip .arr ~ .sl:not(.band) { border-color: var(--cop); }
.strip .sl.done:not(.band) { background: var(--mule); } .strip .arr ~ .sl.done:not(.band) { background: var(--cop); }
.strip .sl.band { width: 22px; height: 22px; border-radius: 6px; border-color: var(--bag); opacity: .55; }
.strip .sl.band.done { background: color-mix(in srgb, var(--bag) 35%, transparent); opacity: 1; }
.strip .sl.next { box-shadow: 0 0 0 2px var(--go); opacity: 1; }
.strip .arr { color: var(--dim); margin: 0 2px; }
.strip small { color: var(--dim); margin-left: 6px; font-size: 12px; }

/* the key to the name tags on the board */
.tag-legend { display: grid; gap: 4px; margin-top: 6px; font-size: 13px; }
.tag-legend .tl { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.tag-legend .tg { display: inline-flex; align-items: center; gap: 4px; color: var(--ink); }
.tag-legend .tg i { color: var(--dim); font-style: normal; }
.tag-legend b, .chip-tag { font: 800 11px/1 var(--f-ui); color: #1a1206; padding: 2px 4px; border-radius: 4px; border: 1px solid #120a1a; letter-spacing: .3px; }
.tut-legend span b.chip-tag { color: #1a1206; }

/* ---------------------------------------------------------------- chat */
#chat-dock[hidden], #chat-dock [hidden] { display: none !important; }   /* the panel sets display: flex */
#chat-dock .chat-btn { position: fixed; right: 14px; bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 40; width: 52px; height: 52px; border-radius: 50%;
  border: 2px solid var(--panel-edge); background: var(--wood); font-size: 24px; box-shadow: 0 4px 14px rgba(0,0,0,.45); }
#chat-dock .badge { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--danger); color: #fff;
  font: 700 12px/20px var(--f-ui); border: 2px solid var(--wood-deep); }
#chat-dock .chat-pop { position: fixed; right: 74px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 40; max-width: min(320px, calc(100vw - 96px));
  background: var(--panel); border: 1px solid var(--panel-edge); border-radius: 12px; padding: 8px 10px; box-shadow: 0 4px 14px rgba(0,0,0,.45); cursor: pointer; }
#chat-dock .chat-pop li { list-style: none; }
#chat-dock .chat-panel { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; height: min(62vh, 520px); display: flex; flex-direction: column; background-color: var(--panel-solid) !important;
  background: var(--panel); border-top: 2px solid var(--panel-edge); border-radius: 16px 16px 0 0; box-shadow: 0 -6px 24px rgba(0,0,0,.5); padding-bottom: env(safe-area-inset-bottom); }
.chat-panel header { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--wood-line); }
.chatui .chan { display: flex; gap: 6px; }
.chatui .chan button { border-radius: 10px; border: 2px solid var(--wood-line); background: var(--wood); padding: 6px 10px; font-size: 14px; color: var(--dim); }
.chatui .chan button[aria-selected="true"] { color: var(--ink); border-color: var(--go); }
.chatui .chan button:disabled { opacity: .4; }
.chatui .x { background: none; border: 0; color: var(--dim); font-size: 26px; line-height: 1; padding: 0 6px; }
.chatui .msgs { flex: 1; overflow-y: auto; list-style: none; margin: 0; padding: 8px 10px; display: grid; gap: 6px; align-content: start; }
.chatui .msgs li, .chatui li { display: grid; grid-template-columns: auto 1fr; gap: 0 6px; font-size: 14px; line-height: 1.35; }
.chatui .msgs li.empty { display: block; color: var(--dim); text-align: center; padding: 20px 0; }
.chatui .tagc { align-self: start; font: 800 11px/1 var(--f-ui); color: #1a1206; padding: 3px 4px; border-radius: 4px; border: 1px solid #120a1a; margin-top: 2px; }
.chatui .who { font-size: 12px; color: var(--dim); }
.chatui .who i { font-style: normal; color: var(--go); }
.chatui .txt { color: var(--ink); word-break: break-word; }
.chatui li.mine .txt { color: var(--ink-bright); }
.chatui .sq { background: color-mix(in srgb, var(--bag) 18%, transparent); border: 1px solid var(--bag); color: var(--bag); border-radius: 4px; padding: 0 3px; font: inherit; font-weight: 700; cursor: pointer; }
.chatui .quick { display: flex; flex-wrap: wrap; gap: 5px; padding: 6px 10px; border-top: 1px solid var(--wood-line); }   /* wraps: every chip in reach, no hidden scrolling */
.chatui .quick .chip { flex: none; padding: 5px 8px; font-size: 13px; }
.chatui form { display: flex; gap: 6px; padding: 8px 10px 10px; }
.chatui input { flex: 1; min-width: 0; border-radius: 10px; border: 2px solid var(--wood-line); background: var(--wood-deep); color: var(--ink); padding: 10px; font: 16px var(--f-ui); }
.chat-panel[data-chan="team"] input { border-color: var(--go); }
.chatui .send { border-radius: 10px; border: 0; background: var(--bag); color: var(--on-bag); font-size: 18px; padding: 0 14px; }
@media (min-width: 980px) {
  #chat-dock .chat-panel { left: auto; right: 16px; bottom: 80px; width: 380px; height: 520px; border: 2px solid var(--panel-edge); border-radius: 16px; }
}

/* typed moves */
.cmdline { margin: 8px 0 0; font-size: 13px; color: var(--ink); }
.cmdline code { font: 700 14px ui-monospace, Menlo, monospace; background: var(--wood-deep); border: 1px solid var(--wood-line); border-radius: 4px; padding: 1px 5px; color: var(--bag); }
.cmdline.bad { color: var(--danger-ink); }
.cmdline.hint { color: var(--dim); font-size: 12px; }
.cmdline small { color: var(--dim); margin-left: 4px; }

/* the chat docked in the game screen (between the status bar and your move): a card, not a sheet */
#chat-dock.docked .chat-btn, #chat-dock.docked .chat-pop { display: none !important; }
.chat-slot:empty { display: none; }
.chat-slot { min-width: 0; }
.chat-slot .chat-panel { position: static !important; display: flex; flex-direction: column; width: auto !important; min-width: 0; height: auto !important;
  background: var(--panel-solid); border: 2px solid var(--panel-edge) !important; border-radius: 16px !important; box-shadow: none !important; padding-bottom: 0 !important; }
.chat-slot .msgs { min-height: 80px; max-height: 190px; }
.chatui .quick, .chatui form, .chatui .cheats { min-width: 0; }
@media (min-width: 980px) {   /* the chat fills the left column between the bar and your move */
  .game .chat-slot { flex: 1; min-height: 220px; display: flex; flex-direction: column; }
  .chat-slot .chat-panel { flex: 1; min-height: 0; }
  .chat-slot .msgs { flex: 1; max-height: none; min-height: 0; }
}

.chatui .txt .all { font-style: normal; font-size: 12px; }
.chatui .cheats { padding: 0 10px 8px; font-size: 12px; color: var(--dim); }
.chatui .cheats button { font: 700 12px ui-monospace, Menlo, monospace; color: var(--bag); background: var(--wood-deep); border: 1px solid var(--wood-line); border-radius: 4px; padding: 1px 5px; cursor: pointer; }
.teams-card .chip-tag { font: 800 10px/1 var(--f-ui); color: #1a1206; padding: 2px 3px; border-radius: 3px; border: 1px solid #120a1a; vertical-align: 1px; }
.chat-slot .x { display: none; }

/* lobby: who you are, and the seat plan */
.you-card { display: grid; gap: 10px; }
.you-row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.you-row label { display: grid; gap: 4px; font-size: 12px; color: var(--dim); flex: 1; min-width: 140px; }
.you-row label.tag-edit { flex: 0 0 auto; min-width: 0; }
.you-row input { border-radius: 10px; border: 2px solid var(--wood-line); background: var(--wood-deep); color: var(--ink); padding: 9px 10px; font: 16px var(--f-ui); }
#p-tag { width: 5.2em; text-transform: uppercase; color: #1a1206; font-weight: 800; letter-spacing: 1px; text-align: center; border-color: #120a1a; }
.you-row .lbl { font-size: 12px; color: var(--dim); width: 52px; }
.looks { display: flex; gap: 6px; flex-wrap: wrap; }
/* girl or boy: a small two-way toggle (ui.ts lookToggle) */
.seg { display: inline-flex; border: 1px solid var(--wood-line); border-radius: 999px; padding: 2px; background: var(--wood-deep); gap: 2px; }
.seg-b { border: 0; background: none; border-radius: 999px; padding: 3px 10px; font-size: 16px; line-height: 1.2; opacity: .55; }
.seg-b:hover { opacity: .85; }
.seg-b[aria-pressed="true"] { background: var(--bag); opacity: 1; box-shadow: 0 1px 3px rgba(0,0,0,.35); }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.sw { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #120a1a; cursor: pointer; }
.sw[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--ink); }
.sw:disabled { cursor: not-allowed; }
.lobby-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.formats { display: flex; gap: 6px; flex-wrap: wrap; }
.team-head { width: 100%; text-align: left; border-radius: 12px; border: 2px solid var(--panel-edge); background: var(--wood); padding: 8px 10px; font-family: var(--f-pixel); font-size: 16px; display: flex; justify-content: space-between; align-items: center; }
.team-head small { font: 12px var(--f-ui); color: var(--dim); }
.team-head.c[aria-pressed="true"] { border-color: var(--mule); box-shadow: 0 0 0 2px var(--mule) inset; }
.team-head.p[aria-pressed="true"] { border-color: var(--cop); box-shadow: 0 0 0 2px var(--cop) inset; }
.seat-list { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 6px; }
.seat { display: flex; align-items: center; gap: 6px; min-height: 36px; padding: 4px 8px; border-radius: 10px; background: var(--wood-deep); border: 1px solid var(--wood-line); font-size: 14px; }
.seat span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat i { color: var(--dim); font-style: normal; }
.seat .chip-tag { font: 800 11px/1 var(--f-ui); color: #1a1206; padding: 2px 4px; border-radius: 4px; border: 1px solid #120a1a; }
.seat .x { background: none; border: 0; color: var(--dim); font-size: 20px; line-height: 1; padding: 0 4px; cursor: pointer; }
.seat.open { border-style: dashed; padding: 0; }
.open-seat { width: 100%; text-align: left; background: none; border: 0; color: var(--dim); padding: 8px; font-size: 14px; cursor: pointer; }
.open-seat small { color: var(--go); margin-left: 4px; }
#start small { font: 600 13px var(--f-ui); }

.team-head { flex-wrap: wrap; gap: 2px 8px; }
.sw:disabled { opacity: .55; background-image: linear-gradient(45deg, transparent 45%, #120a1a 45%, #120a1a 55%, transparent 55%) !important; }
.stepper { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 6px; font-size: 13px; color: var(--dim); }
.stepper .chip { padding: 2px 12px; font-size: 16px; }
.stepper .chip:disabled { opacity: .35; }
.open-seat { white-space: nowrap; }

/* Play now */
.play-now { display: grid; gap: 2px; width: 100%; font-size: 22px; padding: 14px; }
.play-now small { font: 500 13px var(--f-ui); opacity: .8; }
.public-note { margin: 0 0 10px; padding: 8px 10px; border-radius: 10px; background: color-mix(in srgb, var(--go) 12%, transparent); border: 1px solid var(--go); font-size: 13px; color: var(--ink); }
.countdown { font-size: 18px; text-align: center; color: var(--ink); }
.countdown b { font-family: var(--f-pixel); color: var(--bag); font-size: 26px; }

/* ---------- the game screen, compact: one slim bar, the board, chat + events, your move */
.game .bar { grid-area: bar; }
.bar { background: var(--panel); border: 2px solid var(--panel-edge); border-radius: 14px; padding: 10px 12px; display: grid; gap: 8px; font-size: 14px; }
.bar.C { border-color: var(--mule); } .bar.P { border-color: var(--cop); }
.bar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bar .team-name { font-family: var(--f-pixel); font-size: 16px; letter-spacing: .5px; }
.bar.C .team-name { color: var(--mule); } .bar.P .team-name { color: var(--cop-ink); }
.bar-meta { display: flex; align-items: baseline; gap: 14px; color: var(--dim); font-size: 13px; }
.bar-meta .room { margin-left: auto; }
.bar-meta .room b { font-family: var(--f-pixel); font-weight: 400; color: var(--ink); letter-spacing: 1px; }
.bar-bags { display: flex; align-items: center; gap: 6px; }
.bar-bags .lbl { font-size: 11px; letter-spacing: .6px; text-transform: uppercase; color: var(--dim); margin-right: 4px; }
.bar-bags .secret { margin-left: auto; color: var(--bag); }   /* who has the coke: the smugglers' secret */
.bar-notes { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; padding-top: 6px; border-top: 1px solid var(--wood-line); }
.bar .hc { color: var(--dim); font-size: 12px; }
.game .move { grid-area: move; }
.move .status-line { margin: 0; }
.move .big { margin-top: 8px; }
/* phones: on your turn, your move sticks to the bottom edge, under your thumb */
@media (max-width: 979px) {
  .game .move.mine { position: sticky; bottom: 0; z-index: 20; box-shadow: 0 -8px 24px rgba(0,0,0,.45); border-color: var(--go); }
  .chat-slot .msgs { max-height: 112px; }
  .chat-slot .chat-panel.tall .msgs { max-height: 55vh; }
}
/* laptops: the status bar on top, your move at the bottom of the left column, the chat filling between */
@media (min-width: 980px) {
  .game .col-left { height: calc(100dvh - 40px); display: flex; flex-direction: column; gap: 10px; }
  .chatui .grow { display: none; }
}
.chatui .grow { background: none; border: 0; color: var(--dim); font-size: 18px; padding: 0 6px; cursor: pointer; }
#chat-dock .chatui .grow { display: none; }
.chatui li.ev { display: flex; gap: 6px; color: var(--dim); font-size: 12px; padding: 1px 0; }
.chatui li.ev .txt { color: var(--dim); }
.chatui li.ev small { color: var(--dim); opacity: .8; }
.chatui li.ev .evi { width: 22px; text-align: center; flex: none; }
.tag-legend .tl { min-height: 20px; }
.chat-panel header { gap: 6px; } .chat-panel header .chan { flex: 1; }

/* ---------- the compact lobby: status line, teams, two folded rows, the big button at the bottom */
.lobby.compact { gap: 10px; }
.lobby-status { margin: 0; padding: 10px 12px; border-radius: 12px; background: rgba(0,0,0,.25); border: 1px solid var(--wood-line); font-size: 14px; color: var(--ink);
  display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; justify-content: space-between; }
.lobby-status.go { border-color: var(--go); background: color-mix(in srgb, var(--go) 14%, transparent); }
.lobby-status b#countdown { font-family: var(--f-pixel); color: var(--bag); font-size: 20px; }
.lobby-status .share-now { padding: 5px 10px; font-size: 13px; }
.fold { padding: 10px 12px; display: block; }
.fold > * + * { margin-top: 10px; }
.fold summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; font-size: 14px; }
.fold summary::-webkit-details-marker { display: none; }
.fold .lbl { width: 52px; flex: none; }
.fold .edit { margin-left: auto; font-size: 12px; color: var(--bag); text-decoration: underline; }
.fold[open] .edit { visibility: hidden; }
.fold.flat { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 14px; }
.fold .sel { display: grid; gap: 4px; font-size: 12px; color: var(--dim); }
.small { font-size: 12px; margin: 0; }
.center { text-align: center; }
.go-bar { position: sticky; bottom: 0; padding: 10px 0 12px; background: linear-gradient(transparent, var(--felt) 35%); }
.go-bar .big { width: 100%; }
/* start page: how many people; the invite's optional picks */
.people { display: flex; flex-wrap: wrap; gap: 6px; }
.people .chip { min-width: 46px; font-size: 18px; font-weight: 700; padding: 8px 0; }
.people-card { gap: 10px; }
.join-card .opt { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.join-card .opt .lbl { width: 52px; }

/* beside the ⚙️ on the start page: "Sign in" (gold, for a guest) or your name; it opens the account panel */
.account { display: flex; min-width: 0; max-width: 46vw; }
body:not([data-screen="start"]) #gear-dock .account { display: none; }
.account:empty { display: none; }
.acct-chip { height: 36px; font-size: 14px; padding: 0 14px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-chip.primary { background: var(--bag); color: var(--on-bag); border-color: var(--bag-light); font-weight: 600; }
#account-sheet { background: var(--scrim); place-items: center; pointer-events: auto; }   /* centred, dimmed: even where other sheets dock at the side */
.acct-sheet { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.acct-sheet header { align-self: stretch; }
.acct-body { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.acct-body .mark { image-rendering: pixelated; }
.acct-body .who { margin: 0; font-size: 18px; font-weight: 700; color: var(--ink); }
.acct-body .note { margin: 0; max-width: 34ch; }
#gbtn { color-scheme: light; min-height: 44px; }   /* Google's button frame paints a white box under a dark color-scheme */

/* the computer players' robot (instead of the 🤖 emoji) */
.bot-ic { width: 1.35em; height: 1.35em; vertical-align: -0.3em; image-rendering: pixelated; display: inline-block; }

/* the "/" menu of typed moves, just above the chat box */
.chatui .cmd-menu { list-style: none; margin: 0 10px; padding: 4px; border: 1px solid var(--bag); border-radius: 10px; background: var(--wood-deep); font-size: 13px; }
.chatui .cmd-menu li { padding: 5px 8px; border-radius: 6px; cursor: pointer; color: var(--ink); }
.chatui .cmd-menu li[aria-selected="true"], .chatui .cmd-menu li:hover { background: color-mix(in srgb, var(--bag) 18%, transparent); }
.chatui .cmd-menu code { font: 700 13px ui-monospace, Menlo, monospace; color: var(--bag); margin-right: 6px; }

/* ---------- whose turn: a strip over the board in the moving team's colour, and who in it is done */
.turn-banner { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; margin-bottom: 6px; padding: 7px 12px; border-radius: 10px;
  border: 2px solid #120a1a; color: #fff; font-size: 14px; box-shadow: 0 3px 0 rgba(0,0,0,.35); }
.turn-banner.C { background: linear-gradient(var(--mule-light), var(--mule)); }
.turn-banner.P { background: linear-gradient(var(--cop-light), var(--cop)); }
.turn-banner b { font: 400 17px/1 var(--f-pixel); letter-spacing: .5px; text-shadow: 0 2px 0 rgba(0,0,0,.35); }
.turn-banner .you { background: var(--go); color: var(--on-go); font-weight: 700; padding: 2px 8px; border-radius: 999px; animation: nudge 1.4s ease-in-out infinite; }
.turn-banner .what { opacity: .95; }
.turn-banner .pips { display: inline-flex; gap: 5px; margin-left: auto; }
.turn-banner .pips i { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; font: 800 12px/1 var(--f-ui); font-style: normal;
  border: 2px solid rgba(255,255,255,.85); color: #fff; background: rgba(0,0,0,.18); }
.turn-banner .pips i.ok { background: var(--go); border-color: #120a1a; }
@keyframes nudge { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@media (prefers-reduced-motion: reduce) { .turn-banner .you { animation: none; } }
.turn-banner ~ .band-note { top: 56px; }
/* the team key under the board: the moving team lit, the other one quiet; each mover says done or how many to go */
.tag-legend .tl { padding: 3px 6px; border-radius: 8px; border-left: 3px solid transparent; }
.tag-legend .tl.now.C { background: color-mix(in srgb, var(--mule) 18%, transparent); border-left-color: var(--mule); }
.tag-legend .tl.now.P { background: color-mix(in srgb, var(--cop) 20%, transparent); border-left-color: var(--cop); }
.tag-legend .tl.idle { opacity: .6; }
.tag-legend .st { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 999px; margin-left: 2px; }
.tag-legend .st.go { background: color-mix(in srgb, var(--bag) 22%, transparent); color: var(--bag); }
.tag-legend .st.ok { background: color-mix(in srgb, var(--go) 20%, transparent); color: var(--go); }
@media (max-width: 520px) {
  .turn-banner { flex-wrap: nowrap; gap: 8px; padding: 6px 10px; font-size: 13px; }
  .turn-banner b { font-size: 14px; white-space: nowrap; }
  .turn-banner .you { white-space: nowrap; padding: 2px 6px; }
  .turn-banner .pips { gap: 3px; } .turn-banner .pips i { width: 20px; height: 20px; font-size: 11px; }
}
/* the character you're on, in the turn strip: its sprite, piece and call name */
.turn-banner .who { display: inline-flex; align-items: center; gap: 6px; background: rgba(18,10,26,.35); border-radius: 999px; padding: 0 10px 0 2px; height: 30px; }
.turn-banner .who canvas { width: 26px; height: 31px; image-rendering: pixelated; margin-top: -4px; }
.turn-banner .who b { font: 700 14px/1 var(--f-ui); text-shadow: none; letter-spacing: 0; }
.turn-banner .who q { font-style: italic; color: var(--ink-warm); quotes: "“" "”"; }
@media (max-width: 520px) {
  .turn-banner:has(.who) { flex-wrap: wrap; }
  .turn-banner .who { order: 3; flex-basis: 100%; background: none; padding: 0; height: 26px; }
}

/* ---------- the board theme drives every colour (Settings → Look → Game theme; art.ts paints the board).
   West Texas is the :root default above: walnut panels, brass trim, a green felt table. Each theme below
   replaces the whole set, and its --felt/--texture is the table you get with "The theme's own". */
:root[data-theme="city"] {   /* Border City: steel and concrete, neon cyan and green, an asphalt table */
  --felt: #2c2e34; --felt-dark: #17181c; --felt-light: #3c3f47;
  --panel: rgba(26, 28, 34, .94); --panel-solid: #1c1e24; --panel-edge: #5c6474; --wood: #2a2d35; --wood-line: #3e434e; --wood-deep: #14161a;
  --ink: #e8ecf2; --dim: #9aa3b2; --ink-bright: #ffffff; --ink-warm: #c8f4ff; --muted: #5c6474;
  --bag: #3fd2e8; --bag-light: #a8f0fa; --bag-shadow: #1a7a8a; --on-bag: #04161a;
  --go: #3fe07a; --go-light: #a8f8c4; --go-shadow: #1a7a3e; --on-go: #04200e;
  --alt: #ff5ab0; --alt-light: #ffa8d8; --alt-shadow: #8a1e5a; --on-alt: #2a0418;
  --danger: #ff4a5a; --danger-ink: #ff9aa4;
  --logo-1: #1a7a8a; --logo-2: #04161a; --logo-glow: rgba(63, 210, 232, .45);
  --scrim: rgba(6, 8, 12, .66);
  --mule: #ff7a2e; --mule-light: #ffa060; --mule-dark: #7a2e08; --cop: #4a6cff; --cop-light: #7a94ff; --cop-dark: #1a2a7a; --cop-ink: #a0b4ff;   /* neon orange against electric blue */
  --texture: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='9'%3E%3Cpath d='M1 2h1v1H1zM6 1h1v1H6zM4 6h1v1H4zM8 7h1v1H8z' fill='%23fff' fill-opacity='.05'/%3E%3Cpath d='M3 4h1v1H3zM7 4h1v1H7zM1 8h1v1H1z' fill='%23000' fill-opacity='.18'/%3E%3C/svg%3E");
}
:root[data-theme="harbor"] {   /* Harbor: navy steel, container yellow, sea-green, a deep water table */
  --felt: #163450; --felt-dark: #0b1c2e; --felt-light: #22486c;
  --panel: rgba(16, 30, 46, .94); --panel-solid: #12203a; --panel-edge: #6a8aa6; --wood: #1c2e44; --wood-line: #2e4762; --wood-deep: #0c1726;
  --ink: #eef3f8; --dim: #a4b6c8; --ink-bright: #ffffff; --ink-warm: #ffe8a0; --muted: #4e6680;
  --bag: #e8c840; --bag-light: #f8e494; --bag-shadow: #8a7418; --on-bag: #1a1400;
  --go: #4ad8a0; --go-light: #a8f0d4; --go-shadow: #1e7a56; --on-go: #04201a;
  --alt: #d8543a; --alt-light: #f09a84; --alt-shadow: #7a2414; --on-alt: #2a0a04;
  --logo-1: #8a7418; --logo-2: #1a1400; --logo-glow: rgba(232, 200, 64, .4);
  --scrim: rgba(4, 10, 18, .66);
  --mule: #d8543a; --mule-light: #ec7a60; --mule-dark: #6a1e10; --cop: #5aa0e0; --cop-light: #84bcf0; --cop-dark: #1e4a7a; --cop-ink: #a8d0f4;   /* rust red against steel sky */
  --texture: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='8'%3E%3Cpath d='M0 6q4-3 8 0t8 0' fill='none' stroke='%23fff' stroke-opacity='.05'/%3E%3C/svg%3E");
}
:root[data-theme="beach"] {   /* Gulf Beach: deep teal, driftwood sand, coral, a sea-blue table */
  --felt: #17637e; --felt-dark: #0b3448; --felt-light: #2683a6;
  --panel: rgba(14, 52, 64, .93); --panel-solid: #103642; --panel-edge: #e8d2a2; --wood: #1a4a58; --wood-line: #2a6676; --wood-deep: #0a2a34;
  --ink: #fff8ec; --dim: #b8d6d6; --ink-bright: #ffffff; --ink-warm: #ffe0c8; --muted: #4e8288;
  --bag: #ff8a5a; --bag-light: #ffc4a8; --bag-shadow: #a84824; --on-bag: #2a0e02;
  --go: #6ae0c0; --go-light: #b8f6e6; --go-shadow: #2a8a72; --on-go: #042420;
  --alt: #f6d064; --alt-light: #fce69a; --alt-shadow: #9a7a1e; --on-alt: #2a1e02;
  --danger: #ff5a6a; --danger-ink: #ffa8b0;
  --logo-1: #a84824; --logo-2: #2a0e02; --logo-glow: rgba(255, 138, 90, .45);
  --scrim: rgba(4, 18, 24, .62);
  --mule: #e8508a; --mule-light: #f48ab0; --mule-dark: #7a1a40; --cop: #3a8ad8; --cop-light: #6aaaf0; --cop-dark: #164070; --cop-ink: #9cc8f4;   /* sunset magenta against lifeguard blue */
  --texture: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12'%3E%3Cpath d='M0 3q3-2 6 0t6 0M0 9q3-2 6 0t6 0' fill='none' stroke='%23fff' stroke-opacity='.045'/%3E%3C/svg%3E");
}
:root[data-theme="japan"] {   /* Castle Town at night: indigo lacquer, vermilion, washi paper, jade; the night forest table */
  --felt: #101a3a; --felt-dark: #0a1028; --felt-light: #142044;
  --panel: rgba(12, 16, 34, .93); --panel-solid: #0e1226; --panel-edge: #b8382a; --wood: #1a1e34; --wood-line: #2c3250; --wood-deep: #080b18;
  --ink: #ece6d8; --dim: #9aa0b8; --ink-bright: #fffaf0; --ink-warm: #ffd8a0; --muted: #3e4462;
  --bag: #e8503a; --bag-light: #f8a08a; --bag-shadow: #7a1c10; --on-bag: #fff4ec;
  --go: #6ab890; --go-light: #b4e4c8; --go-shadow: #2a6a4a; --on-go: #04180e;
  --alt: #c8a050; --alt-light: #ecd090; --alt-shadow: #6a5020; --on-alt: #1e1404;
  --danger: #ff5a4a; --danger-ink: #ffa89a;
  --logo-1: #7a1c10; --logo-2: #0a0204; --logo-glow: rgba(232, 80, 58, .45);
  --scrim: rgba(4, 6, 16, .66);
  --mule: #d84a32; --mule-light: #ec7a5e; --mule-dark: #6a1a10; --cop: #4a6ac8; --cop-light: #7a94e0; --cop-dark: #1a2a64; --cop-ink: #9cb4ec;   /* the ninjas' vermilion against indigo */
}

:root[data-theme="night"] {   /* West Texas at night: the walnut and brass by lamplight, a moonlit indigo table */
  --felt: #141c40; --felt-dark: #0a1028; --felt-light: #1e2858;
  --panel: rgba(30, 22, 30, .93); --panel-solid: #1e161e; --panel-edge: #8a7044; --wood: #2a2028; --wood-line: #44363c; --wood-deep: #140e14;
  --ink: #efe6d4; --dim: #aaa2a8; --ink-bright: #fff6d8; --ink-warm: #ffd890; --muted: #5a4e56;
  --logo-1: #9a4a10; --logo-2: #2a0e04; --logo-glow: rgba(255, 190, 90, .5);
  --scrim: rgba(4, 6, 16, .66);
  --mule: #e8862c; --mule-light: #f4a860; --mule-dark: #6e3a0e; --cop: #5a8ae0; --cop-light: #84aaf0; --cop-dark: #1e3a70; --cop-ink: #a4c0f4;   /* lamplight amber against moonlit blue */
}

/* the table (Settings → Look → Table): "The theme's own" (above), or a fixed felt that overrides it */
:root:not([data-table="theme"]) { --texture: var(--grain); }
:root[data-table="green"] { --felt: #1d4d37; --felt-dark: #12301f; --felt-light: #2b6a4b; }
:root[data-table="red"] { --felt: #5a1f22; --felt-dark: #34110f; --felt-light: #7a2a2a; }
:root[data-table="blue"] { --felt: #1c3857; --felt-dark: #0f2034; --felt-light: #2a5280; }
:root[data-table="black"] { --felt: #1f1f22; --felt-dark: #111113; --felt-light: #2f2f34; }
/* a painted scene behind the table (art.ts backdrop): the night forest (Castle Town's own, or picked), or the
   West Texas desert by day or night (their own). settings.ts sets data-scene; crisp pixels */
:root[data-table="forest"] { --felt: #101a3a; --felt-dark: #0a1028; --felt-light: #142044; }
:root[data-scene] { background: var(--felt-dark); }
:root[data-scene] body { background: transparent; }
/* West Texas, day or night: CHASE in saloon letters, like a wanted poster */
:root[data-theme="texas"], :root[data-theme="night"] { --f-logo: "Rye", var(--f-pixel); }
:root[data-scene] .tag-legend { text-shadow: 0 1px 0 rgba(0,0,0,.75), 0 0 6px rgba(0,0,0,.6); color: var(--ink-bright); }
:root[data-scene] .start .tag { color: var(--ink-bright); text-shadow: 0 1px 0 rgba(0,0,0,.7), 0 0 10px rgba(0,0,0,.55); }   /* legible on the sky */
:root[data-scene] body::before { content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: var(--backdrop, none) center bottom / cover no-repeat; image-rendering: pixelated; }

/* ---------- Settings: the ⚙️ button on every screen and the sheet it opens */
.gear { background: var(--wood-deep); border: 1px solid var(--wood-line); border-radius: 8px; padding: 2px 7px; font-size: 15px; line-height: 1.3; }
.gear:hover { border-color: var(--panel-edge); }
/* the one ⚙️, in the screen's top-right corner on every screen; the corners it shares make room for it */
#gear-dock { position: fixed; top: max(10px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); z-index: 55; display: flex; align-items: center; gap: 8px; }
.gear-wrap { position: relative; display: block; }
#gear-dock .gear, #gear-dock .acct-chip { height: 36px; border: 1px solid var(--wood-line); box-shadow: 0 3px 10px rgba(0, 0, 0, .35); }
#gear-dock .gear { width: 38px; padding: 0; display: grid; place-items: center; font-size: 18px; }
.lobby .top, .tutorial .top, .bar-head { padding-right: 46px; }
.sheet-back { position: fixed; inset: 0; z-index: 60; background: var(--scrim); display: grid; place-items: center; padding: 14px; }
.sheet { width: min(460px, 100%); max-height: calc(100dvh - 28px); overflow-y: auto; background: var(--panel); border: 2px solid var(--panel-edge); border-radius: 16px;
  padding: 12px 18px 16px; box-shadow: 0 20px 60px rgba(0,0,0,.55); animation: flyin .3s cubic-bezier(.2,1.3,.4,1) both; }
.sheet.again { animation: none; }
/* the tabbed sheet (Settings): a fixed frame, so switching tabs never makes it jump; tabs on top, the page scrolls inside */
.sheet.tabbed { background: var(--panel-solid); display: flex; flex-direction: column; height: min(600px, calc(100dvh - 28px)); overflow: hidden; padding-bottom: 10px; }
.tabs { display: flex; gap: 2px; margin: 8px -18px 0; padding: 0 12px; border-bottom: 1px solid var(--wood-line); overflow-x: auto; scrollbar-width: none; flex: none; }
.tab { display: flex; align-items: center; gap: 6px; background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  padding: 9px 12px 8px; font-size: 14px; font-weight: 500; color: var(--dim); white-space: nowrap; border-radius: 8px 8px 0 0; }
.tab .ic { font-size: 15px; line-height: 1; }
.tab:hover { color: var(--ink); background: rgba(255,255,255,.04); }
.tab[aria-selected="true"] { color: var(--bag); border-bottom-color: var(--bag); }
.tab:focus-visible { outline: 2px solid var(--bag); outline-offset: -2px; }
.tab-page { flex: 1; overflow-y: auto; padding: 10px 2px 4px; display: grid; gap: 2px; align-content: start; }
.tab-page > h3:first-child { margin-top: 0; }
.sheet.tabbed > .note { flex: none; margin: 8px 0 0; padding-top: 8px; border-top: 1px solid var(--wood-line); }
.tabs .tab { flex: 1 1 auto; justify-content: center; }
@media (max-width: 480px) {   /* phones: icon over label, so five tabs fit */
  .tab { flex-direction: column; gap: 2px; padding: 7px 4px 6px; font-size: 12px; }
  .tab .ic { font-size: 17px; }
}
.sheet header { display: flex; align-items: center; justify-content: space-between; }
.sheet h2 { margin: 0; font: 400 20px/1.2 var(--f-pixel); color: var(--bag); }
.sheet .pick { display: flex; align-items: center; gap: 8px; }
.sheet .pick .dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--wood-line); flex: none; }
.sheet .pick .dot.felt { border-radius: 5px; }
/* the Admin tab (admin.ts): one card per room, the housekeeping buttons below */
.admin-rooms { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.admin-room { background: var(--wood-deep); border: 1px solid var(--wood-line); border-radius: 10px; padding: 8px 10px; display: grid; gap: 4px; font-size: 13px; }
.ar-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; } .ar-head .code { font-size: 16px; letter-spacing: 2px; } .ar-head small { color: var(--dim); margin-left: auto; }
.ar-who .off { color: var(--dim); text-decoration: line-through; } .ar-who small { color: var(--dim); }
.ar-acts, .admin-tools { display: flex; gap: 6px; flex-wrap: wrap; } .admin-tools { margin-bottom: 8px; } .admin-tools a.chip { text-decoration: none; color: inherit; }
.admin-note { background: var(--go-shadow); border: 1px solid var(--go); border-radius: 8px; padding: 6px 10px; margin: 0 0 6px; font-size: 13px; }
.admin-login { display: grid; gap: 8px; } .admin-login .err { color: var(--danger-ink); margin: 0; font-size: 13px; }
.invite-page { display: grid; gap: 8px; justify-items: center; text-align: center; padding-top: 8px; } .invite-page .code { font-size: 34px; letter-spacing: 8px; }
.tab-page .acct-body { padding-top: 8px; }
.sheet .x { background: none; border: 0; color: var(--dim); font-size: 26px; line-height: 1; padding: 0 4px; }
.sheet h3 { margin: 16px 0 6px; font-size: 12px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--dim); border-bottom: 1px solid var(--wood-line); padding-bottom: 4px; }
.sheet .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; flex-wrap: wrap; }
.sheet .row > span { color: var(--ink); }
.sheet .row.two { flex-wrap: nowrap; align-items: end; }
.sheet .row.two label { display: grid; gap: 3px; font-size: 12px; color: var(--dim); flex: 1; }
.sheet .row.two label.tag-edit { flex: 0 0 84px; }
.sheet input:not([type]), .sheet select { font: 15px var(--f-ui); color: var(--ink); background: var(--wood-deep); border: 1px solid var(--wood-line); border-radius: 8px; padding: 6px 8px; width: 100%; }
.sheet #set-tag { text-transform: uppercase; font-weight: 800; text-align: center; }
.sheet select { width: auto; }
.sheet .row.profile select { flex: 1; }
.sheet .row > input { flex: 0 1 200px; width: auto; }
.sheet .chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.sheet .swatches { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.sheet .sw.felt { width: 34px; border-radius: 8px; }
.sheet .note { margin: 6px 0 0; font-size: 12px; color: var(--dim); }
/* a switch: the checkbox hides behind a sliding knob */
.sheet .switch { cursor: pointer; }
.sheet .switch input { position: absolute; opacity: 0; pointer-events: none; }
.sheet .switch i { flex: none; width: 42px; height: 24px; border-radius: 999px; background: var(--wood-deep); border: 1px solid var(--wood-line); position: relative; transition: background .15s; }
.sheet .switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--dim); transition: transform .15s, background .15s; }
.sheet .switch input:checked + i { background: color-mix(in srgb, var(--go) 35%, transparent); border-color: var(--go); }
.sheet .switch input:checked + i::after { transform: translateX(18px); background: var(--go); }
.sheet .switch input:focus-visible + i { outline: 2px solid var(--bag); outline-offset: 2px; }
.sheet .row.stack { display: grid; gap: 6px; justify-content: stretch; }
.sheet .row.stack .chips, .sheet .row.stack .swatches { justify-content: flex-start; }
.sheet .chips.boards { display: grid; grid-template-columns: 1fr 1fr; }
.sheet .chips.boards .chip { text-align: left; }
.sheet .row.stack .swatches { gap: 8px; }
/* the colour: one quiet line of small dots, not a block of big buttons */
.sheet .row.colour { flex-wrap: nowrap; }
.sheet .row.colour .swatches { flex-wrap: nowrap; gap: 5px; }
.sheet .row.colour .sw { width: 18px; height: 18px; border-width: 1px; flex: none; }
.sheet .row.colour .sw[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--panel-solid), 0 0 0 4px var(--ink); }
@media (max-width: 420px) { .sheet .row.stack .swatches .sw { width: 26px; height: 26px; } .sheet .row.stack .swatches { gap: 5px; } }
