/* One colour for everything that is pressed or marks a choice: the text colour, as on Playhall
   (--accent, kept as a name). --hint is the amber that marks pieces on the board. */
:root {
  /* dark: Playhall's own dark colours (its public/style.css), so the games and the portal read as one place */
  --bg: #191714;
  --panel: #221f1b;
  --panel-2: #2a251f;
  --line: #3a352e;
  --text: #ece6da;
  --muted: #9c9287;
  --accent: var(--text);
  --accent-ink: var(--panel);
  --hint: #e0a94a;
  --danger: #d9634f;
  --ok: #6fbf73;
  --s0: #cf3a30;
  --s1: #2f74c8;
  --s2: #2f9d4e;
  --s3: #ecb51f;
  --s4: #8455c9;
  --s5: #e0559f;
  --green: #2f9d4e;
  --red: #cf3a30;
  --radius: 12px;
}
/* Light: Playhall's own light colours too. When the device asks for it, unless the player chose dark; or when the player chose
   light (scheme.js sets data-scheme on <html>). The light colours are therefore written twice:
   keep the two blocks the same. */
@media (prefers-color-scheme: light) {
  :root:not([data-scheme="dark"]) {
    --bg: #f4f1ea;
    --panel: #fffdf8;
    --panel-2: #efe8da;
    --line: #d9d2c5;
    --text: #2e2a24;
    --muted: #7d746a;
    --accent: var(--text);
    --accent-ink: var(--panel);
    --hint: #b9781a;
  }
}
:root[data-scheme="light"] {
  --bg: #f4f1ea;
  --panel: #fffdf8;
  --panel-2: #efe8da;
  --line: #d9d2c5;
  --text: #2e2a24;
  --muted: #7d746a;
  --accent: var(--text);
  --accent-ink: var(--panel);
  --hint: #b9781a;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-tap-highlight-color: transparent;
}
.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; max-width: 1120px; margin: 0 auto;
}
.brand { color: var(--text); text-decoration: none; font-weight: 700; font-size: 20px; letter-spacing: .02em; }
.brand { display: inline-flex; align-items: center; gap: 8px; }
.brand-mark { width: 26px; height: 26px; flex: none; }
.brand-mark rect { fill: var(--accent); }
.brand-mark circle { fill: var(--accent-ink); }
.brand-mark path { fill: none; stroke: var(--accent-ink); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.btn {
  appearance: none; border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  padding: 10px 14px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px;
}
.btn:hover { border-color: var(--muted); }
.btn:focus-visible, .chip input:focus-visible + span, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--danger); }
.btn.danger.armed { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.btn.big { width: 100%; font-size: 18px; padding: 14px; }
.btn:disabled { opacity: .5; cursor: default; }

/* Home screen */
.home { max-width: 560px; margin: 0 auto; padding: 8px 16px 40px; }
.home h1 { font-size: 30px; margin: 12px 0 4px; }
.lead { color: var(--muted); margin: 0 0 20px; }
fieldset { border: 0; padding: 0; margin: 0 0 22px; }
legend { font-weight: 700; margin-bottom: 8px; padding: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip > span {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 76px; min-height: 48px; padding: 6px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-weight: 600;
}
.chip > span small { font-weight: 400; color: var(--muted); font-size: 12px; }
.chip input:checked + span { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); color: var(--accent); }
.custom { display: flex; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.custom label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); flex: 1; min-width: 140px; }
.linkrow input, .joinrow input {
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; font: inherit; min-height: 44px; min-width: 0;
}
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { width: 22px; height: 22px; accent-color: var(--accent); }
.switch small { color: var(--muted); }

/* Home screen: back to the game against the computer */
/* Joining with a short code */
.join {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; margin: 0 0 22px;
}
.join label { display: block; font-weight: 700; margin-bottom: 8px; }
.joinrow { display: flex; gap: 8px; }
.joinrow input { flex: 1; text-transform: uppercase; letter-spacing: .12em; font-weight: 600; }
.joinrow input::placeholder { color: var(--muted); opacity: .6; font-weight: 400; }
.join-error { color: var(--danger); font-size: 14px; margin: 8px 0 0; }

/* Home screen: the rules */
.rules { margin-top: 26px; color: var(--muted); }
.rules summary { cursor: pointer; font-weight: 700; color: var(--text); }
.rules ul { margin: 10px 0 0; padding-left: 20px; }
.rules li { margin-bottom: 6px; }

