/* Brass: Birmingham — shared page furniture (home, lobby, pop-ups) in brick and brass colours, then the table:
   players down both edges, the pinch-and-zoom map in the middle, your cards along the bottom. */
:root {
  --felt-glow: #9a6040;
  --felt: #5a3726;
  --felt-dark: #22150d;
  --sheet: #2e1f15;
  --panel: rgba(34, 21, 13, 0.88);
  --text: #f6efe2;
  --muted: #cdb9a0;
  --gold: #f5b700;
  --gold-deep: #c98a00;
  --win: #4be08c;
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --top-h: 44px;
  --col-w: clamp(124px, 18vw, 178px);
  --hand-h: clamp(50px, 15vh, 70px);
}
input { -webkit-user-select: text; user-select: text; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }

/* ---------- home, lobby, pop-ups ---------- */
.brand-icons { display: flex; justify-content: center; gap: 6px; font-size: 26px; }
.brand-icons span { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 10px; background: rgba(255,255,255,.1); border: 1px solid rgba(245,183,0,.4); }
.panel h2 { margin: 0 0 8px; font-size: 20px; display: flex; align-items: center; gap: 8px; }
.field { display: block; margin: 8px 0 4px; }
.field span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.field input { width: 100%; font-size: 20px; padding: 12px 14px; border-radius: 12px; border: 2px solid rgba(255,255,255,.15); background: rgba(0,0,0,.3); color: var(--text); outline: none; }
.row { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.btn { border: 0; border-radius: 12px; padding: 12px 18px; font-size: 17px; font-weight: 700; background: rgba(255,255,255,.12); }
.btn.gold:disabled { filter: grayscale(.8); opacity: .6; }
.btn.ghost { background: transparent; border: 2px solid rgba(255,255,255,.25); }
.btn.danger { background: #a3242f; }
.btn.small { padding: 7px 12px; font-size: 15px; }
.linkbtn { display: block; text-align: center; text-decoration: none; margin-top: 8px; }
.live-dot { display: inline-block; }
.game-list { display: flex; flex-direction: column; gap: 8px; }
.game-item { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: rgba(255,255,255,.06); }
.game-item .code { font-family: ui-monospace, Menlo, Consolas, monospace; background: rgba(0,0,0,.35); padding: 2px 6px; border-radius: 6px; font-size: 13px; margin-left: 6px; }
.code-row { display: flex; align-items: baseline; justify-content: space-between; }
.code-row strong { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 30px; color: var(--gold); letter-spacing: 4px; }
.seat-list { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 8px; }
.seat-list li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,.06); flex-wrap: wrap; }
.seat-list li.empty { opacity: .6; border: 2px dashed rgba(255,255,255,.2); background: transparent; }
.seat-list .tag { font-size: 12px; color: var(--muted); }
.bot-tag { font-size: 12px; color: var(--muted); font-weight: 400; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 18px; border: 2px solid rgba(255,255,255,.9); box-shadow: 0 2px 6px rgba(0,0,0,.4); flex: none; text-shadow: 0 1px 2px rgba(0,0,0,.4); }
.back-link { display: inline-block; color: var(--muted); text-decoration: none; font-weight: 700; font-size: 15px; padding: 4px 0; }
#historyBtn { margin-top: 4px; }
.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 12px; animation: fade .2s ease-out; }
.sheet.wide { width: 900px; }
.sheet h2 { margin: 0 0 10px; font-family: Georgia, serif; padding-right: 36px; }
.sheet h3 { margin: 14px 0 6px; font-size: 16px; }
.sheet .btn.ghost, .sheet .btn.danger { width: 100%; margin-top: 8px; }
.sheet .row .btn { width: auto; }
.rules h3 { color: var(--text); margin: 0 0 4px; font-size: 15px; }
.rules p { margin: 5px 0; }
.claim-list { display: flex; flex-direction: column; gap: 8px; }
.claim-list button { padding: 10px; border-radius: 12px; border: 0; background: rgba(255,255,255,.08); font-size: 17px; font-weight: 700; text-align: left; }
.win-tally { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.win-chip b { color: var(--gold); margin-left: 4px; }
.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: rgba(255,255,255,.06); border-radius: 12px; }
.history-item.incomplete .hi-title { color: var(--muted); }
.hi-main { flex: 1; min-width: 0; }
.hi-date { font-size: 12px; color: var(--muted); }
.hi-title { font-size: 16px; margin: 2px 0; }
.hi-sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hi-del { border: 0; background: rgba(0,0,0,.25); border-radius: 10px; width: 36px; height: 36px; font-size: 16px; flex: none; }
.score-table-wrap { overflow-x: auto; }
table.scores { border-collapse: collapse; width: 100%; font-size: 15px; }
table.scores th, table.scores td { padding: 6px 8px; text-align: center; border-bottom: 1px solid rgba(255,255,255,.08); white-space: nowrap; }
table.scores td.rd { text-align: left; }
table.scores tr.current td { background: rgba(245,183,0,.15); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; border: 1px solid rgba(255,255,255,.6); }
.none { color: var(--muted); font-size: 13px; }
.rotate { display: none; }
@media (orientation: portrait) {
  body.in-game .rotate { display: flex; position: fixed; inset: 0; z-index: 100; flex-direction: column; align-items: center; justify-content: center; background: var(--felt-dark); font-size: 20px; font-weight: 700; }
  .rotate-phone { font-size: 80px; animation: turn 2s ease-in-out infinite; }
}
.round-intro { position: fixed; left: 50%; top: 45%; transform: translate(-50%, -50%); text-align: center; z-index: 31; animation: rise .4s ease-out; pointer-events: none; }
.round-intro.out { animation: fadeOut .3s ease-in forwards; }
.round-intro .ri-round { font-family: Georgia, serif; font-size: 11vh; font-weight: 900; color: #fff; text-shadow: 0 4px 0 rgba(0,0,0,.35), 0 0 30px rgba(0,0,0,.6); white-space: nowrap; }
.round-intro .ri-dealer { margin-top: 6px; font-size: 3.6vh; font-weight: 700; text-shadow: 0 2px 4px rgba(0,0,0,.8); }
.celebrate { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 70; pointer-events: none; }
.your-turn-flash { position: absolute; inset: 0; z-index: 25; pointer-events: none; box-shadow: inset 0 0 60px 10px rgba(245,183,0,.7); animation: fadeOut 1.2s ease-out forwards; }
#scores, #menu, #mat { z-index: 65; }

/* ---------- the table ---------- */
#table { overflow: hidden; touch-action: none; }
.felt { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 40%, #6e4430 0%, var(--felt) 45%, var(--felt-dark) 100%); }
.topbar { position: absolute; top: 0; left: 0; right: 0; height: var(--top-h); display: flex; align-items: center; gap: 8px; padding: 0 calc(8px + var(--safe-r)) 0 calc(8px + var(--safe-l)); z-index: 5; }
.round-info { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; white-space: nowrap; }
.turn-pill { padding: 4px 12px; border-radius: 999px; background: rgba(0,0,0,.4); font-size: 15px; }
.turn-pill.mine { background: var(--gold); color: #3a2800; box-shadow: 0 0 14px rgba(245,183,0,.7); }
.last-move { flex: 1; min-width: 0; font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }
.last-move b { color: var(--text); }
.top-buttons { display: flex; gap: 5px; }
.icon-btn { height: 34px; min-width: 34px; padding: 0 7px; border-radius: 10px; border: 0; background: rgba(0,0,0,.35); font-size: 16px; display: flex; align-items: center; justify-content: center; }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
#tutorBtn { opacity: .55; }
#tutorBtn.on { opacity: 1; box-shadow: inset 0 0 0 2px var(--gold); }

.col { position: absolute; top: var(--top-h); bottom: calc(6px + var(--safe-b)); width: var(--col-w); display: flex; flex-direction: column; justify-content: space-between; gap: 6px; z-index: 3; overflow: hidden; }
.col.left { left: calc(6px + var(--safe-l)); }
.col.right { right: calc(6px + var(--safe-r)); }
.col-players { display: flex; flex-direction: column; gap: 6px; }
.pchip { background: rgba(20,12,7,.75); border: 2px solid var(--pc); border-radius: 12px; padding: 5px 7px; cursor: pointer; }
.pchip.turn { box-shadow: 0 0 0 2px var(--gold), 0 0 16px 4px rgba(245,183,0,.6); animation: glowPulse 1.4s ease-in-out infinite; }
.pchip.me { background: rgba(40,24,12,.9); }
.pc-head { display: flex; align-items: center; gap: 5px; }
.pc-head .avatar { width: 24px; height: 24px; font-size: 12px; border-width: 1.5px; }
.pc-name { flex: 1; min-width: 0; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-order { font-size: 11px; font-weight: 900; background: rgba(255,255,255,.18); border-radius: 999px; min-width: 18px; height: 18px; display: grid; place-items: center; }
.pc-stats { display: flex; justify-content: space-between; font-size: clamp(14px, 4vh, 17px); font-weight: 800; margin-top: 2px; }
.st-money { color: #9fe0a0; }
.st-inc.neg { color: #ff8a80; }
.st-vp { color: var(--gold); }
.pc-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.markets { background: rgba(20,12,7,.75); border-radius: 12px; padding: 5px 7px; font-size: 13px; }
.mk-row { display: flex; justify-content: space-between; font-weight: 700; margin-top: 2px; }
.mk-price { color: var(--gold); }
.ladder { display: flex; gap: 2px; margin: 2px 0 3px; }
.lc { flex: 1; height: 9px; border-radius: 2px; background: rgba(255,255,255,.14); }
.lc.coal.on { background: #111; box-shadow: inset 0 0 0 1px #777; }
.lc.iron.on { background: #e07b1a; }
.mk-deck { color: var(--muted); font-size: 12px; margin-top: 2px; }

.map-wrap { position: absolute; top: var(--top-h); bottom: calc(var(--hand-h) + 10px + var(--safe-b)); left: calc(var(--col-w) + 12px + var(--safe-l)); right: calc(var(--col-w) + 12px + var(--safe-r)); border-radius: 12px; overflow: hidden; background: #3b2a1c; touch-action: none; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.map { width: 100%; height: 100%; display: block; }
.zoom-btns { position: absolute; right: 6px; bottom: 6px; display: flex; flex-direction: column; gap: 4px; z-index: 4; }
.zb { width: 34px; height: 34px; border-radius: 9px; border: 0; background: rgba(0,0,0,.55); font-size: 18px; font-weight: 800; }
.prompt { position: absolute; top: 6px; right: 6px; z-index: 6; display: flex; align-items: center; gap: 8px; background: var(--gold); color: #3a2800; font-weight: 800; font-size: 15px; padding: 5px 6px 5px 12px; border-radius: 999px; box-shadow: 0 4px 14px rgba(0,0,0,.5); animation: rise .2s ease-out; max-width: calc(100% - 12px); }
.prompt .btn.ghost { border-color: rgba(58,40,0,.5); color: #3a2800; }
.prompt .btn.gold { background: #fff3c4; box-shadow: none; }

.action-bar { position: absolute; left: calc(var(--col-w) + 18px + var(--safe-l)); right: calc(var(--col-w) + 58px + var(--safe-r)); bottom: calc(var(--hand-h) + 16px + var(--safe-b)); z-index: 6; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; padding: 5px 8px; border-radius: 14px; background: rgba(20,12,7,.85); box-shadow: 0 4px 16px rgba(0,0,0,.5); }
.ab-hint { font-weight: 700; font-size: 15px; display: inline-flex; align-items: center; gap: 6px; }
.action-bar .btn.small { padding: 7px 12px; font-size: 16px; }

.hand-strip { position: absolute; left: calc(var(--col-w) + 12px + var(--safe-l)); right: calc(var(--col-w) + 12px + var(--safe-r)); bottom: calc(4px + var(--safe-b)); height: var(--hand-h); display: flex; align-items: flex-end; gap: 8px; z-index: 4; }
.hand-cards { flex: 1; display: flex; gap: 4px; align-items: flex-end; justify-content: center; min-width: 0; }
.discard-top { flex: none; opacity: .8; }
.bcard { position: relative; width: min(11.5%, 88px); height: calc(var(--hand-h) - 4px); border-radius: 8px; background: #fbf5e6; color: #2a1a10; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding: 0 2px 3px; box-shadow: 0 2px 6px rgba(0,0,0,.5); border: 2px solid #fff; overflow: hidden; transition: transform .15s, opacity .15s; }
.bcard::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 32%; background: #7a6a55; }
.bcard.town::before { background: var(--rc); }
.bcard.ind::before { background: #3a2a1c; }
.bcard.wild { background: linear-gradient(160deg, #fff3c4, #f5d27a); }
.bcard.wild::before { background: var(--gold-deep); }
.bc-icon { position: relative; font-size: clamp(16px, 5vh, 22px); line-height: 1.1; margin-top: auto; }
.bc-name { position: relative; font-size: clamp(10.5px, 3.2vh, 13px); font-weight: 800; text-align: center; line-height: 1.05; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.bcard.live { cursor: pointer; }
.bcard.can { box-shadow: 0 0 0 3px var(--gold), 0 0 14px 4px rgba(245,183,0,.7); cursor: pointer; animation: glowPulse 1.2s ease-in-out infinite; }
.bcard.dim { opacity: .35; }
.bcard.picked { transform: translateY(-8px); box-shadow: 0 0 0 3px var(--gold), 0 8px 16px rgba(0,0,0,.5); }
.bcard.mini { width: 46px; height: 34px; border-radius: 5px; border-width: 1px; padding: 0 1px 1px; flex: none; }
.bcard.mini .bc-icon { font-size: 12px; }
.bcard.mini .bc-name { font-size: 8.5px; }

/* the map */
.p-box { fill: #f7efdc; stroke: var(--rc, #7a8f4a); stroke-width: 3; }
.place.farm .p-box { fill: #e6edd2; stroke: #7a8f4a; }
.p-name { font: 700 14px "Trebuchet MS", sans-serif; fill: #3a2a1a; text-anchor: middle; }
.slot { fill: rgba(255,255,255,.55); stroke: #9c8a66; stroke-width: 1.5; stroke-dasharray: 4 3; }
.s-icon { font-size: 20px; text-anchor: middle; opacity: .8; }
.s-icon.two { font-size: 15px; }
.t-owner { stroke: #1a120a; stroke-width: 1.5; }
.t-icon { font-size: 19px; text-anchor: middle; }
.flipped .t-icon { font-size: 15px; }
.t-lvl { font: 900 10px sans-serif; fill: #1a120a; }
.flipped .t-lvl { fill: #f5d27a; }
.t-vp { font: 900 11px sans-serif; fill: #f5b700; text-anchor: middle; }
.cube.coal { fill: #151515; stroke: #888; stroke-width: .6; }
.cube.iron { fill: #e07b1a; stroke: #6a3500; stroke-width: .6; }
.cube.beer { fill: #f0b429; stroke: #7a4f00; stroke-width: .6; }
.tile { transform-box: fill-box; transform-origin: center; }
.tile.fresh { animation: tilePop .6s cubic-bezier(.2,1.6,.4,1); }
.tile.flipping { animation: tileFlip .7s ease-in-out; }
.tile.hl .t-owner { stroke: #fff; stroke-width: 4; animation: hlPulse 1s ease-in-out infinite; }
.l-open { stroke-width: 4; stroke-dasharray: 10 7; stroke-linecap: round; fill: none; }
.link.open.canal .l-open { stroke: #3f7fbf; }
.link.open.rail .l-open { stroke: #4a3a2a; }
.link.open.other .l-open { stroke: #8a7a5a; opacity: .22; }
.link.open.hl .l-open { stroke: #f5b700; stroke-width: 10; stroke-dasharray: none; opacity: 1; animation: hlPulse 1s ease-in-out infinite; }
.l-edge { stroke: #1a120a; stroke-width: 15; stroke-linecap: round; }
.l-body { stroke-width: 10; stroke-linecap: round; }
.link.canal .l-mark { stroke: #9fd3ff; stroke-width: 2.5; }
.link.rail .l-mark { stroke: #1a120a; stroke-width: 3; stroke-dasharray: 2 7; }
.link.built.fresh { animation: fade .8s ease-out; }
.l-hit { stroke: transparent; stroke-width: 26; }
.m-box { fill: #33414f; stroke: #c9a227; stroke-width: 2; }
.m-name { font: 700 14px "Trebuchet MS", sans-serif; fill: #fff; text-anchor: middle; }
.m-space { fill: #f7efdc; }
.m-space.blank { fill: #7c7c7c; opacity: .5; }
.m-icon { font-size: 16px; text-anchor: middle; }
.m-icon.any { font-size: 8.5px; }
.m-beer { fill: #f0b429; stroke: #7a4f00; stroke-width: 1; }
.m-bonus { font: 700 11px sans-serif; fill: #ffe9a8; text-anchor: middle; }
.merchant.inactive { opacity: .35; }
.merchant.hl .m-box { stroke: #f5b700; stroke-width: 6; animation: hlPulse 1s ease-in-out infinite; }
.place.hl .p-box { stroke: #f5b700; stroke-width: 7; animation: hlPulse 1s ease-in-out infinite; }

/* choosers and windows */
.choose-list { display: flex; flex-direction: column; gap: 8px; }
.choice { text-align: left; border: 2px solid rgba(245,183,0,.5); border-radius: 12px; background: rgba(255,255,255,.07); padding: 10px 12px; font-size: 17px; }
.choice b { display: block; }
.choice small { display: block; color: var(--muted); font-size: 14px; margin-top: 2px; }
.choice:active { background: rgba(245,183,0,.25); }
.mat { display: flex; flex-direction: column; gap: 8px; }
.mat-row { display: flex; gap: 8px; align-items: flex-start; }
.mat-ind { width: 130px; flex: none; font-weight: 800; font-size: 15px; padding-top: 6px; }
.mat-tiles { display: flex; flex-wrap: wrap; gap: 6px; }
.mt { display: flex; flex-direction: column; font-size: 12.5px; padding: 5px 8px; border-radius: 8px; background: rgba(255,255,255,.07); min-width: 120px; }
.mt b { font-size: 16px; }
.mt.next { background: rgba(245,183,0,.18); outline: 2px solid rgba(245,183,0,.6); }
.mt em { color: #ffb4a8; font-style: normal; font-size: 12px; }
.mt-n { position: absolute; margin-left: 28px; margin-top: 1px; font-weight: 800; color: var(--gold); }

/* the tutor */
.coach { position: absolute; left: 6px; top: 6px; z-index: 7; width: min(330px, 52%); max-height: calc(100% - 56px); overflow-y: auto; touch-action: pan-y; background: #fff8e6; color: #2a1a10; border: 2px solid #c9a227; border-radius: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.5); font-size: 14.5px; line-height: 1.35; animation: rise .25s ease-out; }
.coach.min { width: auto; border: 0; background: none; box-shadow: none; overflow: visible; }
.coach-open { border: 2px solid #c9a227; background: #fff8e6; color: #2a1a10; border-radius: 999px; padding: 5px 12px; font-weight: 800; box-shadow: 0 3px 10px rgba(0,0,0,.4); }
.coach-head { display: flex; align-items: center; gap: 4px; padding: 6px 6px 2px 10px; font-weight: 900; font-size: 15px; position: sticky; top: 0; background: #fff8e6; }
.coach-head span { flex: 1; }
.coach-head button { width: 28px; height: 28px; border-radius: 8px; border: 0; background: rgba(0,0,0,.08); font-weight: 900; }
.coach-text { padding: 2px 10px 8px; }
.coach-text small { color: #6a5540; font-size: 13.5px; }
.coach-btns { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 10px 10px; }
.coach .btn.ghost { border-color: rgba(42,26,16,.35); color: #2a1a10; }
.coach .btn.gold { color: #3a2800; }

@keyframes tilePop { from { transform: scale(.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes tileFlip { 0%, 100% { transform: scaleX(1); } 50% { transform: scaleX(0.05); } }
@keyframes hlPulse { 0%, 100% { stroke-opacity: 1; } 50% { stroke-opacity: .35; } }
@keyframes glowPulse { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.18); } }

/* short screens (phones held sideways) */
@media (max-height: 420px) {
  :root { --top-h: 40px; }
  .round-info { font-size: 14px; }
  .turn-pill { font-size: 14px; padding: 3px 10px; }
  .pc-sub { display: none; }
}
