/* The Parlour — reset, layout and shared components. Reads tokens.css. */
@import url('/ui/tokens.css');

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-ui);
  font-size: var(--t-body);
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* one whisper of grain on the tablecloth */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image: var(--grain);
  opacity: var(--grain-opacity);
  pointer-events: none;
  z-index: 0;
  mix-blend-mode: multiply;
}
:root[data-theme="dark"] body::before { mix-blend-mode: screen; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body::before { mix-blend-mode: screen; } }
body > * { position: relative; z-index: 1; }
/* No double-tap-to-zoom anywhere: taps fire immediately, even right after a
   drawing stroke. Canvases and pannable boards set their own touch-action. */
body * { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; margin: 0; letter-spacing: -0.01em; font-variation-settings: 'opsz' 72; }
h1 { font-size: var(--t-h1); }
h2 { font-size: var(--t-h2); }
h3 { font-size: 1.05rem; }
p { margin: 0 0 var(--s-3); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
img, canvas, svg { display: block; max-width: 100%; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-2); }
.small { font-size: var(--t-small); }
.tiny { font-size: var(--t-tiny); }
.display { font-family: var(--font-display); }
.num { font-variant-numeric: tabular-nums; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }

/* ---------- layout ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: var(--s-3);
  padding: 0 var(--s-4);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar .grow { flex: 1; min-width: 0; }
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: var(--s-2); flex: none; }
.wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variation-settings: 'opsz' 144, 'SOFT' 60;
  text-decoration: none !important;
  white-space: nowrap;
}
.wordmark:hover { color: var(--accent); }
.topbar .title { display: flex; align-items: center; gap: var(--s-2); min-width: 0; }
.topbar .title h1 { font-size: 1.15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .back {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--r-pill);
  color: var(--ink-2); flex: none;
  transition: background var(--d-fast), color var(--d-fast);
}
.topbar .back:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.topbar .back svg { width: 20px; height: 20px; }

@media (max-width: 600px) {
  body[data-game] .topbar #profileLink { display: none; }
  .topbar .title .mark { display: none; }
  .topbar .title h1 { font-size: 1.05rem; }
}

.mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 8px; flex: none;
  background: var(--game); color: var(--game-ink);
}
.mark svg { width: 18px; height: 18px; fill: currentColor; }
.mark.lg { width: 44px; height: 44px; border-radius: 12px; }
.mark.lg svg { width: 26px; height: 26px; }

main.page {
  max-width: var(--content-w);
  margin: 0 auto;
  padding: var(--s-5) var(--s-4) calc(var(--s-7) + env(safe-area-inset-bottom));
}
main.page.narrow { max-width: 520px; }
.page-enter { animation: rise var(--d-slow) var(--ease-out) both; }
/* the page container only fades: an animated transform would become the
   containing block for the fixed bottom toolbar */
