/* Bridge Parlor, in the family's wood look (the Dragonfly 90 / Wolverine 42 and Justice and
   Mercy tables): a dark plank room, an oak card table with a charred edge band and a brass
   inlay, a green felt center, birch-plywood name plates and panels with burned lettering.
   One visual world on purpose, in either app theme.
   Layout: .device.layout-desktop = table + side column; .layout-phone = one column.
   Your hand lives in a tray docked at the bottom of the screen. */
:root {
  --plank: #46321f;
  --plank-2: #574029;
  --maple: #efdcbc;
  --maple-2: #f8eedb;
  --muted: #c9b292;
  --char: #6a3a19;
  --engrave: #5a3216;
  --burn: #6b3f22;
  --ink: #24180f;
  --felt: #317567;
  --felt-2: #255c50;
  --brass: #d8b56a;
  --accent: #2f7d6d;
  --go: #3fb59a;
  --amber: #e9b85c;
  --danger: #b5432f;
  --card-face: #fbfaf6;
  --suit-red: #c8241b;
  --suit-black: #1d1d1d;
  --font-slab: 'Zilla Slab', Rockwell, 'Roboto Slab', 'Bookman Old Style', Georgia, serif;
  --font-card: Arimo, Arial, 'Helvetica Neue', sans-serif;
  --font-body: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --grain-ply: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='640' height='320'%3E%3Cfilter id='g' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.0025 0.11' numOctaves='4' seed='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.45 0 0 0 0 0.27 0 0 0 0 0.12 0.8 0 0 0 -0.34'/%3E%3C/filter%3E%3Crect width='640' height='320' filter='url(%23g)'/%3E%3C/svg%3E");
  --grain-oak: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='640' height='320'%3E%3Cfilter id='g' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.004 0.12' numOctaves='4' seed='9' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.25 0 0 0 0 0.14 0 0 0 0 0.06 1.7 0 0 0 -0.62'/%3E%3C/filter%3E%3Crect width='640' height='320' filter='url(%23g)'/%3E%3C/svg%3E");
  --grain-dark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='640'%3E%3Cfilter id='g' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.12 0.004' numOctaves='4' seed='5' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.06 0 0 0 0 0.035 0 0 0 0 0.02 1.8 0 0 0 -0.55'/%3E%3C/filter%3E%3Crect width='320' height='640' filter='url(%23g)'/%3E%3C/svg%3E");
  --ply: linear-gradient(180deg, #f3e4c7, #e6d0ab);
  --ply-edge: inset 0 0 0 1.5px var(--char), inset 0 0 0 3px rgb(255 245 222 / 0.35), inset 0 0 10px rgb(106 58 25 / 0.28);
  --shadow: 0 2px 6px rgb(0 0 0 / 0.35);
  --radius: 10px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  color: var(--maple-2);
  font: 16px/1.42 var(--font-body);
  background-color: var(--plank);
  background-image:
    var(--grain-dark),
    radial-gradient(ellipse 70% 45% at 50% -5%, rgb(255 214 160 / 0.2), transparent 70%),
    repeating-linear-gradient(90deg, transparent 0 180px, rgb(0 0 0 / 0.22) 180px 182px, rgb(255 230 190 / 0.05) 182px 183px),
    linear-gradient(180deg, #5c432b, #4a3522 45%, #3f2d1d);
  background-size: 320px 640px, auto, auto, auto;
  background-attachment: fixed;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 0 24px;
  -webkit-tap-highlight-color: transparent;
}
body::before { content: ''; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: #3d2a1a; }
h1, h2, h3 { font-family: var(--font-slab); font-weight: 700; line-height: 1.15; text-wrap: balance; margin: 0; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }
p { margin: 0; }
button { font: inherit; }
.muted { color: var(--muted); }
.red { color: var(--suit-red); }
.eyebrow { font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 700; color: var(--muted); }
.nums { font-variant-numeric: tabular-nums; }

/* Plywood pieces and burned-in lettering */
.ply {
  color: var(--ink);
  background-image: var(--grain-ply), var(--ply);
  background-size: 640px 320px, auto;
  box-shadow: var(--ply-edge), 0 8px 20px rgb(0 0 0 / 0.4);
  border-radius: var(--radius);
}
.ply .muted { color: #7a5f45; }
.ply .eyebrow { color: #8a6a48; }
.burn, .ply h2, .ply h3 {
  font-family: var(--font-slab);
  color: var(--engrave);
  text-shadow: 0 1px 0 rgb(255 250 235 / 0.65), 0 0 2px rgb(120 62 22 / 0.3);
}

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px;
  border: 0; border-radius: 8px; padding: 8px 14px; cursor: pointer; font-weight: 600;
  color: var(--engrave);
  background-image: var(--grain-ply), linear-gradient(180deg, #ecd8b4, #d7bb8f);
  background-size: 640px 320px, auto;
  box-shadow: inset 0 0 0 1.5px var(--char), 0 2px 4px rgb(0 0 0 / 0.25);
  transition: transform 100ms ease, filter 150ms ease;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--accent); color: #fff; box-shadow: 0 2px 4px rgb(0 0 0 / 0.3); }
.btn.brass { background: linear-gradient(180deg, #e8c77c, #c99e48); color: #3b2716; box-shadow: inset 0 0 0 1.5px #8a6420, 0 2px 4px rgb(0 0 0 / 0.3); }
.btn.ghost { background: transparent; color: var(--maple-2); box-shadow: inset 0 0 0 1px rgb(244 230 204 / 0.4); }
.btn.small { padding: 4px 11px; font-size: 0.88rem; min-height: 32px; }
.btn:disabled { opacity: 0.45; cursor: default; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

/* ---------------------------------------------------------------- chrome (layout switch) + device frame */
.chrome { max-width: 1240px; margin: 0 auto; display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding-block: 10px 0; }
.switch { display: inline-flex; border-radius: 999px; padding: 2px; gap: 2px; background: rgb(0 0 0 / 0.28); box-shadow: inset 0 0 0 1px rgb(255 235 200 / 0.18); }
.switch button { border: 0; background: transparent; color: var(--maple-2); padding: 4px 12px; border-radius: 999px; cursor: pointer; font-size: 0.85rem; font-weight: 600; min-height: 30px; }
.switch button[aria-pressed='true'] { background-image: var(--grain-ply), var(--ply); background-size: 200px 100px, auto; color: var(--engrave); box-shadow: inset 0 0 0 1.5px var(--char); }
.device { position: relative; max-width: 1240px; margin: 0 auto; }
.device.framed {
  width: 390px; max-width: 100%; height: min(844px, calc(100dvh - 64px)); min-height: 560px; margin: 12px auto 0;
  border: 10px solid #120d09; border-radius: 46px; overflow: hidden;
  background: var(--plank); background-image: var(--grain-dark), linear-gradient(180deg, #5c432b, #3f2d1d); background-size: 320px 640px, auto;
  box-shadow: 0 18px 50px rgb(0 0 0 / 0.5);
  /* Fixed-position pieces (your hand tray, chat, dialogs) stay inside the phone frame. */
  transform: translateZ(0);
}
.device.framed .device-scroll { height: 100%; overflow-y: auto; overflow-x: hidden; padding: 0 10px; }
.device.framed .device-scroll::before { content: ''; display: block; flex: none; width: 110px; height: 22px; margin: 4px auto 0; border-radius: 0 0 14px 14px; background: #120d09; }

/* At the table the page doesn't scroll: the table, your hand and the panels fill the screen. */
html.at-table, html.at-table body { height: 100%; overflow: hidden; }
html.at-table body { display: flex; flex-direction: column; padding-bottom: 0; min-height: 0; }
html.at-table #app { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
html.at-table .chrome { flex: none; }
html.at-table .device:not(.framed) { flex: 1 1 auto; min-height: 0; width: 100%; display: flex; flex-direction: column; }
html.at-table .device-scroll { display: flex; flex-direction: column; min-height: 0; }
html.at-table .device:not(.framed) .device-scroll { flex: 1 1 auto; }
html.at-table .device.framed .device-scroll { overflow: hidden; }
html.at-table #screen { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
html.at-table .topbar { flex: none; padding-block: 8px 6px; }
html.at-table .layout-phone .topbar { padding-block: 4px 4px; }
html.at-table .layout-phone .brand h1 { font-size: 1.05rem; }
html.at-table .layout-phone .brand .pips { display: none; }
html.at-table .layout-phone body, html.at-table body:has(.layout-phone) { padding-left: max(8px, env(safe-area-inset-left, 0px)); padding-right: max(8px, env(safe-area-inset-right, 0px)); }
html.at-table .device.framed .device-scroll { padding: 0 6px; }

/* ---------------------------------------------------------------- top bar */
.topbar { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; padding-block: 12px 10px; }
.brand { display: flex; align-items: baseline; gap: 8px; cursor: pointer; min-width: 0; }
.brand h1 { font-size: 1.45rem; color: #f6e6c8; text-shadow: 0 -1px 0 rgb(0 0 0 / 0.5), 0 1px 0 rgb(255 230 190 / 0.12); white-space: nowrap; }
.brand .pips { font-size: 0.95rem; letter-spacing: 2px; color: #f6e6c8; }
.brand .pips .red { color: #e5574c; }
.topbar .spacer { flex: 1; }
.namebox { display: flex; align-items: center; gap: 6px; }
.namebox label { font-size: 0.85rem; color: var(--muted); }
input[type='text'] {
  font: inherit; color: var(--ink); background: #fffdf8; border: 1px solid #b89a74;
  border-radius: 8px; padding: 6px 10px; min-width: 0; width: 10rem; max-width: 100%;
}
.chat-btn { position: relative; }
.chat-btn .unread { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--danger); color: #fff; font: 700 12px/20px var(--font-body); }
.layout-phone .brand h1 { font-size: 1.2rem; }
.layout-phone .topbar .namebox { flex-basis: 100%; }
.layout-phone .topbar .namebox input { flex: 1; }
.layout-phone .topbar { padding-block: 8px 6px; }

/* ---------------------------------------------------------------- screens */
.screen { animation: screen-in 240ms ease-out both; }
@keyframes screen-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes breathe { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }

/* home: the three games, each with its How to play guide, on one screen */
.page { display: grid; gap: 22px; }
.home { gap: 14px; padding-bottom: 8px; }
.intro { display: grid; gap: 4px; max-width: 72ch; }
.intro h2 { color: #f6e6c8; font-size: 1.5rem; }
.intro p { color: var(--muted); }
.intro b { color: #f6e6c8; }
.section { display: grid; gap: 12px; }
.section > h2 { color: #f6e6c8; }
.variants { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.layout-phone .variants { grid-template-columns: minmax(0, 1fr); gap: 8px; }
.variant { padding: 14px 16px; display: grid; gap: 10px; align-content: start; }
.vhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.variant .tagline { font-size: 0.92rem; }
.howto { display: grid; gap: 6px; justify-items: start; padding: 8px 0; border-block: 1px solid rgb(106 58 25 / 0.2); }
.variant .seats { display: flex; gap: 6px; }
.variant .seats span { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--felt); color: #fff; font-size: 0.72rem; font-weight: 700; box-shadow: inset 0 0 0 2px rgb(0 0 0 / 0.2); }
.variant .seats span.dummy { background: transparent; box-shadow: inset 0 0 0 1.5px dashed; border: 1.5px dashed var(--char); color: var(--char); }
.variant .actions { display: flex; flex-wrap: wrap; gap: 6px; }
.levelrow { display: flex; gap: 6px 10px; align-items: center; flex-wrap: wrap; }
.levelnote { font-size: 0.88rem; }
.joinrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
/* Phone home: compact cards so all three games fit without scrolling */
.layout-phone .home { gap: 8px; }
.layout-phone .intro { display: none; }
.layout-phone .topbar .namebox label { font-size: 0.8rem; }
.layout-phone .topbar .namebox input { padding: 4px 8px; }
.layout-phone .variant { padding: 8px 10px; gap: 6px; }
.layout-phone .vhead { align-items: center; }
.layout-phone .variant h2 { font-size: 1.08rem; }
.layout-phone .variant .eyebrow { display: none; }
.layout-phone .variant .tagline { display: none; }
.layout-phone .variant .seats span { width: 20px; height: 20px; font-size: 0.6rem; }
.layout-phone .howto { grid-auto-flow: column; justify-content: start; align-items: center; padding: 5px 0; gap: 6px; }
.layout-phone .chip { min-height: 26px; min-width: 26px; padding: 2px 7px; justify-content: center; }
.layout-phone .chip.done::after { display: none; }
.layout-phone .levelnote { display: none; }
.layout-phone .levelrow .switch button { padding: 4px 9px; font-size: 0.8rem; }
.layout-phone .variant .actions .btn.small { min-height: 30px; padding: 3px 9px; font-size: 0.82rem; }
.joinrow input { width: 8rem; text-transform: uppercase; letter-spacing: 0.1em; }

/* lobby */
.lobby { max-width: 640px; margin: 0 auto; display: grid; gap: 14px; padding: 20px; }
.codebox { font: 700 2rem/1 var(--font-slab); letter-spacing: 0.2em; color: var(--engrave); padding: 10px 16px; display: inline-block; border-radius: 10px; box-shadow: inset 0 0 0 2px var(--char), inset 0 0 0 4px rgb(255 245 222 / 0.5); }
.seatlist { display: grid; gap: 6px; padding: 0; margin: 0; }
.seatlist li { list-style: none; display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 8px 12px; border-radius: 8px; background: rgb(255 255 255 / 0.4); box-shadow: inset 0 0 0 1px rgb(106 58 25 / 0.3); }
.seatlist .who { display: flex; gap: 8px; align-items: center; min-width: 0; }
.seatlist .pos { font-size: 0.78rem; color: #7a5f45; width: 3.6em; flex: none; }

/* overlays */
.overlay {
  position: fixed; inset: 0; z-index: 50; background: rgb(15 10 6 / 0.62); display: grid; place-items: center;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  animation: fade-in 160ms ease-out both;
}
.sheet { max-width: 640px; width: 100%; max-height: 100%; overflow: auto; padding: 22px; display: grid; gap: 14px; animation: sheet-in 220ms ease-out both; }
@keyframes sheet-in { from { transform: translateY(14px) scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }
.layout-phone .sheet { padding: 16px; }
.sheet .body { display: grid; gap: 10px; max-width: 64ch; }
.sheet .nav { display: flex; gap: 8px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.sheet.guide { max-width: 780px; }
.sheet.guide .body { max-width: none; }
.sheet.guide h3 { margin-top: 6px; }
.dots { display: flex; gap: 6px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: rgb(106 58 25 / 0.3); transition: background-color 200ms; }
.dots i.on { background: var(--accent); }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(150px + env(safe-area-inset-bottom, 0px)); background: #1b120c; color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 60; max-width: calc(100% - 32px); box-shadow: var(--shadow); animation: fade-in 160ms ease-out both; }

/* ---------------------------------------------------------------- the table screen */
.tablescreen { flex: 1 1 auto; min-height: 0; display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
.layout-desktop .tablescreen { grid-template-columns: minmax(0, 1fr) 300px; gap: 10px 12px; padding-bottom: 8px; }
.layout-desktop .tablescreen .status { grid-column: 1 / -1; }
.layout-phone .tablescreen { gap: 4px; }
.tablecol { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.table-area { position: relative; flex: 1 1 auto; min-height: 0; display: flex; }
#felt-host { flex: 1 1 auto; min-height: 0; min-width: 0; display: flex; padding: 9px; }
.layout-phone #felt-host { padding: 7px; }
.status { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; padding: 6px 12px; }
.status .item { display: grid; line-height: 1.2; }
.status .item b { font-family: var(--font-slab); font-size: 1rem; color: var(--engrave); white-space: nowrap; }
.status .contract { font: 700 1.2rem/1.1 var(--font-slab); color: var(--engrave); }
.status .grow { flex: 1; }
.status .lesson-row { flex-basis: 100%; display: flex; gap: 6px 14px; align-items: center; flex-wrap: wrap; padding-top: 4px; border-top: 1px solid rgb(106 58 25 / 0.2); }
.status .goal { color: #6f5741; font-size: 0.9rem; flex: 1 1 280px; min-width: 0; }
.status .chapter-btn { border: 0; background: transparent; padding: 0; text-align: left; cursor: pointer; font: inherit; color: inherit; }
.layout-phone .status { gap: 2px 12px; padding: 4px 10px; flex-wrap: nowrap; overflow: hidden; }
.layout-phone .status .eyebrow { font-size: 0.6rem; white-space: nowrap; }
.panel-sheet .tip { font-weight: 700; color: #8a5a10; }
.panel-sheet .why { font-size: 0.95rem; }
.layout-phone .status .item b { font-size: 0.88rem; }
.layout-phone .status .contract { font-size: 1rem; }
.layout-phone .status .btn.small { min-height: 28px; padding: 2px 9px; font-size: 0.8rem; flex: none; }
.layout-phone .status .item { min-width: 0; flex: 0 1 auto; }
.layout-phone .status .item b { overflow: hidden; text-overflow: ellipsis; display: block; }
.layout-phone .status .chapter-btn b { max-width: 9.5em; }
.layout-phone .status .grow { flex: 0 0 0; }
.layout-phone .status .btn.small { margin-left: auto; }
.vul { font: 700 0.7rem/1.4 var(--font-body); padding: 1px 6px; border: 0; border-radius: 4px; background: var(--danger); color: #fff; letter-spacing: 0.05em; cursor: pointer; vertical-align: middle; }
.timer { font: 700 1rem ui-monospace, Menlo, monospace; color: var(--burn); }
.pulse { animation: pulse 420ms ease-out; }
@keyframes pulse { 40% { transform: scale(1.25); } }

/* The oak table */
.oak {
  position: relative; flex: 1 1 auto; min-height: 0; min-width: 0;
  display: grid; gap: 6px 8px; align-items: center;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 400px) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: 'top top top' 'left felt right' 'bottom bottom bottom';
  padding: 10px 16px; border-radius: 28px;
  background: var(--grain-oak), repeating-linear-gradient(180deg, rgb(0 0 0 / 0.16) 0 2px, transparent 2px 72px), linear-gradient(180deg, #ad8253, #976b40 50%, #82603a);
  background-size: 640px 320px, auto, auto;
  box-shadow: 0 0 0 7px #3b2716, 0 0 0 9px #b8925a, 0 30px 60px rgb(0 0 0 / 0.42), inset 0 2px 30px rgb(0 0 0 / 0.3);
  user-select: none; -webkit-user-select: none;
}
.layout-phone .oak {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  grid-template-areas: 'top top' 'left right' 'felt felt' 'bottom bottom';
  padding: 6px 7px; gap: 4px; border-radius: 18px;
  box-shadow: 0 0 0 5px #3b2716, 0 0 0 7px #b8925a, 0 16px 30px rgb(0 0 0 / 0.38), inset 0 2px 20px rgb(0 0 0 / 0.3);
}
.seat-top { grid-area: top; }
.seat-left { grid-area: left; }
.seat-right { grid-area: right; }
.seat-bottom { grid-area: bottom; }
.seat { position: relative; display: grid; gap: 4px; justify-items: center; align-content: center; min-width: 0; min-height: 0; }
.seat-left { justify-items: start; }
.seat-right { justify-items: end; }
.layout-phone .seat-left, .layout-phone .seat-right { justify-items: center; align-content: start; }

/* Name plates */
.plate {
  position: relative; display: grid; gap: 3px; padding: 4px 10px 5px; border-radius: 10px; min-width: 0; max-width: 100%;
  color: var(--ink);
  background-image: var(--grain-ply), var(--ply); background-size: 640px 320px, auto;
  box-shadow: var(--ply-edge), 0 6px 14px rgb(0 0 0 / 0.35);
  transition: box-shadow 300ms ease;
}
.plate-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.pname { font: 700 16px/1.15 var(--font-slab); color: var(--engrave); text-shadow: 0 1px 0 rgb(255 250 235 / 0.65); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ppos { font-size: 11px; color: #7a5f45; letter-spacing: 0.06em; text-transform: uppercase; }
.plate-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.plate-tags[hidden] { display: none; }
.tag { font: 700 10px/1 var(--font-body); letter-spacing: 0.07em; text-transform: uppercase; padding: 3px 6px; border-radius: 999px; background: var(--burn); color: var(--maple-2); }
.tag.decl { background: var(--accent); }
.tricks { font: 700 11px/1 var(--font-body); padding: 3px 7px; border-radius: 999px; background: #e3cba3; color: var(--engrave); box-shadow: inset 0 0 0 1px rgb(106 58 25 / 0.4); }
.dealer-chip {
  flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  font: 800 13px/1 var(--font-slab); color: #fff4e2;
  background: radial-gradient(circle at 35% 30%, #8a5530, #5a3216 70%);
  box-shadow: inset 0 0 0 1.5px #3b1f0d, inset 0 0 0 3px rgb(255 220 170 / 0.35), 0 2px 4px rgb(0 0 0 / 0.4);
}
.layout-phone .plate { padding: 2px 7px 3px; gap: 2px; border-radius: 8px; }
.layout-phone .pname { font-size: 13px; }
.layout-phone .ppos { font-size: 9.5px; }
.layout-phone .tag, .layout-phone .tricks { font-size: 9px; padding: 2px 5px; }
.layout-phone .dealer-chip { width: 20px; height: 20px; font-size: 11px; }
/* Whose turn: the plate glows and breathes; green when it's you */
.seat.turn .plate { box-shadow: var(--ply-edge), 0 0 0 2px var(--amber), 0 0 22px rgb(255 192 96 / 0.55), 0 6px 14px rgb(0 0 0 / 0.32); }
.seat.turn .plate::after { content: ''; position: absolute; inset: -5px; border-radius: 14px; pointer-events: none; box-shadow: 0 0 0 2px rgb(233 184 92 / 0.8), 0 0 18px 4px rgb(233 184 92 / 0.45); animation: breathe 1.8s ease-in-out infinite; }
.seat.you-act .plate { box-shadow: var(--ply-edge), 0 0 0 3px var(--go), 0 0 26px rgb(63 181 154 / 0.6), 0 6px 14px rgb(0 0 0 / 0.32); }
.seat.you-act .plate::after { box-shadow: 0 0 0 2px rgb(63 181 154 / 0.85), 0 0 20px 5px rgb(63 181 154 / 0.5); }

/* Bid bubbles and chat lines over a plate */
.bubble, .say {
  position: absolute; z-index: 6; pointer-events: none; white-space: nowrap;
  font: 700 1rem/1.2 var(--font-slab); padding: 3px 10px; border-radius: 999px;
  background: var(--card-face); color: var(--suit-black); box-shadow: inset 0 0 0 1px #c9a46d, 0 4px 10px rgb(0 0 0 / 0.35);
}
.bubble { right: -10px; top: -14px; }
.bubble.pass { font: 600 0.82rem/1.2 var(--font-body); color: #5b4a3a; background: #efe2cb; }
.bubble.dbl { background: var(--danger); color: #fff; box-shadow: 0 4px 10px rgb(0 0 0 / 0.35); }
.say {
  left: 50%; bottom: calc(100% + 10px); transform: translateX(-50%); white-space: normal; width: max-content; max-width: 240px;
  font: 600 0.86rem/1.25 var(--font-body); border-radius: 12px; padding: 6px 10px; background: var(--maple-2); z-index: 8;
}
.say::after { content: ''; position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%); border: 6px solid transparent; border-bottom: 0; border-top-color: var(--maple-2); }
.seat-top .say { bottom: auto; top: calc(100% + 8px); }
.seat-top .say::after { bottom: auto; top: -6px; border: 6px solid transparent; border-top: 0; border-bottom-color: var(--maple-2); }
.say[hidden], .bubble[hidden] { display: none; }

/* Hands on the table */
.seat-hand { display: flex; justify-content: center; align-items: flex-end; min-height: 10px; max-width: 100%; width: 100%; }
.seat-top .seat-hand { --cw: var(--cw-top, 54px); }
.seat-left .seat-hand, .seat-right .seat-hand { --cw: var(--cw-side, 42px); justify-content: inherit; }
.seat-hand[data-style='fan'] > .card:not(:first-child) { margin-left: calc(var(--step, calc(var(--cw) * 0.5)) - var(--cw)); transition: margin-left 380ms cubic-bezier(.22,.8,.26,1); }
.seat-hand .gap { width: 6px; flex: none; }
.seat-hand[data-style='rows'] { flex-direction: column; align-items: flex-start; gap: 2px; width: auto; }
.seat-right .seat-hand[data-style='rows'] { align-items: flex-end; }
.seat-hand[data-style='rows'] .row { display: flex; align-items: center; min-height: calc(var(--cw) * 0.86); }
.seat-hand[data-style='rows'] .row + .row { margin-top: calc(var(--cw) * -0.5); }
.seat-hand[data-style='rows'] .row .card + .card { margin-left: calc(var(--cw) * -0.55); }
.seat-hand[data-style='rows'] .row .void { font-size: 0.8rem; opacity: 0.7; color: var(--maple-2); }
.seat-hand[data-mode='backs'] { align-items: center; gap: 8px; }
.seat-hand .backs { display: flex; }
.seat-hand .backs .back { --cw: var(--cw-back, 30px); }
.seat-hand .backs .back + .back { margin-left: calc(var(--cw) * -0.78); }
.seat-hand .count { font: 700 0.8rem/1 var(--font-body); padding: 3px 7px; border-radius: 999px; background: rgb(0 0 0 / 0.3); color: var(--maple-2); }

/* Cards: clean faces like the printed decks; inner sizes follow the card width (cqw). */
.card, .back {
  --cw: 58px;
  width: var(--cw); height: calc(var(--cw) * 1.4); flex: none; position: relative;
  border-radius: calc(var(--cw) * 0.08); box-shadow: 0 1px 3px rgb(0 0 0 / 0.4);
  transition: width 380ms cubic-bezier(.22,.8,.26,1), height 380ms cubic-bezier(.22,.8,.26,1), margin-left 380ms cubic-bezier(.22,.8,.26,1), transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}
.seat-hand .card, .seat-hand .back, .tslot .card, .pile .card, .pile .back { --cw: inherit; }
.card {
  container-type: inline-size; border: 0; padding: 0; margin: 0; text-align: left; line-height: 1;
  background: var(--card-face); color: var(--suit-black); font-family: var(--font-card); font-weight: 700;
  cursor: default; -webkit-touch-callout: none; touch-action: manipulation;
}
.card::before { content: ''; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.14); pointer-events: none; }
.card.red { color: var(--suit-red); }
.card .ci { position: absolute; left: 7cqw; top: 6cqw; display: grid; justify-items: center; font-size: 30cqw; letter-spacing: -0.04em; }
.card .ci .cs { font-size: 26cqw; margin-top: 1cqw; }
.card .cp { position: absolute; right: 8cqw; bottom: 6cqw; font-size: 44cqw; }
.back {
  background-image:
    repeating-linear-gradient(45deg, rgb(106 58 25 / 0.42) 0 1px, transparent 1px 6px),
    repeating-linear-gradient(-45deg, rgb(106 58 25 / 0.42) 0 1px, transparent 1px 6px),
    var(--grain-ply), var(--ply);
  background-size: auto, auto, 200px 100px, auto;
  box-shadow: inset 0 0 0 1.5px var(--char), inset 0 0 0 3px rgb(255 245 222 / 0.5), inset 0 0 0 4px rgb(106 58 25 / 0.55), 0 1px 3px rgb(0 0 0 / 0.4);
}
.card.playable { cursor: pointer; }
@media (hover: hover) { .card.playable:hover { transform: translateY(calc(var(--cw) * -0.22)); z-index: 3; } }
.card.playable:focus-visible { transform: translateY(calc(var(--cw) * -0.22)); z-index: 3; }
.card.dim { filter: brightness(0.72) saturate(0.6); }
.card.hint { box-shadow: 0 0 0 3px var(--amber), 0 4px 12px rgb(0 0 0 / 0.4); transform: translateY(calc(var(--cw) * -0.14)); z-index: 2; }
.card.won { box-shadow: 0 0 0 3px var(--amber), 0 0 18px rgb(243 199 122 / 0.6), 0 6px 14px rgb(0 0 0 / 0.35); }
.card.chosen { transform: translateY(calc(var(--cw) * -0.28)); box-shadow: 0 0 0 3px var(--go), 0 6px 14px rgb(0 0 0 / 0.4); }

/* Honeymoon piles */
.piles { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; max-width: 100%; }
.seat-left .piles, .seat-right .piles { max-width: calc(var(--cw) * 4 + 16px); }
.pile { position: relative; width: var(--cw); height: calc(var(--cw) * 1.4 + var(--cw) * 0.3); }
.pile .under { position: absolute; left: 0; top: 0; }
.pile .over { position: absolute; left: 0; top: calc(var(--cw) * 0.3); }
.pile .slot-empty { position: absolute; left: 0; top: calc(var(--cw) * 0.3); width: var(--cw); height: calc(var(--cw) * 1.4); border: 1.5px dashed rgb(255 244 222 / 0.35); border-radius: calc(var(--cw) * 0.08); }

/* The felt center: the trick, the turn marker, and the bidding box */
.felt {
  grid-area: felt; position: relative; align-self: stretch; min-height: 0;
  background: radial-gradient(ellipse at 50% 40%, rgb(255 255 255 / 0.07), transparent 70%), linear-gradient(180deg, var(--felt), var(--felt-2));
  border: 3px double var(--brass); border-radius: 18px;
  box-shadow: inset 0 2px 14px rgb(0 0 0 / 0.35), 0 4px 10px rgb(0 0 0 / 0.25);
  color: #fff4de;
}
.layout-phone .felt { border-radius: 14px; }
.trick { position: absolute; inset: 0; }
.tslot { --cw: var(--cw-trick-fit, var(--cw-trick, 66px)); position: absolute; width: var(--cw); height: calc(var(--cw) * 1.4); }
.ts-top { left: 50%; top: 5%; transform: translateX(-50%); }
.ts-bottom { left: 50%; bottom: 5%; transform: translateX(-50%); }
.ts-left { left: 12%; top: 50%; transform: translateY(-50%); }
.ts-right { right: 12%; top: 50%; transform: translateY(-50%); }
.tslot .card { position: absolute; inset: 0; }

.turn-marker {
  position: absolute; z-index: 3; pointer-events: none; left: 50%; top: calc(100% - 22px);
  transform: translate(-50%, -50%);
  transition: left 480ms cubic-bezier(.3,1.2,.5,1), top 480ms cubic-bezier(.3,1.2,.5,1);
}
.turn-marker[hidden] { display: none; }
.turn-marker[data-slot='top'] { left: 50%; top: 22px; }
.turn-marker[data-slot='left'] { left: 22px; top: 50%; }
.turn-marker[data-slot='right'] { left: calc(100% - 22px); top: 50%; }
.turn-marker .arrow {
  position: relative; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f6dfa0, #c99a3e 70%); box-shadow: inset 0 0 0 1.5px #7a5418, 0 3px 8px rgb(0 0 0 / 0.45);
  transform: rotate(var(--turn, 0deg)); transition: transform 480ms cubic-bezier(.3,1.2,.5,1);
}
.turn-marker .arrow::before { content: ''; border: 8px solid transparent; border-bottom: 0; border-top: 11px solid #4a2c10; margin-top: 3px; }
.turn-marker .arrow::after { content: ''; position: absolute; inset: -6px; border-radius: 50%; box-shadow: 0 0 0 2px rgb(233 184 92 / 0.8), 0 0 16px 4px rgb(233 184 92 / 0.5); animation: breathe 1.6s ease-in-out infinite; }
.turn-marker.mine .arrow { background: radial-gradient(circle at 35% 30%, #a6ead6, #2f9c84 70%); box-shadow: inset 0 0 0 1.5px #1d5a4b, 0 3px 8px rgb(0 0 0 / 0.45); }
.turn-marker.mine .arrow::after { box-shadow: 0 0 0 2px rgb(63 181 154 / 0.9), 0 0 16px 4px rgb(63 181 154 / 0.55); }
.layout-phone .turn-marker .arrow { width: 24px; height: 24px; }
.layout-phone .turn-marker .arrow::before { border-width: 6px; border-top-width: 9px; }

.center-panel { position: absolute; inset: 0; display: grid; place-items: center; padding: 8px 12px; z-index: 2; pointer-events: none; overflow: hidden; }
.center-panel[hidden] { display: none; }
.center-panel > * { pointer-events: auto; }
.felt[data-mode='play'] .center-panel { padding: 0; }
.center-msg { display: grid; gap: 4px; justify-items: center; text-align: center; font-size: 0.92rem; text-shadow: 0 1px 2px rgb(0 0 0 / 0.5); }
.center-msg b { font-family: var(--font-slab); font-size: 1.1rem; }
.center-msg .sub { font-size: 0.8rem; opacity: 0.85; }
/* The bidding box (and the Minibridge contract picker) on the felt */
.bidbox { width: min(100%, 340px); max-height: 100%; display: grid; gap: 5px; padding: 8px 10px; border-radius: 12px; background-image: var(--grain-ply), var(--ply); background-size: 640px 320px, auto; box-shadow: var(--ply-edge), 0 10px 24px rgb(0 0 0 / 0.45); color: var(--ink); }
.bidbox .head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.bidbox .head b { font: 700 1.05rem/1 var(--font-slab); color: var(--engrave); }
.bidbox .head span { font-size: 0.78rem; color: #7a5f45; }
.bidbox .calls-so-far { display: flex; flex-wrap: wrap; gap: 4px; font-size: 0.8rem; color: #5b4a3a; }
.bidbox .calls-so-far span { padding: 1px 6px; border-radius: 6px; background: rgb(255 255 255 / 0.5); }
.bidbox .calls-so-far b { font-family: var(--font-slab); }
.bidbox .grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 3px; }
.bidbox button { border: 0; background: var(--card-face); color: var(--suit-black); border-radius: 6px; padding: 2px 0; font: 700 0.95rem/1.1 var(--font-card); cursor: pointer; min-height: var(--cw-bid, 28px); box-shadow: inset 0 0 0 1px rgb(106 58 25 / 0.35), 0 1px 2px rgb(0 0 0 / 0.2); transition: transform 100ms ease, box-shadow 150ms ease; }
.bidbox button:active { transform: scale(0.94); }
.bidbox button:disabled { opacity: 0.22; cursor: default; box-shadow: none; }
.bidbox button.hint { box-shadow: 0 0 0 3px var(--amber); }
.bidbox button.sel { background: var(--accent); color: #fff; }
.bidbox .calls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin-top: 2px; }
.bidbox .calls button { font: 700 0.92rem/1 var(--font-body); min-height: calc(var(--cw-bid, 28px) + 6px); color: #fff; }
.bidbox .calls .pass { background: #2f7d55; }
.bidbox .calls .dbl { background: var(--danger); }
.bidbox .calls .rdbl { background: #2c5b8a; }
.bidbox .levels { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.bidbox .strains { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.bidbox .levels button, .bidbox .strains button { min-height: var(--cw-bid, 40px); font-size: 1.05rem; }
.layout-desktop .bidbox .levels button, .layout-desktop .bidbox .strains button { min-height: calc(var(--cw-bid, 28px) + 8px); }
.layout-phone .bidbox { width: 100%; padding: 6px 8px; gap: 4px; }
.layout-phone .bidbox .calls button { min-height: var(--cw-bid, 36px); }
/* The auction while others bid */
.auction-sheet { width: min(100%, 300px); display: grid; gap: 6px; padding: 10px 12px; border-radius: 12px; background: rgb(0 0 0 / 0.22); box-shadow: inset 0 0 0 1px rgb(216 181 106 / 0.45); }
.auction-sheet .who { text-align: center; font: 700 1rem/1.2 var(--font-slab); }
.auction-sheet table { width: 100%; border-collapse: collapse; table-layout: fixed; font-variant-numeric: tabular-nums; }
.auction-sheet th { font: 700 0.66rem/1.2 var(--font-body); letter-spacing: 0.06em; text-transform: uppercase; color: #cfe6dd; text-align: left; padding: 2px 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auction-sheet th.now { color: var(--amber); }
.auction-sheet td { padding: 2px 3px; font: 700 0.95rem/1.2 var(--font-slab); }
.auction-sheet td.pass { font: 400 0.82rem/1.2 var(--font-body); opacity: 0.8; }
.auction-sheet td .red { color: #ff8c80; }
.auction-sheet td.fresh { animation: fade-in 300ms ease-out both; }
/* Result between deals */
.result-card { display: grid; gap: 6px; justify-items: center; text-align: center; padding: 14px 16px; border-radius: 12px; max-width: 280px; background-image: var(--grain-ply), var(--ply); background-size: 640px 320px, auto; box-shadow: var(--ply-edge), 0 10px 24px rgb(0 0 0 / 0.45); color: var(--ink); }
.result-card .result { font: 700 1.45rem/1.1 var(--font-slab); }
.result-card .result.good { color: #1f6a54; }
.result-card .result.bad { color: var(--danger); }
.result-card .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }

/* ---------------------------------------------------------------- your hand tray */
.tray {
  position: relative; z-index: 4; flex: none;
  padding: 0 14px calc(8px + env(safe-area-inset-bottom, 0px));
  border-radius: 18px 18px 6px 6px;
  background-color: #3d2a1a; background-image: var(--grain-dark), linear-gradient(180deg, #54391f, #3d2a1a); background-size: 320px 640px, auto;
  box-shadow: 0 -10px 34px rgb(0 0 0 / 0.55), inset 0 1px 0 rgb(255 235 200 / 0.18), inset 0 0 0 1px rgb(184 146 90 / 0.4);
  transition: box-shadow 400ms ease;
}
.tray-head { position: relative; display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; color: #ffe7b8; padding: 12px 2px 3px; cursor: pointer; text-align: left; min-height: 0; }
.tray-head strong { font: 700 1rem/1 var(--font-slab); }
.tray-head strong { white-space: nowrap; }
.tray-info { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.tray-cue { margin-left: auto; font-size: 0.85rem; font-weight: 700; color: #c9f1e4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tray-cue:empty { display: none; }
.tray-toggle { font-size: 1rem; color: #ffe7b8; margin-left: auto; }
.tray-cue:not(:empty) + .tray-toggle { margin-left: 0; }
.grab { position: absolute; left: 50%; top: 5px; width: 46px; height: 5px; border-radius: 3px; background: rgb(255 235 200 / 0.35); transform: translateX(-50%); }
.tray-cards { --cw: var(--cw-tray, 50px); padding: calc(var(--cw) * 0.2) 4px 2px; transition: padding 380ms cubic-bezier(.22,.8,.26,1); }
.tray[data-size='full'] .tray-cards { --cw: var(--cw-tray-full, 96px); }
.tray-cards[data-style='fan'] > .card:not(:first-child) { margin-left: calc(var(--step, calc(var(--cw) * 0.6)) - var(--cw)); }
.tray.my-move { box-shadow: 0 -10px 34px rgb(0 0 0 / 0.55), inset 0 1px 0 rgb(255 235 200 / 0.18), inset 0 0 0 2px var(--go), 0 0 30px rgb(63 181 154 / 0.35); }
.layout-phone .tray { padding: 0 8px calc(5px + env(safe-area-inset-bottom, 0px)); border-radius: 14px 14px 4px 4px; }
.layout-phone .tray-head { padding: 10px 2px 1px; }
.layout-phone .tray-head strong { font-size: 0.9rem; }
.layout-phone .tray-head { gap: 8px; }
.layout-phone .tray-info, .layout-phone .tray-cue { font-size: 0.76rem; }
.fs-btn { min-width: 36px; }
.layout-phone .grab { top: 4px; height: 4px; }

/* ---------------------------------------------------------------- side column (desktop), toolbar + sheets (phone) */
.side { display: flex; flex-direction: column; gap: 10px; min-width: 0; min-height: 0; }
.side #coach { flex: 0 1 auto; min-height: 0; display: flex; max-height: 62%; }
.side #coach:empty { display: none; }
.side #coach > .panel { flex: 1; min-height: 0; overflow-y: auto; }
.side #info { flex: 1 1 auto; min-height: 120px; display: flex; }
.panel.info-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.info-panel .tab-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.info-panel .log { max-height: none; }
/* Something new to look at: the button glows until you open it. */
.attn { position: relative; animation: attn 1.6s ease-in-out infinite; }
@keyframes attn { 0%, 100% { box-shadow: 0 0 0 2px rgb(233 184 92 / 0.95), 0 0 8px 2px rgb(233 184 92 / 0.45); } 50% { box-shadow: 0 0 0 2px rgb(233 184 92 / 0.5), 0 0 16px 5px rgb(233 184 92 / 0.65); } }
.tabs button.attn { border-radius: 6px 6px 0 0; }
.toolbar { flex: none; display: flex; gap: 5px; padding: 5px 1px; }
.tool {
  flex: none; display: inline-flex; align-items: center; gap: 5px; min-height: 34px; padding: 4px 10px; border: 0; border-radius: 8px; cursor: pointer;
  font: 600 0.84rem/1.1 var(--font-body); color: var(--engrave);
  background-image: var(--grain-ply), linear-gradient(180deg, #ecd8b4, #d7bb8f); background-size: 640px 320px, auto;
  box-shadow: inset 0 0 0 1.5px var(--char), 0 2px 4px rgb(0 0 0 / 0.25);
}
.tool.on { background: var(--accent); color: #fff; box-shadow: inset 0 0 0 1.5px #1d5a4b; }
.tool.coach-btn { flex: 1 1 auto; min-width: 0; justify-content: flex-start; }
.tool .tip { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; color: #8a5a10; }
.tool.on .tip { color: #fff4de; }
.tool .tip.off { font-weight: 400; color: #7a5f45; }
.tool .bulb { font-size: 0.9rem; }
.panel-sheet {
  position: absolute; left: 2px; right: 2px; bottom: 2px; z-index: 12; max-height: calc(100% - 4px); overflow-y: auto;
  padding: 10px 12px 12px; display: grid; gap: 8px; align-content: start; border-radius: 14px;
  box-shadow: var(--ply-edge), 0 -6px 24px rgb(0 0 0 / 0.5); animation: chat-up 240ms cubic-bezier(.22,.8,.26,1) both;
}
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sheet-body { display: grid; gap: 8px; }
.chapter-list { display: grid; gap: 4px; }
.chapter { display: grid; grid-template-columns: 28px 1fr; gap: 0 8px; text-align: left; border: 0; border-radius: 8px; padding: 6px 8px; cursor: pointer; background: rgb(255 255 255 / 0.4); box-shadow: inset 0 0 0 1px rgb(106 58 25 / 0.3); color: var(--ink); }
.chapter .n { grid-row: span 2; font: 700 1.2rem/1.2 var(--font-slab); color: var(--burn); }
.chapter .t { font: 700 0.95rem/1.2 var(--font-slab); color: var(--engrave); }
.chapter .s { font-size: 0.8rem; color: #6f5741; }
.chapter.on { background: #d6ebe5; box-shadow: inset 0 0 0 2px var(--accent); }
.chapter.done .n::after { content: '✓'; font-size: 0.8rem; color: var(--accent); margin-left: 2px; }
/* Chapter chips (home cards and the guide's status row) */
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chip { border: 0; display: inline-flex; align-items: baseline; gap: 5px; min-height: 28px; padding: 3px 9px; border-radius: 999px; cursor: pointer; font: 700 0.82rem/1.2 var(--font-body); color: var(--engrave); background: rgb(255 255 255 / 0.45); box-shadow: inset 0 0 0 1px rgb(106 58 25 / 0.4); }
.chip span { font-weight: 600; color: #6f5741; }
.chip.done { background: #d6ebe5; }
.chip.done::after { content: '✓'; color: var(--accent); font-size: 0.75rem; }
.chip.on { background: var(--accent); color: #fff; box-shadow: none; }
.chip.on span { color: #e6f6f1; }
.coach .acts, .panel-sheet .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.coach .goal, .panel-sheet .goal { font-size: 0.9rem; color: #6f5741; }
.coach-title { font-family: var(--font-slab); color: var(--engrave); }
.panel { padding: 14px; display: grid; gap: 10px; min-width: 0; }
.layout-phone .panel { padding: 12px; gap: 8px; }
.panel h3 { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.coach { box-shadow: var(--ply-edge), 0 0 0 2px #e8a33a, 0 8px 20px rgb(0 0 0 / 0.4); }
.coach .tip { font-weight: 700; color: #8a5a10; }
.coach .why { font-size: 0.95rem; }
.coach .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.coach details summary { cursor: pointer; color: #7a5f45; font-size: 0.9rem; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid rgb(106 58 25 / 0.3); }
.tabs button { border: 0; background: transparent; padding: 8px 12px; color: #7a5f45; font-weight: 700; cursor: pointer; border-bottom: 2px solid transparent; }
.tabs button[aria-selected='true'] { color: var(--engrave); border-bottom-color: var(--accent); }
.auction { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; table-layout: fixed; }
.auction th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: #7a5f45; text-align: left; padding: 2px 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auction td { padding: 3px 4px; font: 700 1rem/1.2 var(--font-slab); color: var(--engrave); }
.auction td.pass { color: #7a5f45; font: 400 0.9rem/1.2 var(--font-body); }
.auction td.fresh { animation: fade-in 260ms ease-out both; }
.score { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 0.92rem; }
.score th, .score td { padding: 3px 4px; text-align: right; border-bottom: 1px solid rgb(106 58 25 / 0.2); }
.score th:first-child, .score td:first-child { text-align: left; }
.score tfoot td { font-weight: 700; border-bottom: none; }
.score .below { color: #7a5f45; font-size: 0.8rem; }
.overflow { overflow-x: auto; }
.log { max-height: 200px; overflow: auto; font-size: 0.88rem; display: grid; gap: 2px; color: #5b4a3a; align-content: start; }

/* ---------------------------------------------------------------- guide walkthrough at the table */
.walk { position: fixed; inset: 0; z-index: 45; }
.walk-block { position: absolute; inset: 0; }
.walk-spot {
  position: absolute; border-radius: 16px; pointer-events: none;
  box-shadow: 0 0 0 3px var(--amber), 0 0 22px 6px rgb(233 184 92 / 0.55), 0 0 0 4000px rgb(14 9 5 / 0.58);
  transition: left 320ms cubic-bezier(.3,1,.4,1), top 320ms cubic-bezier(.3,1,.4,1), width 320ms cubic-bezier(.3,1,.4,1), height 320ms cubic-bezier(.3,1,.4,1);
}
.walk-card { position: absolute; padding: 14px 16px 12px; display: grid; gap: 8px; animation: sheet-in 220ms ease-out both; box-shadow: var(--ply-edge), 0 0 0 2px var(--amber), 0 14px 34px rgb(0 0 0 / 0.55); }
.walk-card h3 { font-size: 1.2rem; }
.walk-card p { font-size: 0.97rem; line-height: 1.4; }
.walk-goal { font-size: 0.9rem !important; color: #5b4a3a; padding-top: 6px; border-top: 1px solid rgb(106 58 25 / 0.25); }
.walk-nav { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.walk-btns { display: flex; gap: 6px; margin-left: auto; }
.walk .btn.ghost { color: var(--engrave); box-shadow: inset 0 0 0 1px rgb(106 58 25 / 0.45); }
.layout-phone .walk-card { padding: 11px 13px 10px; gap: 6px; }
.layout-phone .walk-card p { font-size: 0.92rem; }

/* ---------------------------------------------------------------- chat drawer */
.chat {
  position: fixed; z-index: 40; display: flex; flex-direction: column; gap: 8px; color: var(--ink);
  background-image: var(--grain-ply), var(--ply); background-size: 640px 320px, auto;
  box-shadow: inset 0 0 0 1.5px var(--char), 0 -4px 24px rgb(0 0 0 / 0.5);
  left: 0; right: 0; bottom: 0; max-height: min(72%, 560px); border-radius: 16px 16px 0 0;
  padding: 12px max(14px, env(safe-area-inset-right, 0px)) calc(12px + env(safe-area-inset-bottom, 0px)) max(14px, env(safe-area-inset-left, 0px));
  animation: chat-up 280ms cubic-bezier(.22,.8,.26,1) both;
}
@keyframes chat-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.layout-desktop .chat { left: auto; top: 0; width: 360px; max-height: none; border-radius: 0; padding-top: calc(16px + env(safe-area-inset-top, 0px)); box-shadow: inset 1.5px 0 0 var(--char), -4px 0 24px rgb(0 0 0 / 0.5); animation-name: chat-in; }
@keyframes chat-in { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.chat-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.chat-list { flex: 1 1 auto; min-height: 120px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; background: #fffdf8; border: 1px solid #d9c3a0; border-radius: 10px; padding: 10px; }
.msg { max-width: 88%; align-self: flex-start; background: #efe2cb; border-radius: 12px 12px 12px 4px; padding: 6px 10px; overflow-wrap: anywhere; animation: fade-in 220ms ease-out both; }
.msg .who { display: block; font-size: 12px; font-weight: 700; color: var(--burn); }
.msg.mine { align-self: flex-end; background: #d6ebe5; border-radius: 12px 12px 4px 12px; }
.msg.taunt { background: #fff1d6; box-shadow: inset 0 0 0 1px #ebcf98; }
.msg.table-note { align-self: center; max-width: 94%; text-align: center; background: transparent; border: 1px dashed rgb(106 58 25 / 0.4); font: 600 0.88rem/1.3 var(--font-slab); color: var(--engrave); }
.chat-quick { display: grid; gap: 6px; }
.chat-quick .row { display: flex; flex-wrap: wrap; gap: 5px; }
.chat-quick details summary { cursor: pointer; font-weight: 700; font-size: 0.9rem; color: var(--burn); padding: 2px 0; }
.chat-quick .taunts { display: flex; flex-wrap: wrap; gap: 5px; max-height: 150px; overflow-y: auto; margin-top: 6px; }
.quick { border: 0; min-height: 34px; padding: 5px 10px; border-radius: 999px; font-size: 0.86rem; font-weight: 600; cursor: pointer; color: var(--engrave); background-image: var(--grain-ply), linear-gradient(180deg, #ecd8b4, #d7bb8f); background-size: 640px 320px, auto; box-shadow: inset 0 0 0 1.5px var(--char); text-align: left; }
.quick.react { font-size: 0.95rem; }
.chat-form { display: flex; gap: 8px; }
.chat-form input { flex: 1 1 auto; min-width: 0; width: auto; }
.chat-note { font-size: 0.8rem; color: #7a5f45; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* How to play: a gold pill at the top right, opening rules.html in a new tab (same idea as Apis).
   Not in the offline single-file build, which has no rules page next to it. */
.rules-link {
  display: inline-flex; align-items: center; min-height: 32px; padding: 4px 13px; border-radius: 999px;
  font-size: 0.88rem; font-weight: 700; text-decoration: none; white-space: nowrap;
  color: var(--ink); background: linear-gradient(180deg, #f3dc9c, var(--brass));
  box-shadow: inset 0 -2px 0 rgb(0 0 0 / 0.2), 0 0 0 1px rgb(0 0 0 / 0.4), 0 0 12px rgb(243 220 156 / 0.35);
}
.rules-link:hover { background: linear-gradient(180deg, #fff0c2, #f3dc9c); }
.rules-link:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
/* On a phone the brand, full screen, Guide and How to play share one row, with How to play at the top right. */
.layout-phone .topbar { column-gap: 6px; }
.layout-phone .topbar .brand .pips { display: none; }
.layout-phone .rules-link { padding: 4px 11px; font-size: 0.85rem; }
/* At the table on a phone the bar stays one row (the table fills the rest of the screen):
   the brand gives way first, so Chat, Guide and How to play keep their full size. */
html.at-table .layout-phone .topbar { flex-wrap: nowrap; }
html.at-table .layout-phone .topbar .brand { flex: 0 1 auto; overflow: hidden; }
html.at-table .layout-phone .topbar .brand h1 { overflow: hidden; text-overflow: ellipsis; }
html.at-table .layout-phone .topbar > :not(.brand):not(.spacer) { flex: none; }