/* Game */
.game { max-width: 1120px; margin: 0 auto; padding: 0 12px 24px; }
.invite {
  background: var(--panel); border: 1px solid var(--accent); border-radius: var(--radius);
  padding: 14px 16px; margin: 0 auto 14px; max-width: 720px;
}
.invite h2 { margin: 0 0 2px; font-size: 20px; }
.invite p { margin: 0 0 10px; color: var(--muted); }
.linkrow { display: flex; gap: 8px; flex-wrap: wrap; }
.linkrow input { flex: 1 1 220px; }
.invite-more {
  display: flex; flex-wrap: wrap; gap: 16px; align-items: center;
  margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line);
}
.qr { flex: none; width: 148px; height: 148px; border-radius: 8px; overflow: hidden; background: #fff; }
.qr svg { display: block; width: 100%; height: 100%; }
.invite-alt { flex: 1 1 220px; }
.invite-alt p:last-child { margin-bottom: 0; }
.coderow { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.code {
  font: 700 26px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .12em; color: var(--text); user-select: all; white-space: nowrap;
}
.invite .start { margin-top: 10px; width: 100%; border-color: var(--accent); }
.warn { color: var(--hint) !important; font-size: 14px; margin: 10px 0 0 !important; }

/* The game screen. Narrow: the target card and status, the square, my path, the players, one
   under the other. Wide: the square and my path on the left, the rest in a column on the right. */
.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; max-width: 720px; margin: 0 auto; }
.tablecol { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.board-frame {
  width: min(100%, max(250px, 100dvh - 330px)); max-width: 560px; margin: 0 auto; padding: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
}
@media (min-width: 900px) {
  .layout { max-width: none; grid-template-columns: minmax(0, 1fr) 320px; grid-template-rows: auto 1fr; gap: 12px 20px; align-items: start; }
  .tablecol { grid-column: 1; grid-row: 1 / span 2; }
  .layout > .turn { grid-column: 2; grid-row: 1; }
  .side { grid-column: 2; grid-row: 2; }
  .board-frame { width: min(100%, max(300px, 100dvh - 200px)); max-width: 620px; }
}

/* The square: 25 number cards. A card is a button; the path is drawn by tapping cards, and the
   sign of each step sits between its two cards. --tone is the colour of the target card. */
.board {
  --tone: var(--hint);
  position: relative; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); aspect-ratio: 1;
  container-type: inline-size; user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
.board.green { --tone: var(--green); }
.board.red { --tone: var(--red); }
.cell {
  appearance: none; border: 0; background: none; padding: 0; margin: 0; font: inherit; color: inherit;
  display: grid; place-items: center; aspect-ratio: 1; min-width: 0; cursor: pointer;
}
.cell:disabled { cursor: default; color: inherit; }
.cell .num {
  width: 88%; aspect-ratio: 1; display: grid; place-items: center; border-radius: 16%;
  background: color-mix(in srgb, var(--text) 7%, var(--panel)); border: 2px solid var(--line);
  font-weight: 800; font-size: 28px; font-size: 9.5cqw; line-height: 1; font-variant-numeric: tabular-nums;
  transition: background .12s, border-color .12s, transform .12s;
}
/* where every path starts */
.cell.center .num { border-color: var(--text); box-shadow: 0 0 0 2px var(--text); }
.cell.in .num { background: color-mix(in srgb, var(--tone) 30%, var(--panel)); border-color: var(--tone); }
.cell.in.center .num { box-shadow: 0 0 0 2px var(--tone); }
.cell.end .num { box-shadow: 0 0 0 3px var(--tone); }
.board.mine .cell.can .num { border-style: dashed; border-color: var(--tone); }
.board.mine .cell.can:hover .num { background: color-mix(in srgb, var(--tone) 14%, var(--panel)); }
.board.mine .cell:active .num { transform: scale(.94); }
.cell:focus-visible { outline: none; }
.cell:focus-visible .num { outline: 2px solid var(--text); outline-offset: 2px; }
.board.shown .cell:not(.in) .num { opacity: .55; }
.sign {
  appearance: none; position: absolute; transform: translate(-50%, -50%); z-index: 2; padding: 0; margin: 0;
  width: 22px; width: max(22px, 6.6cqw); aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  background: var(--panel); color: var(--tone); border: 2px solid var(--tone);
  font: 800 16px/1 system-ui, sans-serif; font-size: max(15px, 4.6cqw);
}
button.sign { cursor: pointer; }
.sign.minus { background: var(--tone); color: #fff; }
.sign:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

/* Under the square: the path written out, and its buttons */
.pathbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px;
}
.expr { flex: 1 1 100%; min-height: 28px; font-weight: 700; font-size: 20px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.pathbtns { display: flex; gap: 8px; flex: 1 1 auto; }
.pathbtns .btn { flex: 1; }
.pathbtns #done { flex: 1.4; }
@media (min-width: 560px) {
  .expr { flex: 1 1 200px; }
  .pathbtns { flex: 0 0 auto; }
}

/* Status and the target card of the round */
.turn {
  display: flex; align-items: center; gap: 14px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px; min-height: 74px;
}
.goal {
  flex: none; width: 62px; height: 84px; border-radius: 10px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; background: var(--hint); color: #1b1508;
  box-shadow: 3px 3px 0 color-mix(in srgb, var(--text) 80%, transparent), 0 6px 10px rgba(0, 0, 0, .2);
}
.goal.green { background: var(--green); color: #fff; }
.goal.red { background: var(--red); color: #fff; }
.goal-num { font-weight: 800; font-size: 34px; line-height: 1; font-variant-numeric: tabular-nums; }
.goal-need { font-weight: 800; font-size: 18px; line-height: 1; letter-spacing: .12em; min-height: 18px; margin-right: -.12em; }
.goal-need:empty { display: none; }
.s0 { --c: var(--s0); } .s1 { --c: var(--s1); } .s2 { --c: var(--s2); } .s3 { --c: var(--s3); } .s4 { --c: var(--s4); } .s5 { --c: var(--s5); }
.status { font-weight: 600; font-size: 17px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.status-note { font-weight: 400; font-size: 14px; color: var(--muted); }

.players { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.player {
  display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 12px; min-height: 42px;
}
.player.turn { border-color: var(--c); box-shadow: inset 0 0 0 1px var(--c); }
.player.winner { border-color: var(--ok); box-shadow: inset 0 0 0 1px var(--ok); }
.player .dot { flex: none; width: 14px; height: 14px; border-radius: 50%; background: var(--c); }
.player .name { font-weight: 600; }
.player.absent .name { color: var(--muted); }
.player .tag { font-size: 13px; color: var(--muted); }
.player .tag.you { color: var(--accent); }
.player { flex-wrap: wrap; }
.player .nums { margin-left: auto; display: inline-flex; align-items: center; gap: 12px; font-variant-numeric: tabular-nums; }
.player .score { font-weight: 700; text-align: right; }
.player.out .name { color: var(--muted); }
/* the error card: whoever holds it sits the round out */
.errcard { flex: none; width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; background: #24211c; color: #f2c84b; }
.errcard svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.match { margin: 0; color: var(--muted); font-size: 14px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions .btn { flex: 1; }

@media (prefers-reduced-motion: reduce) {
  .cell .num { transition: none; }
}

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; z-index: 50;
  max-width: calc(100vw - 32px); text-align: center; box-shadow: 0 6px 20px rgba(0, 0, 0, .35);
}

.foot { margin-top: 28px; text-align: center; font-size: 14px; }
.foot a { color: var(--muted); }
.foot a:hover { color: var(--text); }

/* Header: language switch (flags only) next to "New game" */
.top-actions { display: flex; align-items: center; gap: 10px; }
.langs { display: inline-flex; align-items: center; gap: 6px; }
.flag {
  appearance: none; border: 0; background: none; padding: 6px 2px; margin: 0; cursor: pointer; line-height: 0;
  opacity: .45; transition: opacity .15s;
}
.flag svg { display: block; width: 26px; height: 17px; border-radius: 3px; box-shadow: 0 0 0 1px var(--line); }
.flag:hover { opacity: .8; }
.flag[aria-pressed=true] { opacity: 1; cursor: default; }
.flag[aria-pressed=true] svg { box-shadow: 0 0 0 1px var(--bg), 0 0 0 3px var(--accent); }
.flag:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* Foot of the home screen: "Language" opens the list of every language */
.foot { color: var(--muted); }
.foot-link {
  appearance: none; border: 0; background: none; padding: 0; margin: 0; font: inherit; color: var(--muted);
  text-decoration: underline; cursor: pointer;
}
.foot-link:hover { color: var(--text); }
.foot-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.lang-all { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; }
.lang-all[hidden] { display: none; }
.flag.named {
  display: inline-flex; align-items: center; gap: 8px; opacity: 1; line-height: 1.2; font: inherit; font-size: 14px;
  color: var(--text); padding: 7px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel);
}
.flag.named svg { width: 22px; height: 14px; box-shadow: 0 0 0 1px var(--line); }
.flag.named:hover { border-color: var(--muted); }
.flag.named[aria-pressed=true] { border-color: var(--accent); font-weight: 600; }

/* Header: voice chat — the microphone and, while voice is on, a button to leave */
.voice { display: inline-flex; align-items: center; gap: 6px; }
.btn.icon { padding: 6px; min-width: 36px; }
.btn.icon svg, .voice-mark svg {
  display: block; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
#voice-mic.on { border-color: var(--accent); color: var(--accent); }
#voice-mic.on.linked { background: var(--ok); border-color: var(--ok); color: #10210f; }
#voice-mic.on.muted { background: transparent; border-color: var(--danger); color: var(--danger); }
#voice-mic.calling { border-color: var(--ok); color: var(--ok); animation: voice-call 1.6s ease-out infinite; }
@keyframes voice-call {
  from { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent); }
  to { box-shadow: 0 0 0 9px transparent; }
}
@media (prefers-reduced-motion: reduce) { #voice-mic.calling { animation: none; } }
.voice-mark { flex: none; color: var(--muted); line-height: 0; }
.voice-mark svg { width: 14px; height: 14px; }
.voice-mark.linked { color: var(--ok); }
/* The other players are played by <audio> elements that have to be in the page */
.voice-audio { position: absolute; width: 0; height: 0; overflow: hidden; }
/* Narrow phones: in a game the header keeps the mark only, so the buttons fit */
@media (max-width: 560px) {
  body.has-voice .brand [data-i18n] { display: none; }
  body.has-voice .top-actions { gap: 8px; }
}

/* The Playhall bar: the portal's name, its categories, the flags and light/dark. On the start
   screen only; during a game the game's own header is all there is. While it shows, the flags
   are in it, so the ones in the game's header step aside. */
.hall {
  display: flex; align-items: center; gap: 14px;
  max-width: 1120px; margin: 0 auto; padding: 10px 16px 9px;
  border-bottom: 1px solid var(--line); font-size: 14px;
}
body:has(#home[hidden]) .hall { display: none; }
body:has(#home:not([hidden])) .top [data-lang-switch] { display: none; }
.hall-brand { font-weight: 700; font-size: 16px; color: var(--text); text-decoration: none; flex: none; }
.hall-tabs { display: flex; gap: 2px; flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.hall-tabs::-webkit-scrollbar { display: none; }
.hall-tabs a {
  color: var(--muted); text-decoration: none; padding: 5px 9px; border-radius: 7px;
  white-space: nowrap; border: 1px solid transparent;
}
.hall-tabs a:hover { color: var(--text); }
.hall-tabs a[aria-current] { color: var(--text); background: var(--panel); border-color: var(--line); font-weight: 600; }
.hall-tools { display: flex; align-items: center; gap: 10px; flex: none; }
.hall .scheme {
  width: 30px; height: 30px; flex: none; padding: 0; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel); color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
}
.hall .scheme:hover { color: var(--text); border-color: var(--muted); }
.hall .scheme svg { display: block; }
.hall .scheme:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* The start screen and the waiting room, laid out as Playhall's puzzle pages are: one "New game"
   card (friend or computer, the few options, the create button, a friend's code at the bottom),
   and while waiting the seats beside the invite. */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.home .card h1 { margin: 0 0 12px; font-size: 20px; }
.home .card, .home .rowlink { margin-top: 12px; }
.home fieldset { margin: 0 0 16px; }
.home legend { font-weight: 400; font-size: 14px; color: var(--muted); }
.rowlink {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 52px;
  padding: 8px 14px; margin: 0 0 14px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel); color: var(--text); text-decoration: none; font-weight: 600;
}
.rowlink::after { content: "›"; color: var(--muted); font-size: 22px; font-weight: 400; }
.rowlink:hover { border-color: var(--muted); }
.seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 4px; margin: 0 0 16px; background: var(--bg); border-radius: 12px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label > span {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  min-height: 48px; padding: 4px 8px; border: 1px solid transparent; border-radius: 9px;
  cursor: pointer; font-weight: 600; color: var(--muted);
}
.seg small { font-weight: 400; font-size: 12px; }
.seg input:checked + span { background: var(--panel); border-color: var(--line); color: var(--text); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.home .chip > span { min-width: 64px; min-height: 44px; border-radius: 24px; background: transparent; }
.home .chip input:checked + span { background: var(--text); border-color: var(--text); color: var(--panel); box-shadow: none; }
.home .chip input:checked + span small { color: inherit; opacity: .8; }
.chips .more-btn { min-height: 44px; border-radius: 24px; border-style: dashed; background: transparent; color: var(--muted); }
.more { border-top: 1px solid var(--line); margin: 0 0 16px; }
.more summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; cursor: pointer; list-style: none; }
.more summary::-webkit-details-marker { display: none; }
.more summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.more .state { color: var(--muted); font-size: 14px; }
.more .switch { padding: 4px 0 12px; }
.home .btn.primary, .invite .btn.primary, .invite .btn.share { background: var(--text); border-color: var(--text); color: var(--panel); font-weight: 600; }
.or { display: flex; align-items: center; gap: 10px; margin: 16px 0; color: var(--muted); font-size: 14px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.home .join { background: none; border: 0; border-radius: 0; padding: 0; margin: 0; }
.home .join label { font-weight: 400; font-size: 14px; color: var(--muted); }
.home .joinrow input { min-height: 50px; font-size: 20px; letter-spacing: .24em; background: var(--bg); }
.home .joinrow .btn { min-height: 50px; padding: 0 20px; font-weight: 600; border-color: var(--text); }

.invite { background: none; border: 0; padding: 0; max-width: 920px; display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 760px) { .invite { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.invite .count { margin: 0 0 8px; }
.seats { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.seats li { display: flex; align-items: center; gap: 10px; min-height: 54px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 12px; }
.seats li.you { border-color: var(--text); }
.seats li.free { border-style: dashed; border-color: var(--muted); color: var(--muted); }
.seats .av { flex: none; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--muted); }
.seats .av.w { background: #f7f3ea; }
.seats .av.b { background: #23262b; }
.seats .av.s0 { background: var(--s0); } .seats .av.s1 { background: var(--s1); } .seats .av.s2 { background: var(--s2); } .seats .av.s3 { background: var(--s3); } .seats .av.s4 { background: var(--s4); } .seats .av.s5 { background: var(--s5); }
.seats li.free .av { border-style: dashed; }
.seats li.free .av:not(.w):not(.b) { opacity: .55; }
.seats .who { display: flex; flex-direction: column; min-width: 0; }
.seats .who small { color: var(--muted); font-size: 12px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tags:empty { display: none; }
.tags span { font-size: 13px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 14px; }
.invite .start { width: 100%; min-height: 50px; margin-top: 10px; font-size: 17px; }
.invite .linkrow { flex-wrap: nowrap; }
.invite .linkrow input { flex: 1 1 auto; }
.invite .btn.share { flex: 1 1 auto; }
.invite .btn.icon { flex: none; min-width: 46px; }
.invite .btn.icon svg { display: block; width: 20px; height: 20px; margin: auto; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.invite.touch #link, .invite.touch .apps { display: none; }
.invite #code-box { background: var(--bg); border-radius: 10px; padding: 10px 14px; }
.invite #code-box p { font-size: 14px; margin-bottom: 6px; }

/* Inside the game, in the look of the start screen: the main button dark, the others white with
   an outline, round buttons in the header, the game's settings as small labels. The board, the
   pieces and where things sit are untouched. */
.game .btn { background: var(--panel); }
.game .btn.primary { background: var(--text); border-color: var(--text); color: var(--panel); }
.top .btn.small { border-radius: 20px; background: var(--panel); }
.top .btn.icon { border-radius: 50%; }
.game .tags { margin: 0; }
/* The players as seats: a round mark in the player's color. Whose turn it is keeps the outline
   in that player's color. */
.player { border-radius: 12px; min-height: 48px; gap: 10px; }
.player .dot { width: 24px; height: 24px; box-sizing: border-box; border: 1px solid color-mix(in srgb, var(--text) 30%, transparent); }
.player .tag.you { color: var(--muted); }
.match { display: flex; flex-wrap: wrap; gap: 6px; }
.match span { font-size: 13px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--text); }
.match span::first-letter { text-transform: uppercase; }

/* ---------- The end of a game: a card over the board (finale.js) ---------- */
.finale {
  position: fixed; inset: 0; z-index: 45; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(14, 11, 8, .55); animation: finale-in .25s ease-out both;
}
.finale-card {
  width: min(380px, 100%); max-height: 100%; overflow: auto; text-align: center;
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 20px;
  padding: 26px 22px 20px; box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
  animation: finale-pop .45s cubic-bezier(.2, 1.4, .4, 1) both;
}
.finale-mark {
  --tint: var(--muted);
  width: 68px; height: 68px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center;
  background: color-mix(in srgb, var(--tint) 16%, var(--panel)); color: var(--tint);
}
.finale[data-mood="win"] .finale-mark { --tint: var(--accent); background: var(--accent); color: var(--accent-ink); }
.finale[data-mood="plain"] .finale-mark { --tint: var(--accent); }
.finale-mark[style] { background: var(--tint) !important; color: #fff !important; }
.finale-mark svg { width: 36px; height: 36px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.finale-title { margin: 0; font-size: 30px; line-height: 1.15; font-weight: 800; letter-spacing: -.01em; }
.finale-text { margin: 8px 0 0; color: var(--muted); font-size: 16px; line-height: 1.4; }
.finale-rows { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 6px; text-align: left; }
.finale-rows li {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--line);
  border-radius: 999px; font-size: 15px;
}
.finale-rows li.finale-top { border-color: var(--text); font-weight: 700; }
.finale-rows .dot { width: 16px; height: 16px; border-radius: 50%; flex: none; background: var(--muted); }
.finale-rows .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.finale-rows .value { font-variant-numeric: tabular-nums; }
.finale-actions { margin-top: 20px; display: grid; gap: 8px; }
.finale-actions .btn { width: 100%; justify-content: center; text-align: center; min-height: 46px; font-size: 16px; }
.finale .btn.primary { background: var(--text); border-color: var(--text); color: var(--panel); font-weight: 600; }
.finale .btn:not(.primary) { background: var(--panel); }
.finale-actions .finale-close { border-color: transparent; background: none !important; color: var(--muted); min-height: 38px; font-weight: 600; }
.finale-actions .finale-close:hover { color: var(--text); }
#finale-confetti { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 60; pointer-events: none; }
@keyframes finale-in { from { opacity: 0; } }
@keyframes finale-pop { from { opacity: 0; transform: translateY(14px) scale(.92); } }
@media (prefers-reduced-motion: reduce) { .finale, .finale-card { animation: none; } }

/* ---------- Names: the field on the start screen, the pencil and its card (name.js) ---------- */
.home .namefield input, .name-card input {
  width: 100%; box-sizing: border-box; min-height: 46px; padding: 8px 12px; font: inherit; font-size: 16px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--text);
}
.home .namefield input::placeholder, .name-card input::placeholder { color: var(--muted); opacity: .7; }
.name-edit {
  appearance: none; border: 0; background: none; padding: 3px; margin: 0; color: var(--muted); cursor: pointer;
  display: inline-grid; place-items: center; border-radius: 6px; flex: none;
}
.name-edit:hover { color: var(--text); }
.name-edit:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.name-edit svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.seats .name-edit { margin-left: auto; padding: 8px; }
.seats .name-edit svg { width: 18px; height: 18px; }
.name-card { text-align: left; padding-top: 22px; }
.name-card h2 { margin: 0 0 4px; font-size: 20px; }
.name-card p { margin: 0 0 12px; color: var(--muted); font-size: 14px; line-height: 1.4; }
.name-ask { z-index: 46; }

/* ---------- Invite: the buttons that send the link with an app (as in chess and backgammon) ---------- */
.apps { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.tags span::first-letter { text-transform: uppercase; }