main.page-enter { animation-name: fade; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: var(--tap);
  padding: 0 var(--s-4);
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
  font-size: var(--t-small);
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: var(--shadow-1);
  user-select: none;
  white-space: nowrap;
  transition: transform var(--d-fast) var(--ease-out), box-shadow var(--d-fast), background var(--d-fast), border-color var(--d-fast), color var(--d-fast), opacity var(--d-fast);
}
.btn:hover:not(:disabled) { border-color: var(--ink-3); background: var(--surface-2); text-decoration: none; }
.btn:active:not(:disabled) { transform: translateY(1px); box-shadow: none; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.game { background: var(--game); border-color: var(--game); color: var(--game-ink); }
.btn.game:hover:not(:disabled) { filter: brightness(1.08); background: var(--game); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn.ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 50%, var(--line)); }
.btn.danger:hover:not(:disabled) { background: var(--bad-soft); }
.btn.sm { min-height: 34px; padding: 0 var(--s-3); font-size: var(--t-tiny); border-radius: 9px; }
.btn.lg { min-height: 52px; padding: 0 var(--s-5); font-size: var(--t-body); }
.btn.block { width: 100%; }
.btn.icon { width: var(--tap); padding: 0; }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* ---------- cards / panels ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
}
.card.pad { padding: var(--s-4); }
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  padding: var(--s-5);
}
.inset {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--inset);
}
.divider { display: flex; align-items: center; gap: var(--s-3); color: var(--ink-3); font-size: var(--t-small); margin: var(--s-4) 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* ---------- fields ---------- */
.field { display: block; margin-bottom: var(--s-4); }
.field > span, .field label { display: block; font-size: var(--t-small); font-weight: 700; color: var(--ink-2); margin-bottom: var(--s-1); }
.input, input.input, select.input {
  width: 100%;
  min-height: var(--tap);
  padding: 0 var(--s-3);
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--ink);
  box-shadow: var(--inset);
  transition: border-color var(--d-fast), box-shadow var(--d-fast);
}
.input::placeholder { color: var(--ink-3); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.code {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  text-align: center;
  padding-left: calc(var(--s-3) + 0.3em);
}
.input.error { border-color: var(--bad); }
.field .hint { font-size: var(--t-tiny); color: var(--ink-3); margin-top: var(--s-1); }
.field .err { font-size: var(--t-small); color: var(--bad); margin-top: var(--s-1); }
select.input { appearance: none; -webkit-appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239a8b7a' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
input[type="range"] { accent-color: var(--accent); }
input[type="color"] { width: 36px; height: 36px; padding: 0; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface-2); cursor: pointer; }
input[type="color"]::-webkit-color-swatch-wrapper { padding: 3px; }
input[type="color"]::-webkit-color-swatch { border: none; border-radius: 4px; }

/* ---------- pills, chips, avatars ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 10px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: var(--t-tiny);
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.pill.code { font-family: var(--font-display); font-size: 0.95rem; letter-spacing: 0.16em; color: var(--ink); padding-right: 6px; cursor: pointer; }
.pill.code:hover { border-color: var(--accent); color: var(--accent); }
.pill.code svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
.pill.game { background: var(--game-soft); border-color: transparent; color: var(--game); }
.pill.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.pill.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.pill.bad { background: var(--bad-soft); border-color: transparent; color: var(--bad); }
.pill.brass { background: var(--brass); border-color: transparent; color: var(--brass-ink); }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); flex: none; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); animation: pulse 1.2s ease-in-out infinite; }
.dot.off { background: var(--bad); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--av, var(--accent));
  color: #fff8f0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  flex: none;
  position: relative;
  box-shadow: var(--shadow-1), inset 0 -2px 0 rgb(0 0 0 / .12);
  text-decoration: none !important;
}
.avatar.empty { background: var(--surface-2); color: var(--ink-3); border: 1px dashed var(--line-strong); box-shadow: none; }
.avatar.lg { width: 56px; height: 56px; font-size: 1.5rem; }
.avatar.sm { width: 26px; height: 26px; font-size: 0.75rem; }
.avatar .crown {
  position: absolute; top: -7px; right: -5px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--brass); color: var(--brass-ink);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-1);
}
.avatar .crown svg { width: 10px; height: 10px; fill: currentColor; }
.avatar.away { filter: saturate(0.3) brightness(0.9); }

/* ---------- status, banner, toast ---------- */
.status {
  display: flex; align-items: center; gap: var(--s-3);
  min-height: 44px;
  padding: var(--s-2) var(--s-4);
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
  font-weight: 700;
  margin-bottom: var(--s-4);
}
.status .lead { width: 4px; align-self: stretch; border-radius: 2px; background: var(--game); flex: none; margin-left: -6px; }
.status.mine { border-color: var(--game); background: var(--game-soft); }
.status.flash { border-color: var(--bad); color: var(--bad); background: var(--bad-soft); }
.status.bump { animation: bump var(--d-slow) var(--ease-pop); }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.015); } 100% { transform: scale(1); } }

.banner {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-2) var(--s-4);
  margin-bottom: var(--s-3);
  border-radius: var(--r-md);
  background: var(--warn-soft);
  border: 1px solid color-mix(in srgb, var(--warn) 50%, transparent);
  color: var(--warn);
  font-weight: 700;
  font-size: var(--t-small);
  animation: rise var(--d-base) var(--ease-out) both;
}

.toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--s-4) + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: var(--s-2); z-index: 60; pointer-events: none; }
.toast {
  padding: 10px 16px;
  border-radius: var(--r-pill);
  background: var(--ink);
  color: var(--bg);
  font-size: var(--t-small);
  font-weight: 700;
  box-shadow: var(--shadow-2);
  animation: toast-in var(--d-base) var(--ease-pop) both;
  max-width: min(92vw, 420px);
  text-align: center;
}
.toast.bad { background: var(--bad); color: #fff; }
.toast.out { animation: toast-out var(--d-base) var(--ease-out) both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }

/* ---------- sheet / dialog ---------- */
.sheet-scrim {
  position: fixed; inset: 0; z-index: 50;
  background: var(--scrim);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade var(--d-base) both;
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.sheet-scrim.closing { animation: fade-out var(--d-base) both; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { to { opacity: 0; } }
.sheet {
  width: 100%;
  max-height: 88dvh;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: var(--shadow-3);
  padding: var(--s-5) var(--s-5) calc(var(--s-5) + env(safe-area-inset-bottom));
  animation: sheet-up var(--d-slow) var(--ease-out) both;
}
.sheet-scrim.closing .sheet { animation: sheet-down var(--d-base) var(--ease-out) both; }
@keyframes sheet-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes sheet-down { to { transform: translateY(16px); opacity: 0; } }
.sheet h2 { margin-bottom: var(--s-2); }
.sheet .actions { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-4); }
.sheet .actions .btn { flex: 1; }
@media (min-width: 601px) {
  .sheet-scrim { align-items: center; padding: var(--s-4); }
  .sheet { width: min(100%, 460px); max-height: 86vh; border-radius: var(--r-lg); border-bottom: 1px solid var(--line); padding-bottom: var(--s-5); }
  .sheet.wide { width: min(100%, 720px); }
}

/* ---------- toolbar ---------- */
.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2);
  padding: var(--s-2) var(--s-3);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
  margin-bottom: var(--s-4);
}
.toolbar .spacer { flex: 1; }
.toolbar label { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-small); color: var(--ink-2); font-weight: 700; }
@media (max-width: 600px) {
  .toolbar.dock {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
    margin: 0;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    border-bottom: none;
    padding-bottom: calc(var(--s-2) + env(safe-area-inset-bottom));
    box-shadow: var(--shadow-3);
    overflow-x: auto;
    flex-wrap: nowrap;
  }
  body.has-dock main.page { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .toolbar.dock .btn { flex: 1 0 auto; }
}

/* Multi-row toolbar: rows stack, each row is its own flex line; the first row
   can scroll sideways (palettes). */
.toolbar.rows { flex-direction: column; align-items: stretch; gap: var(--s-2); }
.tb-row { display: flex; align-items: center; gap: var(--s-2); min-width: 0; }
.tb-row .spacer { flex: 1; }
.tb-row.scroll { overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding: 2px 0; }
.tb-row.scroll::-webkit-scrollbar { display: none; }
@media (max-width: 600px) {
  .toolbar.dock.rows { flex-wrap: nowrap; overflow: visible; }
  .toolbar.dock.rows .btn { flex: 0 0 auto; }
  body.has-dock.dock-tall main.page { padding-bottom: calc(150px + env(safe-area-inset-bottom)); }
  /* toasts sit above a docked toolbar */
  body.has-dock .toasts { bottom: calc(100px + env(safe-area-inset-bottom)); }
  body.has-dock.dock-tall .toasts { bottom: calc(160px + env(safe-area-inset-bottom)); }
}

/* ---------- log, stats, kbd ---------- */
.log {
  margin-top: var(--s-4);
  color: var(--ink-2);
  font-size: var(--t-small);
}
.log summary { cursor: pointer; font-weight: 700; color: var(--ink-2); padding: var(--s-2) 0; list-style: none; display: flex; align-items: center; gap: var(--s-2); }
.log summary::-webkit-details-marker { display: none; }
.log summary::before { content: ''; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform var(--d-fast); margin-left: 2px; }
.log[open] summary::before { transform: rotate(45deg); }
.log ul { margin: 0; padding: var(--s-3) var(--s-4); list-style: none; max-height: 240px; overflow: auto; }
.log li { padding: 3px 0; border-bottom: 1px dashed var(--line); }
.log li:last-child { border-bottom: none; }
.log-peek { margin: 0; padding: 0 var(--s-1) var(--s-2); list-style: none; color: var(--ink-3); font-size: var(--t-small); }
.log-peek li { padding: 2px 0; }
.log-peek li:last-child { color: var(--ink-2); }
.log[open] + .log-peek { display: none; }

.stats { display: flex; gap: var(--s-3); flex-wrap: wrap; }
.stat {
  flex: 1 1 90px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: var(--s-3) var(--s-2);
  min-width: 90px;
}
.stat .n { font-family: var(--font-display); font-size: 1.8rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; color: var(--ink); }
.stat .l { font-size: var(--t-tiny); color: var(--ink-2); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; margin-top: 4px; text-align: center; }
.stat.game .n { color: var(--game); }

.kbd {
  display: inline-block; padding: 1px 6px; min-width: 22px; text-align: center;
  border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px;
  background: var(--surface); font-size: var(--t-tiny); font-weight: 700; color: var(--ink-2);
  font-family: var(--font-ui);
}

/* ---------- theme switch ---------- */
.switch {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--r-pill);
  border: none; background: transparent; color: var(--ink-2); cursor: pointer;
  transition: background var(--d-fast), color var(--d-fast), transform var(--d-base) var(--ease-pop);
}
.switch:hover { background: var(--surface-2); color: var(--ink); }
.switch:active { transform: rotate(-20deg); }
.switch svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.switch .sun { display: none; }
:root[data-theme="dark"] .switch .sun { display: block; }
:root[data-theme="dark"] .switch .moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .switch .sun { display: block; }
  :root:not([data-theme="light"]) .switch .moon { display: none; }
}

