:root {
  color-scheme: light;
  --page:#f5f2e9; --paper:#fffdf8; --ink:#182821; --muted:#5d6d65;
  --line:#d8dfd5; --forest:#123c32; --forest-deep:#0c2923;
  --table:#146149; --table-deep:#0d4938; --lime:#d7eea0;
  --gold:#edbc6f; --danger:#a42e3f; --ok:#1a7650;
  --shadow:0 18px 48px rgba(19,50,39,.09);
}
* { box-sizing:border-box; }
html { min-width:320px; }
body { margin:0; min-width:320px; min-height:100vh; color:var(--ink);
  font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  background:radial-gradient(circle at 92% 4%,#dcebdc 0,transparent 34%),var(--page); }
button,input { font:inherit; }
button { min-height:46px; padding:.72rem 1.1rem; border:1px solid #a8beb0; border-radius:13px;
  color:var(--forest-deep); background:#f3f7f0; font-weight:700; cursor:pointer;
  transition:background .16s,transform .16s,border-color .16s,box-shadow .16s; }
button:hover:not(:disabled) { background:#e4eee3; transform:translateY(-1px); border-color:var(--forest); }
button:disabled { opacity:.5; cursor:not-allowed; transform:none; }
button:focus-visible,input:focus-visible,[tabindex="0"]:focus-visible {
  outline:3px solid #b16b1e; outline-offset:3px; box-shadow:0 0 0 5px #fffdf8; }
[tabindex="-1"]:focus { outline:none; }
h1,h2,h3,p { margin:0; }
h1,h2,h3 { line-height:1.13; letter-spacing:-.035em; }
h1 { font-family:Georgia,serif; font-size:clamp(1.2rem,2vw,1.58rem); }
h2 { font-family:Georgia,serif; font-size:clamp(2rem,5vw,3.55rem); }
h3 { font-family:Georgia,serif; font-size:1.65rem; }
p { line-height:1.55; }
.eyebrow { color:#9b6a27; font-size:.72rem; font-weight:800; letter-spacing:.18em; line-height:1.3; }
.muted { color:var(--muted); }
.hidden { display:none !important; }
.app-shell { width:min(1200px,calc(100% - 40px)); margin:0 auto; padding:0 0 42px; }
.panel { border:1px solid var(--line); border-radius:24px; background:var(--paper); box-shadow:var(--shadow); }
.primary { border-color:#d2e995; color:#18362b; background:var(--lime); }
.primary:hover:not(:disabled) { background:#e5f3be; border-color:#b7d46d; }
.quiet { background:transparent; border-color:#bdcfc4; }
.compact { min-height:44px; padding:.45rem .85rem; font-size:.84rem; }
.topbar { display:flex; align-items:center; justify-content:space-between; gap:1rem; min-height:94px;
  border-bottom:1px solid #dbe3d9; margin-bottom:28px; }
.brand-lockup { display:flex; align-items:center; gap:.85rem; min-width:0; }
.brand-lockup .eyebrow { margin-bottom:.18rem; }
.brand-mark { width:42px; height:56px; flex:none; display:grid; grid-template-rows:1fr 1fr; place-items:center;
  border-radius:9px; border:2px solid var(--forest); background:var(--paper); color:var(--forest);
  font-size:1rem; font-weight:900; box-shadow:3px 3px 0 var(--gold); }
.brand-mark span:first-child { width:70%; text-align:center; border-bottom:1px solid var(--forest); }
.header-status { display:flex; align-items:center; justify-content:flex-end; flex-wrap:wrap; gap:.55rem; }
.status,.account-chip { display:inline-flex; align-items:center; gap:.45rem; min-height:36px; padding:.35rem .72rem;
  border-radius:999px; border:1px solid var(--line); background:#fff; color:var(--forest);
  font-size:.79rem; font-weight:700; white-space:nowrap; }
.status::before { content:""; width:7px; height:7px; border-radius:50%; background:currentColor; }
.account-chip { min-width:0; max-width:min(45vw,240px); overflow:hidden; text-overflow:ellipsis; }
.connected { color:var(--ok); }.disconnected { color:var(--danger); }.connecting { color:#a16a16; }
.account-chip { color:#48675a; }
.screen { margin:26px auto; }
.auth-layout { min-height:570px; display:grid; grid-template-columns:minmax(0,1.08fr) minmax(350px,.8fr);
  gap:clamp(1.5rem,4vw,4.5rem); align-items:stretch; }
.auth-story { overflow:hidden; position:relative; display:flex; flex-direction:column; justify-content:center;
  padding:clamp(2rem,5vw,4.5rem); border-radius:26px; background:
  radial-gradient(circle at 82% 82%,#27725c 0,transparent 42%),linear-gradient(140deg,#164c3e,#0a2e27);
  color:#fbf9ed; }
.auth-story .eyebrow,.lobby-hero .eyebrow { color:var(--gold); }
.auth-story h2 { max-width:600px; margin:.7rem 0 1.1rem; }
.auth-story > p:not(.eyebrow) { max-width:430px; color:#deebe1; font-size:1.04rem; }
.auth-story .story-note { margin-top:1.5rem; color:#d2e5d8; font-size:.8rem !important; letter-spacing:.03em; }
.story-tiles { display:flex; gap:.5rem; margin-top:2.3rem; transform:rotate(-9deg); transform-origin:left center; }
.story-tiles span { width:54px; height:98px; display:grid; place-items:center; border:2px solid #deded0;
  border-radius:8px; background:#fbf8e9; box-shadow:4px 7px 0 #0b2d2540; color:#234537;
  font-weight:900; font-size:1.4rem; line-height:1.6; text-align:center; }
.story-tiles span:nth-child(2) { transform:translateY(-9px) rotate(10deg); }
.story-tiles span:nth-child(3) { transform:translateY(8px) rotate(19deg); }
.auth-card { display:flex; flex-direction:column; justify-content:center; padding:clamp(1.5rem,4vw,3.3rem); }
.auth-card h3 { margin:.6rem 0 .35rem; font-size:2rem; }
.auth-form { display:grid; gap:1.1rem; margin-top:1.7rem; }
.auth-form label { display:grid; gap:.45rem; font-size:.89rem; font-weight:750; color:#355548; }
.auth-form input { width:100%; min-height:48px; padding:.75rem .85rem; color:var(--ink);
  background:#fbfcf7; border:1px solid #aec3b6; border-radius:12px; }
.auth-form input:hover { border-color:#557f68; }
.auth-form button { width:100%; display:flex; justify-content:space-between; align-items:center; margin-top:.3rem; }
.fine-print { margin-top:1.2rem; color:var(--muted); font-size:.78rem; }
.lobby-layout { display:grid; grid-template-columns:minmax(0,1.2fr) minmax(280px,.82fr); gap:22px; align-items:start; }
.lobby-actions { display:flex; flex-wrap:wrap; gap:.65rem; margin-top:2rem; }
.lobby-actions button { min-width:180px; }
.lobby-hero .quiet { border-color:#d8e9d7; color:#f6f9ec; background:#ffffff12; }
.lobby-hero .quiet:hover { background:#ffffff24; }
.discovery { padding:1.7rem; min-width:0; }
.discovery .section-heading { align-items:center; }
.discovery h3 { margin-top:.4rem; }
.discovery > .muted { margin:.8rem 0; font-size:.87rem; }
.discovery-list { display:grid; gap:.55rem; }
.discovery-row { display:flex; align-items:center; justify-content:space-between; gap:.8rem;
  min-width:0; padding:.85rem; border:1px solid #dce7dd; border-radius:14px; background:#f7faf4; }
.discovery-row > div { min-width:0; }
.discovery-row strong { display:block; overflow-wrap:anywhere; }
.discovery-row small { display:block; margin-top:.25rem; color:var(--muted); }
.discovery-row button { flex:none; min-width:88px; }
.live-badge { flex:none; padding:.35rem .6rem; border-radius:999px; background:#e2f3d8;
  color:#24673e; font-size:.72rem; font-weight:850; letter-spacing:.08em; }
.lobby-hero { position:relative; overflow:hidden; min-height:470px; display:flex; align-items:center; padding:clamp(2rem,5vw,4.2rem);
  border-radius:26px; color:#fffdf1; background:radial-gradient(circle at 85% 65%,#2f8866 0,transparent 39%),linear-gradient(145deg,#144b3c,#0b3129);
  box-shadow:var(--shadow); }
.lobby-copy { position:relative; z-index:1; width:min(430px,100%); }
.lobby-copy h2 { margin:.8rem 0 1rem; }
.lobby-copy > p:not(.eyebrow) { color:#dceadf; }
.lobby-copy .primary { margin-top:2rem; min-width:220px; }
.lobby-note { margin-top:.75rem; font-size:.8rem; }
.hero-art { position:absolute; right:10%; bottom:7%; width:160px; height:170px; opacity:.84; }
.hero-mark { position:absolute; inset:auto 4px 0 auto; width:78px; height:145px; display:grid; grid-template-rows:1fr 2px 1fr;
  place-items:center; border:3px solid #e6e6db; border-radius:10px; color:#294537; background:#faf8ee;
  font-size:1.6rem; font-weight:900; box-shadow:7px 8px 0 #061e1840; transform:rotate(14deg); }
.hero-mark i { width:75%; height:2px; background:#95a295; }
.hero-mark.second { right:75px; bottom:7px; transform:rotate(-19deg); }
.history { padding:1.7rem; }
.section-heading { display:flex; align-items:end; justify-content:space-between; gap:.5rem; }
.section-heading h3 { margin-top:.45rem; }
.section-tag { border-radius:999px; padding:.35rem .7rem; background:#edf4e8; color:#40664d; font-size:.75rem; font-weight:750; }
.history #history-status { margin:.85rem 0; font-size:.88rem; }
.history ol { list-style:none; padding:0; margin:0; display:grid; gap:.6rem; }
.history li { display:flex; align-items:center; justify-content:space-between; gap:.5rem;
  padding:.45rem .7rem; border:1px solid #e1e8df; border-radius:13px; background:#f8faf5; }
.history li button { min-width:0; min-height:44px; flex:1; padding:.25rem; border:0; text-align:left; background:transparent; }
.history li button { overflow-wrap:anywhere; }
.history li span { flex:none; font-size:.75rem; color:var(--muted); }
.state-card { width:min(760px,100%); min-height:440px; padding:clamp(1.6rem,5vw,3.4rem); display:flex;
  flex-direction:column; align-items:center; justify-content:center; gap:1rem; text-align:center; }
.state-card h2 { max-width:550px; }
.state-card .muted { max-width:500px; }
.state-card button { min-width:180px; margin-top:.6rem; }
.pulse { width:64px; height:64px; border:4px solid #dce9d4; border-top-color:var(--forest);
  border-radius:50%; animation:spin 1.1s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }
.versus { width:100%; display:grid; grid-template-columns:minmax(0,1fr) auto minmax(0,1fr); gap:1rem; align-items:center; margin:1.3rem 0; }
.identity-card { display:grid; gap:.55rem; min-width:0; min-height:125px; padding:1.2rem; border:1px solid #d9e5db;
  border-radius:18px; background:#f5f9f3; text-align:left; }
.identity-card span { color:var(--muted); font-size:.8rem; text-transform:uppercase; letter-spacing:.08em; }
.identity-card strong { font-size:1.2rem; overflow-wrap:anywhere; }.identity-card small { color:var(--ok); font-weight:700; }
.versus-mark { width:42px; height:42px; display:grid; place-items:center; border-radius:50%; background:#e5f0db;
  color:var(--forest); font-family:Georgia,serif; font-size:1rem; font-weight:800; }
.game-title-row { display:flex; justify-content:space-between; align-items:center; gap:1rem; margin:6px 2px 12px; }
.game-title-row h2 { margin-top:.2rem; font-size:1.55rem; }
.live-pill { border:1px solid #d2e5d3; border-radius:999px; padding:.4rem .7rem; background:#eef6e8;
  color:#2b694e; font-size:.7rem; font-weight:850; letter-spacing:.1em; }
.game-grid { display:grid; grid-template-columns:minmax(0,1fr) minmax(230px,300px); gap:10px; }
.game-grid > * { min-width:0; }
.player-panel,.score-panel,.hand-panel,.hand-result { padding:.8rem 1rem; }
.player-panel { grid-column:1; min-height:62px; display:flex; align-items:center; justify-content:space-between; gap:1rem; }
.player-panel p { white-space:nowrap; }
.score-panel { grid-column:2; grid-row:1; }
.table { grid-column:1/-1; grid-row:2; }
.hand-panel { grid-column:1/-1; grid-row:3; }
.hand-result { grid-column:1/-1; grid-row:4; }
.player-panel h2,.score-panel h2,.hand-panel h2 { font-family:inherit; font-size:1.05rem; letter-spacing:0; }
.player-panel h2 { overflow-wrap:anywhere; }
.player-panel p { margin:0; color:var(--muted); }
.score-panel { display:grid; grid-template-columns:auto repeat(2,minmax(0,1fr)); align-items:center; gap:.4rem .7rem; }
.score-panel h2 { grid-row:1; margin-right:.3rem; }
.score-row { display:flex; justify-content:space-between; gap:.5rem; padding:.3rem .45rem; border:1px solid var(--line);
  border-radius:10px; background:#f6f9f3; font-size:.82rem; }
.score-row span { min-width:0; overflow-wrap:anywhere; }
.score-row strong { font-variant-numeric:tabular-nums; }
.table { position:relative; min-height:clamp(440px,55vw,650px); display:grid; grid-template-rows:auto minmax(0,1fr) auto;
  padding:.9rem; overflow:hidden; color:#f5f9ef;
  background:radial-gradient(circle at 50% 45%,#1b795b,#0d523f 80%);
  border:8px solid #1d4739; box-shadow:0 15px 34px #153e3133, inset 0 0 0 1px #ffffff30; }
.table-head { display:flex; justify-content:space-between; align-items:start; gap:.8rem; }
#match-status { font-weight:750; font-size:.82rem; }
.timer-wrap { display:flex; align-items:center; gap:.5rem; }
.timer-wrap > span { font-size:.58rem; font-weight:800; letter-spacing:.1em; color:#c6e6d0; }
.timer { min-width:56px; text-align:center; padding:.35rem .5rem; border:1px solid #a8d7b6;
  border-radius:10px; background:#124733; font-size:.95rem; font-variant-numeric:tabular-nums; }
.board-scroll-hint,.hand-scroll-hint { display:none; font-size:.73rem; }
.table.chain-scrollable .board-scroll-hint { display:block; position:absolute; right:12px; bottom:5px; z-index:8; margin:0; color:#d3efdf; font-size:.6rem; pointer-events:none; }
.board { position:relative; width:100%; height:100%; min-height:320px; overflow:visible; }
.board::after { content:""; position:absolute; left:0; top:0; width:var(--surface-width,100%); height:var(--surface-height,100%); pointer-events:none; }
.spinner-center { z-index:2; }
.spinner-branch { position:absolute; inset:0; pointer-events:none; }
.spinner-branch.inactive { opacity:.62; }
.board-destination { position:absolute; z-index:6; width:44px; min-width:44px; height:44px; min-height:44px; padding:0;
  transform:translate(-50%,-50%); border:2px solid #ffe181; border-radius:50%; color:#17382d;
  background:#fff7c92b; box-shadow:0 0 0 4px #f1d99534,0 3px 12px #061f1855; }
.board-destination::before { content:"+"; display:grid; place-items:center; width:20px; height:20px; margin:auto;
  border-radius:50%; background:#ffe16a; color:#17382d; font-size:1rem; font-weight:950; }
.board-destination:hover:not(:disabled) { transform:translate(-50%,-50%) scale(1.06); background:#fff7c94a; }
.board:empty::before { content:attr(data-empty-copy); color:#c8e5d2; font-size:.85rem; font-weight:650; }
.board-ends { z-index:7; width:max-content; max-width:100%; margin:.25rem auto 1rem; padding:.26rem .65rem; border-radius:999px;
  text-align:center; color:#f5e990; background:#092c24b8; font-weight:800; font-size:.8rem; }
.domino { width:47px; height:81px; flex:0 0 auto; display:grid; grid-template-rows:1fr 2px 1fr; place-items:center;
  padding:0; border:2px solid #d8d8ca; border-radius:3px; color:#213b30; background:#fffdf2;
  box-shadow:0 4px 11px #102c2440; font-size:1.15rem; font-weight:850; font-variant-numeric:tabular-nums; }
.domino:hover:not(:disabled) { background:#fffef5; }
.domino .divider,.placement-ghost .divider { width:72%; height:2px; background:#9fb1a6; }
.domino .face,.placement-ghost .face { width:75%; height:75%; display:grid; grid-template-columns:repeat(3,1fr);
  grid-template-rows:repeat(3,1fr); align-items:center; justify-items:center; }
.domino .pip,.placement-ghost .pip { width:5.6px; height:5.6px; border-radius:50%; background:#171b18; }
.domino .pip-1,.placement-ghost .pip-1 { grid-area:1/1; }.domino .pip-3,.placement-ghost .pip-3 { grid-area:1/3; }
.domino .pip-4,.placement-ghost .pip-4 { grid-area:2/1; }.domino .pip-5,.placement-ghost .pip-5 { grid-area:2/2; }
.domino .pip-6,.placement-ghost .pip-6 { grid-area:2/3; }.domino .pip-7,.placement-ghost .pip-7 { grid-area:3/1; }
.domino .pip-9,.placement-ghost .pip-9 { grid-area:3/3; }
.board .domino:disabled { opacity:1; }
.board .domino { position:absolute; z-index:1; width:var(--board-tile-width,80px); height:var(--board-tile-height,40px); min-width:0; min-height:0;
  grid-template-rows:none; grid-template-columns:1fr 2px 1fr; cursor:default; }
.board .domino { border-radius:3px; }
.board.sizing .domino { transition:none; }
.board .domino[data-score-award]::before { position:absolute; z-index:5; content:attr(data-score-award);
  min-width:36px; padding:.16rem .34rem; border:2px solid #fff0a8; border-radius:999px;
  color:#17382d; background:#f6d55f; box-shadow:0 3px 9px #061f1866;
  font-size:.72rem; font-weight:950; line-height:1.1; text-align:center; white-space:nowrap; }
.board .domino.score-at-left::before { right:calc(100% + 6px); top:50%; transform:translateY(-50%); }
.board .domino.score-at-right::before { left:calc(100% + 6px); top:50%; transform:translateY(-50%); }
.board .domino.score-at-top::before,.board .domino.score-at-up::before {
  left:50%; bottom:calc(100% + 6px); transform:translateX(-50%); }
.board .domino.score-at-bottom::before,.board .domino.score-at-down::before {
  left:50%; top:calc(100% + 6px); transform:translateX(-50%); }
.board .domino .face,.board .domino .divider { position:relative; z-index:1; }
.board .domino .divider { width:2px; height:72%; }
.board .domino.double { width:var(--board-tile-height,47px); height:var(--board-tile-width,78px);
  grid-template-rows:1fr 2px 1fr; grid-template-columns:none; }
.board .domino.double .divider { width:72%; height:2px; }
.board .domino.flow-vertical:not(.double),.board .domino.flow-horizontal.double {
  width:var(--board-tile-height,33px); height:var(--board-tile-width,54px);
  grid-template-rows:1fr 2px 1fr; grid-template-columns:none; }
.board .domino.flow-vertical:not(.double) .divider,.board .domino.flow-horizontal.double .divider {
  width:72%; height:2px; }
.board .domino.flow-horizontal:not(.double),.board .domino.flow-vertical.double,.board .spinner-center.double {
  width:var(--board-tile-width,54px); height:var(--board-tile-height,33px);
  grid-template-rows:none; grid-template-columns:1fr 2px 1fr; }
.board .domino.flow-horizontal:not(.double) .divider,.board .domino.flow-vertical.double .divider,
.board .spinner-center.double .divider { width:2px; height:72%; }
#board .domino { display:block; border:0; background:transparent; box-shadow:none; }
#board .tile-body { position:absolute; left:50%; top:50%; box-sizing:border-box;
  display:grid; grid-template-rows:1fr 2px 1fr; grid-template-columns:none; place-items:center;
  border:2px solid #d8d8ca; border-radius:2px; background:#fffdf2; box-shadow:0 2px 4px #102c2430;
  transform-origin:center; }
#board .tile-body > .face { width:calc(var(--board-tile-height,40px) * .65); height:calc(var(--board-tile-height,40px) * .65); }
#board .tile-body > .divider { width:72%; height:2px; }
#board .spinner-center .tile-body { border-color:#f1d995; box-shadow:0 0 0 2px #edbc6f77; }
#board .spinner-center.spinner-activated .tile-body { background:#151515; border-color:#151515; }
#board .spinner-center.spinner-activated .pip,
#board .spinner-center.spinner-activated .divider { background:#fff; }
.board .domino .pip { width:var(--board-pip-size,5px); height:var(--board-pip-size,5px); }
.board::after { content:""; position:absolute; left:0; top:0; width:var(--surface-width,100%); height:var(--surface-height,100%); pointer-events:none; }
.spinner-center { border-color:#f1d995; box-shadow:0 0 0 2px #edbc6f77,0 4px 11px #102c2440; }
.hand-panel,.hand-result { grid-column:1/-1; }
.hand-heading { display:flex; align-items:center; justify-content:space-between; gap:.8rem; }
.hand-heading > div { min-width:0; }
.hand-heading h2 { overflow-wrap:anywhere; }
.hand-heading .eyebrow { margin-bottom:.3rem; }
#turn-indicator { padding:.42rem .7rem; border-radius:999px; color:#60746a; background:#edf2eb;
  font-size:.8rem; font-weight:800; white-space:nowrap; }
#turn-indicator.active-player { color:#245734; background:#e4f3d4; }
#legal-hint { margin-top:.65rem; font-size:.88rem; }
.hand { display:flex; gap:.55rem; overflow-x:auto; overflow-y:hidden; min-height:104px; padding:.65rem .25rem;
  scrollbar-width:thin; scrollbar-color:#9dbbb0 transparent; }
.hand .domino:not(:disabled) { background:#fff4d9; border-color:#579c72; box-shadow:0 0 0 2px #94d9a854,0 4px 11px #102c2440; }
.hand .domino:hover:not(:disabled) { background:#fff8e6; }
.hand .domino:disabled { background:#d2c6aa; border-color:#b7aa8f; opacity:1; filter:none; }
.hand .domino .pip { background:#151713; box-shadow:0 0 0 .3px #151713; }
.hand .domino.selected { border-color:#b76b1a; transform:translateY(-6px); box-shadow:0 8px 20px #8a672f69; }
.table-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.65rem; padding-top:.45rem; border-top:1px solid var(--line); }
.table-actions button { width:100%; }
.direction-action { display:none !important; }
.hand-result { border-color:#a9c88c; background:#f4faec; font-weight:750; color:#2d5235; }
.feedback { display:flex; align-items:center; gap:.55rem; margin-top:18px; padding:.85rem 1.1rem;
  border-radius:15px; font-size:.86rem; color:var(--muted); box-shadow:none; }
.feedback::before { content:""; width:7px; height:7px; flex:none; border-radius:50%; background:var(--ok); }
.feedback strong { color:var(--forest); }
.feedback.error { border-color:#e3b5bd; background:#fff4f5; color:#79303c; }
.feedback.error::before { background:var(--danger); }
.modal { position:fixed; inset:0; z-index:10; display:grid; place-items:center; padding:1rem; background:#071d19bb; }
.modal-card { width:min(460px,100%); max-height:min(90vh,700px); overflow:auto; padding:clamp(1.5rem,5vw,2.4rem);
  border:1px solid #e0e9dc; border-radius:24px; background:var(--paper); box-shadow:0 28px 80px #00140b66; text-align:center; }
.modal-card { overflow-wrap:anywhere; }
.modal-card h2 { margin:.65rem 0 1rem; }
.modal-card button { margin-top:1.3rem; }
.result-card { background:linear-gradient(180deg,#fffdf8,#f2f7eb); }
.result-card h2 { font-size:clamp(2.2rem,8vw,3.4rem); color:var(--forest); }
.result-score { display:grid; gap:.5rem; margin:1rem 0; padding:1rem; border:1px solid #cad9c9;
  border-radius:18px; background:#fff; }
@media (orientation:landscape) and (max-height:500px) {
  #result-modal .result-card { padding:12px 20px; }
  #result-modal h2 { margin:0; font-size:1.65rem; }
  #result-modal .result-score { margin:.4rem 0; padding:.4rem .8rem; gap:.2rem; }
  #result-modal .result-score strong { font-size:1.3rem; }
  #result-modal #result-copy { margin:.5rem 0; }
}
.result-score > div { display:flex; align-items:center; justify-content:space-between; gap:1rem; font-size:1rem; }
.result-score strong { color:var(--ok); font-size:1.8rem; font-variant-numeric:tabular-nums; }
.create-table-card { text-align:left; }
.create-table-card .section-heading { align-items:start; }
.create-table-card h2 { font-size:2rem; }
.create-table-card #close-create-table { margin:0; min-width:44px; min-height:44px; font-size:1.4rem; }
#create-table-form { display:grid; gap:.65rem; margin-top:1.5rem; }
#create-table-form label { font-size:.84rem; font-weight:800; color:var(--forest); }
#create-table-form select { width:100%; min-height:48px; padding:.65rem .8rem; border:1px solid #a9c4b1;
  border-radius:12px; color:var(--ink); background:#f8fbf5; font:inherit; font-weight:700; }
#create-table-form select:disabled { opacity:1; color:#456b53; }
#create-table-form .muted { margin:.7rem 0; font-size:.85rem; }
#create-table-form .primary { width:100%; margin:0; }
@media (max-width:1000px) {
  .lobby-layout { grid-template-columns:minmax(0,1fr); }
  .lobby-hero { min-height:380px; }
}
@media (max-width:700px) {
  .app-shell { width:min(100% - 24px,560px); }
  .topbar { align-items:flex-start; padding:15px 0; min-height:0; flex-wrap:wrap; }
  .header-status { width:100%; justify-content:flex-start; }
  .auth-layout { grid-template-columns:minmax(0,1fr); gap:12px; }
  .auth-story { min-height:285px; padding:2rem; }
  .auth-story h2 { max-width:380px; }
  .story-tiles { position:absolute; right:10px; bottom:25px; margin:0; opacity:.7; transform:scale(.68) rotate(-9deg); transform-origin:right bottom; }
  .auth-card { min-height:350px; }
  .lobby-hero { min-height:380px; padding:2rem; }
  .discovery { padding:1.1rem; }
  .hero-art { opacity:.4; right:4%; }
  .game-grid { grid-template-columns:minmax(0,1fr) minmax(150px,35%); gap:10px; }
  .player-panel,.score-panel,.hand-panel,.hand-result { padding:1rem; }
  .table { min-height:320px; padding:.9rem; }
  .board { min-height:225px; }
  .hand-scroll-hint { display:block; margin-top:.7rem; color:#60746a; }
  .table-actions { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width:700px) and (orientation:portrait) {
  body.game-active { height:100svh; min-height:100svh; overflow:hidden; background:var(--page); }
  body.game-active .app-shell { width:100%; height:100svh; min-height:0; display:flex; flex-direction:column;
    overflow:hidden; padding:0 max(8px,env(safe-area-inset-right)) env(safe-area-inset-bottom) max(8px,env(safe-area-inset-left)); }
  .app-shell { width:calc(100% - 20px); }
  .topbar { margin-bottom:12px; }
  body.game-active .topbar { flex:none; min-height:42px; margin-bottom:3px; padding:3px 0; flex-wrap:nowrap; }
  body.game-active .brand-lockup .eyebrow,body.game-active .brand-lockup h1,body.game-active .account-chip { display:none; }
  body.game-active .brand-mark { width:27px; height:34px; font-size:.72rem; }
  body.game-active .header-status { width:auto; margin-left:auto; justify-content:flex-end; }
  body.game-active #logout { min-height:36px; padding:.3rem .55rem; }
  .brand-mark { width:35px; height:47px; }
  .brand-lockup .eyebrow { font-size:.58rem; }
  .brand-lockup h1 { font-size:1.17rem; }
  .header-status { gap:.35rem; }
  .status,.account-chip { font-size:.72rem; min-height:32px; }
  .auth-story { min-height:250px; padding:1.4rem; }
  .auth-story h2 { font-size:2.05rem; }
  .auth-story > p:not(.eyebrow) { font-size:.88rem; }
  .auth-story .story-note { display:none; }
  .story-tiles { display:none; }
  .auth-card { padding:1.35rem; }
  .lobby-hero { min-height:340px; padding:1.5rem; }
  .lobby-copy h2 { font-size:2.2rem; }
  .lobby-copy .primary { min-width:0; width:100%; }
  .lobby-actions button { width:100%; }
  .discovery-row { align-items:flex-start; flex-wrap:wrap; }
  .discovery-row button { width:100%; }
  .create-table-card { align-self:end; width:100%; max-height:90vh; border-radius:24px 24px 0 0; }
  #create-table-modal { padding:0; place-items:end center; }
  .hero-art { display:none; }
  .history { padding:1.1rem; }
  .history li { align-items:flex-start; flex-direction:column; }
  .history li span { padding-left:.25rem; }
  .state-card { min-height:390px; }
  .versus { grid-template-columns:minmax(0,1fr); gap:.55rem; }
  .identity-card { min-height:0; padding:.8rem; text-align:center; }
  .versus-mark { margin:auto; }
  body.game-active #game-screen { min-height:0; flex:1; display:flex; flex-direction:column; }
  .game-title-row { display:none; }
  .game-grid { min-height:0; height:auto; flex:1; overflow:hidden;
    grid-template-columns:minmax(0,1fr) minmax(0,1fr);
    grid-template-rows:42px minmax(0,1fr) 140px; gap:5px; }
  .game-grid:has(#draw:not(:disabled),#pass:not(:disabled)) {
    grid-template-rows:42px minmax(0,1fr) 190px; }
  .player-panel { grid-column:1; grid-row:1; }
  .score-panel { grid-column:2; grid-row:1; }
  .table { grid-column:1/-1; grid-row:2; }
  .hand-panel { grid-column:1/-1; grid-row:3; }
  .hand-result { grid-column:1/-1; grid-row:4; }
  .player-panel { display:block; min-height:0; align-content:center; }
  .player-panel h2 { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .player-panel,.score-panel { padding:.25rem .55rem; border-radius:12px; }
  .player-panel h2,.score-panel h2 { font-size:.88rem; }
  .player-panel p { margin:0; font-size:.72rem; }
  .score-panel { grid-template-columns:repeat(2,minmax(0,1fr)); gap:.25rem; }
  .score-panel h2 { display:none; }
  .score-row { display:flex; width:100%; border-bottom:1px solid var(--line); padding:.22rem 0; font-size:.76rem; }
  .score-row span { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .table { min-height:0; height:auto; padding:.4rem; border-width:3px; border-radius:14px; }
  .table-head { min-height:28px; align-items:center; pointer-events:none; }
  #match-status { max-width:72%; font-size:.72rem; }
  .timer { min-width:48px; padding:.24rem .35rem; font-size:.78rem; }
  .board { min-height:0; height:100%; }
  .board-ends { padding:.2rem .48rem; font-size:.68rem; }
  .domino { width:44px; min-width:44px; height:72px; }
  .hand-panel { position:relative; z-index:6; padding:.55rem .65rem;
    border-radius:16px; box-shadow:0 -8px 24px #102c2428; }
  .hand-heading .eyebrow { display:none; }
  .hand-heading h2 { font-size:.88rem; }
  #turn-indicator { padding:.28rem .5rem; font-size:.7rem; }
  #legal-hint { margin-top:.25rem; font-size:.72rem; line-height:1.3; }
  .hand-scroll-hint { display:none; }
  .hand { min-height:70px; max-height:76px; padding:.2rem .1rem; gap:.34rem; }
  .table-actions { grid-template-columns:repeat(2,minmax(0,1fr)); gap:.35rem; padding-top:.35rem; }
  .table-actions button { min-height:44px; padding:.4rem .25rem; border-radius:10px; font-size:.72rem; }
  .table-actions button:disabled { display:none; }
  .table-actions:not(:has(button:not(:disabled))) { display:none; }
  body.game-active .hand-result:not(.hidden) { position:fixed; z-index:8; top:64px;
    left:max(8px,env(safe-area-inset-left)); right:max(8px,env(safe-area-inset-right));
    max-height:30vh; overflow:auto; padding:.65rem; box-shadow:0 8px 24px #102c2440; }
  body.game-active .feedback { display:none; }
  body.game-active .feedback.error { position:fixed; z-index:9; top:64px;
    left:max(8px,env(safe-area-inset-left)); right:max(8px,env(safe-area-inset-right));
    display:flex; margin:0; }
  .timer-wrap > span { display:none; }
  .feedback { align-items:flex-start; }
}
/* Portrait gameplay is one continuous table.  The projection remains unchanged:
   this only gives its existing player, timer, hand and action controls stable
   positions around the playable surface. */
@media (max-width:700px) and (orientation:portrait) {
  body.game-active,body.game-active .app-shell,body.game-active #game-screen { background:#0b503c; }
  body.game-active .app-shell { padding-left:0; padding-right:0; }
  body.game-active .topbar { position:relative; z-index:20; padding-left:9px; padding-right:9px;
    background:#083e30; border-bottom:1px solid #6db48e55; }
  body.game-active .game-grid { position:relative; display:block; height:auto; min-height:0; flex:1;
    overflow:hidden; background:radial-gradient(circle at 52% 42%,#197759 0%,#0d5a43 55%,#083f30 100%); }
  body.game-active .game-grid > .panel { border:0; border-radius:0; background:transparent; box-shadow:none; }
  body.game-active .table { position:absolute; inset:0; display:block; min-height:0; height:auto; padding:0; overflow:hidden;
    color:#f7f7ea; background:transparent; }
  body.game-active .table-head { position:absolute; inset:0; z-index:7; display:block; min-height:0; pointer-events:none; }
  body.game-active .board-scroll-hint,body.game-active .board-ends { display:none; }
  body.game-active #match-status { position:absolute; z-index:9; top:84px; left:10px; display:block; max-width:88px;
    padding:.22rem .38rem; border-radius:6px; color:#d6ebdc; background:#073c2fb8; font-size:.56rem; line-height:1.2; }
  body.game-active .timer-wrap { position:absolute; display:flex; align-items:center; gap:.25rem; padding:.18rem .42rem;
    border:1px solid #a8d7b680; border-radius:999px; background:#073c2fc9; color:#f6f3c8; transition:top .18s ease,left .18s ease,right .18s ease,bottom .18s ease; }
  body.game-active .timer-wrap > span { display:inline; color:#c5e9d3; font-size:.54rem; }
  body.game-active .timer { min-width:0; padding:0; border:0; background:transparent; color:#fff7cb; font-size:.78rem; }
  body.game-active .game-grid.turn-opponent .timer-wrap { top:57px; left:10px; }
  body.game-active .game-grid.turn-self .timer-wrap { left:10px; bottom:112px; }
  body.game-active .player-panel { position:absolute; z-index:8; top:8px; right:0; left:0; display:grid; grid-template-columns:auto 1fr;
    align-items:center; column-gap:.45rem; min-width:0; max-width:none; padding:0 10px; color:#f5f4e8; }
  body.game-active .player-panel h2 { grid-column:1; margin:0; color:#fffdf1; font-size:.84rem; line-height:1.05; }
  body.game-active .player-panel p { display:none; }
  body.game-active .opponent-tiles { position:absolute; top:0; left:50%; display:flex; align-items:center; min-width:0; height:27px;
    transform:translateX(-50%); }
  body.game-active .concealed-tile { width:12px; height:25px; margin-left:-3px; border:1px solid #d7e2d4; border-radius:2px;
    background:linear-gradient(135deg,#e8ebdc 0 40%,#82ac94 41% 48%,#e8ebdc 49% 100%); box-shadow:0 1px 2px #001c164d; }
  body.game-active .score-panel { position:absolute; z-index:8; top:34px; left:10px; display:block; width:auto; min-width:56px; padding:0; color:#fffdf1; }
  body.game-active .score-panel h2,body.game-active .score-panel .score-self { display:none; }
  body.game-active .score-panel .score-row span { display:none; }
  body.game-active .score-row { display:flex; justify-content:flex-start; gap:.3rem; margin:0; padding:0; border:0; background:transparent; color:#c7e4d2; font-size:.7rem; }
  body.game-active .score-row strong { color:#fff4a8; font-size:1.1rem; line-height:1; }
  body.game-active .board { position:absolute; inset:103px 5px 118px; width:auto; height:auto; min-height:0; overflow:auto;
    scrollbar-width:none; -ms-overflow-style:none; }
  body.game-active .board::-webkit-scrollbar { display:none; }
  body.game-active .board:empty::before { display:none; }
  body.game-active .hand-panel { position:absolute; z-index:9; right:0; bottom:0; left:0; display:block; height:106px; min-height:0;
    padding:24px 10px calc(8px + env(safe-area-inset-bottom)); color:#f8f8ec; background:transparent !important; box-shadow:none !important; }
  body.game-active .hand-heading { position:absolute; left:10px; bottom:84px; display:flex; align-items:center; min-height:21px; }
  body.game-active .hand-heading .eyebrow { display:none; }
  body.game-active .hand-heading h2 { display:inline; margin:0; color:#f6f5e9; font-size:.78rem; font-weight:750; }
  body.game-active .self-score { display:inline-block; margin-left:.38rem; color:#fff1a4; font-size:1rem; font-weight:900; font-variant-numeric:tabular-nums; }
  body.game-active #turn-indicator { padding:.18rem .43rem; color:#bbdfca; background:#ffffff13; font-size:.63rem; }
  body.game-active #turn-indicator.active-player { color:#173c2d; background:#d5f0b3; }
  body.game-active #legal-hint { position:absolute; right:10px; bottom:105px; left:132px; min-height:17px; margin:0; color:#c2e0d0;
    font-size:.66rem; line-height:1.22; text-align:center; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  body.game-active .hand { display:flex; justify-content:center; gap:.28rem; min-height:75px; max-height:75px; overflow-x:auto; overflow-y:hidden; padding:.26rem .1rem .1rem; }
  body.game-active .hand .domino { width:44px; min-width:44px; height:74px; border-width:1px; border-radius:2px; }
  body.game-active .hand .domino.selected { transform:translateY(-4px); }
  body.game-active .table-actions { position:absolute; left:10px; bottom:180px; display:flex; flex-direction:column; justify-content:flex-end;
    gap:.35rem; min-height:0; padding:0; border:0; }
  body.game-active .table-actions button { width:auto; min-width:78px; min-height:44px; padding:.25rem .6rem; border:1px solid #a9cfb5; border-radius:999px;
    color:#f9faed; background:#115f49; font-size:.68rem; }
  body.game-active .table-actions button:disabled { display:none; }
  body.game-active .table-actions:not(:has(button:not(:disabled))) { display:none; }
  body.game-active .table.chain-scrollable .board-scroll-hint { display:none; }
  body.game-active .board-destination { width:46px; min-width:46px; height:46px; min-height:46px; }
  body.game-active .hand-result:not(.hidden) { position:absolute; z-index:10; top:50px; right:10px; left:132px;
    max-height:36px; overflow:hidden; padding:.28rem .42rem; border:1px solid #82b79a80; border-radius:6px;
    color:#dff1e5; background:#073c2ff2 !important; box-shadow:none; font-size:.6rem; line-height:1.2; text-align:right; }
}
@media (max-width:900px) and (orientation:landscape) and (max-height:500px) {
  body.game-active { height:100svh; overflow:hidden; }
  body.game-active .app-shell { width:100%; height:100svh; min-height:0; display:flex; flex-direction:column;
    overflow:hidden; padding:0 max(8px,env(safe-area-inset-right)) env(safe-area-inset-bottom) max(8px,env(safe-area-inset-left)); }
  body.game-active .topbar { min-height:46px; margin:0; padding:3px 0; flex-wrap:nowrap; }
  body.game-active .header-status { width:auto; margin-left:auto; }
  body.game-active .brand-lockup .eyebrow,body.game-active .account-chip,body.game-active .game-title-row { display:none; }
  body.game-active .brand-mark { width:27px; height:36px; }
  body.game-active #game-screen { min-height:0; flex:1; display:flex; flex-direction:column; }
  body.game-active .game-grid { height:calc(100svh - 50px); min-height:0; flex:1; overflow:hidden;
    grid-template-columns:120px minmax(0,1fr) 172px;
    grid-template-rows:auto 1fr; gap:5px; }
  body.game-active .player-panel { grid-area:1/1; }
  body.game-active .score-panel { grid-area:2/1; align-self:start; }
  body.game-active .table { grid-area:1/2/3/3; min-height:0; }
  body.game-active .table-head { min-height:24px; pointer-events:none; }
  body.game-active .board { height:100%; min-height:0; }
  body.game-active .board-ends { font-size:.68rem; }
  body.game-active .hand-panel { grid-area:1/3/3/4; min-height:0; position:sticky;
    right:env(safe-area-inset-right); align-self:stretch; overflow:hidden;
    display:flex; flex-direction:column; }
  body.game-active .hand-heading,body.game-active #legal-hint,body.game-active .table-actions { flex:none; }
  body.game-active .hand-scroll-hint { display:none; }
  body.game-active .score-panel { display:block; padding:.5rem; }
  body.game-active .score-row { margin-top:.3rem; }
  body.game-active .player-panel { display:block; padding:.5rem; }
  body.game-active .player-panel h2 { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; font-size:.82rem; }
  body.game-active .player-panel p { margin-top:.35rem; white-space:normal; font-size:.68rem; }
  body.game-active .hand-heading { display:block; }
  body.game-active .hand-heading h2 { overflow-wrap:normal; word-break:normal; font-size:.82rem; }
  body.game-active .hand-heading .eyebrow { display:none; }
  body.game-active #turn-indicator { display:inline-block; margin-top:.3rem; }
  body.game-active .hand { flex:1; min-height:0; max-height:none; flex-wrap:wrap; align-content:flex-start; overflow-y:auto; }
  body.game-active .table-actions { grid-template-columns:repeat(2,minmax(0,1fr)); }
  body.game-active .table-actions button:disabled { display:none; }
  body.game-active .table-actions:not(:has(button:not(:disabled))) { display:none; }
  body.game-active .feedback { display:none; }
  body.game-active .feedback.error { position:fixed; z-index:9; top:50px; left:132px; right:184px;
    display:flex; margin:0; }
  body.game-active .hand-result:not(.hidden) { position:fixed; z-index:8; left:132px; right:184px;
    bottom:max(8px,env(safe-area-inset-bottom)); max-height:38vh; overflow:auto; padding:.55rem; }
}
@media (prefers-reduced-motion:reduce) {
  *,*::before,*::after { animation-duration:.01ms !important; transition-duration:.01ms !important; scroll-behavior:auto !important; }
}

/* Stage A: shared Silk Road palette, with the approved green playing surface.
   Illustrated town/teahouse artwork belongs to the later owner-gated stages. */
:root { --page:#f5e9d1; --paper:#fffaf0; --line:#dfcda9; --gold:#efc477;
  --sandstone:#d4ae75; --terracotta:#a85236; --muted:#6b6858; }
body { background:radial-gradient(ellipse at 85% 0,#fce7b8,transparent 60%),var(--page); }
.primary { background:#efd093; border-color:#caa467; color:#283c30; }
.primary:hover:not(:disabled) { background:#f6dfad; border-color:#ae8148; }
body.game-active { height:100svh; min-height:0; overflow:hidden; background:#084332; }
body.game-active .app-shell { width:100%; height:100svh; min-height:0; padding:0 0 env(safe-area-inset-bottom);
  display:flex; flex-direction:column; overflow:hidden; }
body.game-active .topbar { flex:none; min-height:48px; margin:0; padding:3px max(12px,env(safe-area-inset-right)) 3px max(12px,env(safe-area-inset-left));
  flex-wrap:nowrap; background:#083e30; border-bottom:1px solid #83b39945; }
body.game-active .topbar h1 { color:#fbf0d0; font-size:1.12rem; }
body.game-active .brand-lockup .eyebrow,body.game-active .account-chip,body.game-active .game-title-row { display:none; }
body.game-active .brand-mark { width:26px; height:36px; border-radius:3px; }
body.game-active .header-status { width:auto; margin-left:auto; }
body.game-active #logout { min-height:44px; color:#e5efdc; border-color:#7ba28e; }
body.game-active #game-screen { flex:1; min-height:0; display:flex; flex-direction:column; }
body.game-active .game-grid { position:relative; flex:1; display:block; height:auto; min-height:0; overflow:hidden;
  background:radial-gradient(ellipse at 52% 42%,#1a7759 0,#0e5b43 56%,#084332 100%); }
body.game-active .game-grid > .panel { border:0; border-radius:0; background:transparent; box-shadow:none; }
body.game-active .table { position:absolute; inset:0; padding:0; min-height:0; height:auto; display:block; background:transparent; }
body.game-active .table-head { position:absolute; inset:0; z-index:7; display:block; pointer-events:none; }
body.game-active #match-status { top:106px; left:16px; position:absolute; max-width:112px; color:#d4e8d5; font-size:.7rem; }
body.game-active .board-ends { display:none; }
body.game-active .board { position:absolute; inset:80px 60px 158px 150px; width:auto; height:auto; min-height:0;
  overflow:auto; scrollbar-width:thin; scrollbar-color:#4c8d71 transparent;
  touch-action:none; overscroll-behavior:contain; user-select:none; -webkit-user-select:none; cursor:grab; }
#board.camera-dragging { cursor:grabbing; }
#board .board-destination { cursor:pointer; }
body.game-active .player-panel { position:absolute; z-index:8; top:15px; left:16px; right:16px; display:block;
  min-height:0; padding:0; color:#fff4db; }
body.game-active .player-panel h2 { max-width:180px; font-size:1rem; white-space:nowrap; text-overflow:ellipsis; overflow:hidden; }
body.game-active .player-panel p { display:none; }
body.game-active .opponent-tiles { position:absolute; top:0; left:50%; transform:translateX(-50%); display:flex; gap:3px; }
body.game-active .concealed-tile { display:block; width:20px; height:40px; margin:0; border:1px solid #bccaba; border-radius:2px;
  background:repeating-linear-gradient(135deg,#e6e8d9 0 3px,#b1caba 3px 5px); }
body.game-active .score-panel { position:absolute; top:40px; left:16px; display:block; padding:0; min-width:0; width:auto; z-index:8; }
body.game-active .score-panel h2,body.game-active .score-self,body.game-active .score-row span { display:none; }
body.game-active .score-row { margin:0; padding:0; border:0; background:transparent; }
body.game-active .score-row strong { color:#f8dc83; font-size:1.35rem; }
body.game-active .timer-wrap { position:absolute; left:16px; display:flex; gap:.3rem; padding:.2rem .4rem;
  border:1px solid #8cbc9c70; border-radius:6px; color:#e9eedb; background:#073c2fb8; }
body.game-active .game-grid.turn-opponent .timer-wrap { top:78px; bottom:auto; }
body.game-active .game-grid.turn-self .timer-wrap { top:auto; bottom:185px; }
body.game-active .timer-wrap > span { display:inline; font-size:.58rem; }
body.game-active .timer { min-width:0; padding:0; border:0; background:transparent; font-size:.8rem; color:#fff0b5; }
.player-clock { display:block; color:#bbd6c0; font-size:.64rem; letter-spacing:.01em; font-variant-numeric:tabular-nums; }
body.game-active #opponent-clock { margin-top:29px; }
body.game-active .hand-panel { position:absolute; z-index:8; inset:auto 0 0; height:145px; min-height:0; padding:38px 14px 6px;
  display:block; overflow:visible; color:#fff3da; background:transparent !important; box-shadow:none !important; }
body.game-active .hand-heading { position:absolute; left:16px; right:16px; bottom:110px; min-height:0; display:flex; align-items:end; justify-content:space-between; }
body.game-active .hand-heading .player-identity { width:max-content; max-width:112px; }
body.game-active .hand-heading h2 { display:block; margin:0; overflow:hidden; white-space:nowrap;
  text-overflow:ellipsis; text-align:center; color:#fff1d3; font-size:.88rem; }
body.game-active .hand-heading .eyebrow,body.game-active .hand-scroll-hint { display:none; }
body.game-active .self-score { display:block; margin:0 0 3px; text-align:center; line-height:1.1;
  color:#f8dc83; font-size:1.2rem; font-weight:850; }
body.game-active #turn-indicator { display:inline-block; margin:0; padding:.28rem .5rem; color:#ced9cf; background:#ffffff0e; font-size:.7rem; }
body.game-active #turn-indicator.active-player { background:#c9eaa5; color:#16412e; }
body.game-active #legal-hint { position:absolute; bottom:2px; left:16px; right:16px; margin:0; min-height:0;
  text-align:center; font-size:.66rem; line-height:1.2; color:#c7ddc8; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
body.game-active .hand { display:flex; justify-content:safe center; flex-wrap:nowrap; align-content:normal; gap:var(--hand-gap,5px);
  height:100px; min-height:100px; max-height:100px; padding:5px 2px; overflow-x:auto; overflow-y:hidden; }
body.game-active .hand .domino { width:var(--hand-tile-width,44px); min-width:var(--hand-tile-width,44px);
  max-width:var(--hand-tile-width,44px); height:var(--hand-tile-height,88px); border-radius:2px; }
body.game-active .hand .domino.selected { transform:translateY(-4px); }
body.game-active .table-actions { position:absolute; left:16px; bottom:225px; width:auto; display:flex; flex-direction:column; gap:6px; border:0; padding:0; }
body.game-active .table-actions button { min-height:44px; min-width:72px; width:auto; padding:.25rem .45rem; font-size:.7rem;
  border:1px solid #86b59a; border-radius:6px; background:#104f3b; color:#eff1d7; }
body.game-active .table-actions button:disabled { display:none; }
body.game-active #draw { display:none; } /* The bazaar pile is the draw control. */
body.game-active .feedback { display:none; }
body.game-active .feedback.error { position:fixed; top:58px; right:12px; left:auto; width:min(350px,90vw); margin:0; display:flex; z-index:21; }
body.game-active .hand-result:not(.hidden) { position:absolute; inset:auto 16px 152px auto; width:min(380px,60%); max-height:48px;
  overflow:auto; padding:.35rem .5rem; border-radius:6px; background:#083e30ee; color:#dcecd2; font-size:.68rem; z-index:10; }
.bazaar-panel { position:absolute; z-index:9; left:12px; top:38%; width:96px; }
#bazaar { width:100%; display:flex; flex-direction:column; align-items:center; gap:6px; padding:8px 3px;
  color:#efdf9c; border:1px solid transparent; border-radius:8px; background:#073c2f55; font-size:.72rem; }
#bazaar:disabled { opacity:1; cursor:default; color:#b6cbb7; }
#bazaar:disabled .bazaar-pile { opacity:.65; }
.bazaar-label { font-size:.6rem; font-weight:800; letter-spacing:.08em; }
.bazaar-pile { position:relative; display:block; width:45px; height:66px; }
.bazaar-pile i { position:absolute; left:2px; top:12px; width:39px; height:51px; border:1px solid #b6cab6;
  border-radius:2px; background:repeating-linear-gradient(135deg,#e6e8d9 0 3px,#a6c1ac 3px 5px); }
.bazaar-pile i:nth-child(2) { top:6px; }.bazaar-pile i:nth-child(3) { top:0; }
#bazaar-reserve { font-size:.6rem; font-weight:500; }
#bazaar.draw-available { border-color:#e6cc75; animation:bazaar-glow 1.8s ease-in-out infinite; }
@keyframes bazaar-glow { 50% { box-shadow:0 0 0 3px #e6cc7530; background:#256648; } }
/* Destinations reuse the rigid tile-body; they are excluded from chain geometry. */
.board-destination::before { content:none; }
body.game-active .board-destination,.board-destination { min-width:44px; min-height:44px; padding:0;
  border:0; border-radius:2px; background:transparent; box-shadow:none; }
#board .placement-ghost { position:absolute; inset:0; pointer-events:none; }
#board .placement-ghost .tile-body { opacity:.5; border:2px dashed #fff3b0; box-shadow:0 0 0 2px #f4d78b40; }
#board .placement-ghost .pip { width:var(--board-pip-size,5px); height:var(--board-pip-size,5px); }
.board-destination:hover:not(:disabled) { background:transparent; }
#board .board-destination:hover .tile-body,#board .board-destination:focus-visible .tile-body { opacity:.85; }
@media (max-width:700px) and (orientation:portrait) {
  body.game-active .topbar h1 { display:none; }
  body.game-active .topbar { min-height:46px; }
  body.game-active #board { inset-inline:0; top:112px; }
  body.game-active .game-grid:has(.opponent-tiles.completed-hand) :is(#match-status,.bazaar-panel:has(#bazaar:disabled)) { display:none; }
  body.game-active .player-panel { left:10px; top:10px; right:10px; }
  body.game-active .player-panel h2 { max-width:110px; font-size:.78rem; }
  body.game-active .opponent-tiles { left:62%; gap:2px; }
  body.game-active .concealed-tile { width:15px; height:30px; }
  body.game-active .score-panel { top:30px; left:10px; }
  body.game-active #opponent-clock { margin-top:25px; }
  body.game-active #match-status { top:78px; left:50%; transform:translateX(-50%); max-width:38%; font-size:.58rem; }
  body.game-active .timer-wrap { left:8px; }
  body.game-active .game-grid.turn-opponent .timer-wrap { top:72px; }
  body.game-active .game-grid.turn-self .timer-wrap { bottom:190px; }
  body.game-active .hand-heading { left:10px; right:10px; bottom:110px; }
  body.game-active .hand-heading h2 { font-size:.76rem; }
  body.game-active .hand-panel { padding-left:8px; padding-right:8px; }
  body.game-active .hand { gap:4px; }
  body.game-active .table-actions { left:8px; bottom:235px; }
  body.game-active #turn-indicator { max-width:176px; white-space:normal; text-align:right; font-size:.63rem; }
  .bazaar-panel { left:auto; right:8px; width:auto; max-width:45%; top:56px; }
  #bazaar { min-height:44px; display:grid; grid-template-columns:auto auto; gap:0 5px; padding:3px 6px; font-size:.64rem; }
  #bazaar .bazaar-pile { grid-column:1; grid-row:1 / span 3; width:15px; height:26px; }
  #bazaar .bazaar-pile i { width:14px; height:21px; left:0; top:4px; }
  #bazaar .bazaar-pile i:nth-child(2) { top:2px; }
  #bazaar .bazaar-label,#bazaar-count,#bazaar-reserve { grid-column:2; }
}
@media (orientation:landscape) and (max-height:500px) {
  body.game-active .topbar { min-height:40px; }
  body.game-active .board { inset:48px 12px 115px 112px; }
  body.game-active .hand-panel { height:106px; padding-top:12px; }
  body.game-active .hand { height:85px; min-height:85px; max-height:85px; }
  body.game-active .hand .domino { width:36px; min-width:36px; height:72px; }
  body.game-active .hand-heading { bottom:86px; left:130px; }
  body.game-active .game-grid.turn-self .timer-wrap { bottom:158px; }
  body.game-active .table-actions { bottom:16px; }
  .bazaar-panel { top:31%; left:8px; width:80px; }
}
@media (prefers-reduced-motion:reduce) { #bazaar.draw-available { animation:none; } }

#bazaar[data-count="2"] .bazaar-pile i:nth-child(3) { display:none; }

/* Completed stones stay in each player's hand area, never over the board. */
#hand-result { display:none !important; }
body.game-active .hand-reveal { position:absolute; bottom:2px; left:8px; right:8px;
  color:#f4d98c; font-size:.62rem; line-height:1.15; text-align:center;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.hand-reveal[hidden] { display:none !important; }
.hand-reveal span { margin-right:5px; }
.hand-reveal small { font:inherit; color:#bed8bd; }
.reviewing-hand #legal-hint { visibility:hidden; }
body.game-active .opponent-tiles.completed-hand { height:70px; max-width:calc(100% - 84px);
  align-items:start; overflow-x:auto; overflow-y:hidden; gap:4px; }
.opponent-tiles.completed-hand .domino { flex:none; width:30px; min-width:30px; max-width:30px; height:60px; }
.completed-hand-review { position:absolute; top:74px; left:50%; transform:translateX(-50%);
  color:#f4d98c; font-size:.62rem; white-space:nowrap; }
.completed-hand-review[hidden] { display:none; }
@media (max-width:700px) and (orientation:portrait) { .completed-hand-review { left:62%; } }
#hand-reveal-score { color:#f4d98c; font-weight:800; }
.player-time-bar { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,4fr); direction:ltr;
  width:110px; height:16px; margin-top:3px; border-radius:4px; overflow:hidden;
  background:#fff; color:#13261d; font:700 11px/16px system-ui,sans-serif; font-variant-numeric:tabular-nums; }
.player-time-bar[hidden] { display:none; }
.player-time-bar .time-track { position:relative; grid-row:1; min-width:0; }
.player-time-bar .reserve-track { grid-column:1; }
.player-time-bar .turn-track { grid-column:2; box-shadow:inset 1px 0 #0003; }
.player-time-bar i { position:absolute; left:0; top:0; height:100%; }
.player-time-bar b { position:relative; display:block; text-align:center; font:inherit; }
.turn-fill { background:#77da94; }
.reserve-fill { background:#ee8985; }
body.game-active #opponent-time-bar { margin-top:31px; }
body.game-active:has(.player-time-bar:not([hidden])) .timer-wrap,
body.game-active .player-clock:has(+.player-time-bar:not([hidden])) { display:none; }
@media(max-width:700px) {
  body.game-active #opponent-time-bar { margin-top:25px; }
}
.sound-settings { position:relative; }
.sound-settings summary { display:grid; place-items:center; min-width:44px; min-height:44px; cursor:pointer; list-style:none; }
.sound-settings summary::-webkit-details-marker { display:none; }
.sound-settings > div { position:absolute; z-index:40; top:100%; right:0; width:180px; padding:12px;
  background:#083f30; color:#fff1ca; border:1px solid #a8bd8c; border-radius:8px; box-shadow:0 8px 24px #001c1866; }
.sound-settings label { display:block; font-size:.8rem; margin-bottom:8px; }
.sound-settings input[type="checkbox"] { width:18px; height:18px; vertical-align:middle; }
.sound-settings input[type="range"] { width:100%; min-height:28px; padding:0; }

/* Shared mode selection and explicit voluntary resignation, without new artwork. */
.mode-cards { grid-column:1/-1; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.mode-cards button { position:relative; overflow:hidden; min-height:112px; text-align:left; padding:16px; border-radius:12px; background:var(--paper); }
.mode-cards strong { position:relative; z-index:1; display:block; max-width:54%; font-size:1.5rem; color:#174b37; }
.mode-cards .lobby-art { right:8px; bottom:2px; transform:scale(.46); transform-origin:right bottom; }
.mode-cards [aria-pressed="true"] { border:2px solid #247153; box-shadow:0 0 0 2px #24715318; }
.game-menu { min-width:44px; min-height:44px; padding:6px; color:#f6e5b7; font-size:1.4rem; }
body.game-active #game-menu { display:block !important; }
body.game-active .topbar { gap:8px; }
.game-overlay,#result-modal { z-index:60; }
.menu-card { display:grid; gap:12px; width:min(360px,92vw); }
.dialog-actions { display:flex; flex-wrap:wrap; gap:12px; margin-top:20px; }
.dialog-actions button { flex:1; min-height:44px; }

/* Whole-hand panning keeps large tiles accessible after repeated bazaar draws. */
#hand { position:relative; touch-action:none; overscroll-behavior:contain;
  user-select:none; -webkit-user-select:none; }
#hand[data-hand-overflow="true"] { cursor:grab; }
.dragged-domino { position:fixed; z-index:12; pointer-events:none; transform:translate(-50%,-50%);
  opacity:.85; min-width:0; min-height:0; margin:0; }
#hand.hand-dragging,#hand.hand-dragging .domino { cursor:grabbing; }
#hand .domino:disabled { pointer-events:none; }
#hand .recently-drawn { outline:2px solid #f4d478; outline-offset:-3px; }
body.game-active .hand-panel { padding-top:40px; }
body.game-active #hand-scroll-hint:not([hidden]) { display:block; position:absolute; right:10px;
  left:140px; bottom:100px; margin:0; color:#d8e8c7; font-size:.58rem; line-height:10px; text-align:right;
  pointer-events:none; white-space:nowrap; }
@media (orientation:landscape) and (max-height:500px) {
  body.game-active .hand-panel { padding-top:12px; }
  body.game-active #hand-scroll-hint { display:none !important; }
}

/* Expanded hands reserve their own space; the board alone gives up height. */
body.game-active .game-grid { --hand-extra:0px; }
body.game-active .hand-panel { height:calc(145px + var(--hand-extra)); }
body.game-active .hand-heading { bottom:calc(110px + var(--hand-extra)); }
body.game-active .board { bottom:calc(158px + var(--hand-extra)); }
body.game-active .game-grid.turn-self .timer-wrap { bottom:calc(185px + var(--hand-extra)); }
body.game-active .table-actions { bottom:calc(225px + var(--hand-extra)); }
body.game-active #hand-scroll-hint:not([hidden]) { bottom:calc(100px + var(--hand-extra)); }
body.game-active #hand[data-hand-rows="2"] { display:grid; grid-template-columns:repeat(var(--hand-columns),var(--hand-tile-width,44px));
  grid-template-rows:repeat(2,var(--hand-tile-height,88px)); grid-auto-flow:row; align-content:start;
  height:var(--hand-height,194px); min-height:var(--hand-height,194px); max-height:var(--hand-height,194px); gap:var(--hand-gap,4px); }
@media (max-width:700px) and (orientation:portrait) {
  body.game-active .board { bottom:calc(167px + var(--hand-extra)); }
  body.game-active .game-grid.turn-self .timer-wrap { bottom:calc(190px + var(--hand-extra)); }
  body.game-active .table-actions { bottom:calc(235px + var(--hand-extra)); }
}
@media (orientation:landscape) and (max-height:500px) {
  body.game-active .hand-panel { height:106px; }
  body.game-active .board { bottom:115px; }
  body.game-active .hand-heading { bottom:86px; }
  body.game-active .game-grid.turn-self .timer-wrap { bottom:158px; }
  body.game-active .table-actions { bottom:16px; }
}

/* Mobile selection is a preview; the second tap arms a legal placement. */
@media (max-width:700px) {
  body.game-active #hand,body.game-active #hand[data-hand-rows="2"] { gap:var(--hand-gap,6px); }
  body.game-active #hand .domino.selected { position:relative; z-index:3;
    transform:translateY(-.5px) scale(1.1); }
}

@media (max-width:700px) and (orientation:portrait) {
  body.game-active #hand { padding-left:3px; padding-right:3px; }
  /* Reclaim the panel gutters for a full two-row rack; each end still has
     three pixels for its expanded touch target. Keep device safe insets. */
  body.game-active #hand[data-hand-rows="2"] {
    margin-left:max(-8px,calc(env(safe-area-inset-left,0px) - 8px));
    margin-right:max(-8px,calc(env(safe-area-inset-right,0px) - 8px));
  }
  body.game-active #hand .domino { position:relative; width:var(--hand-tile-width,44px);
    min-width:var(--hand-tile-width,44px); max-width:var(--hand-tile-width,44px); height:var(--hand-tile-height,88px); }
  /* Keep a 44px horizontal hit area around the smaller body. The row gap
     also accommodates the selected tile's 10% growth without shared targets. */
  body.game-active #hand .domino::after { content:""; position:absolute; top:0; bottom:0;
    left:50%; width:max(44px,100%); transform:translateX(-50%); }
}

@media (min-width:701px) and (min-height:501px) {
  body.game-active #hand { padding-left:6px; padding-right:6px; }
  /* Clear the footer without lifting the left player HUD into the bazaar. */
  body.game-active #hand[data-hand-rows="2"] { top:-12px; padding-top:7px; padding-bottom:3px; }
  body.game-active #hand .domino { position:relative; }
  body.game-active #hand .domino::after { content:""; position:absolute; top:0; bottom:0;
    left:50%; width:44px; transform:translateX(-50%); }
  .bazaar-compact .bazaar-pile { display:none; }
  .bazaar-compact #bazaar { min-height:44px; flex-direction:row; flex-wrap:wrap;
    justify-content:center; gap:2px 4px; padding:4px; }
  .bazaar-compact .bazaar-label { flex-basis:100%; }
}

/* dominoaz public rooms. Gameplay retains its continuous green felt table. */
body:not(.game-active) { --page:#f7e4b8; --paper:#fff6dd; --ink:#382610; --muted:#6a5334;
  --line:#d5b47c; --gold:#edb542; --forest:#69441d; --forest-deep:#382610; --lime:#f5cb64;
  background:linear-gradient(#f9e3b69c,#f6dca63d 45%,#e2b768b0),var(--public-scene) center/cover fixed; }
body:not(.game-active) .app-shell { width:min(1240px,calc(100% - 48px)); }
body:not(.game-active) .topbar { min-height:84px; margin-bottom:12px; border-color:#9f71304d; }
#brand-home { border:0; padding:0; background:none; box-shadow:none; text-align:left; color:inherit; }
#brand-home:hover { transform:none; }
.wordmark { display:block; font:700 clamp(1.5rem,3vw,2rem)/1 Georgia,serif; letter-spacing:-.05em; }
.brand-lockup .eyebrow { display:block; font-size:.55rem; letter-spacing:.16em; }
body:not(.game-active) .brand-mark { background:#ffefbe; border-color:#9c6625; color:#71471d; }
body:not(.game-active) .quiet { border-color:#a47b43; background:#fff5d880; }
body:not(.game-active) .primary { background:linear-gradient(#ffde80,#e9ac32); color:#35220d; border-color:#b57b24; }
body:not(.game-active) .primary:hover { background:#ffdf8e; }
body:not(.game-active) .panel { background:#fff2d9ef; border-color:#b2864e99; box-shadow:0 12px 35px #71430d1f; }
.home-screen { position:relative; display:grid; grid-template-columns:1fr 1fr; align-content:space-between; gap:40px;
  min-height:min(820px,calc(100svh - 115px)); padding:clamp(24px,4vw,55px) 0 12px; }
.home-intro { grid-column:1/-1; max-width:660px; text-shadow:0 2px 16px #fff1d4; }
.home-intro .eyebrow { color:#715024; }
.home-intro h1 { margin:16px 0 20px; font-size:clamp(3.4rem,7vw,6.3rem); line-height:.96; color:#3e2913; }
.home-intro > p:last-child { color:#4e3922; font-size:clamp(1rem,1.5vw,1.2rem); }
.home-games { grid-column:1/-1; display:grid; grid-template-columns:1fr 1fr; gap:20px; }
.home-game { position:relative; isolation:isolate; overflow:hidden; display:flex; align-items:center; min-height:230px;
  padding:28px; text-align:left; background:linear-gradient(120deg,#fff3cedf,#efc16cde); border:1px solid #b28335;
  border-radius:22px; box-shadow:0 8px 28px #75471029,inset 0 0 0 4px #fff2c94d; }
.home-game:hover:not(:disabled) { background:#ffedbbf0; border-color:#75501d; transform:translateY(-3px); }
.game-card-copy { position:relative; z-index:2; display:grid; gap:10px; max-width:60%; }
.game-card-copy small { color:#78531d; font-size:.58rem; letter-spacing:.14em; }
.game-card-copy strong { font:700 clamp(1.6rem,2.8vw,2.5rem)/1.02 Georgia,serif; color:#493015; }
.game-card-copy > span { font-size:.75rem; font-weight:500; color:#6a4b27; }
.game-card-copy b { margin-top:14px; color:#68451d; font-size:.8rem; }
.home-footnote { grid-column:1/-1; color:#4d371e; font-size:.75rem; text-align:center; text-shadow:0 1px 5px #fff5dd; }
.mode-art { position:absolute; width:300px; height:220px; right:-40px; bottom:0; pointer-events:none; transform:rotate(-9deg); }
.mode-art .domino { position:absolute; display:block; border:0; background:transparent; box-shadow:none; min-height:0; min-width:0; }
.mode-art .tile-body { position:absolute; left:50%; top:50%; display:grid; grid-template-rows:1fr 1px 1fr; place-items:center;
  border:1px solid #b1aa91; border-radius:1px; background:#fffdf2; box-shadow:2px 4px 3px #67411140; transform-origin:center; }
.mode-art .face { width:12px; height:12px; }.mode-art .pip { width:2.5px; height:2.5px; }
.mode-art .divider { height:1px; }.mode-art .art-spinner .tile-body { background:#151515; border-color:#151515; }
.mode-art .art-spinner .pip,.mode-art .art-spinner .divider { background:#fff; }
.join-invitation { display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:10px; padding:16px;
  margin:20px 0; border:2px solid #aa702c; border-radius:14px; background:#fff0c9; color:#493015; }
.join-invitation #join-name { min-width:0; overflow-wrap:anywhere; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden;
  clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.join-invitation .default-avatar { grid-row:1/3; }
.join-invitation .join-actions { grid-column:2/4; display:flex; gap:10px; flex-wrap:wrap; }
.join-timer { font-weight:700; font-variant-numeric:tabular-nums; }
.signin-tiles { display:flex; gap:9px; margin-top:28px; transform:rotate(-8deg); }
body:not(.game-active) .auth-story { background:linear-gradient(#6f42187d,#704414b0),var(--public-scene) left/cover; }
body:not(.game-active) .auth-card { background:#fff8e9f5; }
.auth-card #show-register { margin-top:16px; }.text-action { background:none; border:0; text-decoration:underline; font-weight:500; }
body:not(.game-active) .lobby-layout { gap:16px; }
body:not(.game-active) .lobby-hero { grid-column:1/-1; min-height:220px; padding:28px 32px;
  background:linear-gradient(90deg,#634019d9,#82522588 60%,#ab752529),var(--public-scene) center 70%/cover; }
body:not(.game-active) .lobby-copy { width:min(680px,100%); }
body:not(.game-active) .lobby-copy h2 { font-size:2.5rem; margin:8px 0; color:#fff3d5; }
body:not(.game-active) .lobby-actions { margin-top:16px; }
body:not(.game-active) .mode-cards button { min-height:78px; border-color:#a57932; background:#ffedc9d9; color:#704d22; }
body:not(.game-active) .mode-cards button[aria-pressed="true"] { background:linear-gradient(#ffe194,#eab744); border-color:#8e5a1b; box-shadow:inset 0 -3px 0 #ac702c; }
.lobby-tabs { grid-column:1/-1; display:flex; gap:8px; }
.lobby-tabs button { flex:1; border-color:#a57932; background:#f4dfb9; color:#6b4d29; }
.lobby-tabs button[aria-pressed="true"] { background:#f6cb60; color:#3b280f; }
body:not(.game-active) .history,#my-tables { grid-column:1/-1; }
body:not(.game-active) .discovery { padding:24px; }
body:not(.game-active) .discovery h3,body:not(.game-active) .history h3 { font-size:1.65rem; }
body:not(.game-active) .discovery-row { padding:12px 8px; border:0; border-bottom:1px solid #b6884340; border-radius:0; background:transparent; }
.discovery-row > div { flex:1; }.discovery-row .default-avatar { flex:none; }
body:not(.game-active) .discovery-row small { color:#6b512e; font-size:.72rem; }
body:not(.game-active) .discovery-row strong { font-size:.91rem; }
body:not(.game-active) .discovery-row button { min-width:76px; }
.default-avatar,.profile-avatar { display:inline-grid; place-items:center; flex:none; width:36px; height:36px; border-radius:50%;
  border:1px solid #c89a43; background:linear-gradient(145deg,#ffedb9,#d69a38); color:#5d3a14; font:700 1rem Georgia,serif; }
.profile-avatar { width:76px; height:76px; font-size:2rem; margin-bottom:18px; }
#profile-name { font-size:1.4rem; font-weight:700; margin-top:14px; }
#profile-status { margin:8px 0 16px; }
#profile-modal button { margin-top:14px; }
#opponent h2[data-avatar]::before,#own-player[data-avatar]::before { content:attr(data-avatar); display:inline-grid; place-items:center;
  width:18px; height:18px; margin-right:5px; vertical-align:middle; border-radius:50%; background:#eecb7b; color:#3c2d17; font-size:10px; }
body.game-active #brand-home { padding:0; min-height:36px; }
body.game-active .wordmark { color:#fbf0d0; font-size:1.1rem; }
body.game-active #open-profile { color:#e9d5a1; border-color:#e9d5a14d; }
.tea-steam { position:absolute; right:12%; bottom:10%; display:flex; gap:12px; opacity:.35; pointer-events:none; }
.tea-steam i { width:15px; height:60px; border-left:2px solid #fff8e7; border-radius:50%; filter:blur(2px); animation:tea-rise 5s ease-in-out infinite; }
.tea-steam i:nth-child(2) { animation-delay:1.5s; }.tea-steam i:nth-child(3) { animation-delay:3s; }
@keyframes tea-rise { 0%,100% {transform:translateY(8px);opacity:0;} 50% {transform:translateY(-18px);opacity:.7;} }
@media(max-width:700px) {
  body:not(.game-active) .app-shell { width:calc(100% - 28px); }
  body:not(.game-active) .topbar { padding:12px 0; flex-wrap:nowrap; gap:8px; }
  body:not(.game-active) .header-status { width:auto; margin-left:auto; gap:4px; }
  body:not(.game-active) .brand-lockup .eyebrow { display:none; }
  body:not(.game-active) .wordmark { font-size:1.6rem; }
  body:not(.game-active) .brand-mark { width:28px; height:38px; border-radius:3px; }
  body:not(.game-active) .status { display:none; }
  body:not(.game-active) .account-chip { display:none; }
  .home-screen { min-height:calc(100svh - 110px); padding-top:22px; gap:24px; }
  .home-intro h1 { font-size:clamp(3.1rem,13vw,4.8rem); }
  .home-intro > p:last-child { font-size:.91rem; }
  .home-games { grid-template-columns:1fr; gap:12px; }
  .home-game { min-height:176px; padding:22px; border-radius:16px; }
  .game-card-copy { max-width:64%; }.game-card-copy strong { font-size:1.85rem; }
  .game-card-copy small { font-size:.5rem; }.game-card-copy > span { font-size:.7rem; }.game-card-copy b { margin-top:8px; }
  .mode-art { right:-65px; bottom:-20px; transform:scale(.9) rotate(-9deg); transform-origin:right bottom; }
  body:not(.game-active) .lobby-hero { min-height:205px; padding:22px; }
  body:not(.game-active) .lobby-copy h2 { font-size:2rem; }
  body:not(.game-active) .lobby-actions { gap:8px; flex-wrap:nowrap; }
  body:not(.game-active) .lobby-actions button { min-width:0; width:auto; flex:1; padding:.65rem .5rem; font-size:.76rem; }
  body:not(.game-active) .lobby-note { font-size:.7rem; }
  body:not(.game-active) .discovery-row { flex-wrap:nowrap; gap:8px; }
  body:not(.game-active) .discovery-row button { width:auto; min-width:64px; padding:.5rem; }
  body:not(.game-active) .discovery-row .default-avatar { width:30px; height:30px; }
  body:not(.game-active) .mode-cards { gap:8px; }.mode-cards button strong { font-size:1.1rem; }
  .mode-cards .lobby-art { right:-24px; transform:scale(.35); }
  body:not(.game-active) .discovery { padding:20px; }
  body.game-active .wordmark { display:none; }
  body.game-active #open-profile { min-width:34px; min-height:34px; padding:4px; }
}
@media(prefers-reduced-motion:reduce) { .tea-steam {display:none;} .home-game {transition:none;} }

/* The board camera owns its offsets; browser anchoring must not undo its fit. */
#board { overflow-anchor:none; }

/* Approved Uzbek courtyard: presentation only, outside the green match. */
body:not(.game-active) { background-image:linear-gradient(#f7dfad12,#dfae581a),var(--public-scene); }
body:not(.game-active) .topbar { margin-top:16px; padding:14px 22px; border:1px solid #e5c389;
  border-radius:18px; background:#fff2d9ed; box-shadow:0 8px 30px #59351020; }
body:not(.game-active) .home-screen { max-width:1000px; min-height:calc(100svh - 150px); gap:24px; padding-top:22px; }
.home-intro { justify-self:center; max-width:700px; text-align:center; padding:22px 32px;
  border-radius:24px; background:radial-gradient(ellipse,#fff0d5f5,#fff0d5c7 65%,#fff0d500); }
.home-intro h1 { font-size:clamp(3.8rem,8vw,6.8rem); letter-spacing:-.055em; margin:8px 0 10px; }
.home-intro > p:last-child { font-size:1rem; }
.home-games { max-width:850px; width:100%; justify-self:center; gap:24px; }
.home-game { min-height:320px; display:flex; align-items:end; padding:24px; border:2px solid #bd8b3e;
  background:linear-gradient(180deg,#244e40ed 0%,#123e32f5 58%,#543516 59%,#36220fee 100%);
  box-shadow:0 14px 30px #46270950,inset 0 0 0 4px #e8bf674d; border-radius:24px; }
.home-game:hover:not(:disabled) { background:linear-gradient(180deg,#315e4ef5,#164635 58%,#66431f 59%,#432b13 100%); border-color:#ffe2a0; }
.home-game .game-card-copy { width:100%; max-width:none; gap:7px; text-align:center; }
.home-game .game-card-copy small { color:#f2ce85; font-size:.58rem; }
.home-game .game-card-copy strong { color:#fff0cd; font-size:clamp(1.7rem,3vw,2.3rem); }
.home-game .game-card-copy b { display:block; width:180px; max-width:100%; margin:7px auto 0;
  padding:10px 14px; border-radius:30px; background:linear-gradient(#ffe3a2,#edb44c); color:#422a10; }
.home-game .mode-art { left:50%; right:auto; top:-16px; bottom:auto;
  transform:translateX(-50%) scale(1.36) rotate(-12deg); transform-origin:center; filter:drop-shadow(0 14px 9px #001d1980); }
.home-game .tile-body { box-shadow:2px 4px 0 #bca579,4px 8px 6px #001b1655; border-radius:2px; }
.home-game .art-spinner .tile-body { box-shadow:2px 4px 0 #554b35,4px 8px 6px #001b1655; }
.home-footnote { justify-self:center; padding:6px 16px; border-radius:20px; background:#fff1d8e8; }
body:not(.game-active) .lobby-layout { max-width:1040px; }
body:not(.game-active) .lobby-hero { min-height:270px; border:1px solid #c99748; background-position:center 80%;
  background-image:linear-gradient(90deg,#42280fee,#513615ba 50%,#44290e10),var(--public-scene); }
body:not(.game-active) .lobby-copy > p:not(.eyebrow) { color:#fff0d3; }
body:not(.game-active) .lobby-copy .primary { margin-top:0; }
body:not(.game-active) .lobby-hero .quiet { background:#fff0d9; color:#4d3215; }
body:not(.game-active) .mode-cards strong { color:#4d3215; }
body:not(.game-active) .panel { background:#fff3dcf5; }
body:not(.game-active) .lobby-tabs button { min-height:50px; box-shadow:inset 0 -3px 0 #aa77392b; }
body:not(.game-active) .join-invitation { width:100%; }
@media(max-width:700px) {
  body:not(.game-active) { background-attachment:scroll; background-position:center top; }
  body:not(.game-active) .topbar { margin-top:8px; padding:10px; border-radius:14px; }
  body:not(.game-active) .home-screen { min-height:0; padding-top:6px; margin-top:16px; gap:20px; }
  .home-intro { padding:14px 8px; }
  .home-intro h1 { font-size:3.6rem; }
  .home-intro .eyebrow { font-size:.56rem; }
  .home-intro > p:last-child { font-size:.88rem; }
  .home-games { gap:14px; }
  .home-game { min-height:210px; padding:18px; align-items:center; }
  .home-game .game-card-copy { text-align:left; max-width:55%; gap:8px; }
  .home-game .game-card-copy strong { font-size:1.65rem; }
  .home-game .game-card-copy small { font-size:.5rem; }
  .home-game .game-card-copy b { width:auto; margin:6px 0 0; text-align:center; font-size:.72rem; padding:9px; }
  .home-game .mode-art { left:auto; right:-57px; top:-6px; transform:scale(.95) rotate(-12deg); transform-origin:right center; }
  .home-game,.home-game:hover:not(:disabled) { background:linear-gradient(90deg,#432b15f5 0%,#563a1fed 54%,#164635ed 55%); }
  body:not(.game-active) .lobby-hero { min-height:250px; padding:22px; }
  body:not(.game-active) .mode-cards .lobby-art { opacity:.85; }
}

/* Owner refinement: let the courtyard show through the brand and controls. */
body:not(.game-active) .topbar { background:#fff1d94d; backdrop-filter:blur(5px); }
.home-intro { background:transparent; text-shadow:0 2px 2px #fff0ce,0 0 20px #fff2d9; }
.home-game { background:linear-gradient(180deg,#174738a8 0%,#123e32b8 58%,#503315b8 59%,#36220fc9 100%); }
.home-game:hover:not(:disabled) { background:linear-gradient(180deg,#315e4ec7,#164635cf 58%,#66431fd6 59%,#432b13dc 100%); }
.home-game .game-card-copy { text-shadow:0 2px 4px #2c1a0d; }
.home-game .game-card-copy b { background:linear-gradient(#ffe3a2c9,#edb44cd9); text-shadow:none; }
body:not(.game-active) .primary { background:linear-gradient(#ffde80cf,#e9ac32df); }
body:not(.game-active) .quiet { background:#fff5d8a6; }
@media(max-width:700px) {
  .home-game { background:linear-gradient(90deg,#432b15d9 0%,#563a1fbd 54%,#164635a8 55%); }
  .home-game:hover:not(:disabled) { background:linear-gradient(90deg,#432b15eb 0%,#563a1fd9 54%,#164635c9 55%); }
}
body:not(.game-active) .topbar { background:transparent; backdrop-filter:none; border-color:#e5c38980; box-shadow:none; }
body:not(.game-active) #brand-home { text-shadow:0 1px 2px #fff0ce,0 0 14px #fff2d9; }
.home-game .game-card-copy b { background:#ffdf9294; border:1px solid #ffe9b3; }
body:not(.game-active) .primary { background:#ffd777a6; }

/* One owner-approved night scene on every public screen, including legal pages.
   Retain the allowlisted route so no backend restart is needed. */
body:not(.game-active) { --public-scene:url('/assets/silk-road-teahouse-v1.jpg?build=cabc319d800148cefa1c0379f0a0693227b9aa71a0a79daa8a5b5464fe8c7aec');
  background-image:var(--public-scene); background-color:#101e29;
  background-size:cover; background-position:center; background-repeat:no-repeat;
  background-attachment:fixed;
}
body:not(.game-active) .lobby-hero {
  /* One continuous page illustration; this panel adds contrast, not a second crop. */
  background-image:linear-gradient(90deg,#42280fcc,#513615a6);
}

/* Open-table discovery: readable gold glass, scenery stays visible. */
body:not(.game-active) .discovery.panel { background:#fff0cdba; border:1px solid #c99b53aa;
  backdrop-filter:blur(3px); box-shadow:0 8px 24px #53320e15; }
body:not(.game-active) .discovery-row { background:#fff2d340; border-color:#b98b4970; }
body:not(.game-active) .table-count { display:inline-block; font:700 .85rem system-ui;
  padding:5px 10px; border:1px solid #b98b49; border-radius:18px; vertical-align:middle; }
body:not(.game-active) .discovery-row button { min-height:44px; }
body:not(.game-active) .lobby-hero { min-height:210px; }
/* The mode belongs beside the lobby title; wrap together on narrow screens. */
body:not(.game-active) #lobby-screen .lobby-copy { width:100%; min-width:0; }
#lobby-screen .lobby-heading-row { display:flex; flex-wrap:wrap; align-items:center; gap:12px 24px; }
#lobby-screen .lobby-heading-row h2 { min-width:0; overflow-wrap:anywhere; }
#lobby-screen .lobby-mode-badge {
  display:inline-flex; align-items:center; gap:12px; max-width:100%; padding:8px 16px;
  border:1px solid #e5c58b; border-radius:12px; background:#112c36d9; color:#fff1d7;
}
#lobby-screen #mode-heading {
  min-width:0; font-size:clamp(1.1rem,2vw,1.35rem); font-weight:800;
  letter-spacing:.015em; line-height:1.35; overflow-wrap:anywhere;
}
#lobby-screen .lobby-mode-icon { flex:none; width:64px; height:48px; }
#lobby-screen .chain-mode-icon { display:none; }
body:has(#mode-101[aria-pressed="true"]) #lobby-screen .spinner-mode-icon { display:none; }
body:has(#mode-101[aria-pressed="true"]) #lobby-screen .chain-mode-icon { display:block; }
@media(max-width:700px) {
  #lobby-screen .lobby-heading-row { gap:8px; }
  #lobby-screen .lobby-mode-badge { gap:10px; padding:6px 10px; }
  #lobby-screen .lobby-mode-icon { width:52px; height:40px; }
}
body:not(.game-active):has(#home-screen:not(.hidden)) #connection,
body:not(.game-active):has(#signin-screen:not(.hidden)) #connection { display:none; }

/* Owner-approved room directory; game-table styles remain scoped separately. */
body:not(.game-active) .auth-layout { display:flex; justify-content:center; min-height:70vh; }
body:not(.game-active) .auth-card { width:min(100%,480px); background:#fff1d5b8; backdrop-filter:blur(6px); }
body:not(.game-active) #register-modal .modal-card { background:#fff1d5d9; backdrop-filter:blur(6px); }
.brand-crown { display:none; width:48px; height:48px; color:#efbf55; filter:drop-shadow(0 1px 2px #493116); }
.brand-crown svg { width:100%; height:100%; }
.homepage-active .brand-crown { display:block; }
.homepage-active .brand-mark { display:none; }
.room-directory { grid-template-columns:repeat(auto-fit,minmax(min(100%,300px),1fr)); max-width:850px; }
.room-directory .home-game { max-width:440px; width:100%; justify-self:center; }
.room-emblem { position:absolute; top:20px; left:50%; transform:translateX(-50%); border:2px solid #f3d28b; border-radius:8px; padding:8px 14px; color:#34230f; background:#fff1ce; line-height:1.1; font-size:32px; }
.domino-mode-grid { max-width:1200px; grid-template-columns:repeat(3,minmax(0,1fr)); }
.domino-mode-grid .home-game { min-width:0; }
.coming-soon { opacity:.8; cursor:default; }
@media(max-width:700px) {
  .domino-mode-grid { grid-template-columns:1fr; }
  body:not(.game-active) .auth-layout { min-height:0; }
  body:not(.game-active) .auth-card { padding:22px; }
  .room-directory .room-emblem { left:auto; right:28px; top:50%; transform:translateY(-50%); }
}

#domino-room-title { margin:0; text-align:right; }
@media(min-width:701px) {
  .domino-mode-grid .home-game { min-height:360px; }
  .domino-mode-grid .home-game .mode-art { transform:translateX(-50%) scale(1.05) rotate(-12deg); top:0; }
  .domino-mode-grid .game-card-copy strong { font-size:1.65rem; }
}
.domino-mode-grid .coming-soon { opacity:1; background:linear-gradient(180deg,#244e40d9 0%,#123e32e8 58%,#543516e8 59%,#36220feb 100%); }
#lobby-rooms { grid-column:1/-1; justify-self:start; }

/* Domino Room opens the existing lobby directly, with all modes together. */
.mode-cards { grid-template-columns:repeat(3,minmax(0,1fr)); }
.mode-cards small { position:relative; z-index:1; display:block; margin-top:8px; color:#654b26; }
.mode-cards button:disabled { opacity:1; cursor:default; }
@media(max-width:700px) {
  .mode-cards { grid-template-columns:1fr; }
  .mode-cards strong { max-width:65%; }
}

/* Room entrance uses the same canonical pip renderer as the green table. */
.room-directory .home-game { min-height:350px; border:2px solid #e4bd70;
  background:linear-gradient(155deg,#12534bd9,#0b3934d6 54%,#382b1cdb 55%,#63431cde);
  box-shadow:0 16px 32px #2a170c50,inset 0 0 0 5px #ffe1a31c,inset 0 1px 0 #fff3ca80; }
.room-directory .home-game:hover:not(:disabled) { background:linear-gradient(155deg,#226b60e0,#104a40d9 54%,#49331fdf 55%,#785422e3); border-color:#ffe4a2; }
.room-directory .room-emblem { width:190px; height:155px; padding:0; border:0; border-radius:0; background:none;
  top:25px; left:50%; right:auto; transform:translateX(-50%); pointer-events:none; }
.room-emblem .domino { position:absolute; display:grid; width:58px; min-width:58px; height:116px;
  border:2px solid #d9c69b; border-radius:6px; background:#fff9e8; opacity:1;
  box-shadow:4px 6px 0 #b09b70,8px 15px 18px #001e1b85; }
.room-emblem .domino:first-child { left:36px; top:9px; transform:rotate(-18deg); }
.room-emblem .domino:last-child { left:94px; top:17px; transform:rotate(13deg); }
.room-emblem .domino .pip { width:6.5px; height:6.5px; }
.room-directory .game-card-copy { position:relative; z-index:2; }
.room-directory .game-card-copy b { border-color:#ffe4aa; background:linear-gradient(#ffe6a7d9,#dca94bcc); box-shadow:0 3px 8px #291a1150; }
@media(max-width:700px) {
  .room-directory .home-game { min-height:200px; }
  .room-directory .room-emblem { left:auto; right:-10px; top:50%; transform:translateY(-50%) scale(.78); transform-origin:right center; }
  .room-directory .game-card-copy { max-width:52%; }
  .room-directory .game-card-copy strong { font-size:1.65rem; }
}

/* Match viewport follows Safari chrome at scale 1; browser accessibility zoom remains enabled. */
body.game-active,body.game-active .app-shell { height:var(--game-viewport-height,100dvh); min-height:0; }
body.game-active .app-shell { padding-top:env(safe-area-inset-top); }
body.game-active .topbar { order:0; }
body.game-active #game-screen { order:2; }
body.game-active .feedback.error { position:relative; inset:auto; order:1; flex:none;
  width:auto; max-height:76px; overflow:auto; margin:0 8px; padding:6px 8px;
  align-items:center; gap:8px; font-size:.75rem; border-radius:8px; }
.feedback.dismissed,body.game-active .feedback.dismissed { display:none; }
#dismiss-feedback { flex:none; min-width:44px; min-height:44px; padding:4px; }
body.game-active button,body.game-active summary { touch-action:manipulation; }
body.game-active #board button { touch-action:none; }
body.game-active #board { scrollbar-width:thin; scrollbar-color:#80b69c55 transparent; }
body.game-active #board::-webkit-scrollbar { width:5px; height:5px; }
body.game-active #board::-webkit-scrollbar-thumb { background:#80b69c55; border-radius:4px; }
@media (max-width:700px) and (orientation:portrait) {
  /* Direct pan and pinch keep the full width available to the stones. */
  body.game-active #board { scrollbar-width:none; }
  body.game-active #board::-webkit-scrollbar { width:0; height:0; display:none; }
}
@media (orientation:landscape) and (max-height:500px) {
  body.game-active .feedback.error { max-height:48px; font-size:.66rem; }
  body.game-active .board { top:52px; bottom:100px; left:145px; }
  body.game-active .hand-heading { left:145px; bottom:76px; }
  body.game-active .hand-panel { height:106px; }
  body.game-active .hand { height:85px; min-height:85px; max-height:85px; }
  body.game-active .game-grid.turn-self .timer-wrap { bottom:108px; }
  body.game-active .bazaar-panel { top:auto; bottom:4px; }
}

/* Portrait keeps both wine and tea edges visible without stretching the scene.
   The single full-width panorama fades into the night color below the artwork. */
@media (max-width:700px) and (orientation:portrait) {
  body:not(.game-active) {
    background-image:linear-gradient(to bottom,transparent 40vw,#101e29 67vw),var(--public-scene);
    background-size:100% 68vw,100% auto; background-position:center top;
    background-repeat:no-repeat; background-attachment:scroll;
  }
}

/* Let the artwork show through public panels without fading their text. */
body:not(.game-active) #lobby-screen:not(.hidden) .discovery.panel {
  background:#fff0cda6;
}
body:not(.game-active):has(:is(#home-screen,#domino-room-screen,#lobby-screen):not(.hidden)) .feedback:not(.error) {
  background:#fff3dcb8;
  backdrop-filter:blur(3px);
  -webkit-backdrop-filter:blur(3px);
}

/* Product panels retain approved art and never change table geometry. */
#site-menu-open { min-width:44px;min-height:44px; }
#copyright { text-align:center;padding:12px; }
body.game-active #copyright { display:none; }
.menu-card { display:flex;flex-direction:column;gap:10px; }
#settings-modal fieldset,.amount-options { margin-block:16px;padding:12px;border:1px solid #b18a47;border-radius:12px; }
.consent,.amount-options label { display:flex;align-items:center;gap:9px;margin-block:10px; }
.consent input,.amount-options input { width:20px;height:20px;flex:none; }
.amount-options .locked { color:#655640;background:#d5c7a3aa;padding:10px;border-radius:8px; }
.history li { display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin-block:14px; }
.history bdi { font-family:monospace;overflow-wrap:anywhere;user-select:text; }
#settings-modal select { min-height:44px;width:100%; }
#legal-modal li { margin-block:12px; }
.modal-card { max-height:calc(100dvh - 40px - env(safe-area-inset-top) - env(safe-area-inset-bottom));overflow:auto; }
:root[dir="rtl"] .modal-card,:root[dir="rtl"] .auth-card,:root[dir="rtl"] .lobby-layout { text-align:right; }
:root[dir="rtl"] .board,:root[dir="rtl"] .domino,:root[dir="rtl"] .hand,:root[dir="rtl"] .game-grid { direction:ltr; }
:root[dir="rtl"] .player-panel,:root[dir="rtl"] .player-identity { direction:rtl; }
@media(max-width:700px){.topbar { gap:6px; } #site-menu-open { padding:7px; } .history li { align-items:flex-start; } }
.legal-document { max-width:960px;margin:20px auto;padding:clamp(20px,4vw,48px);line-height:1.65;text-align:left; }
.legal-document section { scroll-margin-top:20px;margin-block:32px; }
.legal-document nav { line-height:2; }

#site-menu-modal,#settings-modal,#support-modal,#legal-modal { z-index:80; }

#site-menu-modal h2,#settings-modal h2,#support-modal h2,#legal-modal h2 { font-size:2rem;line-height:1.15; }
#site-menu-modal button { margin-top:0;min-height:44px; }
#site-menu-modal .modal-card { gap:10px;background:#fff4dbeF;backdrop-filter:blur(6px); }

/* Nard phase 1 directory only; no changes to green game geometry. */
.home-games.nard-directory { max-width:940px;grid-template-columns:repeat(2,minmax(0,1fr)); }
.nard-home-card { position:relative;overflow:hidden; }
.nard-emblem { width:180px;max-width:100%;height:auto;flex:none;filter:drop-shadow(3px 6px 4px #25150955); }
.nard-home-card .nard-emblem { position:absolute;top:24px;left:50%;transform:translateX(-50%) rotate(-8deg); }
.nard-screen { display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px;max-width:940px; }
.nard-screen > button:first-child { justify-self:start;grid-column:1/-1; }
.nard-screen > h2,.nard-subtitle,.nard-mode-choices,.nard-intro,.nard-screen > p { grid-column:1/-1; }
.nard-screen > h2,.nard-subtitle { text-align:center;color:#493015;text-shadow:0 1px 6px #fff8e4; }
.nard-mode-choices { display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px; }
.nard-mode-card { display:flex;flex-direction:column;align-items:center;gap:16px;padding:24px 20px;background:linear-gradient(135deg,#fff5dfad,#f3d8a8bf);border:1px solid #ae804c;border-radius:24px;box-shadow:0 8px 24px #301b1526,inset 0 0 0 4px #fff4dc33;color:#35251a; }
.nard-mode-card .nard-emblem { width:300px; }
.nard-mode-card strong { font:700 1.8rem Georgia,serif;text-shadow:0 1px 3px #fff8e3; }
.nard-mode-card > span { font-size:.8rem;padding:5px 12px;border-radius:99px;background:#fff5dfc9;border:1px solid #b28a55; }
.nard-mode-card:hover:not(:disabled) { background:linear-gradient(135deg,#fff5dfb8,#f3d8a8c2);border-color:#6d4825;box-shadow:0 10px 28px #301b1538,inset 0 0 0 4px #fff4dc55; }
.nard-mode-card:focus-visible { outline:3px solid #155f59;outline-offset:4px; }
.nard-intro,.nard-summary { padding:24px;display:grid;gap:16px;min-width:0; }
body:not(.game-active) .nard-screen :is(.nard-intro,.nard-summary) {
  background:linear-gradient(135deg,#fff5dfad,#f3d8a8b3);
  border:1px solid #ae804c;box-shadow:0 6px 20px #301b151c;
}
.nard-intro { grid-template-columns:minmax(0,1fr) 220px; }
.nard-intro > .nard-emblem { grid-column:2;grid-row:1 / span 4;width:220px;align-self:center; }
.nard-intro > p,.nard-intro > button { grid-column:1; }
.nard-intro > .amount-options { grid-column:1/-1;background:#fff5df80; }
.nard-summary p { color:#53472f; }
.nard-intro > button { justify-self:start; }
.nard-intro .amount-options { display:flex;flex-wrap:wrap;gap:10px;margin:0; }
.nard-intro .amount-options p { flex-basis:100%; }
.nard-intro button:disabled { opacity:.75; }
@media(max-width:700px) {
 .home-games.nard-directory,.nard-screen,.nard-mode-choices { grid-template-columns:minmax(0,1fr); }
 .nard-home-card .nard-emblem { width:140px;top:50%;left:auto;right:6px;transform:translateY(-50%) rotate(-8deg); }
 .nard-mode-card { padding:20px;gap:12px; }
 .nard-mode-card .nard-emblem { width:240px; }.nard-mode-card strong { font-size:1.5rem; }
 .nard-intro { grid-template-columns:minmax(0,1fr); }
 .nard-intro > .nard-emblem { grid-column:1;grid-row:auto;width:220px;justify-self:center; }
 .nard-intro,.nard-summary { padding:20px; }
}
:root[dir="rtl"] .nard-home-card .game-card-copy { text-align:right; }
@media(max-width:700px) {
 :root[dir="rtl"] .nard-home-card .nard-emblem { right:auto;left:6px; }
}

/* Unified night entrance: color and decoration only, never the green game. */
body:not(.game-active) .topbar { background:#10232b70; border-color:#bda67c70; }
body:not(.game-active) #brand-home { color:#fff1d7; text-shadow:0 2px 4px #06121c; }
body:not(.game-active) .brand-lockup .eyebrow { color:#ead4ac; }
body:not(.game-active) .sound-settings > summary { color:#fff1d7; }
body:not(.game-active) .home-intro { text-shadow:0 3px 12px #04111eee; }
body:not(.game-active) .home-intro h1 { color:#fff1d7; font-size:clamp(3.2rem,6vw,5.4rem); }
body:not(.game-active) .home-screen { padding-top:4px; gap:24px; }
body:not(.game-active) :is(#domino-room-title,.nard-screen > h2,.nard-subtitle) {
  color:#fff1d7; text-shadow:0 2px 5px #031322;
}
body:not(.game-active) #copyright { color:#f2e4cc; text-shadow:0 1px 3px #07141d;
  background:#10232b99; border-radius:12px; }
body:not(.game-active) .lobby-hero { background-image:linear-gradient(110deg,#162f3de6,#163344bf); border-color:#bd9e67; }
body:not(.game-active) .tea-steam { display:none; }
body:not(.game-active) #lobby-screen .discovery :is(.muted,small) { color:#46351f; }
body:not(.game-active) .nard-summary p { color:#46351f; }
body:not(.game-active) .auth-card :is(.muted,.fine-print,.eyebrow),
body:not(.game-active) .nard-intro .eyebrow { color:#46351f; }
body:not(.game-active) .auth-card .auth-form label { color:#294537; }
body:not(.game-active) .room-directory.nard-directory { max-width:680px; gap:24px; direction:ltr; }
body:not(.game-active) .room-directory .home-game {
  --room-tone:#542e3b; --room-deep:#291e2e;
  display:flex; flex-direction:column; align-items:center; justify-content:flex-end;
  min-height:286px; padding:180px 22px 22px; border:1px solid #c3a675; border-radius:18px;
  background:linear-gradient(145deg,color-mix(in srgb,var(--room-tone) 91%,transparent),color-mix(in srgb,var(--room-deep) 94%,transparent));
  box-shadow:0 12px 32px #03111e80,inset 0 0 0 5px #c3a67522;
}
body:not(.game-active) .room-directory #open-nard-room { --room-tone:#174e54; --room-deep:#102d39; }
body:not(.game-active) .room-directory .home-game:hover:not(:disabled) {
  background:linear-gradient(145deg,var(--room-tone),var(--room-deep)); border-color:#f8dc9c;
}
body:not(.game-active) .room-directory .home-game:focus-visible { outline:3px solid #fff2ca; outline-offset:5px; }
body:not(.game-active) .room-directory .home-game::before {
  content:""; position:absolute; inset:9px; border:1px solid #d2b47a99; border-radius:10px;
  pointer-events:none;
}
body:not(.game-active) .room-directory .home-game::after {
  content:""; position:absolute; inset:15px; opacity:.14; pointer-events:none; z-index:0;
  background-image:repeating-linear-gradient(45deg,transparent 0 17px,#e0bf7c 18px 19px,transparent 20px 36px),
    repeating-linear-gradient(-45deg,transparent 0 17px,#e0bf7c 18px 19px,transparent 20px 36px);
  mask-image:linear-gradient(#000,transparent 68%); border-radius:7px;
}
body:not(.game-active) .room-directory .game-card-copy { max-width:100%; text-align:center; gap:9px; }
body:not(.game-active) .room-directory .game-card-copy strong { font-size:clamp(1.6rem,2.6vw,2rem); color:#fff1d7; }
body:not(.game-active) .room-directory .game-card-copy b {
  width:180px; max-width:100%; margin:2px auto 0; padding:10px 15px;
  border:1px solid #c6a875; border-radius:10px; color:#fff0d3;
  background:#071a2366; box-shadow:none; font-size:.8rem;
}
body:not(.game-active) .room-directory .room-emblem { top:20px; z-index:1; }
body:not(.game-active) .room-directory .nard-emblem { top:19px; width:142px; z-index:1; }
:root[dir="rtl"] body:not(.game-active) .room-directory .game-card-copy { direction:rtl; text-align:center; }
@media(max-width:700px) {
  body:not(.game-active) .topbar { display:grid; grid-template-columns:44px minmax(0,1fr); gap:8px; }
  body:not(.game-active) #brand-home { justify-self:center; gap:8px; max-width:100%; }
  body:not(.game-active) .brand-crown { flex:none; width:32px; height:36px; }
  body:not(.game-active) .wordmark { font-size:clamp(1.4rem,6vw,1.6rem); }
  body:not(.game-active) .header-status { grid-column:1/-1; width:100%; margin:0; justify-content:center; gap:8px; }
  body:not(.game-active) .home-intro { padding:12px 4px; }
  body:not(.game-active) .home-screen { margin-top:12px; padding-top:0; }
  body:not(.game-active) .room-directory.nard-directory { max-width:460px; gap:16px; }
  body:not(.game-active) .room-directory .home-game { min-height:188px; padding:22px 16px;
    display:grid; grid-template-columns:minmax(0,1fr) 128px; gap:8px; align-items:center; }
  body:not(.game-active) .room-directory .game-card-copy { grid-column:1; max-width:100%; min-width:0; }
  body:not(.game-active) .room-directory .game-card-copy strong { font-size:1.5rem; overflow-wrap:anywhere; }
  body:not(.game-active) .room-directory .game-card-copy b { width:100%; font-size:.75rem; }
  body:not(.game-active) .room-directory .room-emblem { grid-column:2; position:relative;
    left:auto; right:auto; top:auto; width:128px; height:132px; transform:none; }
  body:not(.game-active) .room-emblem .domino { width:44px; min-width:44px; height:88px; }
  body:not(.game-active) .room-emblem .domino:first-child { left:17px; top:15px; }
  body:not(.game-active) .room-emblem .domino:last-child { left:63px; top:25px; }
  body:not(.game-active) .room-emblem .domino .pip { width:5px; height:5px; }
  body:not(.game-active) .room-directory .nard-emblem { grid-column:2; position:relative;
    left:auto; right:auto; top:auto; width:120px; transform:rotate(-6deg); }
}

/* The scene belongs to the viewport, including on long, scrolling lobbies.
   Cover uses one scale for both axes. Each crop favors the identifying
   objects from its original panorama. The Domino table has its own felt. */
body:not(.game-active) {
  --public-scene:url('/assets/silk-road-teahouse-v1.jpg?build=cabc319d800148cefa1c0379f0a0693227b9aa71a0a79daa8a5b5464fe8c7aec');
  --scene-x:64%;
  background:#1c1411;
  isolation:isolate;
}
body:not(.game-active)::before {
  content:"";
  position:fixed;
  inset:0;
  z-index:-1;
  pointer-events:none;
  background:var(--public-scene) var(--scene-x) 64% / cover no-repeat;
}
body:not(.game-active):has(#lobby-screen:not(.hidden)) {
  --public-scene:url('/assets/uzbek-spinner-painted-v1.jpg?build=cabc319d800148cefa1c0379f0a0693227b9aa71a0a79daa8a5b5464fe8c7aec');
  --scene-x:13%;
}
body:not(.game-active):has(#lobby-screen:not(.hidden)):has(#mode-101[aria-pressed="true"]) {
  --public-scene:url('/assets/uzbek-101-painted-v1.jpg?build=cabc319d800148cefa1c0379f0a0693227b9aa71a0a79daa8a5b5464fe8c7aec');
  --scene-x:4%;
}
body:not(.game-active):has(#nard-short-screen:not(.hidden)),
body:not(.game-active):has(#nard-game-screen[data-folk-mode="SHORT"]:not(.hidden)) {
  --public-scene:url('/assets/uzbek-teahouse-painted-v1.jpg?build=cabc319d800148cefa1c0379f0a0693227b9aa71a0a79daa8a5b5464fe8c7aec');
  --scene-x:8%;
}
body:not(.game-active):has(#nard-long-screen:not(.hidden)),
body:not(.game-active):has(#nard-game-screen[data-folk-mode="LONG"]:not(.hidden)) {
  --public-scene:url('/assets/uzbek-courtyard-v2.jpg?build=cabc319d800148cefa1c0379f0a0693227b9aa71a0a79daa8a5b5464fe8c7aec');
  --scene-x:100%;
}
/* Place the entrance tea glasses beside the title, above the room cards.
   On narrow phones a shallow panorama fades into the burgundy page. */
body.homepage-active:not(.game-active) { --scene-x:0%; }
@media (max-width:700px) and (orientation:portrait) {
  body.homepage-active:not(.game-active)::before {
    bottom:auto;
    height:clamp(260px,34svh,340px);
    background-position:12% center;
    -webkit-mask-image:linear-gradient(#000 82%,transparent);
    mask-image:linear-gradient(#000 82%,transparent);
  }
}
body:not(.game-active) .topbar { background:#ffffffed; border-color:#91beb8; box-shadow:0 4px 16px #194d5610; }
body:not(.game-active) #brand-home,
body:not(.game-active) .sound-settings > summary { color:#173e48; text-shadow:none; }
body:not(.game-active) .brand-lockup .eyebrow { color:#39636b; }
body:not(.game-active) :is(.home-intro h1,#domino-room-title,#nard-room-screen > h2,.nard-subtitle) {
  color:#fff3dc; text-shadow:0 1px 4px #1a0e08,0 0 8px #160c09;
}
body:not(.game-active) #copyright { color:#284e57; text-shadow:none; background:#ffffffed; }
body:not(.game-active):not(:has(#nard-game-screen:not(.hidden))) {
  --paper:#fffdf8; --ink:#173e48; --muted:#45646a; --line:#accac7;
  --forest:#216766; --forest-deep:#173e48;
}
body:not(.game-active):not(:has(#nard-game-screen:not(.hidden))) :is(.panel,.auth-card,.modal-card) {
  background:#fffdf8ed; border-color:#a5c8c4; backdrop-filter:none; -webkit-backdrop-filter:none;
  box-shadow:0 6px 20px #16494d14;
}
body:not(.game-active) #lobby-screen .lobby-hero { background:#e0f1eeed; border-color:#8dbcb7; color:#173e48; }
body:not(.game-active) #lobby-screen .lobby-copy h2 { color:#173e48; }
body:not(.game-active) #lobby-screen .lobby-copy > p { color:#315b62; }
body:not(.game-active) #lobby-screen .lobby-mode-badge { color:#173e48; background:#fffdf8; border-color:#83b6b4; }
body:not(.game-active) #lobby-screen .discovery.panel { background:#fffdf8ed; }
body:not(.game-active) :is(#home-screen,#domino-room-screen) .home-game {
  background:#d8eeebeF; border-color:#549995; box-shadow:0 8px 24px #154a531c;
}
body:not(.game-active) #home-screen #open-nard-room { background:#dfedf8ef; border-color:#639ab7; }
body:not(.game-active) :is(#home-screen,#domino-room-screen) .home-game:hover:not(:disabled) { background:#c4e5e2; }
body:not(.game-active) :is(#home-screen,#domino-room-screen) .game-card-copy strong { color:#173e48; text-shadow:none; }
body:not(.game-active) :is(#home-screen,#domino-room-screen) .game-card-copy b { color:#fff; background:#216766; border-color:#216766; }
body:not(.game-active) .room-directory .home-game::before { border-color:#78aaa3; }
body:not(.game-active) .room-directory .home-game::after { opacity:.045; }
body:not(.game-active) .room-directory .home-game:focus-visible { outline-color:#216766; }
body:not(.game-active):not(:has(#nard-game-screen:not(.hidden))) .primary { background:#216766; color:#fff; border-color:#216766; }
body:not(.game-active):not(:has(#nard-game-screen:not(.hidden))) .primary:hover:not(:disabled) { background:#164c50; }
body:not(.game-active) :is(#nard-room-screen,#nard-short-screen,#nard-long-screen) :is(.nard-intro,.nard-summary,.nard-mode-card) {
  background:#fffdf8ed; border-color:#a5c8c4; box-shadow:0 6px 20px #16494d14;
}
/* Coordinated UI corrections: keep the approved room-card placement and artwork. */
.brand-crown,.homepage-active .brand-crown { display:block; flex:none; width:44px; height:36px; }
.brand-crown svg,.home-crown svg { display:block; width:100%; height:100%; }
.home-crown { display:block; width:82px; height:62px; margin:0 auto 6px; }
body:not(.game-active) .wordmark { font-size:clamp(1rem,2.1vw,1.8rem); white-space:nowrap; }
body:not(.game-active) .home-intro h1 { font-size:clamp(1.45rem,5.3vw,4.4rem); overflow-wrap:anywhere; }
.room-navigation { display:flex; flex-wrap:wrap; gap:10px; }
body .room-back { display:inline-flex; align-items:center; justify-content:center; justify-self:start;
  min-height:44px; padding:10px 16px; color:#173e48; background:#fffdf8; border:2px solid #397b80;
  box-shadow:0 2px 6px #173e481c; font-weight:750; text-shadow:none; }
body .room-back:hover { background:#d7efec; }
body .room-back:focus-visible { outline:3px solid #247da2; outline-offset:3px; }
body .history-button { width:46px; height:46px; min-width:46px; padding:10px; display:grid; place-items:center;
  justify-self:end; border:1px solid #477f87; background:#fffdf8; color:#173e48; }
.history-button svg { width:24px; height:24px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
#lobby-screen .tables-container,.tables-container { grid-column:1/-1; padding:0; overflow:hidden; }
.tables-container > section { padding:18px 22px; margin:0; min-height:0; }
.tables-container h3 { font-size:1.25rem; margin:0; }
.tables-container p { margin:8px 0 0; }
.tables-container .playing-tables-section { background:#e6edece8; border-top:1px solid #bad0ce; color:#36565b; }
.tables-container .discovery-list:empty { display:none; }
body:not(.game-active) .tables-container .open-tables-section .discovery-row,.tables-container .nard-table { background:#f5fcf9; }
.nard-table { padding:10px; border-radius:8px; margin-top:8px; }
body .sound-settings > summary { display:grid; place-items:center; min-width:46px; min-height:46px; font-size:1.8rem; font-weight:800; }
.modal { overflow-y:auto; padding:16px; }
.modal-card { max-height:calc(100dvh - 32px); overflow-y:auto; overscroll-behavior:contain; }
.create-table-card { width:min(480px,100%); }
.create-table-card form { display:grid; gap:10px; }
.create-table-card .amount-options { margin:4px 0; padding:10px; }
.modal-actions { display:flex; justify-content:flex-end; gap:10px; }
.history-dialog { width:min(680px,100%); }
.history-dialog .history { margin:0; padding:0; background:none; box-shadow:none; border:0; }
.history-dialog #history-list { overflow-wrap:anywhere; }
.nard-history-list { padding-inline-start:20px; overflow-wrap:anywhere; }
.nard-history-list li { padding-block:10px; border-bottom:1px solid #b8c9bc; }
.nard-history-list p { margin:4px 0; }
.nard-history-list li > bdi { display:block; direction:ltr; user-select:text; font-size:.85em; }
.nard-history-list button { margin-top:6px; }
.nard-intro .amount-options.hidden { display:none; }
@media(max-width:700px) {
 body:not(.game-active) .wordmark { font-size:clamp(.88rem,3.7vw,1.4rem); }
 body:not(.game-active) .brand-crown { display:block; width:28px; height:28px; }
 body:not(.game-active) .brand-lockup .eyebrow { font-size:.5rem; letter-spacing:.1em; }
 .home-crown { width:66px; height:50px; }
 .tables-container > section { padding:14px; }
 .modal { padding:10px; }
 .modal-card { max-height:calc(100dvh - 20px); padding:18px; }
 .modal-actions > button { flex:1; }
}
/* Return controls sit inside the light Create Table panel, not over artwork. */
body:not(.game-active) .nard-intro.lobby-hero { display:flex; min-height:210px; padding:24px 32px; background:#e0f1eeed; }
body:not(.game-active) .nard-intro .lobby-copy { width:100%; }
body:not(.game-active) .nard-intro .lobby-copy h2 { color:#173e48; }
.nard-intro .lobby-mode-badge .nard-emblem { width:46px; height:46px; flex:none; }
.nard-intro .lobby-mode-badge h2 { font:inherit!important; margin:0!important; text-shadow:none!important; }
.lobby-copy > .room-navigation { margin-bottom:16px; }
.nard-screen > .room-navigation { grid-column:1/-1; padding:12px; }
@media(max-width:700px) {
 body:not(.game-active) .nard-intro.lobby-hero { padding:22px; min-height:210px; }
 .lobby-copy .room-back { padding:9px 12px; font-size:.85rem; }
}
.nard-intro .lobby-heading-row { display:flex; flex-wrap:wrap; align-items:center; gap:12px 24px; }
.nard-intro .lobby-mode-badge { display:inline-flex; align-items:center; gap:10px; max-width:100%; padding:8px 14px; border:1px solid #83b6b4; border-radius:12px; background:#fffdf8; color:#173e48; }
body:not(.game-active) .nard-intro .lobby-mode-badge h2 { font-size:1.2rem!important; }
#nard-room-screen .nard-mode-choices { grid-template-columns:repeat(2,minmax(0,1fr)); }
body:not(.game-active) #nard-room-screen .nard-mode-card { display:grid; grid-template-columns:minmax(0,1fr) 72px; gap:8px 12px; padding:18px 20px; border-radius:16px; min-height:110px; text-align:start; }
#nard-room-screen .nard-mode-card .nard-emblem { width:72px; height:72px; grid-column:2; grid-row:1 / span 2; }
#nard-room-screen .nard-mode-card strong { grid-column:1; grid-row:1; font:700 1.1rem system-ui; text-shadow:none; }
#nard-room-screen .nard-mode-card > span { grid-column:1; grid-row:2; justify-self:start; background:#e1f1ec; border-color:#a5c8c4; }
@media(max-width:700px){#nard-room-screen .nard-mode-choices{grid-template-columns:minmax(0,1fr);}.nard-intro .lobby-heading-row{gap:8px;}}

/* Compact shared room/lobby proportions; artwork and active boards are unchanged. */
body:not(.game-active) :is(#lobby-screen,#nard-room-screen,#nard-short-screen,#nard-long-screen) {
  width:min(660px,100%); max-width:100%; margin-inline:auto; gap:12px;
}
body:not(.game-active) :is(#lobby-screen,#nard-short-screen,#nard-long-screen) .lobby-hero {
  min-height:0; padding:18px 22px; border-radius:20px;
}
body:not(.game-active) :is(#lobby-screen,.nard-intro) .lobby-copy h2 {
  font-size:clamp(1.4rem,2.3vw,1.85rem); line-height:1.2; margin:4px 0;
}
.lobby-copy > .room-navigation { margin-bottom:12px; }
body:not(.game-active) :is(#lobby-screen,.nard-intro) .lobby-heading-row { gap:10px 14px; }
body:not(.game-active) :is(#lobby-screen,.nard-intro) .lobby-mode-badge { gap:8px; padding:6px 10px; font-size:1rem; }
body:not(.game-active) .nard-intro .lobby-mode-badge h2 { font-size:1rem!important; }
#lobby-screen .lobby-mode-icon,.nard-intro .lobby-mode-badge .nard-emblem { width:40px; height:36px; }
.lobby-heading-row > .history-button { margin-inline-start:auto; flex:none; }
body:not(.game-active) :is(#lobby-screen,.nard-intro) .lobby-actions { margin-top:14px; gap:10px; }
body:not(.game-active) :is(#lobby-screen,.nard-intro) .lobby-actions button { min-height:44px; padding:10px 16px; font-size:1rem; }
#lobby-screen .lobby-tabs { gap:8px; }
#lobby-screen .lobby-tabs button { min-height:44px; padding:10px 14px; font-size:.9rem; }
body .tables-container { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); }
.tables-container > section { padding:16px; min-width:0; }
.tables-container .section-heading { flex-wrap:wrap; gap:8px; }
.tables-container h3 { font-size:1.15rem; }
.tables-container p { font-size:.9rem; line-height:1.45; }
.tables-container .playing-tables-section { border-top:0; border-inline-start:1px solid #bad0ce; }
@media(max-width:700px) {
 body:not(.game-active) :is(#lobby-screen,#nard-short-screen,#nard-long-screen) .lobby-hero { padding:16px; }
 body .tables-container { grid-template-columns:minmax(0,1fr); }
 .tables-container .playing-tables-section { border-inline-start:0; border-top:1px solid #bad0ce; }
}

/* The navigation and rules lines are separate from the playable room cards. */
.app-shell > #nard-room-screen:not(.hidden) > :is(.room-navigation.panel,p.nard-summary),
.app-shell > :is(#domino-room-screen,#lobby-screen,#room-screen,#nard-room-screen,#nard-short-screen,#nard-long-screen):not(.hidden) ~ :is(.feedback.panel,#copyright) {
  inline-size:fit-content;
  max-inline-size:min(100%,72ch);
  box-sizing:border-box;
  color:#f6ead9;
  background:var(--room-strip-background,#291f1bec);
  border:1px solid var(--room-strip-border,#806b56);
  border-radius:12px;
  box-shadow:none;
  overflow-wrap:anywhere;
}
#nard-room-screen > .room-navigation.panel {
  justify-self:start;
  padding:4px;
}
#nard-room-screen > p.nard-summary {
  justify-self:center;
  margin-block:0;
  padding:7px 14px;
  text-align:center;
}
.app-shell > :is(#domino-room-screen,#lobby-screen,#room-screen,#nard-room-screen,#nard-short-screen,#nard-long-screen):not(.hidden) ~ .feedback.panel:not(.dismissed) {
  display:grid;
  grid-template-columns:auto fit-content(40%) minmax(0,1fr) auto;
  --ok:#a7e4c8;
  --danger:#ffb7b0;
  --forest:var(--ok);
  margin-inline:auto;
  padding-block:4px;
  padding-inline:12px 5px;
  align-items:center;
}
.feedback.error {
  --room-strip-background:#3c2421f2;
  --room-strip-border:#bd8276;
}
@media (max-width:430px) {
  .app-shell > :is(#domino-room-screen,#lobby-screen,#room-screen,#nard-room-screen,#nard-short-screen,#nard-long-screen):not(.hidden) ~ .feedback.panel.error:not(.dismissed) {
    grid-template-columns:auto minmax(0,1fr) auto;
    row-gap:2px;
    & > #feedback { grid-column:1 / 3; }
    & > #dismiss-feedback { grid-area:1 / 3 / 3 / 4; }
  }
}
.app-shell > :is(#domino-room-screen,#lobby-screen,#room-screen,#nard-room-screen,#nard-short-screen,#nard-long-screen):not(.hidden) ~ #copyright {
  margin-inline:auto;
  padding:7px 14px;
}
/* Match controls share a single rail in both game families. */
#match-game-title, .speaker-muted, #sound-settings.silent .speaker-waves {display:none;}
#sound-settings.silent .speaker-muted {display:inline;}
body.playing-table .topbar {position:relative;display:flex;align-items:center;flex-wrap:nowrap;gap:8px;min-height:48px;margin-block:0;padding:2px 8px;}
body.playing-table .topbar .header-status {display:flex;align-items:center;flex-wrap:nowrap;justify-content:flex-end;gap:4px;width:auto;margin-left:auto;}
body.playing-table .topbar .brand-domain,body.playing-table .topbar .eyebrow,body.playing-table .account-chip {display:none;}
body.playing-table .topbar #brand-home {min-width:0;display:flex;gap:4px;padding:0;min-height:44px;}
body.playing-table #brand-home > span:last-child {min-width:0;}
body.playing-table #nard-game-menu {color:#173e48;}
body.playing-table .topbar .wordmark {overflow:hidden;text-overflow:ellipsis;display:block;font-size:clamp(.75rem,2vw,1.15rem);white-space:nowrap;}
body.game-active #sound-settings summary {color:#f6e5b7;}
body.playing-table .topbar .brand-crown {display:block;width:26px;height:28px;flex:none;}
body.playing-table .topbar #open-profile,body.playing-table .topbar .game-menu,body.playing-table .topbar summary {flex:none;min-width:44px;min-height:44px;padding:0;}
@media(min-width:1000px){
 body.playing-table #match-game-title {display:block;position:absolute;left:50%;transform:translateX(-50%);font-weight:700;}
 body.game-active #match-game-title {color:#fbf0d0;}
}
@media(max-width:650px){
 body.playing-table:has(.topbar .game-menu:not(.hidden):enabled) .topbar #logout {display:none;}
 body.playing-table .topbar {gap:3px;padding-inline:3px;}
 body.playing-table .topbar .status {font-size:.7rem;padding:3px;}
}
@media(max-width:405px){
 body.playing-table .topbar:has(.game-menu:not(.hidden):disabled) .wordmark {display:block;}
}

/* Active tables share one menu; the original profile stays on other screens. */
body.playing-table .topbar :is(#open-profile,#account-status,#logout) {display:none;}
body.playing-table .topbar #header-sound-slot {display:block;flex:none;}
body.playing-table .topbar .header-status {display:contents;}
body.playing-table .topbar #connection {position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;}
body.playing-table .topbar #brand-home {flex:1;justify-content:flex-start;max-width:none;}
body.playing-table .topbar .wordmark {font-size:clamp(.9rem,4vw,1.35rem);overflow:hidden;text-overflow:ellipsis;}
#game-menu-sound:empty {display:none;}
#game-menu-sound .sound-settings summary {display:none;}
#game-menu-sound .sound-settings > div {position:static;width:100%;box-sizing:border-box;box-shadow:none;}
/* One active-game header for Spinner, 101 and both Nardy modes. */
body.playing-table .topbar {
 height:50px;min-height:50px;flex:none;gap:6px;margin:0;
 padding:2px max(6px,env(safe-area-inset-right)) 2px max(6px,env(safe-area-inset-left));
 border:1px solid #9bbcb5;border-radius:12px;background:#f7f1e2;
 color:#173e48;box-shadow:none;backdrop-filter:none;
}
body.playing-table .topbar :is(#game-menu,#nard-game-menu) {
 width:44px;min-width:44px;height:44px;min-height:44px;padding:0;
 border:1px solid #a27e45;border-radius:10px;background:transparent;
 color:#173e48;font-size:1.4rem;box-shadow:none;
}
body.playing-table .topbar #brand-home {height:44px;min-height:44px;color:#173e48;text-shadow:none;}
body.playing-table .topbar .wordmark {color:#173e48;}
body.playing-table .topbar #sound-settings > summary {
 width:44px;min-width:44px;height:44px;min-height:44px;padding:0;color:#173e48;
}
body.playing-table #match-game-title {display:none;}
/* The mobile Bazaar has its own lane, including when the phone is rotated. */
@media(max-width:700px), (orientation:landscape) and (max-height:500px) {
 body.game-active #board {left:64px;right:0;}
 body.game-active .bazaar-panel {left:4px;right:auto;width:56px;max-width:56px;top:45%;bottom:auto;}
 body.game-active .bazaar-panel #bazaar {display:flex;flex-direction:column;min-width:44px;min-height:44px;padding:4px 1px;gap:2px;}
 body.game-active .bazaar-panel .bazaar-pile {display:none;}
 body.game-active .bazaar-panel .bazaar-label {font-size:.55rem;letter-spacing:0;}
 body.game-active .bazaar-panel :is(#bazaar-count,#bazaar-reserve) {font-size:.6rem;}
 body.game-active .player-panel {left:72px;right:8px;}
 body.game-active .player-panel h2 {max-width:110px;}
 body.game-active .player-panel .opponent-tiles {left:auto;right:0;transform:none;max-width:calc(100% - 118px);overflow-x:auto;overflow-y:hidden;}
 body.game-active .score-panel {left:72px;}
 body.game-active .game-grid:is(.turn-self,.turn-opponent) .timer-wrap {left:auto;right:8px;}
 body.game-active #match-status {left:72px;right:8px;max-width:none;transform:none;text-align:left;}
 body.game-active:not(:has(.player-time-bar:not([hidden]))) #match-status {right:100px;}
 body.game-active .hand-panel {left:64px;right:0;}
 body.game-active .hand-heading {left:8px;right:8px;}
 body.game-active .table-actions {left:8px;}
}

/* Compact public entry points only; active tables and room layouts are unchanged. */
@media(max-width:700px), (orientation:landscape) and (max-height:500px) {
 body:not(.playing-table):has(:is(#signin-screen,#home-screen):not(.hidden)) .topbar {display:grid;grid-template-columns:44px minmax(0,1fr);align-items:center;gap:8px;min-height:56px;margin:8px 0 12px;padding:6px 8px;border-radius:12px;background:#e3ece7f5;box-shadow:none;}
 body:not(.playing-table):has(#signin-screen:not(.hidden)) .topbar .header-status {display:none;}
 body:not(.playing-table):has(:is(#signin-screen,#home-screen):not(.hidden)) #site-menu-open {width:44px;min-width:44px;min-height:44px;padding:0;}
 body:not(.playing-table):has(:is(#signin-screen,#home-screen):not(.hidden)) #brand-home {justify-self:start;justify-content:flex-start;gap:6px;min-width:0;max-width:100%;min-height:44px;padding:0;text-shadow:none;}
 body:not(.playing-table):has(:is(#signin-screen,#home-screen):not(.hidden)) #brand-home > span:last-child {min-width:0;}
 body:not(.playing-table):has(:is(#signin-screen,#home-screen):not(.hidden)) .brand-crown {display:block;flex:none;width:28px;height:28px;}
 body:not(.playing-table):has(:is(#signin-screen,#home-screen):not(.hidden)) .brand-lockup .eyebrow, body:not(.playing-table):has(:is(#signin-screen,#home-screen):not(.hidden)) .brand-domain {display:none;}
 body:not(.playing-table):has(:is(#signin-screen,#home-screen):not(.hidden)) .wordmark {font-size:clamp(1rem,4.8vw,1.2rem);line-height:1.1;white-space:normal;overflow-wrap:anywhere;}
 body:not(.playing-table):has(:is(#signin-screen,#home-screen):not(.hidden)) .feedback.panel:not(.dismissed) {display:grid;grid-template-columns:minmax(0,1fr) 44px;align-items:start;gap:4px 8px;margin:12px 0;padding:10px 12px;border-radius:12px;background:#e3ece7f5;box-shadow:none;opacity:1;}
 body:not(.playing-table):has(:is(#signin-screen,#home-screen):not(.hidden)) .feedback::before {display:none;}
 body:not(.playing-table):has(:is(#signin-screen,#home-screen):not(.hidden)) .feedback > #feedback-title {grid-column:1;font-size:.82rem;overflow-wrap:anywhere;}
 body:not(.playing-table):has(:is(#signin-screen,#home-screen):not(.hidden)) .feedback > #feedback {grid-column:1;min-width:0;font-size:.85rem;line-height:1.4;overflow-wrap:anywhere;}
 body:not(.playing-table):has(:is(#signin-screen,#home-screen):not(.hidden)) .feedback > #dismiss-feedback {grid-column:2;grid-row:1 / span 2;}
 body:not(.playing-table):has(:is(#signin-screen,#home-screen):not(.hidden)) #copyright {margin-top:14px;padding:10px 12px;border-radius:10px;background:#172c27e8;color:#edf4ee;text-shadow:none;font-size:.7rem;line-height:1.4;overflow-wrap:anywhere;}
 body:not(.playing-table):has(#signin-screen:not(.hidden)) #signin-screen {min-height:0;margin:12px auto;}
 body:not(.playing-table):has(#signin-screen:not(.hidden)) #signin-screen .auth-card {min-width:0;padding:16px;border-radius:16px;background:#edf1e9f5;box-shadow:none;}
 body:not(.playing-table):has(#signin-screen:not(.hidden)) #signin-title {font-size:1.65rem;}
 body:not(.playing-table):has(#signin-screen:not(.hidden)) #signin-screen .auth-card > .eyebrow {font-size:.65rem;margin-bottom:4px;}
 body:not(.playing-table):has(#signin-screen:not(.hidden)) #signin-screen .auth-card > .muted {font-size:1rem;line-height:1.4;margin-top:5px;}
 body:not(.playing-table):has(#signin-screen:not(.hidden)) #login-form {margin-top:14px;gap:12px;}
 body:not(.playing-table):has(#signin-screen:not(.hidden)) #login-form label {gap:6px;font-size:.9rem;}
 body:not(.playing-table):has(#signin-screen:not(.hidden)) #login-form input {min-width:0;min-height:48px;font-size:1rem;}
 body:not(.playing-table):has(#signin-screen:not(.hidden)) #login-form button, body:not(.playing-table):has(#signin-screen:not(.hidden)) #show-register {min-height:44px;white-space:normal;overflow-wrap:anywhere;}
 body:not(.playing-table):has(#signin-screen:not(.hidden)) #show-register {margin-top:12px;}
 body:not(.playing-table):has(#signin-screen:not(.hidden)) #signin-screen .fine-print {margin-top:12px;font-size:.75rem;line-height:1.4;}
}

/* Portrait own-hand rack: compact rows use the full width below the board.
   The player HUD and Bazaar lane keep their existing positions. */
@media (max-width:700px) and (orientation:portrait) {
  body.game-active .hand-panel { left:0; padding-left:8px; padding-right:8px; }
  body.game-active .hand-heading { left:72px; }
  /* A classic scrollbar must not consume the lower row; the swipe hint remains. */
  body.game-active #hand { scrollbar-width:none; }
  body.game-active #hand::-webkit-scrollbar { display:none; }
  body.game-active #hand[data-hand-rows="2"] .domino { transition:background .16s ease,border-color .16s ease,box-shadow .16s ease; }
  body.game-active #hand[data-hand-rows="2"] .domino.selected::after { width:40px; }
  body.game-active #hand[data-hand-rows="2"] {
    row-gap:var(--hand-row-gap,8px); padding-left:10px; padding-right:10px;
  }
  body.game-active #hand .domino:not(:disabled) {
    border-color:#a5e9b6; box-shadow:0 0 0 2px #286546,0 3px 5px #102c2440;
  }
  body.game-active #hand .domino.selected {
    border-color:#ffce70; box-shadow:0 0 0 2px #ab671b,0 3px 5px #102c2440;
  }
}

/* A single ink outline sits above the initial, within the existing header. */
.topbar #brand-home .wordmark {padding-top:.55em;}
.topbar #brand-home .brand-initial {position:relative;display:inline-block;}
.topbar #brand-home .wordmark .brand-initial > .brand-crown {
 position:absolute;display:block;left:50%;bottom:calc(100% - .04em);
 width:.72em;height:.6em;transform:translateX(-50%);color:inherit;filter:none;
 overflow:visible;pointer-events:none;
}

/* Compact open-table entries: reserve space for the name, including inside narrow columns. */
body:not(.game-active) #available-tables .discovery-row {
 display:grid; grid-template-columns:minmax(0,1fr) auto;
 align-items:center; gap:8px; padding:6px 8px; min-height:56px;
}
body:not(.game-active) #available-tables .discovery-row .default-avatar {
 display:none;
}
body:not(.game-active) #available-tables .discovery-row strong {
 white-space:nowrap; overflow:hidden; text-overflow:ellipsis; overflow-wrap:normal;
}
body:not(.game-active) #available-tables .discovery-row small {
 margin:0; font-size:.72rem; line-height:1.3; white-space:nowrap; overflow-wrap:normal;
}
body:not(.game-active) #available-tables .discovery-row button {
 width:auto; min-width:64px; max-width:108px; min-height:44px;
 padding:8px; margin:0; font-size:.82rem; line-height:1.2; white-space:normal;
}
body:not(.game-active) #available-tables .discovery-row > div:not(.default-avatar) {
 display:grid; grid-template-columns:minmax(48px,1fr) auto; align-items:center; gap:8px;
}
@media(max-width:700px) {
 #lobby-screen .tables-container > .open-tables-section { padding:12px 10px; }
}

@media(max-width:1050px) { #lobby-screen .tables-container { grid-template-columns:minmax(0,1fr); } }

/* Match terms stay with the Bazaar, outside the movable board. */
body.game-active .bazaar-panel {display:flex;flex-direction:column;gap:6px;align-items:stretch;}
body.game-active .bazaar-panel #match-status {
 position:static;inset:auto;transform:none;width:100%;max-width:none;margin:0;padding:0;
 color:#f6e5b7;background:transparent;text-align:center;font-size:.7rem;line-height:1.25;
 overflow-wrap:normal;word-break:normal;
}
body.game-active .bazaar-panel #match-stake {
 display:block;text-align:center;color:#d4e8d5;font-size:.65rem;line-height:1.25;overflow-wrap:anywhere;
}
@media(max-width:700px), (orientation:landscape) and (max-height:500px) {
 body.game-active .bazaar-panel #match-status {font-size:.6rem;}
 body.game-active .bazaar-panel #match-stake {font-size:9px;letter-spacing:-.02em;white-space:nowrap;}
}

/* Permanent account reference stays on the own home/profile, outside play. */
.home-account {grid-column:1/-1;display:flex;flex-wrap:wrap;align-items:center;gap:8px 14px;padding:12px 16px;min-width:0;align-self:start;}
.home-account > strong {min-width:0;overflow-wrap:anywhere;}
.player-number-line {display:inline-flex;flex-wrap:wrap;align-items:baseline;gap:6px;max-width:100%;}
.player-number-line bdi {font-variant-numeric:tabular-nums;white-space:nowrap;user-select:text;}
#home-number-feedback {flex-basis:100%;}
#home-number-feedback:empty, #profile-number-feedback:empty {display:none;}

/* Private forms keep controls within narrow screens, including RTL. */
#register-modal .modal-card,#profile-modal .modal-card,#support-modal .modal-card{max-height:calc(100dvh - 2rem);overflow-y:auto;overscroll-behavior:contain}
#register-modal label,#profile-modal label,#support-modal label{min-width:0}
#register-modal input,#register-modal select,#register-modal textarea,#profile-modal input,#profile-modal textarea,#support-modal input,#support-modal textarea{box-sizing:border-box;width:100%;min-width:0;font:inherit}
#register-modal input[type=checkbox]{width:auto}
#register-modal textarea,#profile-modal textarea,#support-modal textarea{min-height:5rem;resize:vertical}
#support-modal ol{padding-inline-start:1.2rem}
#support-modal li,#support-modal p,#profile-modal p{overflow-wrap:anywhere;white-space:pre-wrap}
#support-modal bdi{display:block;font-size:.85em}

.account-chip>span{display:block;font-size:.75em}.account-chip bdi{font-size:.8em}.player-country{font-size:.65em;opacity:.8}

.match-recovery {display:inline-flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:.35rem;
  max-width:100%;padding:.2rem .45rem;border-radius:.5rem;background:#173d33;color:#fff;font-size:.8rem;}
.match-recovery[hidden],.match-recovery button[hidden],
body.game-active .hand-heading:has(.match-recovery:not([hidden])) #turn-indicator,
.nard-play-status:has(.match-recovery:not([hidden])) .nard-message {display:none;}
body.game-active .hand-panel:has(.match-recovery:not([hidden])) #legal-hint {visibility:hidden;}
.match-recovery button {min-height:32px;padding:.2rem .5rem;font:inherit;}
.recovery-symbol {display:inline-block;animation:recovery-flip 1.6s ease-in-out infinite;}
.network-wait .recovery-symbol {animation:none;}
@keyframes recovery-flip {0%,35% {transform:rotate(0);}75%,100% {transform:rotate(180deg);}}
@media (prefers-reduced-motion:reduce) {.recovery-symbol {animation:none;}}
