/* Fonts (self-hosted, SIL Open Font License): Cinzel for titles, Jost for the interface */
@font-face { font-family: 'Exo 2'; font-style: normal; font-weight: 300; font-display: swap; src: url(/fonts/exo-2-latin-300-normal.woff2) format('woff2'); }
@font-face { font-family: 'Exo 2'; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/exo-2-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Exo 2'; font-style: normal; font-weight: 500; font-display: swap; src: url(/fonts/exo-2-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Exo 2'; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/exo-2-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Michroma'; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/michroma-latin-400-normal.woff2) format('woff2'); }
/* OBSDN // KATAN — dark layered panels, one signal red, condensed display, mono numbers. */
:root {
  --ink: #07080b; --panel: #0d0f14; --raise: #151922; --raise-2: #1c212c;
  --line: #232834; --line-2: #323949;
  --fg: #e8ebf1; --mute: #8f96a7; --faint: #5a6173;
  --red: #e3263a; --red-hi: #ff4457; --red-soft: rgba(227, 38, 58, .16);
  --good: #2fbf8f; --gold: #c9a46a;
  --title: "Michroma", "Eurostile", "Exo 2", system-ui, sans-serif;
  --display: "Exo 2", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ui: "Exo 2", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Exo 2", system-ui, sans-serif;
  --read: "Exo 2", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--ink); color: var(--fg); font-family: var(--ui); font-size: 13px; line-height: 1.4; }
.hidden { display: none !important; }
.muted { color: var(--mute); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); }
:focus-visible { outline: 2px solid var(--red-hi); outline-offset: 2px; }
h3 { margin: 0 0 10px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; font-weight: 600; color: var(--mute); }