/* ---------- hub game cards ---------- */
.game-grid { display: grid; grid-template-columns: 1fr; gap: var(--s-3); }
@media (min-width: 601px) { .game-grid { grid-template-columns: repeat(2, 1fr); gap: var(--s-4); } }
@media (min-width: 960px) { .game-grid { grid-template-columns: repeat(3, 1fr); } }
.game-card {
  position: relative;
  display: flex; flex-direction: column; gap: var(--s-2);
  padding: var(--s-4) var(--s-4) var(--s-4) calc(var(--s-4) + 6px);
  color: inherit;
  text-decoration: none !important;
  overflow: hidden;
  transition: transform var(--d-base) var(--ease-out), box-shadow var(--d-base), border-color var(--d-base);
}
.game-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--game); }
.game-card:hover { transform: translateY(-2px) rotate(-0.4deg); box-shadow: var(--shadow-2); border-color: var(--game); }
.game-card:active { transform: translateY(0); }
.game-card .head { display: flex; align-items: center; gap: var(--s-3); }
.game-card h3 { font-size: 1.25rem; }
.game-card p { color: var(--ink-2); font-size: var(--t-small); margin: 0; flex: 1; }
.game-card .meta { display: flex; gap: var(--s-2); flex-wrap: wrap; margin-top: var(--s-1); }
.game-card .go { position: absolute; right: var(--s-4); top: var(--s-4); color: var(--ink-3); transition: transform var(--d-base) var(--ease-out), color var(--d-fast); }
.game-card .go svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }
.game-card:hover .go { transform: translateX(3px); color: var(--game); }

.resume-card {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  margin-bottom: var(--s-5);
  border-left: 6px solid var(--game);
  color: inherit; text-decoration: none !important;
}
.resume-card:hover { box-shadow: var(--shadow-2); }
.resume-card .t { flex: 1; min-width: 0; }
.resume-card .t b { display: block; }
.resume-card .t span { font-size: var(--t-small); color: var(--ink-2); }

/* ---------- start screen + lobby ---------- */
.start { display: flex; flex-direction: column; gap: var(--s-3); }
.start, .lobby { max-width: 560px; margin-left: auto; margin-right: auto; }
.start .row { display: flex; gap: var(--s-2); }
.start .row .input { flex: 1; }
.rules { margin-top: var(--s-2); }
.rules summary { cursor: pointer; font-weight: 700; color: var(--ink-2); padding: var(--s-2) 0; list-style: none; display: flex; align-items: center; gap: var(--s-2); }
.rules summary::-webkit-details-marker { display: none; }
.rules summary::before { content: ''; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform var(--d-fast); margin-left: 2px; }
.rules[open] summary::before { transform: rotate(45deg); }
.rules .body { font-size: var(--t-small); color: var(--ink-2); line-height: 1.55; padding-bottom: var(--s-2); }
.rules .body b { color: var(--ink); }
.rules ul { padding-left: 18px; margin: var(--s-2) 0; }

.lobby { text-align: center; }
.lobby .eyebrow { font-size: var(--t-small); font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.08em; }
.roomcode {
  font-family: var(--font-display);
  font-size: var(--t-code);
  font-weight: 700;
  letter-spacing: 0.22em;
  padding-left: 0.22em;
  color: var(--ink);
  margin: var(--s-2) 0 var(--s-4);
  font-variation-settings: 'opsz' 144;
  user-select: all;
}
.lobby .share { display: flex; justify-content: center; gap: var(--s-2); flex-wrap: wrap; margin-bottom: var(--s-5); }
.seats { display: flex; flex-direction: column; gap: var(--s-2); text-align: left; margin: 0 auto var(--s-5); max-width: 380px; }
.seat {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--line);
  animation: rise var(--d-base) var(--ease-out) both;
}
.seat .n { font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat .tags { display: flex; gap: 4px; }
.seat.empty { border-style: dashed; color: var(--ink-3); background: transparent; }
.seat.empty .n { font-weight: 600; font-style: italic; }
.seat.empty .avatar { animation: pulse 2s ease-in-out infinite; }
.lobby .options { display: flex; gap: var(--s-3); justify-content: center; flex-wrap: wrap; margin-bottom: var(--s-4); text-align: left; }
.lobby .options .field { margin: 0; min-width: 140px; }
.lobby .wait { color: var(--ink-2); font-size: var(--t-small); }
.lobby .ready { color: var(--ok); font-weight: 700; animation: rise var(--d-base) var(--ease-pop) both; }

/* end-of-game sheet */
.result { text-align: center; }
.result .eyebrow { font-size: var(--t-small); font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.08em; }
.result h2 { font-size: var(--t-h1); margin: var(--s-1) 0 var(--s-3); }
.result .stats { justify-content: center; margin-bottom: var(--s-3); }
.result .detail { color: var(--ink-2); font-size: var(--t-small); }

/* board layout helpers */
.boards { display: flex; flex-wrap: wrap; gap: var(--s-4); align-items: flex-start; justify-content: center; }
.board-wrap { flex: 1 1 320px; max-width: 480px; min-width: 0; }
.board-wrap h3 { display: flex; align-items: center; gap: var(--s-2); margin-bottom: var(--s-2); font-family: var(--font-ui); font-size: var(--t-small); color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.06em; }
.board-wrap .info { margin-top: var(--s-2); color: var(--ink-2); font-size: var(--t-small); overflow-wrap: anywhere; }
.board-wrap .info .big { color: var(--ink); font-size: 1.1rem; font-weight: 700; }
.felt {
  background: var(--felt);
  background-image: radial-gradient(ellipse at 50% 30%, rgb(255 255 255 / .06), transparent 70%);
  border-radius: var(--r-md);
  border: 1px solid rgb(0 0 0 / .25);
  box-shadow: var(--inset), var(--shadow-1);
}

/* utilities */
.row { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: var(--s-3); }
.center { text-align: center; }
.mt-2 { margin-top: var(--s-2); } .mt-3 { margin-top: var(--s-3); } .mt-4 { margin-top: var(--s-4); } .mt-5 { margin-top: var(--s-5); }
.mb-3 { margin-bottom: var(--s-3); } .mb-4 { margin-bottom: var(--s-4); }