button {
  font: inherit; font-weight: 600;  font-size: 13px; padding: 9px 13px; min-height: 40px;
  border-radius: 6px; border: 1px solid var(--line-2); background: var(--raise); color: var(--fg); cursor: pointer;
}
button:hover:not(:disabled) { background: var(--raise-2); border-color: var(--faint); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .4; cursor: not-allowed; }
button.primary { background: var(--red); border-color: var(--red); color: #fff; }
button.primary:hover:not(:disabled) { background: var(--red-hi); border-color: var(--red-hi); }
button.ghost { background: transparent; }
button.big { padding: 12px; font-size: 15px; width: 100%; min-height: 48px; }
button.on { background: var(--red-soft); border-color: var(--red); }
input, select {
  font: inherit; font-size: 13px; padding: 9px 10px; min-height: 40px; border-radius: 5px;
  border: 1px solid var(--line-2); background: var(--ink); color: var(--fg);
}
input[type=number] { font-family: var(--mono); }
input[type=checkbox] { accent-color: var(--red); width: 18px; height: 18px; min-height: 0; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 11px; color: var(--mute); }
label.check { flex-direction: row; align-items: center; gap: 10px; font-size: 12.5px; color: var(--fg); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px; }
.card.tight { padding: 14px; }
.screen { min-height: 100vh; }

/* home */
#home { display: grid; place-items: center; padding: 16px; }
.home-card { width: min(420px, 100%); display: flex; flex-direction: column; gap: 16px; padding: 28px; }
.logo { margin: 0; font-family: var(--display); font-weight: 400; font-size: 46px; line-height: 1; letter-spacing: .04em; }
.logo span, .brand span { color: var(--red); margin: 0 .12em; }
.or { display: flex; align-items: center; gap: 10px; color: var(--faint); font-size: 11px; letter-spacing: .12em; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.code-input { flex: 1; text-transform: uppercase; letter-spacing: .3em; font-family: var(--mono); font-weight: 600; }

/* lobby */
.lobby-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; padding: 20px; max-width: 1080px; margin: 0 auto; }
.room-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.room-code { font-family: var(--display); font-size: 64px; line-height: .95; letter-spacing: .12em; }
#inviteLink { font-family: var(--mono); color: var(--faint); word-break: break-all; }
.seats { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-direction: column; gap: 6px; }
.seats li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--raise); border: 1px solid var(--line-2); border-radius: 6px; min-height: 48px; }
.seats li.muted { background: transparent; border-style: dashed; color: var(--faint); }
.seats .name { flex: 1; font-weight: 600; }
.seats button { min-height: 32px; padding: 5px 10px; font-size: 12px; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: 0 0 0 2px rgba(0,0,0,.4); }
.tag { font: 600 9.5px var(--mono); letter-spacing: .04em; text-transform: uppercase; padding: 3px 6px; border-radius: 4px; border: 1px solid var(--line-2); color: var(--mute); }
.tag.ok { color: var(--good); border-color: var(--good); }
.tag.warn { color: #ff8a96; border-color: #5a2a33; }
.settings { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.settings .check { grid-column: 1 / -1; }

/* game */
.game-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 12px; padding: 12px; height: 100vh; }
.board-wrap { position: relative; display: flex; flex-direction: column; gap: 10px; min-height: 0; background: radial-gradient(ellipse 80% 70% at 50% 55%, #131a27 0%, var(--panel) 72%); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.game-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.brand { font-family: var(--display); font-size: 22px; letter-spacing: .04em; line-height: 1; white-space: nowrap; }
#board { flex: 1; width: 100%; min-height: 0; }
.status { flex: 1; min-width: 220px; background: var(--raise); border: 1px solid var(--line-2); border-radius: 6px; padding: 10px 14px; font-weight: 600; }
.status.mine { background: var(--red-soft); border-color: var(--red); }
.status.urgent { background: var(--red); border-color: var(--red); color: #fff; }
.dice { position: absolute; left: 14px; bottom: 14px; display: flex; gap: 6px; }
.die { width: 44px; height: 44px; background: linear-gradient(145deg, #ffffff, #d5d9e2); color: var(--ink); border-radius: 9px; display: grid; place-items: center; font: 600 22px var(--mono); box-shadow: inset -3px -4px 0 rgba(0,0,0,.12), 0 5px 0 #8f96a7, 0 10px 18px rgba(0,0,0,.55); transform: perspective(240px) rotateX(16deg) rotateZ(-7deg); animation: roll .5s ease-out; }
.die + .die { transform: perspective(240px) rotateX(16deg) rotateZ(6deg); }
.die.red { background: linear-gradient(145deg, var(--red-hi), var(--red)); color: #fff; box-shadow: inset -3px -4px 0 rgba(0,0,0,.18), 0 5px 0 #8e1422, 0 10px 18px rgba(0,0,0,.55); }
@keyframes roll { from { opacity: 0; translate: 0 -14px; } }
.cam { position: absolute; right: 14px; bottom: 14px; display: flex; gap: 6px; }
.cam button { min-width: 40px; min-height: 40px; padding: 0 10px; font: 600 15px var(--mono); background: rgba(13,15,20,.8); backdrop-filter: blur(4px); }
#camFlat { font-size: 11px; }
.cam { align-items: center; }
.sound { display: flex; align-items: center; gap: 6px; padding: 0 8px 0 0; border: 1px solid var(--line-2); border-radius: 6px; background: var(--raise); }
.sound button { border: 0; background: none; min-height: 40px; min-width: 40px; padding: 0 8px; color: var(--fg); }
.sound input { width: 80px; accent-color: var(--red); min-height: 0; padding: 0; border: 0; background: none; }
#sndBtn .mute { display: none; }
#sndBtn.off { color: var(--faint); }
#sndBtn.off .mute { display: inline; }
#sndBtn.off .wave { display: none; }
.tilt { flex-direction: row; align-items: center; gap: 8px; min-height: 40px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 6px; background: rgba(13,15,20,.8); backdrop-filter: blur(4px); font: 600 10.5px var(--mono); text-transform: uppercase; color: var(--mute); }
.tilt b { color: var(--fg); display: inline-block; min-width: 3.2em; }
.tilt input { width: 110px; accent-color: var(--red); min-height: 0; padding: 0; border: 0; background: none; }
.tip { position: absolute; z-index: 5; max-width: 280px; background: var(--raise); border: 1px solid var(--line-2); border-radius: 8px; padding: 10px 12px; font-size: 12.5px; line-height: 1.5; color: var(--mute); pointer-events: none; box-shadow: 0 12px 40px rgba(0,0,0,.55); }
.tip b { color: var(--fg); }
.tip > b:first-child { display: block; font-family: var(--display); font-weight: 400; font-size: 20px; letter-spacing: .04em; margin-bottom: 4px; }
.tip .warn { color: var(--red-hi); }
.side { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; min-height: 0; padding-bottom: 8px; }
.players { display: flex; flex-direction: column; gap: 6px; }
.pl { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: grid; grid-template-columns: auto 1fr auto; gap: 3px 10px; align-items: center; }
.pl.turn { background: var(--raise); box-shadow: inset 3px 0 0 var(--red); border-color: var(--line-2); }
.pl .nm { font-weight: 600; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pl .vp { font: 600 20px var(--mono); }
.pl .meta { grid-column: 2 / 4; font: 10.5px var(--mono); color: var(--mute); display: flex; gap: 12px; flex-wrap: wrap; text-transform: uppercase; }
.award { font: 600 9.5px var(--mono); color: var(--gold); border: 1px solid #5c4a2a; padding: 1px 5px; border-radius: 4px; text-transform: uppercase; }
.hand-head { display: flex; justify-content: space-between; align-items: baseline; }
.hand { display: flex; gap: 6px; margin-bottom: 12px; }
.rc { flex: 1; border-radius: 6px; padding: 7px 4px; text-align: center; color: #fff; border: 1px solid rgba(255,255,255,.1); box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 4px 0 rgba(0,0,0,.45), 0 8px 14px rgba(0,0,0,.35); background-image: linear-gradient(180deg, rgba(255,255,255,.12), rgba(0,0,0,.12)) !important; }
.rc .n { font: 600 20px var(--mono); }
.rc .l { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; opacity: .9; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.actions button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; min-height: 48px; }
.actions .wide { grid-column: 1 / -1; align-items: center; text-align: center; }
.cost { display: block; font: 400 9.5px var(--mono); color: var(--mute); text-transform: uppercase; }
.dev-cards { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.dev { border: 1px solid var(--line-2); border-radius: 6px; padding: 5px 8px; font-size: 12px; display: flex; gap: 8px; align-items: center; background: var(--raise); }
.dev button { padding: 3px 9px; min-height: 28px; font-size: 11.5px; }
.trade-grid { display: grid; grid-template-columns: 62px repeat(5, 1fr); gap: 4px; align-items: center; font-size: 12px; }
.trade-grid .hd { font: 600 9.5px var(--mono); text-align: center; color: #fff; border-radius: 4px; padding: 3px 0; text-transform: uppercase; }
.stepper { display: flex; align-items: center; justify-content: center; gap: 2px; }
.stepper button { padding: 0 6px; min-height: 26px; font-size: 13px; }
.stepper span { min-width: 14px; text-align: center; font: 600 12px var(--mono); }
.offer { background: var(--raise); border: 1px solid var(--line-2); border-radius: 6px; padding: 10px; margin-top: 8px; font-size: 12.5px; }
.offer .resp { display: flex; gap: 8px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.bank-row { display: flex; gap: 6px; align-items: center; margin-top: 12px; flex-wrap: wrap; font-size: 12.5px; }
.bank-row select { min-height: 34px; padding: 5px 8px; }
.tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.tabs button { min-height: 32px; padding: 5px 12px; font: 600 11px var(--mono); text-transform: uppercase; }
.tabs button.active { background: var(--fg); color: var(--ink); border-color: var(--fg); }
.log { max-height: 190px; overflow-y: auto; font-size: 12px; line-height: 1.55; color: var(--mute); }
.log div { border-bottom: 1px solid var(--raise); padding: 3px 0; }
.chat-log { max-height: 190px; min-height: 80px; overflow-y: auto; font-size: 12.5px; line-height: 1.55; margin-bottom: 8px; }
.chat-form { display: flex; gap: 6px; }
.chat-form input { flex: 1; }
.badge { background: var(--red); color: #fff; border-radius: 10px; font-size: 10px; padding: 0 6px; }

/* board svg */
.hex { stroke: #07080b; stroke-width: .07; transition: filter .12s; }
.tile:hover .hex { filter: brightness(1.22); }
.tile-name { stroke: #07080b; stroke-width: .035px; stroke-linejoin: round; paint-order: stroke; font: 600 .14px var(--ui); letter-spacing: .02px; text-anchor: middle; fill: #f3f5f9; fill-opacity: .85; pointer-events: none; }
.token .disc { fill: #0b0d12; stroke: #3a4254; stroke-width: .035; }
.token .rim { fill: #2a303d; }
.token.hot .disc { stroke: var(--red); stroke-width: .05; }
.token text { font: 600 .28px var(--mono); text-anchor: middle; dominant-baseline: central; fill: var(--fg); }
.token.hot text { fill: var(--red-hi); }
.token .pip { fill: var(--mute); stroke: none; }
.token.hot .pip { fill: var(--red-hi); }
.token, .tile-name { pointer-events: none; }
.port { cursor: help; }
.port:hover rect:first-of-type { stroke: var(--fg); }
.port-ratio { font: 600 .2px var(--mono); fill: var(--fg); dominant-baseline: central; }
.port-sub { font: 600 .12px var(--ui); fill: #c9cfdb; dominant-baseline: central; }
.spot { fill: rgba(62, 230, 168, .14); stroke: var(--target, #3ee6a8); stroke-width: .055; pointer-events: none; animation: pulse .9s infinite alternate; filter: drop-shadow(0 0 .06px #3ee6a8); }
.spot-dot { fill: var(--target, #3ee6a8); pointer-events: none; }
.edge-hit { stroke: var(--target, #3ee6a8); stroke-width: .1; stroke-dasharray: .12 .12; stroke-linecap: round; pointer-events: none; animation: pulse .9s infinite alternate; }
.tap { fill: transparent; cursor: pointer; }
.edge-hit.ship-hit { stroke: #5fb4ff; }
.edge-hit.ship-hit.pick { stroke: #ffd166; stroke-dasharray: none; stroke-width: .12; }
.edge-hit.ship-hit.picked { stroke: #ffd166; stroke-width: .16; stroke-dasharray: none; animation: none; }
.hex-hit.pirate { fill: #5fb4ff; opacity: .16; stroke: #5fb4ff; stroke-width: .05; cursor: pointer; animation: pulseHex .9s infinite alternate; }
.tap-line { stroke: transparent; stroke-width: .5; stroke-linecap: round; cursor: pointer; }
.hex-hit { fill: var(--red-hi); opacity: 0; cursor: pointer; }
.robbed { fill: #07080b; opacity: .42; }
.rob-hit { cursor: pointer; }
.rob-hit .hex-hit.on { opacity: 1; fill: rgba(255, 68, 87, .04); stroke: rgba(255, 68, 87, .75); stroke-width: .05; stroke-dasharray: .14 .1; animation: none; }
.rob-hit:hover .hex-hit.on, .rob-hit:focus-visible .hex-hit.on { fill: rgba(255, 68, 87, .32); stroke: #ff4457; stroke-width: .09; stroke-dasharray: none; }
.rob-hit .ghost { opacity: 0; pointer-events: none; transition: opacity .12s; }
.rob-hit:hover .ghost { opacity: .9; }
.rob-hit.sea .hex-hit.pirate { opacity: 1; fill: rgba(95, 180, 255, .03); stroke: rgba(95, 180, 255, .55); stroke-width: .04; stroke-dasharray: .12 .1; animation: none; }
.rob-hit.sea:hover .hex-hit.pirate { fill: rgba(95, 180, 255, .3); stroke: #5fb4ff; stroke-dasharray: none; }
.hex-hit.on { opacity: .2; stroke: var(--red-hi); stroke-width: .06; animation: pulseHex .9s infinite alternate; }
@keyframes pulse { from { opacity: .35; } to { opacity: 1; } }
@keyframes pulseHex { from { opacity: .08; } to { opacity: .3; } }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.65); display: grid; place-items: center; z-index: 20; padding: 16px; }
.modal-card { width: min(460px, 100%); display: flex; flex-direction: column; gap: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.modal-card h3 { font-family: var(--display); font-weight: 400; font-size: 26px; letter-spacing: .04em; text-transform: none; color: var(--fg); }
.modal-card ol { margin: 0; padding-left: 20px; line-height: 1.8; }
.pick { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.pick button { padding: 10px 4px; color: #fff; font-weight: 600; border: 1px solid rgba(255,255,255,.1); }
.pick button.sel { outline: 2px solid var(--fg); outline-offset: 2px; }
.conn { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); background: var(--red); color: #fff; padding: 6px 14px; border-radius: 20px; z-index: 30; font-size: 12px; font-weight: 600; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--raise-2); border: 1px solid var(--line-2); color: var(--fg); padding: 10px 16px; border-radius: 8px; z-index: 30; font-size: 13px; max-width: 90vw; box-shadow: 0 10px 40px rgba(0,0,0,.6); }

.music-btn { position: fixed; right: 16px; bottom: 16px; z-index: 26; display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 22px; background: var(--raise-2); border: 1px solid var(--line-2); box-shadow: 0 8px 24px rgba(0,0,0,.5); font-weight: 600; }
.music-btn.on { border-color: #1db954; color: #1db954; }
.music { position: fixed; right: 16px; bottom: 70px; z-index: 26; width: min(380px, calc(100vw - 32px)); max-height: calc(100vh - 90px); overflow-y: auto; background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px; padding: 14px; box-shadow: 0 18px 50px rgba(0,0,0,.65); display: flex; flex-direction: column; gap: 10px;
  transform: translateY(16px); opacity: 0; visibility: hidden; transition: transform .18s, opacity .18s, visibility 0s .18s; }
.music.open { transform: none; opacity: 1; visibility: visible; transition: transform .18s, opacity .18s; }
.music-head { display: flex; justify-content: space-between; align-items: center; }
.music-head h3 { margin: 0; }
.music-player iframe { display: block; width: 100%; border: 0; border-radius: 12px; background: var(--raise); }
.music-empty { border: 1px dashed var(--line-2); border-radius: 10px; padding: 22px 12px; text-align: center; color: var(--mute); }
.music-form { display: flex; flex-direction: column; gap: 6px; }
.music-row { display: flex; gap: 6px; }
.music-row input { flex: 1; }
.music-sub { margin: 4px 0 0; }
.music-lib { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 210px; overflow-y: auto; }
.music-lib li { display: flex; gap: 4px; align-items: stretch; }
.music-lib li.on .lib-play { border-color: var(--red); background: var(--red-soft); }
.lib-play { flex: 1; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 8px; text-align: left; padding: 6px 10px; min-height: 44px; }
.lib-dot { grid-row: 1 / 3; align-self: center; width: 10px; height: 10px; border-radius: 50%; }
.lib-dot.spotify { background: #1db954; }
.lib-dot.youtube, .lib-dot.ytlive { background: #ff3b3b; }
.lib-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-kind { font: 10px var(--mono); color: var(--mute); text-transform: uppercase; }
.lib-del { min-width: 40px; font-size: 16px; }
.lib-empty { color: var(--faint); font-size: 12px; padding: 6px 2px; }
.music-note a { color: var(--fg); }
.music-presets { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.music-presets span:last-child { display: contents; }
.music-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.music-note { margin: 0; line-height: 1.45; }
.chat-play { margin-left: 6px; min-height: 26px; padding: 2px 8px; font-size: 11px; }

.map-pick { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) 150px; grid-template-rows: auto auto; gap: 4px 12px; align-items: start; }
.map-pick label { grid-column: 1; }
.map-pick p { grid-column: 1; margin: 0; }
.map-preview { grid-column: 2; grid-row: 1 / 3; height: 118px; background: radial-gradient(circle at 50% 45%, #16243a, #0a0f18 75%); border: 1px solid var(--line-2); border-radius: 8px; padding: 6px; }
.map-preview svg { width: 100%; height: 100%; }


/* ---------- stage 1: hand dock, icons, dev cards, trade drawer ---------- */
.game-grid { grid-template-columns: minmax(0, 1fr) 320px; }
.main-col { display: flex; flex-direction: column; gap: 10px; min-height: 0; min-width: 0; }
.dock, .board-wrap, .dock-cards { min-width: 0; }
.main-col .board-wrap { flex: 1; }
.ri { display: block; flex: none; }
.chip { display: inline-flex; align-items: center; gap: 2px; padding: 2px 5px; border-radius: 5px; color: #fff; border: 1px solid rgba(255,255,255,.14); margin: 1px 2px 1px 0; vertical-align: middle; line-height: 1; }
.chip b { font: 600 11px var(--mono); }
.dock { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.dock-bar { display: flex; gap: 6px; flex-wrap: wrap; align-items: stretch; }
.db { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 74px; min-height: 58px; padding: 6px 10px; }
.db-ic { color: var(--fg); display: grid; place-items: center; }
.db.primary .db-ic { color: #fff; }
.db-l { font-weight: 600; font-size: 12px; }
.db-s { display: flex; align-items: center; gap: 2px; font: 10px var(--mono); color: var(--mute); text-transform: uppercase; }
.db-s em { font-style: normal; margin-left: 4px; }
.db:disabled .db-ic { opacity: .45; }
.dock-bar .leave { margin-left: auto; align-self: center; min-height: 36px; }
.dock-cards { display: flex; gap: 12px; align-items: flex-end; overflow-x: auto; padding: 10px 2px 4px; }
.hand { display: flex; gap: 6px; margin: 0; }
.rc { position: relative; width: 66px; height: 96px; flex: none; padding: 0; border-radius: 8px; border: 1px solid rgba(255,255,255,.14); background: var(--c); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 4px 0 rgba(0,0,0,.45), 0 8px 14px rgba(0,0,0,.35); cursor: default; transition: transform .12s; }
.rc .n { font: 600 20px var(--mono); }
.rc::after { content: ''; position: absolute; inset: 4px; border-radius: 5px; border: 1px solid rgba(255,255,255,.16); pointer-events: none; }
.rc.none { opacity: .38; }
.rc.pickable:not(.none) { cursor: pointer; outline: 2px dashed rgba(255,255,255,.5); outline-offset: 2px; }
.rc.pickable:not(.none):hover { transform: translateY(-4px); }
.rc:hover { background: var(--c); }
.dock-sep { width: 1px; background: var(--line-2); flex: none; }
.dev-rack { display: flex; gap: 10px; align-items: flex-end; padding: 0 8px 6px 2px; }
/* Development cards: portrait playing cards with a title band, art medallion, effect line and footer. */
.devc { --ink: #b9b3e6; --edge: #4b4090; --face: #201a3b; --band: #2e2560; --art: #3a2f78;
  position: relative; width: 90px; height: 128px; flex: none; border-radius: 9px; padding: 6px 5px 5px; box-sizing: border-box;
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
  background: linear-gradient(160deg, var(--face), #120f22); border: 1.5px solid var(--edge); color: var(--ink);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.04), 0 4px 0 rgba(0,0,0,.45), 0 10px 18px rgba(0,0,0,.45);
  transition: transform .15s ease; }
.devc:hover { transform: translateY(-6px) rotate(-1.5deg); }
.devc.stack { box-shadow: inset 0 0 0 2px rgba(255,255,255,.04), calc(3px * var(--stack)) calc(-3px * var(--stack)) 0 -1px var(--band), calc(5px * var(--stack)) calc(-5px * var(--stack)) 0 -1px var(--edge), 0 4px 0 rgba(0,0,0,.45), 0 10px 18px rgba(0,0,0,.45); }
.dv-top { flex: none; width: 100%; box-sizing: border-box; border-radius: 5px 5px 3px 3px; background: var(--band); color: #fff; font: 600 9.5px/1.25 var(--ui); padding: 3px 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dv-art { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 40% 35%, color-mix(in srgb, var(--art) 70%, #fff 30%), var(--art)); color: #fff; box-shadow: inset 0 -3px 0 rgba(0,0,0,.25), 0 0 0 2px var(--edge); flex: none; }
.dv-text { font-size: 9.5px; line-height: 1.2; color: var(--ink); flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; overflow: hidden; }
.dv-foot { flex: none; width: 100%; display: flex; justify-content: center; }
.dv-state { font: 600 9px var(--mono); text-transform: uppercase; color: var(--ink); opacity: .75; padding: 2px 0; }
.dv-state.ok { color: #ffe3a3; opacity: 1; }
.dv-play { width: 100%; min-height: 22px; padding: 1px 6px; font-size: 11px; font-weight: 600; background: var(--edge); border-color: color-mix(in srgb, var(--edge) 60%, #fff 40%); color: #fff; }
.dv-play:hover:not(:disabled) { filter: brightness(1.2); }
.devc.ready { border-color: #fff; box-shadow: 0 0 0 2px var(--edge), 0 4px 0 rgba(0,0,0,.45), 0 10px 22px rgba(0,0,0,.5); }
.dv-n { position: absolute; top: -8px; right: -8px; min-width: 22px; height: 22px; border-radius: 11px; display: grid; place-items: center; background: var(--red); color: #fff; font: 600 11px var(--mono); font-style: normal; border: 2px solid var(--ink-bg, #07080b); }
.devc-knight { --edge: #b4243a; --band: #7d1a2b; --art: #a3283d; --face: #2a1218; --ink: #f0b9c2; }
.devc-roadBuilding { --edge: #2b8a78; --band: #1c5c50; --art: #237d6c; --face: #0f2420; --ink: #a9e3d6; }
.devc-yearOfPlenty { --edge: #4f8f3a; --band: #355f27; --art: #4c8a37; --face: #142112; --ink: #c6e6b3; }
.devc-monopoly { --edge: #6b55d8; --band: #45369a; --art: #5b49c4; --face: #1d1838; --ink: #cfc6ff; }
.devc-vp { --edge: #b8902c; --band: #7a5d17; --art: #b08624; --face: #2a2110; --ink: #f0d79a; }
.devc.empty { --edge: #323949; --band: #1c212c; --art: #232834; --face: #10131a; --ink: #8f96a7; border-style: dashed; }
.devc.empty .dv-text { flex-wrap: wrap; justify-content: center; gap: 2px; }
.devc.empty .chip { padding: 1px 3px; }
.build-menu { position: absolute; left: 10px; bottom: calc(100% - 4px); z-index: 8; display: flex; gap: 6px; padding: 8px; background: var(--raise-2); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: 0 12px 40px rgba(0,0,0,.6); flex-wrap: wrap; max-width: calc(100% - 20px); }
.build-opt { display: grid; grid-template-columns: 34px auto; grid-template-rows: auto auto auto; column-gap: 8px; text-align: left; align-items: center; min-width: 150px; padding: 8px 10px; opacity: .6; }
.build-opt svg { grid-row: 1 / 4; }
.build-opt.ok { opacity: 1; border-color: var(--good); }
.bo-name { font-weight: 600; }
.bo-cost { display: flex; flex-wrap: wrap; }
.bo-why { font: 10px var(--mono); text-transform: uppercase; color: var(--mute); display: flex; align-items: center; gap: 3px; flex-wrap: wrap; }
.build-opt.ok .bo-why { color: var(--good); }
.drawer { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 7; width: min(560px, calc(100% - 24px)); background: var(--raise); border: 1px solid var(--line-2); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 18px 50px rgba(0,0,0,.65); }
.dr-head { display: flex; justify-content: space-between; align-items: center; }
.dr-head b { font-family: var(--display); font-weight: 400; font-size: 20px; letter-spacing: .04em; }
.dr-zones { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.zone { min-height: 54px; border: 1px dashed var(--line-2); border-radius: 8px; padding: 6px 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.op-l { width: 100%; font: 600 10px var(--mono); text-transform: uppercase; color: var(--mute); }
.zitem { display: inline-flex; align-items: center; gap: 4px; padding: 3px; border-radius: 8px; background: var(--c); color: #fff; border: 1px solid rgba(255,255,255,.18); }
.zitem b { font: 600 15px var(--mono); min-width: 14px; text-align: center; }
.zitem > .ri { margin-left: 4px; }
.zitem > b:last-child { margin-right: 6px; }
.zbtn { min-height: 26px; min-width: 26px; padding: 0; font-size: 15px; font-weight: 600; background: rgba(0,0,0,.28); border-color: rgba(255,255,255,.25); color: #fff; }
.zbtn:hover:not(:disabled) { background: rgba(0,0,0,.45); }
.dr-note { font-size: 12.5px; color: var(--mute); }
.dr-note.ok { color: var(--good); }
.dr-want { display: flex; gap: 6px; }
.want { flex: 1; min-height: 40px; display: grid; place-items: center; color: #fff; border: 1px solid rgba(255,255,255,.14); }
.want:hover:not(:disabled) { filter: brightness(1.2); }
.dr-rates { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.dr-rates .op-l { width: auto; margin-right: 2px; }
.rate { display: flex; align-items: center; gap: 4px; min-height: 34px; padding: 3px 8px; }
.rate b { font: 600 11px var(--mono); }
.rate.port { border-color: var(--gold); }
.dr-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.dr-resp { display: flex; flex-direction: column; gap: 6px; }
.dr-resp .resp { display: flex; align-items: center; gap: 8px; }
.rs { font: 600 10px var(--mono); text-transform: uppercase; }
.rs.accept { color: var(--good); } .rs.reject { color: var(--red-hi); } .rs.wait { color: var(--mute); }
.offer-pop { position: absolute; top: 64px; left: 50%; transform: translateX(-50%); z-index: 9; width: min(360px, calc(100% - 24px)); background: var(--raise-2); border: 1px solid var(--gold); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; box-shadow: 0 18px 50px rgba(0,0,0,.65); animation: popIn .2s ease-out; }
.op-head { display: flex; align-items: center; gap: 8px; }
.op-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.op-btns { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
@keyframes popIn { from { opacity: 0; transform: translate(-50%, -8px); } }
.piece-toggle { position: absolute; top: 64px; left: 14px; z-index: 6; display: flex; align-items: center; gap: 6px; padding: 6px 8px; background: var(--raise-2); border: 1px solid var(--line-2); border-radius: 8px; font-size: 12px; }
.piece-toggle button { min-height: 32px; padding: 4px 12px; }
.feed { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--mute); }
.feed div { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 6px 9px; display: flex; align-items: center; flex-wrap: wrap; gap: 2px; }
.feed div:last-child { color: var(--fg); border-color: var(--line-2); }
.log div { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; }
.trade-grid .hd { display: flex; align-items: center; justify-content: center; gap: 4px; padding: 5px 0; }
.pick button { display: grid; place-items: center; min-height: 52px; }

/* ---------- effects ---------- */
.fx { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.fly { position: fixed; will-change: transform; }
.fly-card { width: 26px; height: 36px; border-radius: 4px; display: grid; place-items: center; color: #fff; border: 1.5px solid rgba(255,255,255,.55); box-shadow: 0 6px 14px rgba(0,0,0,.55); }
.fly-card.back { background: linear-gradient(135deg, #2b3243, #151922); color: #8f96a7; }
.fly-card.devback { background: linear-gradient(135deg, #3a2f78, #1d1838); color: #cfc6ff; }
.fly-card.coin { width: 24px; height: 24px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff3b0, #e2b23a 45%, #8a6414); border-color: #fff3b0; }
.fx-bubble { position: fixed; font: 600 15px var(--mono); color: #fff; background: var(--good); padding: 3px 9px; border-radius: 12px; box-shadow: 0 6px 16px rgba(0,0,0,.5); white-space: nowrap; }
.dice-tumble { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); display: flex; gap: 14px; z-index: 6; pointer-events: none; }
.tdie { width: 58px; height: 58px; border-radius: 12px; display: grid; place-items: center; font: 600 28px var(--mono); color: var(--ink); background: linear-gradient(145deg, #fff, #d5d9e2); box-shadow: inset -4px -5px 0 rgba(0,0,0,.12), 0 7px 0 #8f96a7, 0 16px 28px rgba(0,0,0,.6); }
.dice-tumble.seven .tdie { background: linear-gradient(145deg, var(--red-hi), var(--red)); color: #fff; box-shadow: inset -4px -5px 0 rgba(0,0,0,.18), 0 7px 0 #8e1422, 0 16px 28px rgba(0,0,0,.6); }
.tile.hit .hex { animation: hexHit 1.2s ease-in-out 2; stroke: #ffd166; stroke-width: .12; }
.tile.blk .hex { animation: hexBlk 1.2s ease-in-out 2; stroke: #ff5a5f; stroke-width: .12; }
@keyframes hexBlk { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(.55) saturate(1.4); } }
@keyframes hexHit { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.55) saturate(1.2); } }
.dr-asks { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ask { display: flex; align-items: center; gap: 6px; min-height: 36px; padding: 4px 10px; font-size: 12px; }
.ask span { font-weight: 600; }
.ask.bank { border-color: var(--gold); }
.ask b { color: var(--gold); }
@media (prefers-reduced-motion: reduce) { .tile.hit .hex, .tile.blk .hex { animation: none; } }

@media (max-width: 900px) {
  .lobby-grid { grid-template-columns: 1fr; padding: 12px; }
  .room-code { font-size: 48px; }
  .game-grid { grid-template-columns: 1fr; height: auto; padding: 8px; }
  #board { height: auto; aspect-ratio: var(--board-ar, 12 / 10.8); flex: none; }
  .side { overflow: visible; }
  .main-col .board-wrap { flex: none; }
  .dock { position: sticky; bottom: 0; z-index: 10; }
  .dock-bar { flex-wrap: nowrap; overflow-x: auto; }
  .db { flex: none; }
  .game-grid { grid-template-columns: minmax(0, 1fr); }
  .db { min-width: 60px; min-height: 52px; padding: 4px 6px; }
  .rc { width: 54px; height: 82px; }
  .devc { width: 80px; height: 116px; }
  .dv-art { width: 34px; height: 34px; }
  .brand { font-size: 18px; }
  .cam { position: static; justify-content: center; flex-wrap: wrap; }
  .dice { position: static; justify-content: center; min-height: 0; }
  .dice:empty { display: none; }
  .cam button { min-width: 34px; min-height: 34px; padding: 0 8px; font-size: 13px; }
  .tilt { min-height: 34px; padding: 0 8px; } .tilt input { width: 80px; }
  .die { width: 36px; height: 36px; font-size: 18px; }
  .dice { left: 10px; bottom: 10px; }
}
/* Manual pick rows in the trade drawer */
.dr-pick { display: flex; flex-direction: column; gap: 4px; }
.want { position: relative; }
.want.give small { position: absolute; top: 2px; right: 5px; font: 600 11px var(--mono); color: #fff; text-shadow: 0 1px 2px #000; }
.want.give i { position: absolute; bottom: 1px; left: 0; right: 0; text-align: center; font: 600 9px var(--mono); font-style: normal; opacity: .85; }
.want.give.port { box-shadow: inset 0 0 0 2px var(--gold); }
.want:disabled { opacity: .35; cursor: not-allowed; }

/* Quick chat and emotes */
.emote { position: relative; flex: none; }
#emoteBtn { width: 42px; height: 42px; padding: 0; font-size: 21px; line-height: 1; background: var(--raise); border: 1px solid var(--line-2); border-radius: 6px; }
.emote-panel { position: fixed; z-index: 90; width: min(330px, 86vw); max-height: min(380px, 60vh); overflow-y: auto; background: rgba(17,19,25,.97); border: 1px solid rgba(255,255,255,.12); border-radius: 12px; padding: 10px; box-shadow: 0 16px 40px rgba(0,0,0,.6); display: flex; flex-direction: column; gap: 10px; }
.emote-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.em { font-size: 22px; height: 42px; padding: 0; background: transparent; border: 1px solid transparent; border-radius: 8px; }
.em:hover { background: rgba(255,255,255,.08); transform: scale(1.12); }
.quick-list { display: flex; flex-wrap: wrap; gap: 6px; }
.qk { font-size: 12px; min-height: 32px; padding: 4px 10px; border-radius: 16px; }
.say-bubble { position: fixed; z-index: 60; max-width: 220px; pointer-events: none; background: #fff; color: #111; font: 600 13px/1.3 var(--sans, system-ui); padding: 7px 12px; border-radius: 14px; border-left: 4px solid var(--c, #888); box-shadow: 0 8px 22px rgba(0,0,0,.5); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transform: translate(-100%, -50%); }
.say-bubble::after { content: ''; position: absolute; right: -7px; top: 50%; margin-top: -6px; border: 6px solid transparent; border-left-color: #fff; border-right: 0; }
.say-bubble.big { font-size: 30px; padding: 4px 10px; border-left: 0; background: rgba(255,255,255,.95); }
.say-bubble.top { transform: translate(-50%, -50%); }
.say-bubble.top::after { display: none; }
@media (max-width: 760px), (max-height: 560px), (pointer: coarse) and (max-width: 1400px) { .emote-panel { position: fixed; left: 8px; right: 8px; bottom: 8px; width: auto; max-height: 55vh; z-index: 90; } }

/* Your turn: the screen edges pulse. The glow sits on its own layer and only its opacity animates,
   so phones (iPhone Safari especially) don't repaint the blur every frame. */
#turnGlow { position: fixed; inset: 0; pointer-events: none; z-index: 70; opacity: 0; --glow: 240, 60, 80;
  transform: translateZ(0); -webkit-transform: translateZ(0); will-change: opacity; -webkit-backface-visibility: hidden; backface-visibility: hidden; contain: strict; }
#turnGlow::before { content: ''; position: absolute; inset: 0; border-radius: 0; box-shadow: inset 0 0 0 3px rgba(var(--glow), .95), inset 0 0 70px 10px rgba(var(--glow), .55); }
#turnGlow.on { animation: turnPulse 1.1s ease-in-out infinite alternate; }
#turnGlow.urgent { animation-duration: .45s; }
#turnGlow.urgent::before { box-shadow: inset 0 0 0 4px rgba(var(--glow), 1), inset 0 0 90px 16px rgba(var(--glow), .7); }
@keyframes turnPulse { from { opacity: .3; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { #turnGlow.on { animation: none; opacity: .8; } }

/* ---------- Phone: one screen, no scrolling ---------- */
.log-btn, .zoom-reset { display: none; }
@media (max-width: 760px), (max-height: 560px), (pointer: coarse) and (max-width: 1400px) {
  body:has(#game:not(.hidden)) { overflow: hidden; }
  #game.screen { min-height: 0; }
  #game .game-grid { display: flex; flex-direction: column; height: 100vh; height: 100dvh; padding: 4px; gap: 4px; overflow: hidden; }
  #game .main-col, #game .side { display: contents; }
  #game .players { order: 1; flex: none; flex-direction: row; gap: 4px; padding-right: 42px; overflow-x: auto; scrollbar-width: none; }
  #game .board-wrap { order: 2; flex: 1 1 auto; min-height: 0; padding: 4px; gap: 4px; border-radius: 8px; overflow: hidden; }
  #game .dock { order: 3; flex: none; position: relative; padding: 6px; gap: 6px; border-radius: 8px; }
  #game .tabs-card { display: none; }
  body.sheet-open #game .tabs-card { display: flex; flex-direction: column; position: fixed; left: 6px; right: 6px; bottom: 6px; height: 58vh; height: 58dvh; z-index: 85; box-shadow: 0 -10px 40px rgba(0,0,0,.6); }
  body.sheet-open #game .tabs-card .log, body.sheet-open #game .tabs-card .chat { flex: 1; min-height: 0; }

  .pl { flex: 1 1 0; min-width: 76px; padding: 4px 6px; gap: 0 5px; border-radius: 6px; }
  .pl .nm { font-size: 11px; flex-wrap: nowrap; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; min-width: 0; }
  .pl .nm .tag { display: none; }
  .pl .vp { font-size: 15px; }
  .pl .meta { grid-column: 1 / 4; font-size: 9px; gap: 5px; flex-wrap: nowrap; overflow: hidden; }
  .pl .meta > span:nth-child(n+3):not(.award) { display: none; }
  .pl .meta .award { font-size: 8px; padding: 0 3px; }
  .pl.turn { box-shadow: inset 0 -3px 0 var(--red); }
  .pl .dot { width: 8px; height: 8px; }

  .game-top { flex-wrap: nowrap; gap: 4px; }
  .game-top .brand { display: none; }
  .status { min-width: 0; padding: 5px 8px; font-size: 12px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .sound { padding: 0; border: 0; background: none; }
  .sound input { display: none; }
  #sndBtn, #emoteBtn, .log-btn { width: 36px; height: 36px; min-height: 36px; padding: 0; }
  #emoteBtn { font-size: 18px; }
  .log-btn { display: grid; place-items: center; position: relative; flex: none; background: var(--raise); border: 1px solid var(--line-2); border-radius: 6px; color: var(--fg); }
  .log-btn .badge { position: absolute; top: -4px; right: -4px; }

  #board { flex: 1 1 auto; height: auto; min-height: 0; aspect-ratio: auto; transform-origin: 0 0; touch-action: none; }
  .zoom-reset { display: block; position: absolute; top: 48px; right: 6px; z-index: 5; min-height: 30px; padding: 2px 10px; font-size: 11px; background: rgba(13,15,20,.85); }
  .zoom-reset.hidden { display: none; }
  .board-wrap > #feed { position: absolute; top: 46px; left: 6px; right: 6px; z-index: 4; pointer-events: none; gap: 0; }
  .board-wrap > #feed div { display: none; }
  .board-wrap > #feed div:last-child { display: flex; font-size: 11px; padding: 3px 8px; background: rgba(13,15,20,.82); justify-content: center; animation: feedFade 5s ease-in forwards; }
  @keyframes feedFade { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }

  .dice { position: absolute; left: 6px; bottom: 6px; z-index: 4; }
  .die { width: 30px; height: 30px; font-size: 16px; border-radius: 7px; }
  .cam { position: absolute; right: 4px; bottom: 4px; gap: 3px; flex-wrap: nowrap; z-index: 4; }
  .cam button { min-width: 30px; min-height: 30px; padding: 0 6px; font-size: 12px; }
  .tilt { min-height: 30px; padding: 0 6px; gap: 4px; }
  .tilt span { display: none; }
  .tilt input { width: 64px; }

  .dock-bar { flex-wrap: nowrap; gap: 4px; overflow-x: auto; scrollbar-width: none; }
  .db { flex: 1 1 0; min-width: 0; min-height: 46px; padding: 3px 2px; gap: 1px; }
  .db .db-s { display: none; }
  .db-l { font-size: 10px; white-space: nowrap; }
  .db svg { width: 18px; height: 18px; }
  .dock-bar .leave { flex: none; min-height: 30px; padding: 0 8px; font-size: 11px; }
  .dock-cards { gap: 6px; padding: 2px 0 0; align-items: stretch; scrollbar-width: none; }
  .hand { gap: 4px; }
  .rc { width: 44px; height: 60px; gap: 2px; border-radius: 6px; }
  .rc svg { width: 22px; height: 22px; }
  .rc .n { font-size: 14px; }
  .dev-rack { gap: 6px; padding: 0 2px; }
  .devc { width: 60px; height: 64px; }
  .devc .dv-text { display: none; }
  .devc .dv-art { width: 22px; height: 22px; }
  .devc .dv-art svg { width: 16px; height: 16px; }
  .devc .dv-top { font-size: 8.5px; }

  .music-btn { top: 6px; right: 6px; bottom: auto; width: 36px; height: 36px; min-height: 36px; padding: 0; justify-content: center; border-radius: 8px; }
  .music-btn span { display: none; }
  .drawer { bottom: 6px; max-height: calc(100% - 52px); overflow-y: auto; padding: 10px; gap: 8px; }
  .offer-pop { top: 46px; }
}

/* ---------- Phone v2: colonist-style one screen ---------- */
.phone-top, .board-fabs, .pl-m { display: none; }
@media (max-width: 760px), (max-height: 560px), (pointer: coarse) and (max-width: 1400px) {
  #game .phone-top { order: 0; display: flex; align-items: center; gap: 6px; flex: none; }
  .icon-btn { position: relative; flex: none; width: 38px; height: 38px; min-height: 38px; padding: 0; display: grid; place-items: center; background: var(--raise); border: 1px solid var(--line-2); border-radius: 8px; color: var(--fg); }
  .icon-btn .badge { position: absolute; top: -5px; right: -5px; }
  .bank-strip { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 3px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 3px 6px; }
  .bk-ic { color: var(--mute); display: grid; place-items: center; margin-right: 2px; }
  .bk { flex: 0 1 30px; height: 34px; border-radius: 5px; background: var(--c); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; border: 1px solid rgba(255,255,255,.2); box-shadow: inset 0 1px 0 rgba(255,255,255,.2); }
  .bk b { font: 600 10px var(--mono); }
  .bk.dev { background: #3a2f78; color: #d9d2ff; }
  .music-btn { display: none; }

  #game .players { padding: 0 0 2px; position: relative; z-index: 12; overflow: visible; gap: 5px; }
  #game .pl { flex: 1 1 0; min-width: 0; padding: 0; display: block; background: none; border: 0; box-shadow: none; position: relative; }
  #game .pl > :not(.pl-m) { display: none; }
  .pl-m { display: block; background: var(--panel); border: 1px solid var(--line-2); border-radius: 7px; }
  .pl.turn .pl-m { border-color: var(--pc); box-shadow: 0 0 0 1px var(--pc), 0 0 12px rgba(255,255,255,.08); }
  .pm-h { display: flex; align-items: center; gap: 4px; padding: 2px 5px 2px 2px; border-radius: 6px 6px 0 0; background: var(--pc); color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.7); min-width: 0; }
  .pm-vp { flex: none; width: 21px; height: 21px; border-radius: 50%; display: grid; place-items: center; background: #0d0f14; color: #fff; border: 2px solid rgba(255,255,255,.85); font: 600 11px var(--mono); text-shadow: none; }
  .pm-n { font-weight: 600; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .pm-bot { font-style: normal; font-size: 9px; margin-right: 2px; opacity: .85; }
  .pm-b { display: flex; justify-content: space-between; padding: 3px 4px; font: 600 10.5px var(--mono); }
  .pm-s { display: flex; align-items: center; gap: 2px; color: var(--fg); }
  .pm-s svg { color: var(--mute); }
  .pm-s.award, .pm-s.award svg { color: var(--gold); }
  .pm-card { display: inline-block; width: 8px; height: 11px; border-radius: 2px; background: #6b7894; border: 1px solid rgba(255,255,255,.3); }
  .pm-card.dev { background: #6b4fd0; }
  .pm-turn { position: absolute; left: 3px; right: 3px; top: 100%; background: var(--pc); color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.75); border-radius: 0 0 7px 7px; padding: 1px 2px 3px; text-align: center; font: 600 10px/1.2 var(--ui); box-shadow: 0 4px 10px rgba(0,0,0,.4); }
  .pm-turn span, .pm-turn time { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .pm-turn time { font: 600 10px var(--mono); }
  .pm-turn time:empty { display: none; }

  #game .board-wrap { border: 0; padding: 0; background: radial-gradient(ellipse 90% 70% at 50% 50%, #142036 0%, #0b1220 75%); }
  .game-top { position: absolute; left: 54px; right: 84px; bottom: 8px; z-index: 5; justify-content: center; pointer-events: none; }
  .status { pointer-events: auto; text-align: center; font-size: 11.5px; padding: 4px 10px; border-radius: 14px; background: rgba(13,15,20,.85); }
  .status.mine { background: rgba(120,20,32,.9); }
  .board-fabs { display: flex; flex-direction: column; gap: 6px; position: absolute; left: 6px; bottom: 6px; z-index: 6; }
  .board-fabs .log-btn, .board-fabs #emoteBtn { width: 38px; height: 38px; min-height: 38px; border-radius: 8px; background: var(--raise); }
  .board-fabs .emote { position: relative; }
  .dice { left: auto; right: 6px; bottom: 6px; }
  .board-wrap > #feed { top: 34px; }
  .zoom-reset { top: 34px; }
  .offer-pop { top: 36px; }
  .dock-bar .leave { display: none; }

  .phone-settings { position: fixed; top: 52px; left: 8px; right: 8px; z-index: 95; display: flex; flex-direction: column; gap: 12px; padding: 12px; background: var(--raise-2); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 18px 50px rgba(0,0,0,.7); }
  .ps-head { display: flex; justify-content: space-between; align-items: center; font-size: 15px; }
  .ps-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
  .ps-row.col { flex-direction: column; align-items: stretch; }
  .ps-l { font: 600 11px var(--mono); text-transform: uppercase; color: var(--mute); min-width: 64px; }
  .ps-row > button { flex: 1; min-height: 40px; }
  #phoneSettings .sound { padding: 0 8px 0 0; border: 1px solid var(--line-2); background: var(--raise); }
  #phoneSettings .sound input { display: block; width: 150px; }
  #phoneSettings .cam { position: static; flex-wrap: wrap; gap: 6px; }
  #phoneSettings .cam button { min-width: 44px; min-height: 40px; }
  #phoneSettings .tilt { min-height: 40px; flex: 1; }
  #phoneSettings .tilt span { display: inline; }
  #phoneSettings .tilt input { flex: 1; width: auto; }
}
@media (max-width: 760px), (max-height: 560px), (pointer: coarse) and (max-width: 1400px) {
  .pm-award, .pm-award svg { color: var(--gold) !important; }
  .pl-m.light .pm-h, .pl-m.light .pm-turn { color: #111; text-shadow: none; }
  .pm-b { padding: 3px 3px; font-size: 10px; gap: 1px; }
  .pm-s { gap: 1px; }
  .pm-s svg { width: 10px; height: 10px; }
  .pm-card { width: 7px; height: 10px; }
  .board-wrap > #feed div:last-child { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-align: center; }
}
@media (max-width: 760px), (max-height: 560px), (pointer: coarse) and (max-width: 1400px) {
  .board-wrap > #feed div:last-child { display: flex; flex-wrap: wrap; justify-content: center; max-height: 38px; overflow: hidden; }
  .pm-card.pm-dev { background: #7d5cf0; }
}
@media (max-width: 760px), (max-height: 560px), (pointer: coarse) and (max-width: 1400px) {
  body.sheet-open #game .tabs-card .chat:not(.hidden) { display: flex; flex-direction: column; }
  body.sheet-open #game .tabs-card .chat-log { flex: 1; min-height: 0; overflow-y: auto; }
}

/* ---------- Board zoom (all screens) ---------- */
#board { touch-action: none; transform-origin: 0 0; position: relative; z-index: 1; }
.board-wrap { overflow: hidden; }
.board-wrap > .game-top { position: relative; z-index: 6; }
.board-wrap.zoomed #board { cursor: grab; }
.zoom-ctl { position: absolute; right: 14px; top: 64px; z-index: 6; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 4px; background: rgba(13,15,20,.78); border: 1px solid var(--line-2); border-radius: 10px; backdrop-filter: blur(4px); }
.zoom-ctl button { width: 34px; height: 34px; min-height: 34px; padding: 0; font: 600 18px var(--mono); line-height: 1; background: var(--raise); }
.zoom-ctl span { font: 600 9.5px var(--mono); color: var(--mute); }
@media (max-width: 760px), (max-height: 560px), (pointer: coarse) and (max-width: 1400px) {
  .zoom-ctl { right: 6px; top: 34px; padding: 3px; gap: 3px; }
  .zoom-ctl button { width: 32px; height: 32px; min-height: 32px; font-size: 17px; }
  #board { cursor: default; }
}
@media (max-width: 760px), (max-height: 560px), (pointer: coarse) and (max-width: 1400px) {
  .board-wrap > .game-top { position: absolute; z-index: 6; }
  .board-wrap > #feed { right: 50px; }
}
#board { z-index: 0; }
.board-wrap > .cam, .board-wrap > .dice, .board-wrap > .tip, .board-wrap > .drawer, .board-wrap > .offer-pop, .board-wrap > .piece-toggle, .board-wrap > .board-fabs, .board-wrap > #feed { z-index: 6; }
.board-wrap > .game-top { background: #10141d; border-radius: 8px; box-shadow: 0 0 0 6px #10141d; }
@media (max-width: 760px), (max-height: 560px), (pointer: coarse) and (max-width: 1400px) { .board-wrap > .game-top { background: none; box-shadow: none; } }

/* ---------- Trade: aligned layout (all screens) ---------- */
.dr-head button { min-height: 32px; padding: 4px 12px; font-size: 12px; }
.zone { align-content: flex-start; }
.zone .op-l { margin-bottom: 2px; }
.zone-empty { line-height: 30px; }
.dr-btns { flex-wrap: nowrap; }
.dr-btns > button { flex: 1 1 0; min-width: 0; min-height: 42px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dr-btns.three > [data-offer] { flex: 1.6 1 0; }
.dr-resp { gap: 6px; }
.dr-resp .resp { display: grid; grid-template-columns: 12px minmax(0, 1fr) 92px 76px; align-items: center; gap: 10px; min-height: 44px; padding: 4px 6px 4px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.resp .rn { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.resp .rn b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.resp .rn small { color: var(--mute); white-space: nowrap; font-size: 11px; }
.resp .rs { justify-self: stretch; text-align: center; padding: 4px 0; border-radius: 12px; border: 1px solid currentColor; font-size: 10px; letter-spacing: .04em; }
.resp .rs.wait { border-color: var(--line-2); }
.resp [data-confirm] { width: 100%; min-height: 34px; padding: 0 8px; }
.resp .rs-gap { display: block; }
.dr-note { text-align: center; padding: 2px 0; }
.op-head { min-width: 0; }
.op-head b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.op-head .muted { white-space: nowrap; flex: none; }
.op-zones .zone { min-height: 58px; }
.op-btns { flex-wrap: nowrap; }
.op-btns > button { flex: 1 1 0; min-height: 42px; }
.op-note { text-align: center; font-size: 12.5px; padding: 8px; border-radius: 8px; background: var(--panel); color: var(--mute); }
.op-note.accept { color: var(--good); }

@media (max-width: 760px), (max-height: 560px), (pointer: coarse) and (max-width: 1400px) {
  /* trade, build and incoming offers sit as full-width sheets at the bottom of the board,
     and the floating buttons, dice and status step out of the way while they are open */
  .drawer { left: 6px; right: 6px; bottom: 6px; width: auto; transform: none; }
  .offer-pop { top: auto; bottom: 6px; left: 6px; right: 6px; width: auto; transform: none; }
  #game .build-menu { left: 0; right: 0; max-width: none; }
  .board-wrap.overlay-open > .board-fabs, .board-wrap.overlay-open > .dice, .board-wrap.overlay-open > .game-top, .board-wrap.overlay-open > #feed { visibility: hidden; }
  .dr-resp .resp { grid-template-columns: 10px minmax(0, 1fr) 80px 66px; gap: 8px; }
  .resp .rn { flex-direction: column; gap: 0; line-height: 1.2; }
  .dr-btns > button, .op-btns > button { min-height: 40px; font-size: 13px; padding: 0 8px; }
}
@media (max-width: 760px), (max-height: 560px), (pointer: coarse) and (max-width: 1400px) {
  /* build menu: one row of equal cards (road, ship, settlement, city) */
  #game .build-menu { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; padding: 6px; }
  #game .build-opt { min-width: 0; grid-template-columns: 1fr; grid-template-rows: 34px auto auto auto; justify-items: center; text-align: center; row-gap: 3px; padding: 6px 4px; }
  #game .build-opt > svg { grid-row: auto; width: 30px; height: 30px; }
  #game .build-opt { grid-template-rows: 32px auto auto auto; align-content: start; }
  #game .bo-name { font-size: 11.5px; white-space: nowrap; }
  #game .bo-cost .chip { margin: 1px; }
  #game .bo-name { font-size: 12px; }
  #game .bo-cost { justify-content: center; gap: 2px; }
  #game .bo-why { justify-content: center; text-align: center; font-size: 9px; line-height: 1.25; }
}
@media (max-width: 760px), (max-height: 560px), (pointer: coarse) and (max-width: 1400px) {
  /* phone dialogs */
  .modal-card { padding: 16px; width: calc(100vw - 24px); max-width: none; }
  .modal-card h3 { font-size: 19px; line-height: 1.2; margin: 0 0 10px; }
  .modal-card .row > button { flex: 1 1 0; min-height: 42px; }
}

/* ---------- Phone: dev cards behind one button, opened as a sheet ---------- */
.dev-btn { display: none; }
@media (max-width: 760px), (max-height: 560px), (pointer: coarse) and (max-width: 1400px) {
  #game .dock-cards { overflow: visible; align-items: stretch; }
  #game .dev-rack { display: none; }
  .dev-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; position: relative; flex: none; width: 58px; min-height: 0; padding: 4px 2px; border-radius: 8px; background: linear-gradient(160deg, #3a2f78, #201a3b); border: 1px solid #6b5bd0; color: #d9d2ff; font: 600 10px var(--ui); }
  .dev-btn b { font: 600 15px var(--mono); color: #fff; }
  .dev-btn.ready { box-shadow: 0 0 0 2px var(--good), 0 0 14px rgba(47,191,143,.45); }
  .dev-btn .dot-ready { position: absolute; top: -5px; right: -5px; width: 14px; height: 14px; border-radius: 50%; background: var(--good); border: 2px solid var(--panel); }
  body.dev-open #game .dev-rack { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: 12px 10px; position: fixed; left: 6px; right: 6px; bottom: 6px; z-index: 86; max-height: 62vh; max-height: 62dvh; overflow-y: auto; padding: 44px 12px 16px; margin: 0; background: var(--raise-2); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 -12px 40px rgba(0,0,0,.65); -webkit-mask-image: none; mask-image: none; }
  body.dev-open #game .dev-rack::before { content: 'Development cards'; position: absolute; top: 12px; left: 14px; font: 400 18px var(--display); letter-spacing: .04em; color: var(--fg); }
  body.dev-open #game .dev-rack .devc { width: 90px; height: 128px; }
  body.dev-open #game .dev-rack .devc .dv-text { display: block; }
  body.dev-open #game .dev-rack .devc .dv-art { width: 34px; height: 34px; }
  body.dev-open #game .dev-rack .devc .dv-art svg { width: 26px; height: 26px; }
  body.dev-open #game .dev-rack .devc .dv-top { font-size: 10px; }
  body.dev-open #game .dev-rack .dv-play { min-height: 26px; font-size: 12px; padding: 0 12px; }
}
.board-wrap > .drawer { z-index: 9; }
.board-wrap > .offer-pop { z-index: 10; }
@media (max-width: 760px), (max-height: 560px), (pointer: coarse) and (max-width: 1400px) {
  /* Trade and incoming offers: anchored to the bottom of the screen (over the dock) so short
     Android screens have room; the action buttons are pinned so Offer / Bank / Clear always show. */
  #game .drawer, #game .offer-pop { position: fixed; left: 6px; right: 6px; bottom: 6px; top: auto; width: auto; transform: none; z-index: 80; max-height: calc(100vh - 110px); max-height: calc(100dvh - 110px); overflow-y: auto; overscroll-behavior: contain; padding: 10px; gap: 8px; }
  #game .drawer .dr-btns { position: sticky; bottom: -10px; margin: 0 -10px -10px; padding: 8px 10px 10px; background: var(--raise); border-top: 1px solid var(--line); z-index: 1; }
  #game .drawer .zone { min-height: 46px; padding: 5px 8px; }
  #game .drawer .want { min-height: 36px; }
  #game .drawer .dr-pick { gap: 3px; }
  #game .drawer .dr-head b { font-size: 18px; }
}
.dr-hint { font-size: 11.5px; color: var(--mute); text-align: center; line-height: 1.35; }
@media (max-width: 760px), (max-height: 560px), (pointer: coarse) and (max-width: 1400px) {
  /* Offers sit in the middle of the board, clear of your hand and action bar,
     so you can check your cards while you decide. */
  #game .offer-pop, #game .drawer.my-offer { position: absolute; top: 50%; bottom: auto; left: 6px; right: 6px; transform: translateY(-50%); max-height: calc(100% - 12px); z-index: 12; animation: none; }
  #game .offer-pop { border-width: 2px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.25), 0 18px 50px rgba(0,0,0,.7); }
}
@media (max-width: 760px), (max-height: 560px), (pointer: coarse) and (max-width: 1400px) {
  /* Building an offer: the sheet stays inside the board area, above your hand and action bar,
     so your card counts stay visible. It scrolls if needed; the buttons stay pinned. */
  #game .drawer { position: absolute; left: 6px; right: 6px; bottom: 6px; top: auto; transform: none; max-height: calc(100% - 12px); z-index: 12; }
  #game .drawer .dr-head { position: sticky; top: -10px; margin: -10px -10px 0; padding: 8px 10px 4px; background: var(--raise); z-index: 1; }
  #game .drawer .dr-head b { font-size: 16px; }
  #game .drawer .dr-head button { min-height: 28px; padding: 2px 10px; }
  #game .drawer .zone { min-height: 40px; padding: 4px 8px; }
  #game .drawer .zone .op-l { width: auto; margin: 0 6px 0 0; }
  #game .drawer .want { min-height: 34px; }
  #game .drawer .dr-hint { font-size: 10.5px; }
}
@media (max-width: 760px), (max-height: 560px), (pointer: coarse) and (max-width: 1400px) { .tap-line { stroke-width: .62; } }
/* Phone: Trade button sits right above your cards; tapping a card also opens trading */
.hand-bar { display: none; }
@media (max-width: 760px), (max-height: 560px), (pointer: coarse) and (max-width: 1400px) {
  .hand-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -2px 0 -2px; }
  .hb-l { font: 600 10.5px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .hb-l small { text-transform: none; letter-spacing: 0; font-family: var(--ui); }
  .hb-trade { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 14px; border-radius: 16px; background: var(--red); border-color: var(--red); color: #fff; font-weight: 600; font-size: 13px; }
  .hb-trade:disabled { background: var(--raise); border-color: var(--line-2); color: var(--mute); opacity: .7; }
  .hb-trade.on { background: var(--raise); border-color: var(--red); color: var(--fg); }
  #game #act-trade { display: none; }
}
/* Touch screens have no hover: skip the hover-only ghost robber so a tap is never spent on hover */
@media (hover: none) { .rob-hit .ghost { transition: none; } .rob-hit:hover .ghost { opacity: 0; } }
/* Dice stats tab */
.dice-pane { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
.ds-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; }
.ds-head span { color: var(--mute); font: 600 11px var(--mono); }
.ds-chart { display: grid; grid-template-columns: repeat(11, 1fr); gap: 4px; height: 150px; align-items: stretch; }
.ds-col { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; }
.ds-n { font: 600 10px var(--mono); color: var(--mute); }
.ds-bar-wrap { position: relative; flex: 1; width: 100%; background: rgba(255,255,255,.04); border-radius: 4px; }
.ds-bar { position: absolute; left: 15%; right: 15%; bottom: 0; background: #4d7cff; border-radius: 3px 3px 0 0; transition: height .3s; }
.ds-bar.seven { background: var(--red); }
.ds-exp { position: absolute; left: 0; right: 0; height: 2px; background: var(--gold); box-shadow: 0 0 0 1px rgba(0,0,0,.4); }
.ds-k { font: 600 12px var(--mono); }
.ds-legend { display: flex; gap: 14px; font-size: 11px; color: var(--mute); }
.ds-sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: #4d7cff; margin-right: 5px; vertical-align: -1px; }
.ds-sw.exp { height: 2px; background: var(--gold); vertical-align: 2px; }
/* 5-6 players on a phone: two rows of three compact cards; the turn shows inside the card */
@media (max-width: 760px), (max-height: 560px), (pointer: coarse) and (max-width: 1400px) {
  #game .players.many { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
  #game .players.many .pl-m { display: flex; flex-direction: column; }
  #game .players.many .pm-b { padding: 2px 3px; font-size: 9.5px; }
  #game .players.many .pm-b .pm-s:nth-child(n+3) { display: none; }
  #game .players.many .pm-turn { position: static; border-radius: 0 0 6px 6px; padding: 0 2px 1px; font-size: 9px; display: flex; justify-content: center; gap: 4px; box-shadow: none; }
  #game .players.many .pm-turn span, #game .players.many .pm-turn time { display: inline; font-size: 9px; }
  #game .players.many .pm-vp { width: 18px; height: 18px; font-size: 10px; }
  #game .players.many .pm-n { font-size: 10px; }
}

/* ---------- Phone turned sideways: board on the left, everything else in a column on the right ---------- */
@media (max-height: 560px) and (orientation: landscape), (pointer: coarse) and (orientation: landscape) and (max-width: 1400px) {
  #game .game-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(270px, 34vw); grid-template-rows: auto auto minmax(0, 1fr) auto; column-gap: 6px; row-gap: 4px; height: 100vh; height: 100dvh; padding: 4px max(4px, env(safe-area-inset-right)) 4px max(4px, env(safe-area-inset-left)); }
  #game .board-wrap { grid-column: 1; grid-row: 1 / 5; }
  #game .phone-top { grid-column: 2; grid-row: 1; }
  #game .players { grid-column: 2; grid-row: 2; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 0; }
  #game .players.many { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #game .players .pm-turn { position: static; border-radius: 0 0 6px 6px; padding: 0 2px 1px; display: flex; justify-content: center; gap: 4px; box-shadow: none; font-size: 9.5px; }
  #game .players .pm-turn span, #game .players .pm-turn time { display: inline; }
  #game .dock { grid-column: 2; grid-row: 4; padding: 5px; gap: 5px; }
  .bank-strip { padding: 2px 4px; }
  .bk { height: 30px; }
  #gearBtn { width: 34px; height: 34px; min-height: 34px; }
  #game .db { min-height: 40px; }
  #game .rc { width: 38px; height: 52px; }
  #game .rc svg { width: 18px; height: 18px; }
  .dev-btn { width: 50px; }
  .hb-l small { display: none; }
  .hb-trade { min-height: 28px; padding: 0 10px; font-size: 12px; }
  .phone-settings { left: auto; right: 8px; width: min(360px, 60vw); top: 8px; max-height: calc(100dvh - 16px); overflow-y: auto; }
  body.sheet-open #game .tabs-card { left: auto; right: 6px; width: min(380px, 60vw); height: calc(100dvh - 12px); }
  body.dev-open #game .dev-rack { left: auto; right: 6px; width: min(420px, 60vw); max-height: calc(100dvh - 12px); }
  .emote-panel { left: auto !important; right: 8px !important; width: min(340px, 60vw) !important; }
  .say-bubble { max-width: 180px; }
}
/* Tip shown once on big boards while the phone is upright */
.rotate-tip { position: fixed; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 96; display: flex; align-items: center; gap: 10px; padding: 9px 12px 9px 14px; background: var(--raise-2); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 12px 30px rgba(0,0,0,.6); font-size: 12.5px; width: max-content; max-width: calc(100vw - 24px); }
.rotate-tip button { min-height: 30px; padding: 0 10px; font-size: 12px; }
@media (orientation: landscape) { .rotate-tip { display: none; } }
/* Keep the board clear of the floating controls */
@media (max-width: 760px), (max-height: 560px), (pointer: coarse) and (max-width: 1400px) { #game #board { padding: 0 0 40px 0; box-sizing: border-box; } }
@media (max-height: 560px) and (orientation: landscape), (pointer: coarse) and (orientation: landscape) and (max-width: 1400px) {
  #game #board { padding: 0 48px 0 48px; }
  /* the space between players and cards shows the log and chat */
  #game .tabs-card { display: flex; flex-direction: column; grid-column: 2; grid-row: 3; min-height: 0; overflow: hidden; }
  #game .tabs-card .log, #game .tabs-card .chat:not(.hidden), #game .tabs-card .dice-pane:not(.hidden) { flex: 1; min-height: 0; overflow-y: auto; }
  #game .tabs-card .chat:not(.hidden) { display: flex; flex-direction: column; }
  #game .tabs-card .chat-log { flex: 1; min-height: 0; overflow-y: auto; }
  #game .tabs-card .tabs button { min-height: 28px; padding: 2px 8px; font-size: 11px; }
  #game .tabs-card .log > div { font-size: 11px; padding: 2px 6px; }
  .board-fabs .log-btn, #chatFab { display: none; }
}

/* ================= Simple mode (kid-friendly) ================= */
.simple-btn { flex: none; min-height: 34px; font-size: 12px; }
.simple-btn.on { border-color: var(--good); color: var(--good); }
@media (max-width: 760px), (max-height: 560px), (pointer: coarse) and (max-width: 1400px) { .simple-btn { display: none; } }

/* next step: big, friendly banner */
html.simple .status { font-size: 17px; font-weight: 600; padding: 10px 16px; border-radius: 14px; text-align: center; letter-spacing: .01em; }
html.simple .status.mine { background: linear-gradient(180deg, #c8243a, #8e1527); box-shadow: 0 0 0 2px rgba(255,255,255,.12), 0 8px 24px rgba(200,36,58,.35); }
@media (max-width: 760px), (max-height: 560px), (pointer: coarse) and (max-width: 1400px) { html.simple .status { font-size: 15px; padding: 7px 12px; } }

/* only the buttons you can use right now */
html.simple #actions .db:disabled { display: none; }
html.simple #actions .db { min-height: 56px; font-size: 14px; }
html.simple #actions .db .db-l { font-size: 13px; font-weight: 600; }
html.simple #actions .db .db-s { display: none; }
html.simple #act-end { background: #1f8f5f; border-color: #2fbf8f; color: #fff; }
html.simple #act-end.done-ready { animation: doneNudge 1.4s ease-in-out infinite; }
@keyframes doneNudge { 0%, 100% { box-shadow: 0 0 0 0 rgba(47,191,143,.0); } 50% { box-shadow: 0 0 0 6px rgba(47,191,143,.35); } }
html.simple #act-roll { display: none; } /* the giant Roll button replaces it */

/* giant roll button over the board */
.big-roll { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 11; display: flex; flex-direction: column; align-items: center; gap: 2px; width: 150px; height: 150px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ff5a6e, #c8243a 60%, #8e1527); border: 4px solid rgba(255,255,255,.85); color: #fff; font: 600 24px var(--ui); letter-spacing: .04em; box-shadow: 0 16px 40px rgba(0,0,0,.6), 0 0 0 0 rgba(255,90,110,.5); animation: rollPulse 1.6s ease-in-out infinite; justify-content: center; }
.big-roll span { font-size: 52px; line-height: 1; }
.big-roll.hidden { display: none; }
@keyframes rollPulse { 0%, 100% { box-shadow: 0 16px 40px rgba(0,0,0,.6), 0 0 0 0 rgba(255,90,110,.45); } 50% { box-shadow: 0 16px 40px rgba(0,0,0,.6), 0 0 0 18px rgba(255,90,110,0); } }
@media (prefers-reduced-motion: reduce) { .big-roll, html.simple #act-end.done-ready { animation: none; } }
@media (max-width: 760px), (max-height: 560px), (pointer: coarse) and (max-width: 1400px) { .big-roll { width: 120px; height: 120px; font-size: 20px; } .big-roll span { font-size: 42px; } }

/* clean screen: advanced bits move to Settings */
html.simple .zoom-ctl, html.simple .board-wrap > #feed, html.simple .tabs button[data-tab="dice"] { display: none !important; }
html.simple .hb-l small { display: none; }

/* easy bank swaps */
.easy-swaps { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; }
.swap { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 4px 8px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line-2); }
.swap:hover { border-color: var(--good); }
.sw-g { display: inline-flex; align-items: center; gap: 3px; padding: 3px 6px; border-radius: 6px; background: var(--c); color: #fff; font: 600 12px var(--mono); text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.sw-arrow { color: var(--mute); font-weight: 600; }

/* cheer */
.cheer { position: fixed; left: 50%; top: 38%; transform: translate(-50%, -50%); z-index: 97; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 22px; border-radius: 18px; background: rgba(17,19,25,.92); border: 2px solid var(--good); color: #fff; font: 600 18px var(--ui); pointer-events: none; box-shadow: 0 18px 50px rgba(0,0,0,.6); animation: cheerPop 1.8s ease-out forwards; }
.ch-i { font-size: 46px; line-height: 1; }
@keyframes cheerPop { 0% { opacity: 0; transform: translate(-50%, -40%) scale(.6); } 12% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); } 20% { transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -60%) scale(.96); } }
@media (prefers-reduced-motion: reduce) { .cheer { animation: none; } }
.hint-hand text { animation: hintBob .9s ease-in-out infinite alternate; }
@keyframes hintBob { from { transform: translateY(-.06px); } to { transform: translateY(.1px); } }
@media (prefers-reduced-motion: reduce) { .hint-hand text { animation: none; } }
.board-wrap > .big-roll { z-index: 13; }
#game #board { z-index: 0; }
button.big-roll:active:not(:disabled), button.big-roll:hover { transform: translate(-50%, calc(-50% + 1px)); }
.cheer, .rotate-tip { }
.rotate-tip { bottom: auto; top: 56px; }
html.simple .dr-hint { display: none; }
html.simple .dr-hint.bank-tip { display: block; color: var(--gold); }
.invite-btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.invite-btns button { min-height: 36px; padding: 0 12px; }
.invite-btns .wa { background: #1fa855; border-color: #1fa855; color: #fff; font-weight: 600; }
/* End-of-game summary */
.over-head { text-align: center; margin-bottom: 8px; }
.over-trophy { font-size: 52px; line-height: 1; animation: trophy 1s ease-out; }
@keyframes trophy { 0% { transform: scale(.3) rotate(-20deg); opacity: 0; } 60% { transform: scale(1.15) rotate(6deg); opacity: 1; } 100% { transform: none; } }
.over-head h3 { margin: 6px 0 0; font-size: 24px; }
.podium { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.podium li { display: grid; grid-template-columns: 30px 12px minmax(0, 1fr) auto; grid-template-rows: auto auto; align-items: center; column-gap: 8px; padding: 8px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.podium li:first-child { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.podium b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pd-m { font-size: 20px; grid-row: 1 / 3; text-align: center; }
.podium .dot { grid-row: 1 / 3; }
.pd-vp { font: 600 15px var(--mono); }
.podium small { grid-column: 3 / 5; color: var(--mute); font-size: 11px; }
.podium small:empty { display: none; }
.awards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; margin-bottom: 12px; }
.aw { display: grid; grid-template-columns: 30px minmax(0, 1fr); grid-template-rows: auto auto auto; column-gap: 6px; padding: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.aw-i { grid-row: 1 / 4; font-size: 22px; align-self: center; text-align: center; }
.aw-t { font: 600 10px var(--mono); text-transform: uppercase; letter-spacing: .05em; color: var(--mute); }
.aw b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.aw small { color: var(--mute); font-size: 11px; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 120; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 8px; height: 13px; border-radius: 2px; animation-name: confettiFall; animation-timing-function: cubic-bezier(.25,.6,.5,1); animation-fill-mode: forwards; }
@keyframes confettiFall { to { top: 105%; transform: translateX(40px) rotate(720deg); opacity: .9; } }
/* New pieces: houses drop in with a bounce, roads and ships fade in */
.new-piece { animation: pieceDrop .55s cubic-bezier(.3,1.6,.5,1) both; transform-box: view-box; }
@keyframes pieceDrop { 0% { transform: translateY(-1.1px) scale(.4); opacity: 0; } 60% { opacity: 1; } 100% { transform: none; opacity: 1; } }
.new-road { animation: roadIn .45s ease-out both; }
@keyframes roadIn { 0% { opacity: 0; filter: brightness(2.2); } 100% { opacity: 1; filter: none; } }
@media (prefers-reduced-motion: reduce) { .new-piece, .new-road { animation: none; } }
/* Tip button and ring */
.hint-btn { flex: none; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-width: 52px; min-height: 46px; padding: 2px 6px; border-radius: 10px; background: #3a3215; border: 1px solid var(--gold); color: var(--gold); font-size: 18px; line-height: 1; }
.hint-btn span { font: 600 10px var(--ui); }
.hint-btn:disabled { display: none; }
.hint-ring circle { fill: none; stroke: var(--gold); stroke-width: .07; transform-box: fill-box; transform-origin: center; animation: hintRing 1.3s ease-out infinite; }
.hint-ring circle + circle { animation-delay: .65s; }
@keyframes hintRing { 0% { transform: scale(.5); opacity: 1; } 100% { transform: scale(1.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .hint-ring circle { animation: none; } }
/* How to play */
.howto { position: fixed; inset: 0; z-index: 110; display: grid; place-items: center; background: rgba(5,7,12,.72); padding: 16px; }
.howto.hidden { display: none; }
.ht-card { width: min(380px, 100%); background: var(--raise-2); border: 1px solid var(--line-2); border-radius: 18px; padding: 22px 20px 16px; text-align: center; box-shadow: 0 24px 60px rgba(0,0,0,.7); }
.ht-icon { font-size: 64px; line-height: 1; margin-bottom: 8px; animation: trophy .5s ease-out; }
.ht-card h3 { margin: 0 0 8px; font-size: 22px; }
.ht-card p { margin: 0 0 14px; font-size: 15px; line-height: 1.5; color: var(--fg); }
.ht-dots { display: flex; justify-content: center; gap: 6px; margin-bottom: 14px; }
.ht-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); }
.ht-dots i.on { background: var(--red); width: 20px; border-radius: 4px; }
.ht-btns { display: flex; gap: 8px; }
.ht-btns button { flex: 1; min-height: 46px; font-size: 15px; }
#btnHowTo { width: 100%; margin-top: 8px; }
/* ---------- Map maker ---------- */
.mm { position: fixed; inset: 0; z-index: 105; display: flex; flex-direction: column; gap: 8px; padding: 10px max(10px, env(safe-area-inset-right)) 10px max(10px, env(safe-area-inset-left)); background: var(--bg, #0b0d12); overflow-y: auto; }
.mm.hidden { display: none; }
.mm-top { display: flex; align-items: center; gap: 8px; }
.mm-title { font-size: 17px; white-space: nowrap; }
.mm-top input { flex: 1; min-width: 0; min-height: 38px; }
.mm-tools { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.mm-tool { min-height: 40px; padding: 0 14px; font-weight: 600; }
.mm-tool.on { background: var(--raise-2); border-color: var(--good); box-shadow: 0 0 0 1px var(--good); }
.mm-tools select { min-height: 40px; flex: 1; min-width: 120px; }
.mm-grid-wrap { flex: 0 0 auto; background: radial-gradient(ellipse at center, #142036, #0b1220 75%); border: 1px solid var(--line); border-radius: 12px; padding: 6px; }
#mmGrid { display: block; width: 100%; max-height: 52vh; touch-action: none; user-select: none; -webkit-user-select: none; }
#mmGrid polygon { cursor: pointer; transition: fill .12s; }
.mm-info { text-align: center; font: 600 13px var(--mono); color: var(--good); }
.mm-info.bad { color: var(--gold); }
.mm-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.mm-actions button { min-height: 44px; }
.mm-actions button.hidden { display: none; }
.mm-actions:has(#mmUse.hidden) { grid-template-columns: 1fr 1fr; }
.mm-load { display: flex; gap: 6px; }
.mm-load input { flex: 1; min-width: 0; min-height: 40px; font-family: var(--mono); }
.mm-list { display: flex; flex-direction: column; gap: 6px; padding-bottom: 10px; }
.mm-item { display: flex; align-items: center; gap: 10px; padding: 6px 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.mm-item b { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mm-thumb { width: 54px; height: 40px; flex: none; }
.mm-thumb svg { width: 100%; height: 100%; }
#btnMapMaker { width: 100%; margin-top: 6px; }
#lobbyMapMaker { margin: 6px 0; }
@media (min-width: 900px) { .mm { left: 50%; transform: translateX(-50%); width: 720px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); } }

/* ---------- Coloured action buttons ---------- */
/* Roll: white, like a real die */
#act-roll:not(:disabled) { background: linear-gradient(180deg, #ffffff, #dfe3ea); border-color: #ffffff; color: #12151c; box-shadow: 0 3px 0 #9aa1ae, 0 6px 16px rgba(255,255,255,.12); }
#act-roll:not(:disabled) .db-l { color: #12151c; font-weight: 600; }
#act-roll:not(:disabled):active { box-shadow: 0 1px 0 #9aa1ae; }
/* Build: builder's orange */
#act-build:not(:disabled) { background: linear-gradient(180deg, #f39a2b, #c96a10); border-color: #ffb45c; color: #fff; box-shadow: 0 3px 0 #7a3d05; }
#act-build:not(:disabled) .db-ic { color: #ffe9cc; }
#act-build:not(:disabled) .db-l, #act-build:not(:disabled) .db-s { color: #fff; }
#act-build.on { background: linear-gradient(180deg, #ffb45c, #e07b14); box-shadow: 0 0 0 2px #ffd9a8, 0 3px 0 #7a3d05; }
/* Dev card: purple with a star card */
#act-dev:not(:disabled) { background: linear-gradient(180deg, #7d5cf0, #4b2fb3); border-color: #a98bff; color: #fff; box-shadow: 0 3px 0 #2a1870; }
#act-dev:not(:disabled) .db-l, #act-dev:not(:disabled) .db-s, #act-dev:not(:disabled) .db-s em { color: #f1ecff; }
#act-dev:disabled .db-ic svg rect:first-child { fill: #3a3550; }
/* End turn / Done: green with a moving "next" arrow */
#act-end:not(:disabled) { background: linear-gradient(180deg, #2fbf8f, #178a63); border-color: #6ee0b8; color: #fff; box-shadow: 0 3px 0 #0b5a3f; }
#act-end:not(:disabled) .db-l { color: #fff; font-weight: 600; }
#act-end:not(:disabled) .end-ring { animation: endSpin 3s linear infinite; transform-origin: center; transform-box: fill-box; }
#act-end:not(:disabled) .end-arrow { animation: endNudge 1.2s ease-in-out infinite; }
@keyframes endSpin { to { transform: rotate(360deg); } }
@keyframes endNudge { 0%, 100% { transform: translateX(-1.5px); } 50% { transform: translateX(2px); } }
#act-end.done-ready .end-arrow { animation-duration: .7s; }
/* disabled buttons stay calm and grey */
#act-roll:disabled, #act-build:disabled, #act-dev:disabled, #act-end:disabled { background: var(--raise); border-color: var(--line-2); box-shadow: none; }
@media (prefers-reduced-motion: reduce) { #act-end .end-ring, #act-end .end-arrow { animation: none !important; } }
/* the giant Simple-mode roll button is a white die too */
.big-roll { background: radial-gradient(circle at 35% 30%, #ffffff, #e9ecf2 60%, #c3c9d4); border-color: #ffffff; color: #12151c; animation-name: rollPulseW; }
.big-roll span { filter: drop-shadow(0 2px 2px rgba(0,0,0,.25)); }
@keyframes rollPulseW { 0%, 100% { box-shadow: 0 16px 40px rgba(0,0,0,.6), 0 0 0 0 rgba(255,255,255,.45); } 50% { box-shadow: 0 16px 40px rgba(0,0,0,.6), 0 0 0 18px rgba(255,255,255,0); } }

/* Secret VP cards: shown only to their owner, next to the public score everyone sees */
.vp-hid { font-size: .62em; font-weight: 600; color: #f5c542; margin-left: 2px; vertical-align: super; letter-spacing: 0; }

/* Spicy chat pack (18+, host opt-in) */
.emote-panel .quick-h { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; opacity: .7; margin: 8px 2px 4px; }
.emote-panel .quick-list.spicy .qk { border-color: rgba(229,72,77,.55); background: rgba(229,72,77,.14); }

/* Tablets (iPad, Galaxy Tab, open foldables): the phone layout, scaled up so it fills the bigger screen */
@media (pointer: coarse) and (min-width: 600px) and (min-height: 600px) and (max-width: 1400px) {
  #game .rc { width: auto; flex: 1 1 0; min-width: 0; max-width: 64px; height: 86px; gap: 4px; border-radius: 8px; }
  #game .rc svg { width: 28px; height: 28px; }
  #game .rc .n { font-size: 18px; }
  #game .dev-btn { width: 70px; flex: none; font-size: 12px; }
  #game .hand { gap: 8px; flex: 1 1 auto; min-width: 0; }
  #game .db { min-height: 52px; font-size: 16px; }
  #game .db svg { width: 22px; height: 22px; }
  #game .icon-btn { width: 46px; height: 46px; min-height: 46px; }
  #game .hb-trade { min-height: 38px; padding: 0 16px; font-size: 15px; }
  .hb-l { font-size: 13px; }
  .bk { height: 40px; }
  #gearBtn { width: 44px; height: 44px; min-height: 44px; }
  .devc { width: 76px; height: 82px; }
}

/* Short phones held sideways: no room for the log/chat panel in the column, so it opens as a sheet from the round buttons instead */
@media (max-height: 430px) and (orientation: landscape) {
  #game .tabs-card { display: none; }
  body.sheet-open #game .tabs-card { display: flex; flex-direction: column; position: fixed; top: 6px; bottom: 6px; left: auto; right: 6px; width: min(380px, 60vw); height: auto; z-index: 85; }
  #game .board-fabs .log-btn, #game #chatFab { display: grid; }
  #game .board-fabs { flex-direction: column; top: 6px; bottom: auto; }
}

/* iPhone / iPad / Android touch polish */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
button, a, .rc, .devc, [data-hand], [data-say], #board { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
#board { touch-action: none; }
#game { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#game input, #game textarea { -webkit-user-select: text; user-select: text; }
/* Text boxes at 16px or more, so iPhone Safari doesn't zoom the page in when you type */
@media (pointer: coarse) { input:not([type=checkbox]):not([type=range]), select, textarea { font-size: 16px; } .code-input { letter-spacing: .2em; } }
/* Notch, Dynamic Island and the home bar (when opened from the home screen, or a phone with a notch) */
.screen:not(#game) { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
@media (max-width: 760px), (max-height: 560px), (pointer: coarse) and (max-width: 1400px) {
  #game .game-grid { padding-top: max(4px, env(safe-area-inset-top)); padding-bottom: max(4px, env(safe-area-inset-bottom)); padding-left: max(4px, env(safe-area-inset-left)); padding-right: max(4px, env(safe-area-inset-right)); }
}

/* 5-6 players: the player building in the special building phase */
.pl.sb { outline: 2px dashed #f39a2b; outline-offset: -2px; }
.pm-turn.pm-sb { background: #f39a2b; color: #2a1606; }

/* ---------- Animated reactions (Golf Clash style) ---------- */
.rx-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.rx-btn { padding: 2px; min-height: 0; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); border-radius: 10px; display: grid; place-items: center; }
.rx-btn:hover { background: rgba(255,255,255,.1); }
.rx-btn svg { width: 44px; height: auto; pointer-events: none; }
.rx-pop-wrap { position: fixed; z-index: 120; transform: translate(-50%, 0); pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: 2px; animation: rxIn 2.9s cubic-bezier(.2,1.4,.4,1) forwards; }
.rx-pop-wrap .rx { filter: drop-shadow(0 6px 10px rgba(0,0,0,.45)); overflow: visible; }
.rx-cap { font: 600 15px var(--ui); letter-spacing: .02em; color: #fff; background: rgba(12,14,20,.86); border: 2px solid var(--c); border-radius: 999px; padding: 3px 12px; white-space: nowrap; text-shadow: 0 1px 0 #000; }
.rx-cap b { color: var(--c); margin-right: 6px; font-weight: 600; }
@keyframes rxIn { 0% { transform: translate(-50%, 30px) scale(.2); opacity: 0; } 12% { transform: translate(-50%, 0) scale(1.12); opacity: 1; } 20% { transform: translate(-50%, 0) scale(1); } 86% { transform: translate(-50%, 0) scale(1); opacity: 1; } 100% { transform: translate(-50%, -24px) scale(.85); opacity: 0; } }
.rx-pop-wrap .rx-body { transform-origin: 0 40px; transform-box: view-box; }
/* per character */
.rx-pop-wrap .rx-lol .rx-body { animation: rxShake .16s ease-in-out infinite alternate; }
.rx-pop-wrap .rx-tear { animation: rxTearL .5s ease-out infinite; transform-box: view-box; }
.rx-pop-wrap .rx-tear.r { animation-name: rxTearR; }
.rx-pop-wrap .rx-cry .rx-body { animation: rxSob .45s ease-in-out infinite; }
.rx-pop-wrap .rx-stream { animation: rxStream .6s linear infinite; transform-box: fill-box; transform-origin: top; }
.rx-pop-wrap .rx-rage .rx-body { animation: rxShake .06s linear infinite alternate; }
.rx-pop-wrap .rx-steam { animation: rxSteam .7s ease-out infinite; transform-box: view-box; }
.rx-pop-wrap .rx-steam.r { animation-delay: .35s; }
.rx-pop-wrap .rx-shades { animation: rxShades .9s cubic-bezier(.3,1.4,.5,1) both; transform-box: view-box; }
.rx-pop-wrap .rx-spark { animation: rxSpark .8s ease-in-out .8s infinite; transform-box: fill-box; transform-origin: center; opacity: 0; }
.rx-pop-wrap .rx-shock .rx-body { animation: rxJump .5s ease-out 2; }
.rx-pop-wrap .rx-pop { animation: rxEyes .5s ease-out both; transform-box: view-box; transform-origin: 0 -10px; }
.rx-pop-wrap .rx-jaw { animation: rxJaw .6s ease-out both; transform-box: fill-box; transform-origin: top; }
.rx-pop-wrap .rx-evil .rx-body { animation: rxEvil .34s ease-in-out infinite alternate; }
.rx-pop-wrap .rx-hand { animation: rxSlap .5s cubic-bezier(.5,0,.5,1.6) both; transform-box: view-box; }
.rx-pop-wrap .rx-party .rx-body { animation: rxDance .4s ease-in-out infinite alternate; }
.rx-pop-wrap .rx-conf { animation: rxConf 1.1s ease-in calc(var(--i) * .08s) infinite; transform-box: fill-box; }
.rx-pop-wrap .rx-sleep .rx-body { animation: rxNod 1.1s ease-in-out infinite; }
.rx-pop-wrap .rx-z { animation: rxZ 1.4s ease-out infinite; transform-box: fill-box; }
.rx-pop-wrap .rx-z.b { animation-delay: .5s; }
.rx-pop-wrap .rx-heart { animation: rxBeat .35s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
.rx-pop-wrap .rx-fly { animation: rxFly 1.2s ease-out calc(var(--i) * .3s) infinite; transform-box: fill-box; }
.rx-pop-wrap .rx-clapl { animation: rxClapL .16s ease-in-out infinite alternate; transform-box: view-box; }
.rx-pop-wrap .rx-clapr { animation: rxClapR .16s ease-in-out infinite alternate; transform-box: view-box; }
.rx-pop-wrap .rx-fart .rx-body { animation: rxWobble .25s ease-in-out infinite alternate; }
.rx-pop-wrap .rx-gas { animation: rxGas 1.1s ease-out calc(var(--i) * .2s) infinite; transform-box: fill-box; transform-origin: center; }
@keyframes rxShake { from { transform: rotate(-9deg) translateY(-2px); } to { transform: rotate(9deg) translateY(2px); } }
@keyframes rxTearL { from { transform: translate(0, 0); opacity: 1; } to { transform: translate(-14px, 10px); opacity: 0; } }
@keyframes rxTearR { from { transform: translate(0, 0); opacity: 1; } to { transform: translate(14px, 10px); opacity: 0; } }
@keyframes rxSob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(4px) scaleY(.96); } }
@keyframes rxStream { from { transform: scaleY(.3); opacity: 1; } to { transform: scaleY(1.2); opacity: .5; } }
@keyframes rxSteam { from { transform: translateY(6px) scale(.6); opacity: 0; } 30% { opacity: 1; } to { transform: translateY(-14px) scale(1.3); opacity: 0; } }
@keyframes rxShades { from { transform: translateY(-60px); } to { transform: translateY(0); } }
@keyframes rxSpark { 0%, 100% { transform: scale(0); opacity: 0; } 50% { transform: scale(1.2) rotate(45deg); opacity: 1; } }
@keyframes rxJump { 0% { transform: translateY(0); } 40% { transform: translateY(-14px) scaleY(1.06); } 100% { transform: translateY(0); } }
@keyframes rxEyes { from { transform: scale(.4); } 60% { transform: scale(1.35); } to { transform: scale(1.15); } }
@keyframes rxJaw { from { transform: scaleY(.2); } to { transform: scaleY(1.25); } }
@keyframes rxEvil { from { transform: rotate(-5deg) scale(1); } to { transform: rotate(5deg) scale(1.05); } }
@keyframes rxSlap { from { transform: translateY(-50px) rotate(-20deg); } 70% { transform: translateY(4px); } to { transform: translateY(0); } }
@keyframes rxDance { from { transform: rotate(-12deg) translateX(-4px); } to { transform: rotate(12deg) translateX(4px); } }
@keyframes rxConf { from { transform: translateY(0) rotate(0); opacity: 1; } to { transform: translateY(110px) rotate(320deg); opacity: 0; } }
@keyframes rxNod { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(10deg) translateY(3px); } }
@keyframes rxZ { from { transform: translate(0, 6px); opacity: 0; } 30% { opacity: 1; } to { transform: translate(10px, -16px); opacity: 0; } }
@keyframes rxBeat { from { transform: scale(.9); } to { transform: scale(1.25); } }
@keyframes rxFly { from { transform: translate(0, 0) scale(.5); opacity: 0; } 20% { opacity: 1; } to { transform: translate(14px, -40px) scale(1.1); opacity: 0; } }
@keyframes rxClapL { from { transform: translateX(-6px) rotate(-8deg); } to { transform: translateX(8px) rotate(6deg); } }
@keyframes rxClapR { from { transform: translateX(6px) rotate(8deg); } to { transform: translateX(-8px) rotate(-6deg); } }
@keyframes rxWobble { from { transform: scaleX(1.04) scaleY(.96); } to { transform: scaleX(.96) scaleY(1.04); } }
@keyframes rxGas { from { transform: scale(.3) translateY(0); opacity: .9; } to { transform: scale(1.6) translateY(10px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .rx-pop-wrap, .rx-pop-wrap * { animation-duration: .01s !important; animation-iteration-count: 1 !important; } .rx-pop-wrap { animation: none; transform: translate(-50%, 0); } }

/* Undo a misplaced piece */
.undo-chip { position: absolute; z-index: 7; top: 10px; left: 50%; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 14px; border-radius: 999px; background: rgba(20,23,31,.92); color: #fff; border: 1px solid rgba(255,255,255,.25); font-weight: 600; box-shadow: 0 6px 18px rgba(0,0,0,.45); animation: undoIn .25s ease-out; }
.undo-chip.hidden { display: none; }
.undo-chip:hover { background: rgba(40,45,58,.95); }
@keyframes undoIn { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }
@media (pointer: coarse) { .undo-chip { min-height: 42px; padding: 8px 18px; font-size: 15px; } }

/* Host tools, pause, watching */
.host-btn { font-size: 18px; }
.host-btn.hidden { display: none !important; }
.ht-list { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-direction: column; gap: 6px; }
.ht-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; }
.ht-n { font-weight: 600; flex: 1; }
.ht-s { font-size: 11px; color: var(--mute); text-transform: uppercase; letter-spacing: .06em; }
button.danger { border-color: #e5484d; color: #ff8a8d; }
.paused-ov { position: absolute; inset: 0; z-index: 30; display: grid; place-items: center; background: rgba(8,10,14,.62); backdrop-filter: blur(2px); border-radius: inherit; }
.paused-ov.hidden { display: none; }
.po-box { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 22px 28px; background: rgba(20,23,31,.95); border: 1px solid var(--line-2); border-radius: 14px; text-align: center; }
.po-ic { font-size: 44px; line-height: 1; }
.watch-badge { position: absolute; z-index: 8; top: 10px; right: 10px; display: inline-flex; align-items: center; gap: 8px; padding: 4px 6px 4px 12px; border-radius: 999px; background: rgba(20,23,31,.92); border: 1px solid var(--line-2); font-weight: 600; }
.watch-badge.hidden { display: none; }
body.spectating #game .dock, body.spectating .emote, body.spectating #emoteBtn, body.spectating .board-fabs .emote, body.spectating #act-hint, body.spectating .big-roll, body.spectating .undo-chip { display: none !important; }
body.spectating #game .game-grid { grid-template-rows: auto auto minmax(0, 1fr); }
.quick-row { font-weight: 600; color: #ffd65a; }

/* ---------- Home: living island ---------- */
#home.home2 { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, 440px); gap: 0; padding: 0; place-items: stretch; min-height: 100vh; min-height: 100dvh; background: radial-gradient(ellipse 70% 60% at 35% 50%, #10203a 0%, #0b0d12 70%); }
.h2-island { position: relative; display: grid; place-items: center; min-height: 0; overflow: hidden; }
.h2-svg { width: min(100%, 760px); height: auto; max-height: 92vh; cursor: pointer; filter: drop-shadow(0 18px 30px rgba(0,0,0,.5)); }
.h2-hint { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); padding: 6px 14px; border-radius: 999px; background: rgba(12,14,20,.8); border: 1px solid var(--line-2); color: #e8ebf1; font-weight: 600; white-space: nowrap; }
.h2-hint b { color: #ffd65a; }
.h2-panel { display: flex; flex-direction: column; gap: 12px; padding: max(22px, env(safe-area-inset-top)) 22px max(22px, env(safe-area-inset-bottom)); background: rgba(13,15,21,.88); border-left: 1px solid var(--line); justify-content: center; }
.h2-top { display: flex; justify-content: space-between; align-items: center; }
.h2-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 4px 12px 4px 6px; border-radius: 999px; background: #1a1d25; border: 1px solid var(--line-2); font-weight: 600; }
.h2-dot { width: 24px; height: 24px; border-radius: 50%; border: 2px solid rgba(255,255,255,.7); }
.h2-wins { color: #ffd65a; font-size: 12px; }
.h2-logo { margin: 4px 0 0; }
.h2-tag { margin: 0; }
.h2-main { font-size: 17px; min-height: 56px; }
.h2-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.h2-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px; min-height: 84px; border-radius: 12px; text-align: left; background: #1a1d25; border: 1px solid var(--line-2); }
.h2-tile b { font-size: 14px; }
.h2-tile small { color: var(--mute); font-weight: 600; font-size: 11px; }
.h2-ic { font-size: 22px; line-height: 1; margin-bottom: 4px; }
.h2-tile.t-bots { background: linear-gradient(160deg, #2a2160, #1a1d25); border-color: #6b5bd0; }
.h2-tile.t-join { background: linear-gradient(160deg, #16382c, #1a1d25); border-color: #2f8f6b; }
.h2-tile.t-map { background: linear-gradient(160deg, #3a2a10, #1a1d25); border-color: #a8832f; }
.h2-tile.t-how { background: linear-gradient(160deg, #1d2a40, #1a1d25); border-color: #3d6bb5; }
.h2-tile:hover { filter: brightness(1.15); }
.h2-join.hidden, .h2-rejoin.hidden { display: none; }
.h2-rejoin { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 8px 8px 12px; border-radius: 10px; background: #14261c; border: 1px solid #2f6b45; color: #9be0b4; font-weight: 600; }
.h2-rejoin b { font-family: var(--mono); letter-spacing: .1em; color: #fff; }
/* island pieces */
.hi-tile polygon { transition: filter .2s; }
.hi-tile:hover polygon { filter: brightness(1.15); }
.hi-tile.hit polygon { animation: hiHit .5s ease-in-out 2; }
@keyframes hiHit { 50% { filter: brightness(1.7) saturate(1.3); } }
.hi-house.pop { animation: hiPop .45s cubic-bezier(.2,1.6,.4,1); transform-box: fill-box; transform-origin: center bottom; }
@keyframes hiPop { from { transform: scale(.1) translateY(-20px); } }
.hi-road { animation: hiRoad .5s ease-out; }
@keyframes hiRoad { from { opacity: 0; } }
.hi-robber { transition: transform .5s cubic-bezier(.3,1.3,.5,1); }
.hi-gain { animation: hiGain 1.2s ease-out forwards; transform-box: fill-box; }
@keyframes hiGain { from { opacity: 0; translate: 0 6px; } 20% { opacity: 1; translate: 0 0; } to { opacity: 0; translate: 0 -26px; } }
/* phones: island on top, buttons below */
@media (max-width: 760px), (max-height: 560px) and (orientation: portrait) {
  #home.home2 { grid-template-columns: 1fr; grid-template-rows: minmax(0, 40vh) auto; overflow-y: auto; }
  .h2-island { min-height: 34vh; padding-top: env(safe-area-inset-top); }
  .h2-svg { max-height: 40vh; width: 100%; }
  .h2-hint { bottom: 6px; font-size: 13px; }
  .h2-panel { border-left: 0; border-top: 1px solid var(--line); border-radius: 18px 18px 0 0; padding: 16px 16px max(16px, env(safe-area-inset-bottom)); gap: 10px; justify-content: flex-start; }
  .h2-logo { font-size: 34px; }
  .h2-tag { display: none; }
}
@media (max-height: 560px) and (orientation: landscape) { #home.home2 { grid-template-columns: 1fr minmax(300px, 46vw); } .h2-panel { overflow-y: auto; justify-content: flex-start; } .h2-logo { font-size: 28px; } .h2-tile { min-height: 64px; padding: 8px; } }
@media (prefers-reduced-motion: reduce) { .hi-house.pop, .hi-road, .hi-gain, .hi-tile.hit polygon { animation: none; } }
@media (max-width: 760px) {
  #home.home2 { grid-template-rows: minmax(0, 36vh) auto; }
  .h2-svg { max-height: 36vh; }
  .h2-island { min-height: 30vh; }
  .h2-name { font-size: 0; gap: 0; }
  .h2-name input { font-size: 16px; }
  .h2-logo { font-size: 30px; }
  .h2-tile { min-height: 66px; padding: 9px 10px; }
  .h2-ic { font-size: 18px; margin-bottom: 2px; }
  .h2-main { min-height: 50px; }
}
@media (max-height: 560px) and (orientation: landscape) { #home.home2 { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; } .h2-panel { max-height: 100dvh; } }

/* Profile */
.pf-cols { display: flex; gap: 10px; margin: 6px 0 4px; }
.pf-col { width: 36px; height: 36px; min-height: 0; padding: 0; border-radius: 50%; background: var(--c) !important; border: 3px solid transparent; box-shadow: 0 0 0 1px rgba(255,255,255,.25); }
.pf-col.on { border-color: #fff; box-shadow: 0 0 0 2px var(--c); }
.pf-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 8px 0; }
.pf-stats div { display: flex; flex-direction: column; align-items: center; padding: 10px 4px; border-radius: 10px; background: #1a1d25; border: 1px solid var(--line); }
.pf-stats b { font-size: 22px; } .pf-stats small { color: var(--mute); font-size: 11px; }
.pf-games { list-style: none; padding: 0; margin: 0 0 8px; display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
.pf-games li { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 4px; border-radius: 10px; background: #1a1d25; border: 1px solid var(--line); text-align: center; }
.pf-games li span { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--mute); white-space: nowrap; }
.pf-games li b { font-size: 20px; } .pf-games li small { color: var(--mute); font-size: 11px; }
.pf-rivals { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-direction: column; gap: 6px; }
.pf-rivals li { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 6px 10px; border-radius: 8px; background: #1a1d25; }
.pf-score b.w { color: #2fbf8f; } .pf-score b.l { color: #ff6b6e; }
.pf-rivals small { color: var(--mute); }
.pf-code summary { cursor: pointer; font-weight: 600; margin: 6px 0; }
.pf-code code { flex: 1; font-family: var(--mono); font-size: 12px; word-break: break-all; background: #0b0d12; padding: 8px; border-radius: 6px; }

/* Daily challenge */
.h2-daily { display: flex; align-items: center; gap: 12px; padding: 10px 12px; min-height: 60px; border-radius: 12px; text-align: left; background: linear-gradient(120deg, #4a3208, #2a1d0a 60%, #1a1d25); border: 1px solid #d9a22b; }
.h2-daily .h2-ic { margin: 0; font-size: 26px; }
.hd-t { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.hd-t b { font-size: 15px; color: #ffd65a; }
.hd-t small { color: #e8d3a0; font-weight: 600; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hd-go { padding: 6px 12px; border-radius: 999px; background: #ffd65a; color: #2a1d0a; font-weight: 600; }
.dl-list { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-direction: column; gap: 6px; }
.dl-list li { display: grid; grid-template-columns: 34px 1fr auto auto; gap: 8px; align-items: center; padding: 7px 10px; border-radius: 8px; background: #1a1d25; }
.dl-list li.you { outline: 2px solid #ffd65a; }
.dl-list small { color: var(--mute); }
.dl-s { font-weight: 600; color: #ffd65a; font-family: var(--mono); }
.daily-score { text-align: center; font-weight: 600; } .daily-score b { color: #ffd65a; font-size: 18px; }
.dl-list li.muted { display: block; text-align: center; }

/* Board toolbar (top-right): host tools, voice */
.board-tools { position: absolute; z-index: 8; top: 10px; right: 10px; display: flex; flex-direction: column; gap: 6px; }
.board-tools .icon-btn { position: relative; width: 42px; height: 42px; min-height: 42px; padding: 0; display: grid; place-items: center; border-radius: 10px; background: rgba(20,23,31,.92); border: 1px solid var(--line-2); font-size: 18px; }
.board-tools .hidden { display: none !important; }
.voice-btn.on { background: #178a63 !important; border-color: #2fbf8f !important; box-shadow: 0 0 0 3px rgba(47,191,143,.25); }
.voice-btn.muted { background: #5a1c1e !important; border-color: #e5484d !important; }
.voice-btn .badge { position: absolute; top: -5px; right: -5px; }
.voice-leave { font-size: 14px !important; color: #ff8a8d; }
body.spectating .board-tools { display: none; }
.pl.in-voice .pm-n::after, .pl.in-voice .nm::after { content: ' 🎙'; font-size: .85em; }
.pl.speaking .pl-m, .pl.speaking { box-shadow: 0 0 0 3px #2fbf8f, 0 0 16px rgba(47,191,143,.7) !important; }

/* 3D dice */
.dice3d { gap: 26px; perspective: 600px; }
.cube-wrap { width: 60px; height: 60px; perspective: 500px; filter: drop-shadow(0 14px 14px rgba(0,0,0,.55)); }
.cube { position: relative; width: 60px; height: 60px; transform-style: preserve-3d; }
.cf { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); padding: 9px; gap: 2px; border-radius: 11px; background: radial-gradient(circle at 30% 25%, #fff, #e4e7ee 70%, #c9ced9); border: 1px solid rgba(0,0,0,.12); backface-visibility: hidden; box-shadow: inset 0 0 8px rgba(0,0,0,.12); }
.cf i { display: block; border-radius: 50%; margin: 2px; }
.cf i.p { background: radial-gradient(circle at 35% 35%, #444b5c, #10131a); }
.cf.f1 i.p { background: radial-gradient(circle at 35% 35%, #ff6b74, #b5162a); }
.f1 { transform: translateZ(30px); } .f6 { transform: rotateY(180deg) translateZ(30px); }
.f3 { transform: rotateY(90deg) translateZ(30px); } .f4 { transform: rotateY(-90deg) translateZ(30px); }
.f2 { transform: rotateX(90deg) translateZ(30px); } .f5 { transform: rotateX(-90deg) translateZ(30px); }
.dice3d.seven .cf { background: radial-gradient(circle at 30% 25%, #ff8a92, #e3263a 70%, #a3122a); }
.dice3d.seven .cf i.p { background: #fff; }
@media (max-width: 760px) { .cube-wrap, .cube { width: 48px; height: 48px; } .f1 { transform: translateZ(24px); } .f6 { transform: rotateY(180deg) translateZ(24px); } .f3 { transform: rotateY(90deg) translateZ(24px); } .f4 { transform: rotateY(-90deg) translateZ(24px); } .f2 { transform: rotateX(90deg) translateZ(24px); } .f5 { transform: rotateX(-90deg) translateZ(24px); } .cf { padding: 7px; } }

/* Night */
html.night .board-wrap { background: radial-gradient(ellipse 80% 70% at 50% 45%, #0d1a33 0%, #05070d 75%); }
html.night .board-wrap::before { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 0; border-radius: inherit; opacity: .55;
  background-image: radial-gradient(1.2px 1.2px at 12% 18%, #fff, transparent), radial-gradient(1px 1px at 78% 12%, #fff, transparent), radial-gradient(1.4px 1.4px at 88% 64%, #fff, transparent), radial-gradient(1px 1px at 22% 82%, #fff, transparent), radial-gradient(1.2px 1.2px at 55% 8%, #fff, transparent), radial-gradient(1px 1px at 5% 50%, #fff, transparent), radial-gradient(1px 1px at 95% 35%, #fff, transparent), radial-gradient(1.3px 1.3px at 40% 92%, #fff, transparent); }
html.night .board-wrap::after { content: '🌙'; position: absolute; top: 8px; left: 50%; transform: translateX(-50%); font-size: 18px; opacity: .55; pointer-events: none; z-index: 1; }
html.night #board { filter: brightness(.74) saturate(.82) contrast(1.06); }
html.night #board > g:last-of-type { filter: brightness(1.15); }
@media (max-width: 760px) { html.night .board-wrap::after { display: none; } }

/* Lobby: map as a board, and the map gallery */
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.map-board { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 14px; align-items: center; }
.map-preview.board-look { display: block; width: 100%; aspect-ratio: 1.15; min-height: 0; padding: 6px; border-radius: 14px; cursor: pointer; background: radial-gradient(ellipse at 50% 45%, #10203a, #0b0d12 75%); border: 1px solid var(--line-2); box-shadow: inset 0 0 30px rgba(0,0,0,.6); }
.map-preview.board-look svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 8px 12px rgba(0,0,0,.5)); }
.map-preview.board-look:hover { border-color: #ffd65a; }
.mb-info { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.mb-name { font-size: 20px; font-family: var(--display); letter-spacing: .03em; }
.mb-btns { display: flex; flex-direction: column; gap: 6px; }
@media (max-width: 520px) { .map-board { grid-template-columns: 1fr; } }
.mg-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.mg-tab { min-height: 34px; padding: 4px 12px; border-radius: 999px; }
.mg-tab.on { background: #ffd65a; color: #2a1d0a; border-color: #ffd65a; }
.mg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; max-height: min(60vh, 560px); overflow-y: auto; padding: 2px; }
.mg-grid.hidden { display: none; }
.mg-card { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px; min-height: 0; border-radius: 12px; background: #141821; border: 2px solid var(--line); text-align: center; }
.mg-card.on { border-color: #ffd65a; box-shadow: 0 0 0 3px rgba(255,214,90,.25); }
.mg-card:hover { border-color: #8a7a4a; }
.mg-prev { display: block; width: 100%; aspect-ratio: 1.2; border-radius: 8px; background: radial-gradient(ellipse at 50% 45%, #10203a, #0b0d12 80%); padding: 4px; }
.mg-prev svg { width: 100%; height: 100%; display: block; }
.mg-card b { font-size: 13px; } .mg-card small { color: var(--mute); font-size: 11px; }
#modalBody:has(.mg-grid) { width: min(780px, 96vw); max-width: 96vw; }
.map-pick.map-board { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); grid-template-rows: auto; gap: 14px; align-items: center; }
.map-pick.map-board .map-preview { grid-column: 1; grid-row: 1; height: auto; }
.map-pick.map-board .mb-info { grid-column: 2; grid-row: 1; }
.map-pick.map-board p { grid-column: auto; }
@media (max-width: 520px) { .map-pick.map-board { grid-template-columns: 1fr; } .map-pick.map-board .mb-info { grid-column: 1; grid-row: 2; } .map-pick.map-board .map-preview { max-height: 230px; } .mb-btns { flex-direction: row; } .mb-btns button { flex: 1; } }
.mg-grid { align-items: start; }
.mg-prev { aspect-ratio: auto; height: 118px; }
.mg-tab.on { background: #ffd65a !important; color: #2a1d0a !important; border-color: #ffd65a !important; }
/* Desktop: the board toolbar sits below the top bar (it covered the emoji button) */
@media (min-width: 761px) and (min-height: 561px) and (pointer: fine) { .board-tools { top: auto; bottom: 64px; right: 12px; } }

/* Your turn: a big flash in your colour */
.yt-flash { position: fixed; inset: 0; z-index: 200; pointer-events: none; display: grid; place-items: center; animation: ytBg 1.7s ease-out forwards; background: radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--pc) 35%, transparent), transparent 70%); }
.yt-box { display: flex; align-items: center; gap: 14px; padding: 18px 34px; border-radius: 22px; background: rgba(12,14,20,.9); border: 4px solid var(--pc); box-shadow: 0 0 0 6px color-mix(in srgb, var(--pc) 35%, transparent), 0 20px 60px rgba(0,0,0,.6); animation: ytPop 1.7s cubic-bezier(.2,1.5,.4,1) forwards; }
.yt-box b { font-family: var(--display); font-size: clamp(34px, 9vw, 64px); letter-spacing: .05em; color: #fff; text-shadow: 0 0 18px var(--pc); }
.yt-ic { font-size: clamp(30px, 8vw, 54px); animation: ytWiggle .35s ease-in-out 3; }
@keyframes ytBg { 0% { opacity: 0; } 8% { opacity: 1; } 18% { opacity: .35; } 28% { opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; } }
@keyframes ytPop { 0% { transform: scale(.3); opacity: 0; } 12% { transform: scale(1.12); opacity: 1; } 20% { transform: scale(1); } 78% { transform: scale(1); opacity: 1; } 100% { transform: scale(.9) translateY(-20px); opacity: 0; } }
@keyframes ytWiggle { 50% { transform: rotate(-18deg) scale(1.15); } }
@media (prefers-reduced-motion: reduce) { .yt-flash, .yt-box, .yt-ic { animation-duration: .01s; } .yt-flash { animation: none; opacity: 0; } }
/* Auto-roll countdown */
.autoroll-chip { position: absolute; z-index: 9; left: 50%; bottom: 70px; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 14px; border-radius: 999px; background: rgba(12,14,20,.94); border: 2px solid #ffd65a; color: #fff; font-weight: 600; white-space: nowrap; box-shadow: 0 8px 24px rgba(0,0,0,.5); }
.autoroll-chip b { color: #ffd65a; font-size: 1.2em; }
.autoroll-chip small { color: var(--mute); font-weight: 600; }
.autoroll-chip.hidden { display: none; }
#autoRollBtn.on { border-color: #ffd65a; color: #ffd65a; }

/* ---------- Typography: Cinzel (engraved capitals) for titles, Jost (light geometric) for the interface ---------- */
body { font-weight: 400; letter-spacing: .01em; font-feature-settings: "tnum" 1; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
button { font-weight: 500; letter-spacing: .02em; }
b, strong { font-weight: 600; }
.logo, .h2-logo { font-family: var(--display); font-weight: 600; letter-spacing: .08em; }
.logo span, .brand span { color: var(--red); letter-spacing: 0; margin: 0 .12em; }
h3 { font-family: var(--display); font-weight: 600; letter-spacing: .1em; text-transform: none; font-size: 13px; }
.room-code { font-family: var(--display); font-weight: 600; letter-spacing: .16em; }
.brand { font-family: var(--display) !important; font-weight: 600 !important; letter-spacing: .08em; }
.mb-name, .h2-tile b, .hd-t b, .yt-box b, .pf-stats b, .mg-card b, .bo-name, .pm-n, .nm, .rx-cap b { font-family: var(--display); letter-spacing: .04em; }
.yt-box b { font-weight: 700; letter-spacing: .12em; }
.status, .big-roll, .db-l { letter-spacing: .03em; }
input, select, textarea { font-weight: 400; }

/* ---------- Build menu: elegant piece cards ---------- */
.build-menu { gap: 8px; padding: 10px; border-radius: 16px; background: linear-gradient(180deg, rgba(28,32,43,.97), rgba(16,19,26,.97)); border: 1px solid rgba(255,214,90,.18); box-shadow: 0 18px 50px rgba(0,0,0,.65), inset 0 1px 0 rgba(255,255,255,.05); backdrop-filter: blur(6px); }
.build-opt { display: flex !important; align-items: center; gap: 12px; min-width: 196px; padding: 10px 14px 10px 10px !important; opacity: 1 !important; text-align: left; border-radius: 13px; background: linear-gradient(180deg, #1b1f2a, #151820); border: 1px solid rgba(255,255,255,.07); transition: transform .12s, border-color .2s, box-shadow .2s; }
.build-opt .bo-medal { flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 35% 30%, #2b3142, #12151c 75%); border: 1px solid rgba(255,214,90,.28); box-shadow: inset 0 2px 6px rgba(0,0,0,.6); }
.build-opt .bo-medal svg { width: 30px; height: 30px; grid-row: auto !important; }
.bo-body { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.bo-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.bo-name { font-size: 15px !important; font-weight: 600; color: #f1e9d2; white-space: nowrap; }
.bo-left { font-size: 10.5px; color: var(--mute); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.bo-cost { display: flex; gap: 4px; flex-wrap: wrap; }
.bo-pill { position: relative; display: inline-flex; align-items: center; gap: 3px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--c); color: #fff; border: 1px solid rgba(255,255,255,.22); box-shadow: inset 0 1px 0 rgba(255,255,255,.2); font-size: 12px; }
.bo-pill b { font-weight: 600; }
.bo-pill.short { filter: saturate(.35) brightness(.7); }
.bo-pill.short::after { content: ''; position: absolute; top: -2px; right: -2px; width: 7px; height: 7px; border-radius: 50%; background: #ff5c62; box-shadow: 0 0 0 2px #151820; }
.bo-why { display: flex !important; align-items: center; gap: 6px; font: 500 11px var(--ui) !important; text-transform: none !important; letter-spacing: .02em; color: var(--mute); white-space: nowrap; }
.bo-why i { width: 7px; height: 7px; border-radius: 50%; background: #6b7280; flex: none; }
.build-opt.st-ready { border-color: rgba(47,191,143,.65); background: linear-gradient(180deg, #17302a, #131c1b); box-shadow: 0 0 0 1px rgba(47,191,143,.25), 0 8px 22px rgba(47,191,143,.12); }
.build-opt.st-ready .bo-medal { border-color: rgba(47,191,143,.8); }
.build-opt.st-ready .bo-why { color: #6fe3b9; } .build-opt.st-ready .bo-why i { background: #2fbf8f; box-shadow: 0 0 8px #2fbf8f; }
.build-opt.st-ready:hover { transform: translateY(-2px); }
.build-opt.st-need .bo-why { color: #f0b86a; } .build-opt.st-need .bo-why i { background: #f39a2b; }
.build-opt.st-nospot, .build-opt.st-none { opacity: .62 !important; }
/* phones: three compact cards in a row */
@media (max-width: 760px), (max-height: 560px), (pointer: coarse) and (max-width: 1400px) {
  #game .build-opt { flex-direction: column !important; align-items: center; justify-content: flex-start; text-align: center; gap: 6px; min-width: 0; padding: 10px 6px !important; display: flex !important; }
  #game .bo-body { align-items: center; gap: 4px; }
  #game .bo-head { flex-direction: column; align-items: center; gap: 0; }
  #game .bo-name { font-size: 13px !important; }
  #game .bo-cost { justify-content: center; }
  #game .bo-why { white-space: normal; justify-content: center; font-size: 10px !important; line-height: 1.2; }
  #game .build-opt .bo-medal { width: 40px; height: 40px; }
}

/* Tiny scaled SVG text: no hinting, so digits don't drift apart */
#board text, .token text { text-rendering: geometricPrecision; letter-spacing: 0; }
@media (max-width: 760px), (max-height: 560px), (pointer: coarse) and (max-width: 1400px) {
  #game .pm-n, #game .nm { font-family: var(--ui); letter-spacing: .01em; font-weight: 600; }
  #game .build-opt { padding: 8px 4px !important; gap: 4px; }
  #game .build-opt .bo-medal { width: 34px; height: 34px; }
  #game .build-opt .bo-medal svg { width: 24px; height: 24px; }
  #game .bo-left { font-size: 9.5px; }
  #game .bo-pill { height: 19px; padding: 0 5px; font-size: 11px; }
  #game .bo-why i { display: none; }
  #game .bo-why { font-size: 10px !important; }
  #game .board-tools { top: auto; bottom: 64px; right: 8px; }
}
.h2-logo { font-size: clamp(30px, 3.4vw, 46px); white-space: nowrap; }
@media (max-width: 760px) { .h2-logo { font-size: clamp(24px, 8vw, 34px); } }
.logo { letter-spacing: .06em; }
/* Leave sits in the top bar as a quiet icon button */
.top-leave { display: inline-flex; align-items: center; gap: 6px; color: #e9a3ad; border-color: rgba(233,90,110,.35); }
.top-leave:hover { background: rgba(233,90,110,.12); color: #ffd0d6; }
@media (max-width: 760px), (max-height: 560px), (pointer: coarse) and (max-width: 1400px) { .top-leave { display: none; } }
/* Discard: tap the cards themselves */
.dc-head h3 { margin: 0 0 2px; }
.dc-sub { font-size: 12px; color: var(--muted, #9aa3b5); }
.dc-cards { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin: 16px 0 14px; }
.dc-card { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; aspect-ratio: 3/4; min-height: 0; padding: 8px 0;
  border-radius: 12px; border: 1px solid rgba(255,255,255,.14); color: #fff;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 92%, #fff 8%), color-mix(in srgb, var(--c) 78%, #000 22%)) !important; color: #fff !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 4px 10px rgba(0,0,0,.3); transition: transform .12s, box-shadow .12s; }
.dc-card b { font: 500 18px var(--ui); }
.dc-card:not(:disabled):hover { transform: translateY(-3px); }
.dc-card.dc-on { box-shadow: 0 0 0 2px #fff, 0 6px 16px rgba(0,0,0,.4); }
.dc-card:disabled { opacity: .35; }
.dc-card.dc-on:disabled { opacity: 1; }
.dc-pick { position: absolute; top: -9px; right: -9px; min-width: 26px; height: 26px; padding: 0 6px; display: grid; place-items: center;
  border-radius: 13px; background: #e5394f; color: #fff; font: 600 13px var(--ui); box-shadow: 0 2px 6px rgba(0,0,0,.45); cursor: pointer; }
.dc-foot { display: flex; align-items: center; gap: 12px; }
.dc-bar { flex: 1; height: 6px; border-radius: 3px; background: rgba(255,255,255,.1); overflow: hidden; }
.dc-bar i { display: block; height: 100%; background: linear-gradient(90deg, #e5394f, #ff7a59); transition: width .2s; }
.dc-count { font: 500 14px var(--ui); color: #dfe3ec; min-width: 44px; text-align: right; }
.dc-foot .primary { min-width: 120px; }
.dc-cards { padding: 10px 10px 0 0; }
/* Avatars */
.av { display: inline-grid; place-items: center; flex: none; border-radius: 50%; overflow: hidden; line-height: 1; vertical-align: middle;
  background: color-mix(in srgb, var(--ac) 30%, #141925); box-shadow: 0 0 0 2px var(--ac), 0 2px 6px rgba(0,0,0,.35); }
.av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.av-i { color: #fff; font-family: var(--display); background: color-mix(in srgb, var(--ac) 55%, #141925); }
.pl > .av { margin-right: 2px; }
.pm-n .av { margin-right: 5px; box-shadow: 0 0 0 1.5px rgba(255,255,255,.85); }
#seats li > .av { margin-right: 4px; }
.h2-dot.has-av { background: none !important; width: 26px; height: 26px; display: inline-grid; place-items: center; }
.pf-av { display: flex; gap: 16px; align-items: center; margin: 6px 0 10px; }
.pf-av-side { display: flex; flex-direction: column; gap: 4px; }
.pf-av-side small { color: var(--muted, #9aa3b5); font-size: 12px; }
.pf-up { cursor: pointer; display: inline-flex; align-items: center; padding: 6px 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,.18); }
.pf-avs { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; margin-bottom: 12px; }
.pf-avb { aspect-ratio: 1; min-height: 0; padding: 0; font-size: 22px; border-radius: 50%; background: #1a2030; border: 1px solid #2a3142; }
.pf-avb.on { box-shadow: 0 0 0 2px #ffd65a; }
@media (max-width: 420px) { .pf-avs { grid-template-columns: repeat(6, 1fr); } }

/* Michroma is one wide weight: no fake bold, tighter spacing, slightly smaller; long reading text stays in Jost. */
body { font-synthesis: none; }
body, button, input, select, textarea { letter-spacing: 0; }
html { font-size-adjust: none; }
.log div, .log li, #log > *, [data-chat] > *, .chat-line, .modal p, .muted, .small, input, textarea, select, .toast, .tip-text, .howto p, .status, #status { font-family: var(--read) !important; }
/* Michroma fit fixes */
#zoomLvl, .zoom-ctl span { font-family: var(--read) !important; }
.pl .meta { font-size: 9.5px; gap: 9px; }
.bo-why { font-family: var(--read) !important; font-size: 12px !important; }
@media (max-width: 760px), (max-height: 560px), (pointer: coarse) and (max-width: 1400px) {
  #game .pm-n { font-size: 9.5px; letter-spacing: -.01em; }
  #game .pm-n .av { width: 16px !important; height: 16px !important; font-size: 10px !important; margin-right: 3px; }
  #game .bo-why { font-size: 10.5px !important; line-height: 1.2; white-space: normal; }
  #game .bo-name { font-size: 13px; }
}
@media (max-width: 760px), (max-height: 560px), (pointer: coarse) and (max-width: 1400px) {
  #game .db { min-width: 0; overflow: hidden; }
  #game .db-l { font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; letter-spacing: -.01em; }
}
/* Small phones: Michroma is too wide for the tight spots, so those use Jost */
@media (max-width: 400px) {
  #game .db-l, #game .pm-n, #game .pm-b, #game .hand-label, #game .bo-left { font-family: var(--read) !important; font-size: 11.5px; letter-spacing: 0; }
  #game .pm-n { font-weight: 600; }
}
@media (max-width: 400px) {
  #game .pm-n .av { display: none; }
  #game .db-l { font-size: 10px; white-space: normal; line-height: 1.05; text-overflow: clip; text-align: center; }
}
.h2-logo { font-size: clamp(22px, 2.5vw, 34px) !important; }
@media (max-width: 760px) { .h2-logo { font-size: clamp(18px, 6.2vw, 26px) !important; } }
/* Tall dialogs (profile with avatars) scroll inside the screen */
.modal-card { max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; }
.modal-card h3 { font-size: 22px; }
.pf-avs { grid-template-columns: repeat(8, 1fr) !important; gap: 5px; }
.pf-avb { font-size: 18px; }
.pf-stats b { font-family: var(--read); }
@media (max-width: 760px) { .pf-av-now .av { width: 60px !important; height: 60px !important; } .pf-av { gap: 12px; } }

/* Michroma only for the game's titles; everything else is Exo 2 */
.brand, .h2-logo, .logo, #roomCode, .modal-card h3 { font-family: var(--title) !important; letter-spacing: .04em; font-weight: 400; }
.mb-name, .h2-tile b, .hd-t b, .yt-box b, .pf-stats b, .mg-card b, .bo-name, .pm-n, .nm, .rx-cap b { letter-spacing: .01em; font-weight: 600; }
body { font-synthesis: weight; }
/* ----- Emote packs ----- */
.pack-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 14px; }
.pack-chip { display: flex; align-items: center; gap: 8px; text-align: left; padding: 8px 10px; min-height: 0; border-radius: 12px; background: #151a24; border: 1px solid #2a3142; color: var(--fg); opacity: .7; }
.pack-chip.on { opacity: 1; border-color: #2fbf8f; background: linear-gradient(180deg, rgba(47,191,143,.14), rgba(47,191,143,.04)); }
.pack-chip.locked { opacity: .4; }
.pack-chip:disabled { cursor: default; }
.pack-chip .pc-ic { font-size: 22px; }
.pack-chip .pc-t { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.pack-chip .pc-t b { font-size: 13px; font-weight: 600; }
.pack-chip .pc-t small { font-size: 11px; color: var(--mute); }
.pack-chip .pc-st { color: #2fbf8f; font-weight: 600; }
.em-tabs { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 6px; border-bottom: 1px solid #2a3142; scrollbar-width: none; }
.em-tabs button { flex: none; display: flex; flex-direction: column; align-items: center; gap: 1px; min-height: 0; padding: 4px 8px; font-size: 18px; border-radius: 10px; background: transparent; border: 1px solid transparent; color: var(--fg); }
.em-tabs button small { font-size: 9.5px; color: var(--mute); }
.em-tabs button.on { background: #1f2636; border-color: #3a4358; }
.em-body { max-height: min(52vh, 420px); overflow-y: auto; }
.pk-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.pk-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; min-height: 0; border-radius: 12px; background: #151a24; border: 1px solid #2a3142; color: var(--fg); }
.pk-btn span { font-size: 28px; line-height: 1.1; }
.pk-btn small { font-size: 9px; font-weight: 600; letter-spacing: .02em; text-align: center; line-height: 1.1; color: #cfd5e2; }
.pk-btn:hover { border-color: #ffd65a; transform: translateY(-1px); }
.pk-edit { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
@media (max-width: 400px) { .pk-grid { grid-template-columns: repeat(3, 1fr); } }
/* the big animated emoji that pops out of a player's card */
.rx-emo { line-height: 1; filter: drop-shadow(0 6px 10px rgba(0,0,0,.45)); }
.rx-emo.an-bounce { animation: anBounce .5s ease-in-out infinite alternate; }
.rx-emo.an-jump { animation: anJump .55s cubic-bezier(.3,1.6,.5,1) infinite; }
.rx-emo.an-shake { animation: anShake .12s linear infinite alternate; }
.rx-emo.an-wobble { animation: anWobble .4s ease-in-out infinite alternate; }
.rx-emo.an-spin { animation: anSpin 1s cubic-bezier(.5,0,.3,1) infinite; }
.rx-emo.an-punch { animation: anPunch .45s cubic-bezier(.2,1.8,.4,1) infinite; }
.rx-emo.an-tilt { animation: anTilt .9s ease-in-out infinite alternate; }
.rx-emo.an-squint { animation: anSquint 1.1s ease-in-out infinite; }
.rx-emo.an-drop { animation: anDrop .9s cubic-bezier(.5,0,.6,1.6) 1 both; }
.rx-emo.an-sink { animation: anSink 2.4s ease-in 1 both; }
.rx-emo.an-float { animation: anFloat 1.2s ease-in-out infinite alternate; }
.rx-emo.an-wave { animation: anWave .3s ease-in-out infinite alternate; transform-origin: 70% 90%; }
.rx-emo.an-heart { animation: anHeart .6s ease-in-out infinite; }
@keyframes anBounce { from { transform: translateY(0) scale(1, 1); } to { transform: translateY(-10px) scale(1.05, .95); } }
@keyframes anJump { 0%, 100% { transform: translateY(0) scale(1); } 40% { transform: translateY(-22px) scale(1.08); } }
@keyframes anShake { from { transform: translateX(-5px) rotate(-6deg); } to { transform: translateX(5px) rotate(6deg); } }
@keyframes anWobble { from { transform: rotate(-12deg) scale(1.02); } to { transform: rotate(12deg) scale(.98); } }
@keyframes anSpin { from { transform: rotateY(0); } to { transform: rotateY(360deg); } }
@keyframes anPunch { 0% { transform: scale(.7); } 40% { transform: scale(1.25); } 100% { transform: scale(1); } }
@keyframes anTilt { from { transform: rotate(-8deg); } to { transform: rotate(10deg) translateX(4px); } }
@keyframes anSquint { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(.82) translateY(6px); } }
@keyframes anDrop { 0% { transform: translateY(-60px); opacity: 0; } 60% { transform: translateY(6px); opacity: 1; } 100% { transform: translateY(0); } }
@keyframes anSink { 0% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(30px); opacity: .4; } }
@keyframes anFloat { from { transform: translateY(0) rotate(-3deg); } to { transform: translateY(-12px) rotate(3deg); } }
@keyframes anWave { from { transform: rotate(-18deg); } to { transform: rotate(18deg); } }
@keyframes anHeart { 0%, 100% { transform: scale(1); } 20% { transform: scale(1.22); } 40% { transform: scale(.96); } 60% { transform: scale(1.12); } }
@media (prefers-reduced-motion: reduce) { .rx-emo { animation: none !important; } }
.emote-panel { overflow: hidden; width: min(380px, 92vw); max-height: min(520px, 70vh); }
.emote-panel .em-tabs { flex: none; }
.emote-panel .em-body { flex: 1; min-height: 0; overflow-y: auto; max-height: none; display: flex; flex-direction: column; gap: 10px; }
@media (max-width: 760px), (max-height: 560px), (pointer: coarse) and (max-width: 1400px) { .emote-panel { width: auto; max-height: 60vh; } }
/* Action bar: Roll · Trade · Build · Dev card · End turn, one icon style */
.db { border-radius: 12px; }
.db-ic svg { display: block; }
#act-trade:not(:disabled) { background: linear-gradient(180deg, #3d8bff, #1f5fd6); border-color: #8dbbff; color: #fff; box-shadow: 0 3px 0 #123b8a; }
#act-trade:not(:disabled) .db-ic { color: #e6f0ff; }
#act-trade:not(:disabled) .db-l { color: #fff; font-weight: 600; }
#act-trade.on { background: linear-gradient(180deg, #6aa6ff, #2f6fe6); box-shadow: 0 0 0 2px #cfe1ff, 0 3px 0 #123b8a; }
#act-trade:not(:disabled) .db-ic svg { animation: tradeSwap 2.4s ease-in-out infinite; }
@keyframes tradeSwap { 0%, 70%, 100% { transform: translateX(0); } 80% { transform: translateX(-2px); } 90% { transform: translateX(2px); } }
#act-end:not(:disabled), html.simple #act-end:not(:disabled) { background: linear-gradient(180deg, #f0465c, #b81d33); border-color: #ff8a98; color: #fff; box-shadow: 0 3px 0 #6e0f1c; }
#act-end:not(:disabled) .db-ic { color: #fff; }
#act-end:not(:disabled) .db-ic svg { animation: endWave 1.6s ease-in-out infinite; transform-origin: 20% 90%; }
@keyframes endWave { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-8deg); } }
#act-trade:disabled { background: var(--raise); border-color: var(--line-2); box-shadow: none; }
.hint-btn svg { display: block; }
@media (prefers-reduced-motion: reduce) { #act-trade .db-ic svg, #act-end .db-ic svg { animation: none !important; } }
#act-roll:not(:disabled) .db-ic { color: #12151c; }
#game .hb-trade:not(:disabled) { background: linear-gradient(180deg, #3d8bff, #1f5fd6) !important; border-color: #8dbbff !important; color: #fff !important; box-shadow: 0 3px 0 #123b8a !important; }
.pack-chip.locked { opacity: .55; cursor: pointer; }
.pack-chip.ro { cursor: default; }
.pack-chip .pc-st { font-size: 11px; white-space: nowrap; }
/* Board themes */
.th-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.th-card { display: flex; flex-direction: column; gap: 6px; padding: 6px; min-height: 0; border-radius: 12px; background: #151a24; border: 1px solid #2a3142; color: var(--fg); }
.th-card.on { border-color: #ffd65a; box-shadow: 0 0 0 2px rgba(255,214,90,.35); }
.th-card b { font-size: 12px; font-weight: 600; }
@media (max-width: 420px) { .th-grid { grid-template-columns: repeat(2, 1fr); } }
html[data-theme="tropical"] .board-wrap { background: radial-gradient(ellipse 80% 70% at 50% 45%, #0f3a46 0%, #071a22 75%); }
html[data-theme="desert"] .board-wrap { background: radial-gradient(ellipse 80% 70% at 50% 45%, #2e2212 0%, #120c06 75%); }
html[data-theme="frost"] .board-wrap { background: radial-gradient(ellipse 80% 70% at 50% 45%, #1e3044 0%, #0a121c 75%); }
html[data-theme="neon"] .board-wrap { background: radial-gradient(ellipse 80% 70% at 50% 45%, #1b0838 0%, #05020c 75%); }
html[data-theme="neon"] #board .tile polygon:first-child { filter: drop-shadow(0 0 .04px #ff3ea5); }
html[data-theme="royal"] .board-wrap { background: radial-gradient(ellipse 80% 70% at 50% 45%, #22152f 0%, #0a0610 75%); }
/* Leagues */
.league-row { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 4px; }
.t-league { background: linear-gradient(160deg, rgba(255,214,90,.16), rgba(255,214,90,.03)); border-color: rgba(255,214,90,.45); grid-column: 1 / -1; }
.lg-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.lg-item { display: flex; align-items: center; gap: 10px; text-align: left; min-height: 0; padding: 10px 12px; border-radius: 12px; background: #151a24; border: 1px solid #2a3142; color: var(--fg); }
.lg-item b { flex: 1; font-weight: 600; }
.lg-item small { color: var(--mute); letter-spacing: .08em; }
.lg-new { display: flex; gap: 8px; margin-bottom: 8px; }
.lg-new input { flex: 1; min-width: 0; }
.lg-code { letter-spacing: .12em; color: #ffd65a; }
.lg-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 6px 0 10px; }
.lg-table th { text-align: left; font-weight: 600; color: var(--mute); font-size: 11px; padding: 4px 6px; border-bottom: 1px solid #2a3142; }
.lg-table td { padding: 7px 6px; border-bottom: 1px solid rgba(255,255,255,.05); }
.lg-table tr.you td { background: rgba(255,214,90,.08); }
.lg-table td:last-child, .lg-table th:last-child { text-align: right; }
.lg-recent { list-style: none; padding: 0; margin: 0 0 10px; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
.lg-recent small { color: var(--mute); margin-right: 6px; }
.row.wrap { flex-wrap: wrap; }

/* ---------- Cities & Knights ---------- */
.ck-bar { position: absolute; bottom: 76px; left: 14px; z-index: 5; display: flex; flex-direction: column; gap: 4px; padding: 6px 8px; background: rgba(12,16,24,.82); border: 1px solid var(--line-2); border-radius: 10px; cursor: pointer; font-size: 12px; color: #e8ecf2; backdrop-filter: blur(6px); }
.ck-bar.hidden { display: none; }
.ckb-track { display: flex; gap: 2px; align-items: center; }
.ckb-track i { width: 16px; height: 16px; border-radius: 4px; background: rgba(255,255,255,.07); display: grid; place-items: center; font-style: normal; font-size: 11px; }
.ckb-track i.land { background: rgba(217,90,60,.25); }
.ckb-track i.ship { background: rgba(255,214,90,.25); box-shadow: 0 0 0 1px #ffd65a inset; }
.ckb-st { display: flex; gap: 8px; align-items: center; white-space: nowrap; }
.ckb-st .ok { color: #7fd99a; } .ckb-st .bad { color: #ff8a7a; }
.ckb-ev b { margin-left: 2px; display: inline-block; min-width: 14px; padding: 0 3px; border-radius: 3px; background: #c0392b; color: #fff; font-size: 10px; text-align: center; }
.ck-ul { margin: 6px 0 8px 18px; padding: 0; line-height: 1.5; color: var(--mute); }
.ck-track { border: 1px solid var(--line-2); border-left: 4px solid var(--tc); border-radius: 10px; padding: 10px 12px; margin: 8px 0; display: flex; flex-direction: column; gap: 6px; background: rgba(255,255,255,.02); }
.ckt-h { display: flex; align-items: center; gap: 8px; } .ckt-h b { flex: 1; }
.ckt-ic { font-size: 18px; }
.ckt-pips { display: flex; gap: 4px; }
.ckt-pips i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--tc); opacity: .5; }
.ckt-pips i.on { background: var(--tc); opacity: 1; }
.ckt-pips i.pow { border-radius: 3px; } .ckt-pips i.met { box-shadow: 0 0 0 2px rgba(255,214,90,.35); }
.ckt-f { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ck-kgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.ck-kb { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 10px; border-radius: 10px; text-align: left; min-height: 74px; }
.ck-kb span { display: flex; gap: 3px; align-items: center; font-size: 11.5px; color: var(--mute); }
.ck-kb small { color: #ff9b8a; font-size: 11px; }
.ck-kb.off { opacity: .6; }
.ck-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin: 10px 0; }
.ck-pick button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; border-radius: 10px; background: var(--c, var(--raise)); color: #fff; }
.ck-pick.who { grid-template-columns: 1fr; } .ck-pick.who button { flex-direction: row; justify-content: flex-start; background: var(--raise); }
.ck-impr { display: flex; gap: 6px; font-size: 11px; align-items: center; margin-top: 2px; }
.ck-impr > span { display: inline-flex; align-items: center; gap: 2px; padding: 1px 5px; border-radius: 6px; background: color-mix(in srgb, var(--tc, #555) 22%, transparent); }
.rc.com { border-style: dashed; }
.dc-cards.ck { grid-template-columns: repeat(4, 1fr); }
.devc.prog { border-top: 3px solid var(--tc); }
.devc.prog .dv-top { font-size: 11px; }
@media (max-width: 760px) { .ck-bar { top: 6px; left: 50%; transform: translateX(-50%); padding: 4px 6px; font-size: 11px; } .ckb-track i { width: 13px; height: 13px; font-size: 9px; } .ck-impr { display: none; } }
body.dev-open.ck-mode #game .dev-rack::before { content: 'Progress cards'; }
@media (max-width: 760px) { .ck-bar { bottom: auto; } body.many-cards #game .rc { width: 36px; } body.many-cards #game .rc svg { width: 17px; height: 17px; } body.many-cards #game .hand { gap: 4px; } }

/* Game modes with their own board: no map choice */
.map-board.mode-map .mb-btns { display: none; }
.map-board.mode-map #mapPreview { pointer-events: none; }

/* New Energies */
#board .hazard { fill: rgba(227, 38, 58, .28); stroke: #e3263a; stroke-width: .04; stroke-dasharray: .1 .07; }
.neb-tr { display: flex; gap: 6px; flex-wrap: wrap; }
.neb-t { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; }
.neb-t i { width: 6px; height: 10px; border-radius: 2px; background: rgba(255,255,255,.12); }
.neb-t i.on { background: var(--ec); box-shadow: 0 0 4px var(--ec); }
.db.energy { --bc: #d9a92a; }
#act-energy:not(:disabled) { background: linear-gradient(180deg, #f0c23a, #c9931a); border-color: #ffe08a; color: #1a1300; box-shadow: 0 3px 0 #7a5a0c; }
#act-energy:not(:disabled) .db-ic, #act-energy:not(:disabled) .db-l { color: #1a1300; font-weight: 600; }

/* Dawn of Humankind */
#board .region-name { font: 700 .5px var(--display, sans-serif); letter-spacing: .1em; opacity: .7; paint-order: stroke; stroke: #07080b; stroke-width: .05px; }
#board .tap.pick { fill: rgba(255,214,90,.25); stroke: #ffd65a; stroke-width: .03; }
#board .tap.picked { fill: rgba(255,214,90,.5); stroke: #fff; stroke-width: .04; }
#board .camp-ready .tap { fill: rgba(63,191,95,.85); stroke: #fff; stroke-width: .03; animation: pulse 1.2s infinite; }

/* Starfarers */
#act-launch:not(:disabled) { background: linear-gradient(180deg, #8a5cff, #5a2fd6); border-color: #c4a8ff; color: #fff; box-shadow: 0 3px 0 #33188a; }
#act-launch:not(:disabled) .db-ic, #act-launch:not(:disabled) .db-l { color: #fff; font-weight: 600; }
.enc-text { font-size: 16px; line-height: 1.45; margin: 8px 0 12px; }
.enc-last { max-width: 260px; margin-top: 2px; line-height: 1.3; }
.ck-pick button.sel { outline: 3px solid #fff; }

/* ---------- Board-first desktop (review: board too small at 1280×720) ---------- */
.top-more { position: relative; }
.more-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; display: flex; flex-direction: column; gap: 4px; min-width: 190px; padding: 6px; background: var(--raise-2); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: 0 12px 30px rgba(0,0,0,.55); }
.more-pop.hidden { display: none; }
.more-pop button { display: flex !important; justify-content: flex-start; gap: 8px; width: 100%; text-align: left; }
.more-pop button::after { content: attr(title); font-weight: 500; color: var(--mute); }
html.phone-ui .top-more { display: none; }
html:not(.phone-ui) .game-top { flex-wrap: nowrap; gap: 8px; }
html:not(.phone-ui) .game-top .status { min-width: 0; padding: 8px 12px; }
html:not(.phone-ui) .game-top .sound input { width: 64px; }
@media (max-width: 1500px) { html:not(.phone-ui) .brand { font-size: 15px; } }
@media (max-width: 1150px) { html:not(.phone-ui) .brand { display: none; } html:not(.phone-ui) .top-leave span { display: none; } }
html:not(.phone-ui) .board-wrap { gap: 6px; padding: 8px; }
/* Dock: cards on the left, actions on the right, one row. */
html:not(.phone-ui) .dock { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "cards actions"; align-items: end; gap: 10px; padding: 8px 10px; }
html:not(.phone-ui) .dock > .dock-cards { grid-area: cards; padding: 6px 2px 2px; }
html:not(.phone-ui) .dock > #actions { grid-area: actions; display: grid; grid-template-columns: repeat(3, minmax(74px, auto)); gap: 6px; justify-content: end; }
html:not(.phone-ui) .dock > #actions:empty { display: none; }
html:not(.phone-ui) .dock > .hand-bar { display: none; }
@media (max-height: 800px) { html:not(.phone-ui) .rc { height: 84px; } html:not(.phone-ui) .db { min-height: 50px; } }
/* Simple mode: the board is the screen. No tilt bar; zoom buttons appear only when zoomed (so Fit is always reachable). */
html.simple:not(.phone-ui) .cam { display: none; }
html.simple .board-wrap.zoomed .zoom-ctl { display: flex !important; }
.board-wrap.zoomed::after { content: 'Drag to move · double-click or ⤢ Fit to reset'; position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 6; font-size: 12px; color: var(--mute); background: rgba(13,15,20,.75); border: 1px solid var(--line-2); border-radius: 999px; padding: 4px 10px; pointer-events: none; }

/* Legal build targets (review: hard to tell apart and to hit). Green = "you can build here"; red stays for hot numbers. */
#board .tgt .ghost-piece, #board .tgt .ghost-road { opacity: 0; pointer-events: none; transition: opacity .12s; }
#board .ghost-road { stroke-width: .13; stroke-linecap: round; }
#board .tgt:hover .ghost-piece, #board .tgt:focus-within .ghost-piece { opacity: .62; }
#board .tgt:hover .ghost-road, #board .tgt:focus-within .ghost-road { opacity: .7; }
#board .tgt:hover .spot, #board .tgt:focus-within .spot { stroke: #fff; stroke-width: .08; animation: none; }
#board .tgt:hover .edge-hit, #board .tgt:focus-within .edge-hit { stroke: #fff; animation: none; }
@media (hover: none) { #board .tgt:hover .ghost-piece, #board .tgt:hover .ghost-road { opacity: 0; } }
html.simple .spot { stroke-width: .08; }
html.simple .spot-dot { transform-box: fill-box; transform-origin: center; transform: scale(1.3); }
html.simple .edge-hit { stroke-width: .14; }
/* Keyboard focus on board targets */
#board [tabindex]:focus { outline: none; }
#board .tap:focus-visible { fill: rgba(255,255,255,.28); stroke: #fff; stroke-width: .05; }
#board .tap-line:focus-visible { stroke: rgba(255,255,255,.45); }
#board .rob-hit:focus-visible .hex-hit { opacity: 1; fill: rgba(255, 68, 87, .32); stroke: #fff; stroke-width: .09; }
.sr-only { position: absolute !important; top: 0; left: 0; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.h2-tile.t-practice { background: linear-gradient(160deg, #18493a, #1a1d25); border-color: #3ee6a8; }
/* Undo sits at the bottom of the board, clear of the status banner at the top. */
/* (on phones the banner is at the bottom, so Undo stays at the top there) */
html:not(.phone-ui) .undo-chip { top: auto; bottom: 12px; }
/* Log and chat: one capped panel so the rail never grows past the screen. */
html:not(.phone-ui) .side .log, html:not(.phone-ui) .side .chat-log { max-height: min(190px, 26vh); }

/* ---------- build strip: always-on row of buildable pieces ---------- */
.build-strip { display: flex; flex-direction: column; gap: 4px; padding: 2px 1px 4px; }
.bs-row { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.bs-row::-webkit-scrollbar { display: none; }
.bs-item { position: relative; flex: 0 0 auto; display: flex; align-items: center; gap: 6px; padding: 4px 9px 4px 5px; min-height: 38px;
  border-radius: 10px; border: 1px solid var(--line-2); background: rgba(255,255,255,.03); color: var(--muted, #9aa3b2); cursor: pointer;
  font: inherit; transition: background .2s, border-color .2s, box-shadow .2s, opacity .2s, transform .15s; }
.bs-ic { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: rgba(0,0,0,.25); flex: none; }
.bs-txt { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; line-height: 1; }
.bs-name { font-size: 11px; font-weight: 600; letter-spacing: .02em; white-space: nowrap; }
.bs-cost { display: flex; gap: 2px; }
.bs-pill { display: inline-flex; align-items: center; gap: 1px; height: 15px; padding: 0 3px; border-radius: 4px; background: color-mix(in srgb, var(--c) 30%, transparent); font-size: 9px; }
.bs-pill b { font-size: 9px; }
.bs-pill.short { outline: 1.5px solid #ff5b6b; opacity: .55; }
.bs-need { opacity: .55; }
.bs-none { opacity: .3; }
.bs-afford { border-color: #3ee6a8; color: #dff; opacity: 1; }
.bs-ready { border-color: #3ee6a8; background: linear-gradient(160deg, rgba(62,230,168,.28), rgba(62,230,168,.08)); color: #fff; opacity: 1;
  box-shadow: 0 0 0 1px rgba(62,230,168,.5), 0 0 14px rgba(62,230,168,.45); animation: bsGlow 1.8s ease-in-out infinite; }
.bs-ready:hover, .bs-ready:focus-visible { transform: translateY(-1px); }
.bs-pop { animation: bsPop .6s cubic-bezier(.3,1.6,.5,1) both, bsGlow 1.8s ease-in-out .6s infinite; }
.bs-new { position: absolute; top: -7px; right: -5px; width: 16px; height: 16px; border-radius: 50%; background: #3ee6a8; color: #062; font-weight: 800;
  font-size: 13px; line-height: 16px; text-align: center; animation: bsBadge 2.4s ease forwards; }
@keyframes bsGlow { 50% { box-shadow: 0 0 0 1px rgba(62,230,168,.8), 0 0 22px rgba(62,230,168,.7); } }
@keyframes bsPop { 0% { transform: scale(.7) translateY(6px); } 60% { transform: scale(1.15) translateY(-3px); } 100% { transform: none; } }
@keyframes bsBadge { 0%, 80% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { .bs-ready, .bs-pop, .bs-new { animation: none; } }
/* desktop: one row across the top of the dock */
html:not(.phone-ui) .board-wrap > .build-strip { position: absolute; left: 10px; top: 10px; z-index: 6; flex-direction: column; gap: 6px; overflow: visible; max-height: calc(100% - 90px); }
html:not(.phone-ui) .board-wrap > .build-strip.hidden { display: none; }
html:not(.phone-ui) .board-wrap > .build-strip .bs-item { background: rgba(14,17,24,.78); backdrop-filter: blur(6px); min-width: 118px; }
html:not(.phone-ui) .board-wrap > .build-strip .bs-ready { background: linear-gradient(160deg, rgba(62,230,168,.38), rgba(14,17,24,.85)); }
/* trade rates: one small chip per port, after a thin separator; same ready/afford/need colours as the pieces */
.bs-ports { display: flex; flex-wrap: wrap; gap: 5px; }   /* chips sit on their own row under the pieces: always visible, never scrolled away */
.bs-sep { display: none; }
html:not(.phone-ui) .board-wrap > .build-strip .bs-row { flex-direction: column; overflow: visible; }
.bs-chip { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-height: 30px; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--line-2); background: rgba(255,255,255,.03); color: var(--muted, #9aa3b2); font: inherit; font-size: 11px; white-space: nowrap; cursor: pointer; }
.bs-chip b { font-weight: 700; letter-spacing: .02em; }
.bs-chip .ri { flex: none; }
.bs-chip.bs-need { opacity: .6; }
.bs-chip.bs-afford { border-color: #3ee6a8; color: #dff; opacity: 1; }
.bs-chip.bs-ready { border-color: #3ee6a8; background: linear-gradient(160deg, rgba(62,230,168,.28), rgba(62,230,168,.08)); color: #fff; opacity: 1;
  box-shadow: 0 0 0 1px rgba(62,230,168,.5), 0 0 12px rgba(62,230,168,.4); animation: bsGlow 1.8s ease-in-out infinite; }
html:not(.phone-ui) .board-wrap > .build-strip .bs-ports { max-width: 150px; margin-top: 2px; }
html:not(.phone-ui) .board-wrap > .build-strip .bs-sep { display: block; flex-basis: 100%; height: 1px; margin: 1px 0 2px; background: var(--line-2); }
html:not(.phone-ui) .board-wrap > .build-strip .bs-chip { background: rgba(14,17,24,.78); backdrop-filter: blur(6px); }
html:not(.phone-ui) .board-wrap > .build-strip .bs-chip.bs-ready { background: linear-gradient(160deg, rgba(62,230,168,.38), rgba(14,17,24,.85)); }
html.phone-ui .bs-chip { min-height: 32px; padding: 2px 9px; }
/* short landscape has no spare height: the chips stand at the start of the strip, fixed, and only the pieces scroll beside them */
@media (max-height: 430px) and (orientation: landscape) {
  #game .build-strip { flex-direction: row; align-items: center; gap: 5px; }
  /* pieces keep at least 55% of the strip; the chips get at most 45% and scroll on their own (lit ones come first) */
  #game .bs-ports { order: -1; flex: 0 1 auto; max-width: 45%; flex-wrap: nowrap; gap: 4px; overflow-x: auto; scrollbar-width: none; padding-right: 6px;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 12px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 12px), transparent); }
  #game .bs-ports::-webkit-scrollbar { display: none; }
  #game .bs-row { flex: 1 1 55%; min-width: 55%; }
  .bs-chip { min-height: 30px; padding: 1px 6px; gap: 3px; font-size: 10px; }
  .bs-chip .bs-w { display: none; }
}
/* phone: a slim row right under the status, before the buttons */
html.phone-ui .build-strip { gap: 5px; padding: 7px 6px 2px 1px; }
html.phone-ui .bs-item { min-height: 34px; padding: 3px 7px 3px 4px; }
html.phone-ui .bs-ic { width: 22px; height: 22px; }
html.phone-ui .bs-ic svg { width: 18px; height: 18px; }
html.phone-ui .build-strip .bs-item { flex: 1 1 auto; justify-content: center; padding: 3px 5px; }
html.phone-ui .build-strip .bs-ic { display: none; }
html.phone-ui .build-strip .bs-name { font-size: 10px; }

/* ---------- room code chip + spectator bar ---------- */
.room-chip { display: inline-flex; align-items: center; gap: 6px; flex: none; padding: 5px 10px; border-radius: 10px; border: 1px solid var(--line-2);
  background: rgba(255,255,255,.04); color: inherit; font: inherit; cursor: pointer; white-space: nowrap; }
.room-chip:hover, .room-chip:focus-visible { border-color: #3ee6a8; }
.room-chip .rc-k { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; opacity: .65; }
.room-chip b { font-family: 'Michroma', var(--font, sans-serif); font-size: 13px; letter-spacing: .12em; }
.room-chip .rc-w { font-size: 11px; padding: 1px 6px; border-radius: 999px; background: rgba(62,230,168,.16); color: #bff5e1; }
html.phone-ui .board-wrap > .room-chip { position: absolute; top: 6px; left: 6px; z-index: 7; padding: 3px 7px; background: rgba(14,17,24,.82); backdrop-filter: blur(6px); }
html.phone-ui .board-wrap > .room-chip b { font-size: 11px; }
html.phone-ui .board-wrap > .room-chip .rc-k { display: none; }
/* spectator bar: bottom-centre of the board, clear of the top bar */
.watch-badge { top: auto !important; right: auto !important; bottom: 12px; left: 50%; transform: translateX(-50%); white-space: nowrap; }
.wb-follow { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; font-size: 12px; opacity: .9; }
.wb-follow select { font: inherit; padding: 3px 6px; border-radius: 8px; background: #151922; color: inherit; border: 1px solid var(--line-2); }
/* following a player: their cards show, read-only (no actions, no build strip) */
body.spectating.following #game .dock { display: block !important; pointer-events: none; }
body.spectating.following #game .dock #actions, body.spectating.following #game .dock #buildMenu, body.spectating.following .hand-bar button { display: none !important; }
body.spectating:not(.following) .board-wrap > .build-strip, body.spectating:not(.following) .dock .build-strip { display: none !important; }
body.spectating .build-strip .bs-item { display: none; } /* spectators following a player see only that player's trade rates */
body.spectating .bs-chip { pointer-events: none; }
/* spectators may chat and react when the host allows it */
body.spectating.spec-chat .emote, body.spectating.spec-chat #emoteBtn, body.spectating.spec-chat .board-fabs .emote { display: inline-flex !important; }
html:not(.phone-ui) .game-top > .status { min-width: 230px; flex: 1 1 auto; }
html:not(.phone-ui) .game-top > .room-chip { padding: 4px 8px; }
@media (max-width: 1450px) { html:not(.phone-ui) .game-top > .room-chip .rc-k { display: none; } html:not(.phone-ui) .game-top > .room-chip b { font-size: 11.5px; letter-spacing: .08em; } }
.wb-follow, .watch-badge > span { white-space: nowrap; }
.watch-badge { padding: 5px 6px 5px 12px; }
.wb-follow { flex-direction: row !important; margin: 0; }
.watch-badge > * { flex: none; }
html:not(.phone-ui) .game-top .top-more > button, html:not(.phone-ui) .game-top button { white-space: nowrap; }
@media (max-width: 1400px) { html:not(.phone-ui) .game-top #sndVol { display: none; } }
html.phone-ui .watch-badge { top: 6px !important; right: 6px !important; bottom: auto; left: auto; transform: none; padding: 3px 4px 3px 9px; gap: 5px; font-size: 12px; }
html.phone-ui .wb-follow { font-size: 0; gap: 0; }
html.phone-ui .wb-follow select { font-size: 12px; max-width: 96px; padding: 2px 4px; }
html.phone-ui .watch-badge button { padding: 3px 8px; }
.bot-name { background: none; border: 0; padding: 2px 4px; margin: 0; font: inherit; color: inherit; cursor: pointer; border-radius: 6px; text-align: left; }
.bot-name:hover, .bot-name:focus-visible { background: rgba(255,255,255,.07); }
.bot-name span { font-size: 11px; opacity: .6; }
.bot-name-input { font: inherit; width: 130px; padding: 3px 6px; border-radius: 6px; border: 1px solid #3ee6a8; background: #11151c; color: inherit; }
.bot-av { position: relative; display: inline-flex; cursor: pointer; }
.bot-av-cam { position: absolute; right: -4px; bottom: -4px; font-size: 10px; background: #1a1f29; border-radius: 50%; padding: 1px 2px; line-height: 1; }

/* ================= Room pass (room code) ================= */
.room-pass { position: relative; display: inline-flex; align-items: center; gap: 8px; flex: none; height: 40px; padding: 0 6px 0 11px;
  border-radius: 12px; border: 1px solid rgba(255,255,255,.14); background: linear-gradient(180deg, #1d2330, #141922);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06); color: #eef2f8; font: inherit; cursor: pointer; white-space: nowrap; }
.room-pass .rp-key { color: #f2c14e; flex: none; }
.room-pass .rp-code { font-family: 'Michroma', sans-serif; font-size: 15px; letter-spacing: .16em; line-height: 1; padding-top: 1px; font-variant-numeric: tabular-nums; }
.room-pass .rp-act { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: rgba(255,255,255,.07); color: #b9c3d3; transition: background .15s, color .15s; }
.room-pass .rp-ok { display: none; }
.room-pass:hover .rp-act, .room-pass:focus-visible .rp-act { background: rgba(62,230,168,.18); color: #3ee6a8; }
.room-pass:focus-visible { outline: 2px solid #3ee6a8; outline-offset: 2px; }
.room-pass.copied .rp-act { background: #3ee6a8; color: #062b1f; }
.room-pass.copied .rp-copy { display: none; }
.room-pass.copied .rp-ok { display: block; animation: rpOk .35s cubic-bezier(.3,1.6,.5,1); }
.room-pass .rp-eye { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; margin-left: 2px; border-radius: 999px;
  background: rgba(255,93,93,.14); color: #ffb3b3; font-size: 12px; font-weight: 700; }
.room-pass .rp-tip { position: absolute; left: 50%; top: calc(100% + 8px); transform: translate(-50%, -4px); padding: 5px 10px; border-radius: 8px;
  background: #3ee6a8; color: #062b1f; font-size: 12px; font-weight: 700; pointer-events: none; opacity: 0; transition: opacity .18s, transform .18s; z-index: 30; }
.room-pass.copied .rp-tip { opacity: 1; transform: translate(-50%, 0); }
@keyframes rpOk { from { transform: scale(.4); } to { transform: none; } }
html.phone-ui .board-wrap > .room-pass { position: absolute; top: 6px; left: 6px; z-index: 7; height: 34px; gap: 6px; padding: 0 4px 0 9px;
  background: rgba(16,20,28,.9); backdrop-filter: blur(8px); }
html.phone-ui .room-pass .rp-code { font-size: 13px; letter-spacing: .12em; }
html.phone-ui .room-pass .rp-act { width: 24px; height: 24px; }
html.phone-ui .room-pass .rp-tip { left: 0; transform: translateY(-4px); }
html.phone-ui .room-pass.copied .rp-tip { transform: none; }

/* ================= Spectator console ================= */
.spec-console { position: absolute; z-index: 8; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; align-items: center; gap: 4px;
  padding: 6px; border-radius: 18px; background: rgba(15,18,26,.88); backdrop-filter: blur(14px) saturate(1.2);
  border: 1px solid rgba(255,255,255,.1); box-shadow: 0 14px 40px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.05); color: #e9eef6; white-space: nowrap; }
.spec-console.hidden { display: none; }
.sc-live { display: flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px 0 11px; border-radius: 12px; background: rgba(255,72,72,.12); }
.sc-dot { width: 8px; height: 8px; border-radius: 50%; background: #ff4b4b; box-shadow: 0 0 0 0 rgba(255,75,75,.6); animation: scPulse 1.8s ease-out infinite; }
.sc-word { font-weight: 700; font-size: 13px; color: #ff8a8a; letter-spacing: .02em; }
@keyframes scPulse { 0% { box-shadow: 0 0 0 0 rgba(255,75,75,.55); } 70% { box-shadow: 0 0 0 7px rgba(255,75,75,0); } 100% { box-shadow: 0 0 0 0 rgba(255,75,75,0); } }
.sc-mid { display: flex; align-items: center; gap: 10px; padding: 0 8px 0 10px; }
.sc-cap { font-size: 13px; color: #aeb8c8; }
.sc-cap b { font-weight: 700; }
.sc-faces { display: flex; gap: 4px; }
.sc-face { position: relative; display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border-radius: 50%; border: 0; background: transparent; cursor: pointer;
  opacity: .62; transition: opacity .15s, transform .15s; }
.sc-face::after { content: ''; position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 2px transparent; transition: box-shadow .15s; }
.sc-face:hover, .sc-face:focus-visible { opacity: 1; transform: translateY(-1px); }
.sc-face:focus-visible { outline: none; }
.sc-face:focus-visible::after { box-shadow: 0 0 0 2px #fff; }
.sc-face.on { opacity: 1; }
.sc-face.on::after { box-shadow: 0 0 0 2px var(--pc), 0 0 12px var(--pc); }
.sc-leave { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 13px; border-radius: 12px; border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.04); color: #cdd5e2; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.sc-leave:hover, .sc-leave:focus-visible { background: rgba(255,72,72,.16); border-color: rgba(255,72,72,.45); color: #ff9a9a; outline: none; }
@media (prefers-reduced-motion: reduce) { .sc-dot, .room-pass.copied .rp-ok { animation: none; } }
/* phone: compact, top-right, faces only */
html.phone-ui .spec-console { left: auto; right: 6px; top: 6px; bottom: auto; transform: none; padding: 4px; gap: 2px; border-radius: 14px; }
html.phone-ui .sc-live { height: 30px; padding: 0 8px; }
html.phone-ui .sc-word { font-size: 12px; }
html.phone-ui .sc-cap { display: none; }
html.phone-ui .sc-mid { padding: 0 2px; }
html.phone-ui .sc-face { width: 30px; height: 30px; }
html.phone-ui .sc-face .av { width: 22px !important; height: 22px !important; font-size: 12px !important; }
html.phone-ui .sc-leave { height: 30px; padding: 0 8px; }
html.phone-ui .sc-leave span { display: none; }
html.phone-ui .spec-console { top: auto; right: auto; left: 50%; bottom: 62px; transform: translateX(-50%); }
.room-pass .rp-code { color: #f4f7fb !important; text-shadow: 0 1px 0 rgba(0,0,0,.4); }
html.phone-ui .board-wrap > .room-pass { top: 40px; }

/* ================= OBSDN Arena front page ================= */
.arena { min-height: 100vh; min-height: 100dvh; max-width: 1080px; margin: 0 auto; padding: clamp(20px, 5vw, 56px) clamp(16px, 4vw, 40px) 32px; display: flex; flex-direction: column; gap: 22px; }
.arena.hidden { display: none; }
.ar-logo { margin: 0; font-family: 'Michroma', sans-serif; font-weight: 400; font-size: clamp(30px, 6vw, 56px); letter-spacing: .06em; color: #f4f6fa; line-height: 1.05; }
.ar-logo span { color: #f2c14e; }
.ar-tag { margin: 10px 0 0; max-width: 52ch; color: #aeb8c8; font-size: clamp(14px, 1.8vw, 17px); line-height: 1.5; }
.ar-feature { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: center; gap: clamp(16px, 3vw, 36px); padding: clamp(16px, 3vw, 28px);
  border-radius: 22px; background: radial-gradient(120% 140% at 0% 0%, rgba(242,193,78,.12), transparent 55%), linear-gradient(180deg, #171c26, #10141c); border: 1px solid rgba(255,255,255,.08); }
.ar-art { display: grid; place-items: center; aspect-ratio: 1.1; border-radius: 16px; background: radial-gradient(closest-side, #1f4f6e, #0e2738 70%, transparent 100%); }
.ar-hexes { width: 92%; height: auto; filter: drop-shadow(0 10px 22px rgba(0,0,0,.45)); }
.ar-game { margin: 0; font-family: 'Michroma', sans-serif; font-weight: 400; font-size: clamp(28px, 4.4vw, 44px); letter-spacing: .14em; color: #fff; }
.ar-pitch { margin: 10px 0 14px; color: #c8d0dc; line-height: 1.55; max-width: 44ch; }
.ar-facts { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 18px; padding: 0; }
.ar-facts li { padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,.06); color: #dfe5ee; font-size: 12.5px; }
.ar-play { font-size: 17px; padding: 13px 26px; border-radius: 14px; }
.ar-sub { margin: 8px 0 0; font-size: 15px; font-weight: 600; color: #aeb8c8; }
.ar-soon { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.ar-soon li { display: flex; flex-direction: column; gap: 3px; padding: 14px; border-radius: 14px; background: rgba(255,255,255,.03); border: 1px dashed rgba(255,255,255,.12); color: #9aa4b4; }
.ar-soon .ar-ic { font-size: 22px; margin-bottom: 4px; filter: grayscale(.3); }
.ar-soon b { color: #dfe5ee; font-weight: 600; }
.ar-soon small { font-size: 12px; }
.ar-foot { margin-top: auto; padding-top: 8px; font-size: 12px; color: #6f7a8c; }
.ar-back { align-self: flex-start; margin: 0 0 6px; padding: 4px 10px; border-radius: 999px; border: 1px solid rgba(255,255,255,.12); background: transparent; color: #aeb8c8; font: inherit; font-size: 12px; cursor: pointer; }
.ar-back:hover, .ar-back:focus-visible { color: #fff; border-color: #f2c14e; }
@media (max-width: 760px) {
  .ar-feature { grid-template-columns: 1fr; }
  .ar-art { aspect-ratio: 1.5; }
  .ar-soon { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ar-play { width: 100%; }
}
#arena.screen { padding: calc(env(safe-area-inset-top) + clamp(28px, 6vw, 64px)) clamp(18px, 4vw, 40px) calc(env(safe-area-inset-bottom) + 28px); box-sizing: border-box; width: 100%; max-width: 1080px; margin: 0 auto; overflow: visible; height: auto; justify-content: flex-start; align-items: stretch; }
.h2-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.h2-top .ar-back { margin: 0; height: 30px; min-height: 0; line-height: 1; padding: 0 12px; flex: none; width: auto; }
/* phones: the home panel must not grow past the screen (long daily-challenge text pushed it 23px wide) */
.h2-panel { min-width: 0; box-sizing: border-box; }
.h2-panel > * { min-width: 0; max-width: 100%; }
@media (max-width: 760px) { #home.home2 { grid-template-columns: minmax(0, 1fr); } }

/* ---------- OBSDN Carrom ---------- */
.kind-carrom #board, .kind-carrom #dice, .kind-carrom #bankStrip, .kind-carrom #buildStrip, .kind-carrom .dock,
.kind-carrom #ckBar, .kind-carrom #tradeDrawer, .kind-carrom #players, .kind-carrom #pieceToggle, .kind-carrom #offerPop,
.kind-carrom #undoChip, .kind-carrom #bigRoll, .kind-carrom #simpleBtn, .kind-carrom #skyBtn, .kind-carrom #themeBtn,
.kind-carrom #autoRollBtn, .kind-carrom #howBtn, .kind-carrom #tip, .kind-carrom [data-tab="dice"],
.kind-carrom .zoom-ctl, .kind-carrom .cam { display: none !important; }
.kind-carrom .board-wrap { min-height: calc(100dvh - 70px); }
/* #gameHost: where a module game (see window.ArenaGames in client.js) draws; .cr-host is added by carrom.js */
#gameHost { position: relative; flex: 1 1 auto; min-height: 0; }
.cr-host { position: relative; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 46px 4px 6px; }
.cr-hud { display: flex; gap: 10px; width: min(100%, 720px); }
.cr-pl { flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 14px;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); position: relative; overflow: hidden; }
.cr-pl.turn { border-color: var(--pc); box-shadow: 0 0 0 1px var(--pc), 0 8px 26px -12px var(--pc); }
.cr-pl-t { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.cr-pl-t b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.cr-pl-t small { font-weight: 400; color: #9aa4b5; }
.cr-pl-c { font-size: 13px; color: #c9d1de; display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.cr-dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.cr-w { background: #f3e9d2; box-shadow: inset 0 0 0 2px #b39a6f; }
.cr-b { background: #2b1c12; box-shadow: inset 0 0 0 2px #6b4a33; }
.cr-q { background: #c8263b; box-shadow: 0 0 0 2px #e9c46a; }
.cr-timer { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,.08); }
.cr-timer i { display: block; height: 100%; width: 100%; background: var(--pc); transition: width .2s linear; }
.cr-timer.low i { background: #ff4d5e; }
.cr-stage { flex: 1 1 auto; width: 100%; min-height: 0; display: grid; place-items: center; }
.cr-canvas { touch-action: none; border-radius: 18px; box-shadow: 0 30px 60px -30px rgba(0,0,0,.85); }
.cr-mine .cr-canvas { cursor: grab; }
.cr-controls { width: min(100%, 560px); display: grid; gap: 4px; }
.cr-slider { width: 100%; height: 30px; accent-color: #3ee6a8; }
.cr-slider:disabled { opacity: .3; }
.cr-hint { margin: 0; text-align: center; font-size: 13px; color: #aab3c2; min-height: 1.35em; }
.cr-over { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(6,8,12,.55); backdrop-filter: blur(3px); z-index: 5; }
.cr-over.hidden { display: none; }
.cr-over-box { text-align: center; padding: 24px 26px; border-radius: 20px; background: #141a24; border: 1px solid rgba(233,196,106,.35); width: min(92%, 340px); }
.cr-over-ic { font-size: 46px; line-height: 1; }
.cr-over-box h2 { margin: 10px 0 6px; }
.cr-over-stats { list-style: none; margin: 0; padding: 0; color: #aab3c2; font-size: 14px; display: grid; gap: 3px; }
.cr-over-act { display: flex; gap: 10px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
@media (max-width: 700px) {
  .cr-host { padding: 88px 4px 46px; gap: 8px; }
  .cr-controls { padding: 0 48px; box-sizing: border-box; }
  .cr-pl { padding: 6px 8px; gap: 7px; }
  .cr-pl-t b { font-size: 13px; }
}

.ar-board { width: 100%; height: 100%; filter: drop-shadow(0 18px 28px rgba(0,0,0,.55)); }
.ar-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.lobby-carrom #lobby .settings { display: none !important; }
/* conquer lobby (the shell's panel inside #gameLobby) and its placeholder game screen */
.lobby-conquer #lobby .settings:not(.cq-settings) { display: none !important; }
.cq-settings { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.cq-settings .cq-wide { grid-column: 1 / -1; }
.cq-settings .cq-intro { margin: 0; line-height: 1.5; }
.cq-settings .cq-link { display: inline; min-height: 0; padding: 0; margin-left: 4px; border: 0; background: none; color: #f2c14e; font: inherit; text-decoration: underline; cursor: pointer; }
.cq-settings .cq-goal { margin: 0; padding: 7px 10px; border-radius: 8px; background: rgba(242,193,78,.08); border: 1px solid rgba(242,193,78,.22); line-height: 1.45; }
.cq-settings .cq-goal b { color: #f2c14e; }
.cq-start-sum { align-self: center; padding: 4px 10px; border-radius: 999px; font: 700 12px var(--ui); color: #f2c14e; background: rgba(242,193,78,.1); border: 1px solid rgba(242,193,78,.35); white-space: nowrap; }
/* conquer game screen (public/conquer.js, laid out by public/conquer.css): WATAN's board pieces stay hidden */
.kind-conquer #board, .kind-conquer #dice, .kind-conquer #bankStrip, .kind-conquer #buildStrip, .kind-conquer .dock,
.kind-conquer #ckBar, .kind-conquer #tradeDrawer, .kind-conquer #players, .kind-conquer #pieceToggle, .kind-conquer #offerPop,
.kind-conquer #undoChip, .kind-conquer #bigRoll, .kind-conquer #simpleBtn, .kind-conquer #skyBtn, .kind-conquer #themeBtn,
.kind-conquer #autoRollBtn, .kind-conquer #tip, .kind-conquer [data-tab="dice"],
.kind-conquer .zoom-ctl, .kind-conquer .cam { display: none !important; }
.cq-soon { flex: 1; display: grid; place-content: center; text-align: center; gap: 6px; min-height: 200px; color: var(--mute); }
.cq-soon b { font-family: var(--display); font-size: 28px; color: var(--fg); letter-spacing: .04em; }
.cr-settings { display: grid; gap: 10px; margin-bottom: 8px; }
.cr-set-mode { margin: 0; color: #c9d1de; line-height: 1.5; }
.cr-set-row { display: flex; align-items: center; gap: 10px; justify-content: space-between; max-width: 320px; }

/* Music: on the home and arena screens it lives in the header, so no floating control covers home actions. */
.music-home { display: none; }
body[data-screen="home"] .music-home, body[data-screen="arena"] .music-home { display: inline-flex; align-items: center; }
body[data-screen="home"] .music-btn, body[data-screen="arena"] .music-btn { display: none; }
body[data-screen="home"] .music, body[data-screen="arena"] .music { bottom: 16px; }
.h2-top { flex-wrap: wrap; }
.h2-top .music-home { margin: 0 0 0 auto; height: 30px; min-height: 0; line-height: 1; padding: 0 12px; flex: none; width: auto; }
.ar-music { position: absolute; top: 12px; right: 12px; margin: 0; }
/* reaction / quick-chat rate limit */
.emote-panel.cooling [data-rx], .emote-panel.cooling [data-say] { opacity: .45; }
.emote.cooling { opacity: .6; }
.arena { position: relative; }

/* ================= W-03: short landscape phones (about 300-430px tall) =================
   The board gets the main area. The right column keeps only what a turn needs (bank, a one-row player strip,
   hand and actions). Tap the strip to open full player stats; log and chat stay behind their round buttons. */
@media (max-height: 430px) and (orientation: landscape) {
  #game .game-grid { grid-template-columns: minmax(0, 1fr) clamp(160px, 31vw, 270px); column-gap: 4px; }
  #game #board { padding: 0; }
  #game .board-wrap > .room-pass { top: 6px; height: 30px; }
  #game .board-wrap > #feed, #game .zoom-reset { top: 40px; }
  #game .game-top { left: 50px; right: 76px; bottom: 5px; }
  #game .status { font-size: 11px; line-height: 1.2; padding: 4px 8px; display: block; -webkit-line-clamp: unset; overflow: visible; max-width: 100%; }
  #game .phone-top { gap: 4px; }
  #game #gearBtn { width: 32px; height: 32px; min-height: 32px; }
  #game .bank-strip { padding: 2px 3px; gap: 2px; }
  #game .bk-ic { display: none; }
  #game .bk { flex: 1 1 0; min-width: 0; height: 28px; }
  /* players: one compact strip (colour, points), full stats in a panel on tap */
  #game .players { grid-template-columns: repeat(auto-fit, minmax(34px, 1fr)); cursor: pointer; gap: 3px; }
  #game .players.many { grid-template-columns: repeat(auto-fit, minmax(34px, 1fr)); }
  #game .pl-m .pm-b, #game .players .pm-turn { display: none; }
  #game .pm-h { padding: 2px; gap: 2px; justify-content: center; border-radius: 6px; }
  #game .pm-n { font-size: 0; gap: 0; display: inline-flex; }
  #game .pm-n > * { font-size: 11px; }
  #game .pl.turn .pl-m { box-shadow: 0 0 0 2px #fff; }
  body.players-open #game .players { position: absolute; z-index: 60; grid-column: 2; grid-row: 2 / 5; top: 40px; right: 4px; left: auto; width: clamp(160px, 31vw, 270px); grid-template-columns: 1fr 1fr; gap: 4px; padding: 6px; background: var(--raise-2); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: 0 12px 40px rgba(0,0,0,.7); }
  body.players-open #game .players .pl-m .pm-b { display: flex; }
  body.players-open #game .players .pm-n { font-size: 11px; }
  body.players-open #game .players .pm-h { justify-content: flex-start; }
  body.players-open #game .players .pm-turn { display: flex; position: static; }
  /* room code: icon only, so it stops covering the island */
  #game .board-wrap > .room-pass { width: 34px; padding: 0; justify-content: center; gap: 0; }
  #game .room-pass .rp-code, #game .room-pass .rp-act, #game .room-pass .rp-eye { display: none; }
  #game .room-pass .rp-key { display: block; }
  /* board tools (host crown, voice) in a row at the top right */
  #game .board-tools { top: 6px; bottom: auto; right: 6px; flex-direction: row; gap: 4px; }
  #game .board-tools .icon-btn { width: 34px; height: 34px; min-height: 34px; border-radius: 8px; font-size: 16px; }
  .tap-line { stroke-width: .92; }
  .big-roll { width: 84px; height: 84px; font-size: 15px; } .big-roll span { font-size: 30px; }
  /* dock: build strip, tip + trade, hand, dev cards: every row short, hand always the full width */
  #game .dock { padding: 4px; gap: 4px; }
  #game .dock-bar .hint-btn, #game .hint-btn { min-height: 30px; height: 30px; flex-direction: row; gap: 4px; padding: 0 10px; width: auto; }
  #game .hint-btn svg { width: 16px; height: 16px; }
  #game .hand-bar { margin: 0; }
  #game .hb-l { display: none; }
  #game .hand-bar { justify-content: flex-end; }
  #game .hb-trade { min-height: 28px; }
  #game .dock-cards { flex-wrap: wrap; gap: 4px; padding: 0; }
  #game .dock-sep { display: none; }
  #game .hand { flex: 1 1 100%; justify-content: space-between; gap: 3px; }
  #game .hand .rc { flex: 1 1 0; width: auto; min-width: 0; height: 46px; }
  #game .hand .rc svg { width: 18px; height: 18px; }
  #game .hand .rc .n { font-size: 13px; }
  #game .dev-btn { flex: 1 1 100%; width: auto; flex-direction: row; gap: 8px; min-height: 28px; height: 28px; padding: 0 8px; }
  #game .dev-btn svg { width: 14px; height: 14px; }
  #game .dev-btn span { font-size: 10px; }
}

/* W-03: Carrom has no side column; on short landscape screens its table gets the whole width */
@media (max-height: 430px) and (orientation: landscape) {
  .kind-carrom #game .game-grid { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
  .kind-carrom #game .board-wrap { grid-column: 1; grid-row: 1; min-height: 0; }
  .kind-carrom #game .phone-top { position: fixed; top: 6px; right: 6px; z-index: 30; grid-column: auto; grid-row: auto; }
  .kind-carrom #game .phone-top .bank-strip { display: none; }
  .kind-carrom #game .players { display: none; }
}
@media (max-height: 430px) and (orientation: landscape) {
  /* the table is a square, so it takes the height; players and the striker slider sit in a column beside it */
  .kind-carrom .cr-host { display: grid; grid-template-columns: minmax(0, 1fr) clamp(150px, 28vw, 240px); grid-template-rows: auto minmax(0, 1fr); gap: 6px; padding: 4px 4px 4px 50px; align-items: start; }
  .kind-carrom .cr-hud { grid-column: 2; grid-row: 1; flex-direction: column; gap: 4px; width: 100%; padding-top: 38px; box-sizing: border-box; }
  .kind-carrom .cr-pl { padding: 4px 6px; gap: 6px; }
  .kind-carrom .cr-stage { grid-column: 1; grid-row: 1 / 3; height: 100%; align-self: stretch; }
  .kind-carrom .cr-controls { grid-column: 2; grid-row: 2; padding: 0; width: 100%; align-self: end; }
  .kind-carrom .cr-hint { font-size: 11px; }
}
@media (max-height: 430px) and (orientation: landscape) {
  .kind-carrom .cr-pl { flex: 0 0 auto; }
  .kind-carrom #game .game-top { right: calc(clamp(150px, 28vw, 240px) + 12px); }
  .kind-carrom #game .board-tools { right: 48px; }
  .kind-carrom #game .phone-top { top: 6px; }
}

/* W-03 review: in short landscape no floating control sits over the island.
   Chip, chat, log and emote make one row along the top-left; the board keeps clear strips top and bottom. */
@media (max-height: 430px) and (orientation: landscape) {
  #game #board { padding: 34px 0 36px; }
  #game .board-wrap > .room-pass { top: 4px; left: 4px; }
  #game .board-fabs { flex-direction: row; top: 3px; bottom: auto; left: 38px; gap: 4px; }
  #game .board-fabs .log-btn, #game .board-fabs #emoteBtn, #game .board-fabs #chatFab { width: 30px; height: 30px; min-height: 30px; }
  #game .board-wrap > .room-pass { top: 3px; left: 3px; height: 30px; width: 30px; }
  #game .board-tools .icon-btn { width: 30px; height: 30px; min-height: 30px; }
  #game .game-top { bottom: 2px; }
  #game .dice { bottom: 0; }
  #game .board-tools { top: 4px; right: 4px; }
  #game .board-wrap > #feed, #game .zoom-reset { top: 4px; }
  #game .dice { bottom: 3px; }
  /* build strip: tighter cards and a fade on the right edge says there is more to scroll */
  #game .build-strip .bs-item { padding: 3px 4px 3px 3px; gap: 3px; }
  #game .build-strip .bs-name { font-size: 10px; }
}
@media (max-height: 560px) and (orientation: landscape) {
  #game .bs-row { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 22px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 22px), transparent); padding-right: 14px; }
}

/* W-05: points to win. Pending/saved/forced note under the field, and the target in play. */
.vp-note { grid-column: 1 / -1; margin: -6px 0 0; min-height: 0; }
.vp-note:empty { display: none; }
.vp-note.warn { color: #f0b429; }
.map-fixed { margin: 6px 0 0; color: var(--ink-2, #c9d0dc); border-left: 3px solid #d9a92a; padding-left: 8px; }
.race-to { align-self: flex-start; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 3px 10px; border-radius: 999px; background: var(--raise-2); border: 1px solid var(--line-2); color: #f0c419; }
.map-board.mode-map #setMap, .map-board.mode-map #mapPreview { cursor: default; }
@media (max-height: 560px) and (orientation: landscape), (pointer: coarse) and (orientation: landscape) and (max-width: 1400px) {
  #game .race-to { grid-column: 2; grid-row: 3; align-self: start; justify-self: start; font-size: 10px; padding: 1px 8px; margin: 0; line-height: 1.5; }
}
@media (max-width: 760px) and (orientation: portrait) { #game .race-to { padding: 2px 9px; font-size: 11px; margin-left: 2px; } }
.mm-ask { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; margin: 6px 0; border: 1px solid #d9a92a; border-radius: 8px; background: var(--raise-2); }
.mm-ask.hidden { display: none; }
.mm-ask span { flex: 1 1 200px; }

/* ---------- Counteroffers ---------- */
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.cq { display: inline-flex; align-items: center; gap: 3px; padding: 1px 6px 1px 4px; border-radius: 8px; background: var(--c); color: #fff; border: 1px solid rgba(255,255,255,.18); font-size: 12px; white-space: nowrap; vertical-align: middle; }
.cq b { font: 600 13px var(--mono); }
.cq-plus { margin: 0 3px; color: var(--mute); }
.dr-resp .resp.counter { grid-template-columns: 12px minmax(0, 1fr); row-gap: 6px; align-items: start; padding: 8px 8px 8px 10px; border-color: var(--gold); }
.resp.counter .dot { margin-top: 5px; }
.resp.counter .ctext { line-height: 1.9; font-size: 13px; min-width: 0; }
.resp.counter .cbtns { grid-column: 1 / -1; display: flex; gap: 6px; }
.resp.counter .cbtns > button { flex: 1 1 0; min-height: 34px; padding: 0 8px; }
.op-note.counter { color: var(--fg); border: 1px solid var(--gold); }
.drawer.counter .dr-btns { margin-top: 2px; }
.drawer.counter .ctr-orig { text-align: left; }
@media (max-width: 760px), (max-height: 560px), (pointer: coarse) and (max-width: 1400px) {
  /* The counter sheet stays low and short: the board and the turn banner above it stay visible. */
  #game .drawer.counter { max-height: 58%; gap: 6px; }
  #game .drawer.counter .ctr-pick { flex-direction: row; align-items: center; gap: 6px; }
  #game .drawer.counter .ctr-pick .op-l { width: 48px; flex: none; }
  #game .drawer.counter .ctr-pick .dr-want { flex: 1; }
  #game .drawer.counter .ctr-pick .want { min-height: 32px; }
  #game .drawer.counter .ctr-orig { display: none; }
}
@media (max-height: 400px) {
  #game .drawer, #game .drawer.counter { max-height: 72%; }
  #game .drawer.counter .zone { min-height: 36px; }
}
@media (max-height: 400px) {
  #game .drawer.counter .ctr-pick .op-l { width: 30px; font-size: 8px; line-height: 1.1; }
  #game .drawer.counter .ctr-pick .dr-want { min-width: 0; gap: 4px; }
  #game .drawer.counter .ctr-pick .want { min-width: 0; padding: 0; }
}
.op-grace { font-size: 12px; line-height: 1.35; color: var(--gold); text-align: center; }
