/* Boom Town: newsprint + board-game palette */
:root {
  --paper: #f5eedc;
  --paper2: #ebe2ca;
  --card: var(--card);
  --ink: #1d1a16;
  --muted: #6d655a;
  --line: #d8cdb2;
  --red: #c8312b;
  --green: #1e7a46;
  --gold: #c99a2e;
  --blue: #1f4fa3;
  --shadow: 0 2px 0 #d8cdb2, 0 8px 24px rgba(40, 30, 10, 0.08);
  --surface: #ffffff;
  --newsprint: #fbf7ea;
  --paper-line: #c9bd9d;
  --hl: #fff3c4;
  --hl2: #fff8e1;
  --good-bg: #e6f4ea;
  --bad-bg: #fde8e6;
  --info-bg: #eef1f6;
  --cell: #f3ecd8;
  --cell2: #e6dcc0;
  --btn: #1d1a16;
  --btn-fg: #f5eedc;
  --toast-bg: #1d1a16;
  --toast-fg: #f5eedc;
  --header-bg: #1d1a16;
  --header-fg: #f5eedc;
  --board-line: #1d1a16;
  color-scheme: light;
  --serif: Georgia, "Times New Roman", "DejaVu Serif", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--paper); color: var(--ink); font: 16px/1.4 var(--sans); }
button, input, select { font: inherit; color: inherit; }
a { color: var(--blue); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.center { text-align: center; }
.up { color: var(--green); }
.down { color: var(--red); }
.fine { font-size: 0.82em; color: var(--muted); margin: 6px 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0; }
.loading, .center-msg { padding: 15vh 20px; text-align: center; font-family: var(--serif); font-size: 1.4em; }

.logo { font-family: var(--serif); font-weight: 900; letter-spacing: -0.02em; margin: 0; font-size: 3rem; }
.logo::before { content: "🏙️ "; }
.logo.small { font-size: 1.7rem; }

/* buttons */
.btn { background: var(--btn); color: var(--btn-fg); border: 0; border-radius: 10px; padding: 10px 16px; font-weight: 700;
  cursor: pointer; box-shadow: 0 3px 0 #000; transition: transform 0.05s; touch-action: manipulation; }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #000; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.big { padding: 14px 20px; font-size: 1.1em; width: 100%; margin: 6px 0; }
.btn.huge { padding: 22px; font-size: 1.4em; width: 100%; margin: 8px 0; background: var(--red); box-shadow: 0 4px 0 #7b1914; }
.btn.alt { background: var(--blue); box-shadow: 0 3px 0 #0e2b5e; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.btn.danger { background: var(--red); box-shadow: 0 3px 0 #7b1914; }
.btn.sm { padding: 7px 11px; font-size: 0.88em; border-radius: 8px; }
.btn.on { background: var(--green); box-shadow: 0 3px 0 #0d4426; }
.btn-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 8px 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); margin-bottom: 14px; }
.card h2, .card h3 { margin: 0 0 8px; font-family: var(--serif); }
.code-pill { display: inline-block; background: var(--ink); color: var(--paper); padding: 4px 12px; border-radius: 999px; font-weight: 700; letter-spacing: 0.08em; }
.tok { font-size: 1.4em; line-height: 1; }
.tok.big { font-size: 2.6em; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: var(--gc, #999); margin-right: 6px; vertical-align: -1px; border: 1px solid rgba(0,0,0,.2); }
.term { border-bottom: 1px dotted currentColor; cursor: help; }

/* forms */
.f { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; }
.f > span { font-weight: 600; }
.f small { display: block; font-weight: 400; color: var(--muted); font-size: 0.85em; }
.f input, .f select, .row input, .row select, .manual select, .repairs input, .advance select, .auction-start input, .contract select {
  padding: 10px; border: 2px solid var(--line); border-radius: 10px; background: var(--surface); min-width: 0; }
.f.check { flex-direction: row; align-items: flex-start; gap: 10px; }
.f.check input { width: 22px; height: 22px; margin-top: 1px; flex: none; accent-color: var(--ink); }
.row input { flex: 1 1 100px; }

/* toasts */
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 84px; z-index: 50; width: min(560px, 94vw); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { background: var(--toast-bg); color: var(--toast-fg); padding: 12px 16px; border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.25); animation: tin .25s ease-out; transition: opacity .5s, transform .5s; }
.toast.good { background: var(--green); }
.toast.warn { background: var(--red); }
.toast.big { background: var(--gold); color: var(--ink); font-weight: 700; font-size: 1.05em; }
.toast.rent { background: #5b3b8c; }
.toast.ai { background: var(--blue); font-weight: 700; }
.toast.out { opacity: 0; transform: translateY(10px); }
body.tv #toasts { top: 74px; bottom: auto; left: auto; right: 18px; transform: none; width: min(460px, 34vw); }
body.phone #toasts { bottom: 82px; pointer-events: auto; }
body.phone #toasts .toast { cursor: pointer; }
@keyframes tin { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* reactions */
.reaction { position: fixed; bottom: 10vh; z-index: 60; display: flex; flex-direction: column; align-items: center; animation: rise 3.2s ease-out forwards; pointer-events: none; }
.r-emoji { font-size: 4rem; }
.r-name { background: var(--toast-bg); color: var(--toast-fg); border-radius: 999px; padding: 2px 10px; font-size: .9rem; }
@keyframes rise { from { transform: translateY(0); opacity: 1; } to { transform: translateY(-60vh); opacity: 0; } }

/* ------------------------------------------------ home */
.home-wrap { max-width: 640px; margin: 0 auto; padding: 8vh 20px; text-align: center; }
.tagline { font-family: var(--serif); font-size: 1.2em; color: var(--muted); }
.joinbox { margin: 24px 0; display: flex; gap: 8px; align-items: flex-end; justify-content: center; flex-wrap: wrap; }
.joinbox label { display: flex; flex-direction: column; text-align: left; gap: 4px; font-weight: 600; }
.joinbox input { padding: 12px; font-size: 1.4em; letter-spacing: .2em; width: 160px; text-transform: uppercase; border: 2px solid var(--line); border-radius: 10px; }
.saved ul { list-style: none; padding: 0; text-align: left; }
.saved li a { display: block; padding: 10px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; color: var(--ink); text-decoration: none; }
.home footer { margin-top: 40px; color: var(--muted); font-size: .8em; }

/* ------------------------------------------------ settings */
.presets { display: flex; gap: 8px; }
.preset { flex: 1; padding: 12px; border-radius: 10px; border: 2px solid var(--ink); background: transparent; font-weight: 800; cursor: pointer; font-size: 1.05em; }
.preset.on { background: var(--ink); color: var(--paper); }
.preset-help { color: var(--muted); }
.set-sec { border-top: 1px solid var(--line); padding: 6px 0; }
.set-sec summary { font-weight: 800; font-family: var(--serif); font-size: 1.1em; cursor: pointer; padding: 6px 0; }
.set-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 0 18px; }

/* ------------------------------------------------ TV */
body.tv { font-size: clamp(15px, 1.15vw, 22px); overflow-x: hidden; }
.tv-head { display: flex; align-items: center; gap: 18px; padding: 10px 22px; border-bottom: 3px double var(--ink); background: var(--paper2); flex-wrap: wrap; }
.head-stats { display: flex; gap: 16px; flex-wrap: wrap; flex: 1; color: var(--muted); font-weight: 600; }
.paused { color: var(--red); }
.host-mini { display: flex; gap: 8px; }
.setup-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; padding: 20px; }
.setup-side { position: sticky; top: 20px; align-self: start; }
.challenge-box { margin-top: 12px; padding: 10px; background: var(--paper2); border-radius: 10px; }

.lobby { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 24px; padding: 24px; min-height: 100vh; }
.lobby-join { text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.qr { width: min(42vh, 90%); background: var(--surface); padding: 10px; border-radius: 16px; border: 3px solid var(--ink); margin: 12px 0; }
.join-code { font-family: var(--serif); font-weight: 900; font-size: 5rem; letter-spacing: .15em; line-height: 1; }
.join-url { font-size: 1.2em; }
.ptiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.ptile { border: 3px solid var(--pc, #999); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; align-items: center; gap: 4px; background: var(--surface); animation: pop .3s; }
.ptile.ai { border-style: dashed; border-color: var(--muted); }
.ptile small { color: var(--muted); }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }

.play-grid { display: grid; grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.3fr) minmax(0, 1fr); gap: 18px; padding: 18px; }
.groups { list-style: none; padding: 0; margin: 0; }
.groups li { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 4.2em; align-items: center; gap: 10px; padding: 3px 0; border-bottom: 1px dashed var(--line); }
.g-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.g-bar { height: 12px; background: var(--paper2); border-radius: 6px; position: relative; overflow: hidden; }
.g-bar::after { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: var(--ink); opacity: .35; }
.g-bar span { display: block; height: 100%; background: var(--gc); border-radius: 6px; transition: width 1s; }
.groups b { text-align: right; font-variant-numeric: tabular-nums; }
.rate { margin: 8px 0; font-size: 1.1em; }
.trigger { background: var(--hl); border: 2px solid var(--gold); border-radius: 12px; padding: 8px 12px; }
.trigger.secret { background: #2a2622; color: var(--paper); border-color: #000; }
.turn-card { border: 4px solid var(--pc); }
.turn-top { display: flex; align-items: center; gap: 14px; }
.turn-top h2 { font-size: 2.2em; margin: 0; }
.turn-top small { color: var(--muted); text-transform: uppercase; letter-spacing: .1em; font-weight: 700; }
.dice { margin-left: auto; font-size: 3.4em; line-height: 1; }
.die { display: inline-block; animation: roll .5s; }
@keyframes roll { from { transform: rotate(-200deg) scale(.4); } to { transform: none; } }
.on-space { margin: 10px 0; }
.space-chip { display: inline-flex; flex-direction: column; border-left: 10px solid var(--gc, var(--ink)); background: var(--surface); padding: 8px 14px; border-radius: 8px; font-weight: 700; font-size: 1.3em; }
.space-chip .sw { display: none; }
.space-chip small { font-weight: 500; font-size: .7em; color: var(--muted); }
.space-chip.plain { border-left-color: var(--ink); }
.doing { font-size: 1.15em; }
.ai-note { background: var(--blue); color: #fff; padding: 12px 14px; border-radius: 10px; font-size: 1.3em; }
.pl-list { list-style: none; padding: 0; margin: 0; }
.pl-list li { display: grid; grid-template-columns: 2em minmax(0, 1fr) auto; grid-template-rows: auto auto; gap: 0 10px; padding: 8px; border-radius: 10px; border-left: 6px solid var(--pc); margin-bottom: 6px; background: var(--surface); }
.pl-list li.active { outline: 3px solid var(--pc); }
.pl-list li.out { opacity: .45; }
.pl-list .tok { grid-row: span 2; align-self: center; }
.pl-name { display: flex; flex-direction: column; min-width: 0; }
.pl-name small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-money { text-align: right; display: flex; flex-direction: column; font-weight: 800; font-variant-numeric: tabular-nums; }
.pl-money small { font-weight: 500; color: var(--muted); }
.pl-badges { grid-column: 2 / 4; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.log { list-style: none; padding: 0; margin: 0; font-size: .9em; }
.log li { padding: 4px 0; border-bottom: 1px dotted var(--line); }

/* newspaper */
.paper { background: var(--newsprint); border: 1px solid var(--paper-line); padding: 14px 18px; font-family: var(--serif); box-shadow: 0 2px 0 var(--paper-line); margin-bottom: 14px; border-radius: 4px; }
.paper.empty { color: var(--muted); font-style: italic; }
.masthead { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 3px double var(--ink); padding-bottom: 4px; margin-bottom: 6px; }
.masthead span { font-weight: 900; font-size: 1.4em; font-variant: small-caps; letter-spacing: .03em; }
.headline { font-size: 1.9em; line-height: 1.05; margin: 6px 0 10px; font-weight: 900; }
.paper.compact .headline { font-size: 1.4em; }
.paper-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 16px; }
.paper h4 { margin: 6px 0 4px; font-size: .8em; text-transform: uppercase; letter-spacing: .12em; border-bottom: 1px solid var(--ink); }
.movers, .blurbs { list-style: none; padding: 0; margin: 0; }
.movers li { display: flex; align-items: center; justify-content: space-between; font-family: var(--sans); padding: 2px 0; }
.movers li i { margin-right: 4px; }
.movers b { margin-left: auto; padding-left: 8px; }
.rate-note { font-size: .85em; margin-top: 6px; font-family: var(--sans); }
.story { margin: 4px 0 8px; font-style: italic; }
.blurb { padding: 3px 0; font-size: .92em; border-bottom: 1px dotted var(--paper-line); }
.blurb .src { font-variant: small-caps; font-weight: 800; font-size: .85em; }
.blurb.scoop .src { color: var(--red); }
.blurb.ledger .src { color: var(--blue); }
.truth { font-family: var(--sans); font-size: .75em; padding: 1px 6px; border-radius: 4px; color: #fff; }
.truth.yes { background: var(--green); }
.truth.no { background: var(--red); }
.lesson { margin-top: 10px; padding: 8px 10px; background: var(--hl); border-radius: 6px; font-family: var(--sans); font-size: .92em; }

/* overlays */
.overlay { position: fixed; inset: 0; z-index: 40; background: rgba(20, 16, 10, .78); display: flex; align-items: center; justify-content: center; padding: 3vh; }
.spin-wrap { width: min(1100px, 92vw); text-align: center; }
.spin-paper { animation: spin 1.3s cubic-bezier(.2,.8,.25,1); }
.spin-paper .paper { font-size: 1.3em; text-align: left; }
.spin-paper .headline { font-size: 2.6em; }
.tap { color: var(--paper); font-family: var(--serif); font-size: 1.4em; font-weight: 900; letter-spacing: .1em; }
@keyframes spin { 0% { transform: rotate(-1080deg) scale(.05); } 100% { transform: none; } }
.auction-box { background: var(--card); border-radius: 22px; padding: 30px 44px; text-align: center; border: 6px solid var(--gold); min-width: min(700px, 90vw); }
.auction-box h1 { font-family: var(--serif); font-size: 3em; margin: 6px 0; }
.auction-box h2 { margin: 0; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.gavel { font-size: 3.5em; animation: bang 1s infinite; display: inline-block; transform-origin: 80% 80%; }
@keyframes bang { 0%, 70%, 100% { transform: rotate(0); } 80% { transform: rotate(-30deg); } }
.countdown { font-size: 4em; font-weight: 900; font-variant-numeric: tabular-nums; font-family: var(--serif); }
.countdown.sm { font-size: 2.4em; }
.reveal-bids { list-style: none; padding: 0; font-size: 1.5em; max-width: 480px; margin: 10px auto; }
.reveal-bids li { display: flex; justify-content: space-between; padding: 6px 14px; border-bottom: 1px dashed var(--line); animation: pop .4s backwards; }
.reveal-bids li:nth-child(2) { animation-delay: .3s; } .reveal-bids li:nth-child(3) { animation-delay: .6s; } .reveal-bids li:nth-child(4) { animation-delay: .9s; }
.reveal-bids li.win { background: var(--hl); font-weight: 900; }
.result { font-size: 1.5em; }

/* results */
.end-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; padding: 18px; }
.end-grid .wide { grid-column: span 2; }
.podium { list-style: none; padding: 0; margin: 0; }
.podium li { display: grid; grid-template-columns: 2em 2em minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 10px; border-left: 6px solid var(--pc); background: var(--surface); border-radius: 10px; margin-bottom: 8px; font-size: 1.1em; }
.podium li.winner { background: var(--hl); font-size: 1.35em; }
.place { font-weight: 900; font-family: var(--serif); }
.awards { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.awards li { background: var(--surface); border: 2px solid var(--gold); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; }
.awards small { color: var(--muted); }
.hotg { margin-top: 14px; padding: 12px; background: var(--newsprint); border: 1px solid var(--paper-line); font-family: var(--serif); font-style: italic; font-size: 1.15em; }
.challenge-res.pass { border: 3px solid var(--green); }
.challenge-res.fail { border: 3px solid var(--red); }
.stars { font-size: 2em; color: var(--gold); }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { font-size: 11px; fill: var(--muted); font-family: var(--sans); }
.legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: .85em; }
.legend i { display: inline-block; width: 12px; height: 4px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }

/* ------------------------------------------------ phone */
body.phone { padding-bottom: 76px; }
.join-screen, .lobby-phone, .end-phone { max-width: 520px; margin: 0 auto; padding: 24px 16px; }
.join-screen { text-align: center; padding-top: 10vh; }
.join-screen .f { text-align: left; }
.join-screen input { font-size: 1.3em; }
.me-banner { display: flex; align-items: center; gap: 14px; padding: 16px; background: var(--surface); border-radius: 16px; border: 4px solid var(--pc); margin-bottom: 14px; }
.me-banner h2 { margin: 0; font-family: var(--serif); font-size: 1.8em; }
.plist { list-style: none; padding: 0; margin: 0; }
.plist li { padding: 8px; border-left: 6px solid var(--pc); background: var(--surface); border-radius: 8px; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.plist li .btn { margin-left: auto; }

.wallet { position: sticky; top: 0; z-index: 10; background: var(--header-bg); color: var(--header-fg); padding: 10px 16px 12px; border-bottom: 6px solid var(--pc); }
.w-who { display: flex; align-items: center; gap: 8px; }
.your-turn { margin-left: auto; background: var(--red); color: #fff; padding: 2px 10px; border-radius: 999px; font-size: .8em; font-weight: 800; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.w-cash { font-size: 2.3em; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1.1; }
.w-cash.neg { color: #ff8a80; }
.w-sub { font-size: .9em; opacity: .85; }
.trig-me { background: var(--gold); padding: 8px 16px; font-weight: 700; }
.debt { background: var(--red); color: #fff; padding: 10px 16px; display: flex; flex-direction: column; gap: 8px; }
.debt .btn { align-self: flex-start; background: var(--surface); color: var(--red); }
.tabbody { padding: 14px; max-width: 640px; margin: 0 auto; }
.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); background: var(--card); border-top: 2px solid var(--ink); padding-bottom: env(safe-area-inset-bottom); }
.tabs button { background: none; border: 0; padding: 8px 2px; font-size: .72em; font-weight: 700; display: flex; flex-direction: column; align-items: center; position: relative; cursor: pointer; }
.tabs button span { font-size: 1.6em; }
.tabs button.on { background: var(--ink); color: var(--paper); }
.tabs em { position: absolute; top: 4px; right: 18%; background: var(--red); color: #fff; font-style: normal; border-radius: 999px; padding: 0 6px; font-size: .9em; }
.decide { border: 3px solid var(--gold); }
.decide h2 { font-size: 1.7em; }
.big-price { font-size: 2.2em; font-weight: 900; margin: 6px 0; }
.gchip { display: inline-flex; align-items: center; font-size: .85em; font-weight: 700; }
.roll-card h2 { text-align: center; }
.manual { display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; color: var(--muted); }
.jail-box { background: var(--paper2); padding: 10px; border-radius: 10px; margin-bottom: 8px; }
.hint { background: var(--hl); padding: 8px; border-radius: 8px; }
.waiting { display: flex; gap: 14px; align-items: center; border-left: 8px solid var(--pc); }
.waiting h2 { margin: 0; }
.cards summary { font-weight: 800; cursor: pointer; }
.repairs, .advance, .auction-start { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
.repairs input { width: 80px; }
.advance select { flex: 1; min-width: 0; }
.auction-start input { width: 100px; }
.perks { list-style: none; padding: 0; margin: 0; }
.perks li { padding: 8px 10px; border-radius: 10px; margin-bottom: 6px; display: flex; flex-direction: column; gap: 2px; }
.perks li.good { background: var(--good-bg); }
.perks li.bad { background: var(--bad-bg); }
.perks li .btn { align-self: flex-start; }
.deals { padding-left: 18px; margin: 0; }
.reacts { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; margin: 10px 0; }
.reacts button { font-size: 1.6em; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 6px 0; cursor: pointer; }
.summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.summary div { display: flex; flex-direction: column; }
.summary b { font-size: 1.25em; font-variant-numeric: tabular-nums; }
.summary .fine { grid-column: span 2; }
.g-head { margin: 16px 0 6px; display: flex; align-items: center; gap: 4px; font-family: var(--serif); }
.g-head b { margin-left: auto; font-family: var(--sans); }
.pcard { background: var(--surface); border: 1px solid var(--line); border-left: 8px solid var(--gc); border-radius: 12px; margin-bottom: 8px; overflow: hidden; }
.phead { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px; background: none; border: 0; padding: 12px; text-align: left; font-weight: 700; cursor: pointer; }
.pname { min-width: 0; }
.pval { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ptags { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 12px 10px; }
.tag { background: var(--paper2); padding: 2px 8px; border-radius: 999px; font-size: .78em; font-weight: 600; }
.tag.warn { background: var(--bad-bg); color: var(--red); }
.tag.good { background: var(--good-bg); color: var(--green); }
.pdetail { padding: 0 12px 12px; border-top: 1px dashed var(--line); }
.pdetail .cur { font-weight: 900; color: var(--ink); text-decoration: underline; }
.loanbox { background: var(--paper2); padding: 8px 10px; border-radius: 10px; margin: 8px 0; }
.mgroup { background: var(--surface); border: 1px solid var(--line); border-left: 8px solid var(--gc); border-radius: 12px; margin-bottom: 8px; padding: 10px 12px; }
.mgroup summary { font-weight: 800; cursor: pointer; display: flex; align-items: center; }
.mgroup summary b { margin-left: auto; }
.mgroup ul { list-style: none; padding: 0; margin: 8px 0 0; }
.mgroup li { display: grid; grid-template-columns: minmax(0, 1fr) auto 5em; gap: 8px; padding: 4px 0; border-bottom: 1px dotted var(--line); }
.mgroup li b { text-align: right; }
.offer { border: 3px solid var(--blue); }
.offer.mine { border-color: var(--line); }
.trade-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.trade-cols h4 { margin: 8px 0 4px; }
.pick { display: flex; align-items: flex-start; gap: 6px; padding: 6px; border-left: 5px solid var(--gc, var(--gold)); background: var(--paper); border-radius: 6px; margin-bottom: 4px; font-size: .9em; }
.pick input { margin-top: 3px; }
.pick span { display: flex; flex-direction: column; min-width: 0; }
.pick small { color: var(--muted); }
.contract { background: var(--paper2); padding: 10px; border-radius: 10px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.contract .pick { flex: 1 1 100%; }
.legend-papers { padding-left: 18px; }
.gloss dt { font-weight: 800; margin-top: 8px; text-transform: capitalize; }
.gloss dd { margin: 0; color: var(--muted); }
.modal { position: fixed; inset: 0; z-index: 30; background: rgba(20,16,10,.7); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-box { background: var(--card); border-radius: 18px; border: 5px solid var(--gold); padding: 18px; width: min(460px, 100%); text-align: center; max-height: 90vh; overflow: auto; }
.modal-box h2 { font-family: var(--serif); margin: 4px 0; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin: 8px 0; }
.yourbid { background: var(--hl); padding: 8px; border-radius: 8px; }
.debrief li { margin-bottom: 6px; }
.end-phone .awards { grid-template-columns: 1fr; }

@media (max-width: 900px) {
  .play-grid, .setup-grid, .lobby, .end-grid { grid-template-columns: minmax(0, 1fr); }
  .end-grid .wide { grid-column: auto; }
  .join-code { font-size: 3.5rem; }
}
@media (max-width: 420px) {
  .paper-cols { grid-template-columns: minmax(0, 1fr); }
  .trade-cols { grid-template-columns: minmax(0, 1fr); }
  .logo { font-size: 2.3rem; }
}

/* rent popups */
.rent-box { border-color: var(--pc, var(--gold)); }
.rent-icon { font-size: 3rem; line-height: 1; animation: pop .4s; }
.rent-box h2 { font-size: 1.6em; }
.rent-owner { font-size: 1.1em; margin: 6px 0; }
.rent-owe { margin: 10px 0 0; text-transform: uppercase; letter-spacing: .12em; font-size: .8em; color: var(--muted); font-weight: 700; }
.rent-amt { font-size: 3rem; font-weight: 900; font-family: var(--serif); line-height: 1.1; font-variant-numeric: tabular-nums; }
.rent-why { list-style: none; padding: 0; margin: 8px 0; font-size: .88em; color: var(--muted); }
.rent-why li::before { content: "• "; }
.rent-short { background: var(--bad-bg); color: var(--red); padding: 8px 10px; border-radius: 8px; font-size: .9em; }
#paid-pop { position: fixed; inset: 0; z-index: 35; display: flex; align-items: center; justify-content: center; pointer-events: none; opacity: 0; transition: opacity .3s; }
#paid-pop.show { opacity: 1; pointer-events: auto; background: rgba(20,16,10,.45); }
.paid-box { background: var(--card); border: 5px solid var(--green); border-radius: 18px; padding: 18px 24px; text-align: center; width: min(360px, 90vw); transform: scale(.8); transition: transform .3s; }
#paid-pop.show .paid-box { transform: none; }
.paid-box .rent-amt { color: var(--green); }
#rent-banner { position: fixed; left: 50%; bottom: 36px; z-index: 45; transform: translate(-50%, 200%); max-width: 92vw; white-space: nowrap; background: #5b3b8c; color: #fff; padding: 14px 26px;
  border-radius: 16px; font-size: 1.5em; display: flex; gap: 14px; align-items: center; box-shadow: 0 10px 30px rgba(0,0,0,.3); transition: transform .45s cubic-bezier(.2,.9,.3,1.2); }
#rent-banner.show { transform: translate(-50%, 0); }
.rb-amt { background: var(--gold); color: var(--ink); padding: 2px 10px; border-radius: 8px; font-weight: 900; margin: 0 4px; }

/* live auctions */
.auction-box.live { min-width: min(980px, 94vw); text-align: left; }
.auction-box.live h1 { text-align: center; }
.auc-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.live-dot { color: var(--red); font-weight: 900; letter-spacing: .12em; animation: breathe 2.4s ease-in-out infinite; }
.auc-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 24px; margin: 12px 0; }
.highbid { text-align: center; background: var(--hl2); border: 3px solid var(--gold); border-radius: 18px; padding: 16px; }
.hb-label { text-transform: uppercase; letter-spacing: .15em; color: var(--muted); font-weight: 800; font-size: .85em; }
.hb-amt { font-family: var(--serif); font-weight: 900; font-size: 4.6em; line-height: 1; font-variant-numeric: tabular-nums; }
.hb-who { font-size: 1.6em; font-weight: 800; }
.reserve { margin-top: 10px; font-weight: 800; color: var(--muted); }
.reserve.met { color: var(--green); }
.auc-hist { list-style: none; padding: 0; margin: 0; font-size: 1.15em; }
.auc-hist li { display: flex; justify-content: space-between; padding: 6px 10px; border-bottom: 1px dashed var(--line); }
.auc-hist li.top { background: var(--hl); font-weight: 900; border-radius: 8px; }
.countdown { transition: color .4s, transform .4s; }
.countdown.hot { color: var(--red); transform: scale(1.12); }
.auction-box.live .countdown { text-align: center; }
.auction-box.live .bids-in { text-align: center; }
.sold-stamp { display: inline-block; font-family: var(--serif); font-weight: 900; font-size: 4em; color: var(--red); border: 8px solid var(--red);
  padding: 4px 26px; border-radius: 14px; transform: rotate(-8deg); margin: 14px 0; animation: stamp .5s cubic-bezier(.2,1.6,.4,1); }
.sold-stamp.no { color: var(--muted); border-color: var(--muted); }
@keyframes stamp { from { transform: scale(3) rotate(-8deg); opacity: 0; } to { transform: rotate(-8deg); opacity: 1; } }
.auc-modal { text-align: center; }
.m-high { background: var(--hl2); border: 3px solid var(--gold); border-radius: 14px; padding: 10px; margin: 10px 0; display: flex; flex-direction: column; }
.m-high b { font-family: var(--serif); font-size: 2.4em; line-height: 1.1; }
.m-high.me { background: var(--good-bg); border-color: var(--green); }
.m-high small { text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 800; }
.m-status { font-weight: 800; margin: 6px 0; }
.m-status.win { color: var(--green); }
.m-status.lose { color: var(--red); }
@media (max-width: 900px) { .auc-grid { grid-template-columns: minmax(0, 1fr); } }

/* homes */
.w-home { font-size: .85em; opacity: .9; margin-top: 2px; }
.movein { background: var(--good-bg); padding: 10px; border-radius: 10px; }
.tag.home { background: var(--good-bg); color: var(--green); }
.pl-home { color: var(--green) !important; }
.budget ul { list-style: none; padding: 0; margin: 0; }
.budget li { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px dotted var(--line); }
.budget li.net { border-bottom: 0; border-top: 2px solid var(--ink); margin-top: 4px; font-weight: 800; }

/* in-app confirm */
.ask-overlay { position: fixed; inset: 0; z-index: 80; background: rgba(20,16,10,.6); display: flex; align-items: center; justify-content: center; padding: 16px; animation: tin .15s; }
.ask-box { background: var(--card); border: 5px solid var(--gold); border-radius: 18px; padding: 20px; width: min(400px, 100%); text-align: center; animation: pop .25s; }
.ask-box.danger { border-color: var(--red); }
.ask-icon { font-size: 2.8rem; line-height: 1; }
.ask-msg { font-size: 1.15em; font-weight: 600; margin: 10px 0 16px; }
.ask-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ask-btns .btn { padding: 12px; }

/* TV mini board */
.board-card { padding: 10px; }
.miniboard { display: grid; grid-template-columns: repeat(11, minmax(0, 1fr)); grid-template-rows: repeat(11, minmax(0, 1fr));
  gap: 2px; --mb: min(33vh, 25vw); width: var(--mb); height: var(--mb); max-width: 100%; margin: 0 auto; background: var(--board-line); padding: 2px; border-radius: 6px; }
.mb-cell { position: relative; background: var(--cell); overflow: visible; min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center; }
.mb-cell .band { position: absolute; }
.mb-cell.b .band { left: 0; right: 0; top: 0; height: 30%; }
.mb-cell.t .band { left: 0; right: 0; bottom: 0; height: 30%; }
.mb-cell.l .band { top: 0; bottom: 0; right: 0; width: 30%; }
.mb-cell.r .band { top: 0; bottom: 0; left: 0; width: 30%; }
.mb-cell.corner { background: var(--cell2); }
.mb-icon { font-size: clamp(7px, .9vh, 12px); opacity: .7; font-weight: 900; }
.mb-own { position: absolute; width: 34%; aspect-ratio: 1; border-radius: 50%; border: 1px solid rgba(0,0,0,.4); }
.mb-cell.b .mb-own { bottom: 6%; left: 6%; } .mb-cell.t .mb-own { top: 6%; left: 6%; }
.mb-cell.l .mb-own { left: 6%; top: 6%; } .mb-cell.r .mb-own { right: 6%; top: 6%; }
.mb-pips { position: absolute; font-size: clamp(6px, .8vh, 11px); line-height: 1; color: var(--ink); font-weight: 900; bottom: 2%; right: 4%; }
.mb-toks { position: absolute; inset: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; pointer-events: none; z-index: 2; }
.mb-tok { font-size: clamp(9px, 1.5vh, 20px); line-height: 1; filter: drop-shadow(0 0 1px #fff) drop-shadow(0 1px 1px rgba(0,0,0,.5)); }
.mb-tok.now { animation: hop 1s infinite; }
@keyframes hop { 50% { transform: translateY(-25%); } }
.mb-centre { grid-row: 2 / 11; grid-column: 2 / 11; background: var(--paper); display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: clamp(16px, 3vh, 40px); font-family: var(--serif); font-weight: 900; opacity: .9; }
.mb-centre span { font-size: .5em; letter-spacing: .05em; }

@media (max-width: 900px) { .miniboard { --mb: min(90vw, 70vh); } }

/* auction sparkle (no flashing: one burst per new high bid, then a slow glow) */
@keyframes breathe { 50% { opacity: .55; } }
.highbid { position: relative; overflow: visible; transition: box-shadow .8s; }
.highbid.glow { animation: glowfade 2.2s ease-out; }
@keyframes glowfade { 0% { box-shadow: 0 0 0 0 rgba(201,154,46,.0); } 25% { box-shadow: 0 0 40px 10px rgba(201,154,46,.55); } 100% { box-shadow: 0 0 14px 2px rgba(201,154,46,.25); } }
.hb-who { position: relative; display: inline-block; padding: 0 22px; text-shadow: 0 0 14px rgba(201,154,46,.55); }
.hb-who.quiet { text-shadow: none; color: var(--muted); font-weight: 600; font-size: 1.2em; }
.hb-sparkles i { position: absolute; font-style: normal; color: var(--gold); font-size: .7em; opacity: .85; animation: drift 4s ease-in-out infinite; }
.hb-sparkles i:nth-child(1) { left: -2px; top: -10px; }
.hb-sparkles i:nth-child(2) { right: -4px; top: -6px; animation-delay: 1s; }
.hb-sparkles i:nth-child(3) { left: 4px; bottom: -10px; animation-delay: 2s; }
.hb-sparkles i:nth-child(4) { right: 2px; bottom: -12px; animation-delay: 3s; }
@keyframes drift { 0%, 100% { transform: translateY(0) scale(.8); opacity: .35; } 50% { transform: translateY(-6px) scale(1.15); opacity: .95; } }
.burst { position: absolute; left: 50%; top: 50%; width: 0; height: 0; pointer-events: none; z-index: 3; }
.burst span { position: absolute; left: 0; top: 0; color: var(--gold); font-size: calc(22px * var(--s, 1)); opacity: 0;
  text-shadow: 0 0 8px rgba(255, 215, 120, .9); animation: fly var(--d, 1s) cubic-bezier(.15,.7,.3,1) forwards; }
@keyframes fly { 0% { transform: translate(-50%, -50%) scale(.3); opacity: 1; } 70% { opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1) rotate(90deg); opacity: 0; } }
.m-high { position: relative; overflow: visible; }
@media (prefers-reduced-motion: reduce) {
  .hb-sparkles, .burst { display: none; }
  .live-dot, .mb-tok.now, .your-turn, .gavel, .die, .spin-paper, .sold-stamp, .reaction, .highbid.glow { animation: none !important; }
  .countdown.hot { transform: none; }
}

/* ------------------------------------------------ TV: fixed 1920x1080 stage, scaled to fit */
body.tv.scaled { overflow: hidden; background: #2a2622; }
body.tv.scaled[data-status="ended"] { overflow-y: auto; overflow-x: hidden; }
#stage.scaled { position: absolute; width: 1920px; height: 1080px; transform-origin: 0 0; background: var(--paper);
  font-size: 20px; overflow: hidden; }
body.tv[data-status="ended"] #stage.scaled { height: auto; min-height: 1080px; overflow: visible; }
/* inside the stage, size things in pixels (vw/vh would refer to the real screen) */
#stage.scaled .lobby { min-height: 0; height: 1080px; }
#stage.scaled .qr { width: 430px; }
#stage.scaled .join-code { font-size: 6rem; }
#stage.scaled .play-grid { grid-template-columns: minmax(0, .95fr) minmax(0, 1.3fr) minmax(0, 1fr); height: calc(1080px - 66px); padding: 16px; gap: 16px; }
#stage.scaled .play-grid .col { display: flex; flex-direction: column; min-height: 0; }
#stage.scaled .play-grid .col > .card { margin-bottom: 14px; }
#stage.scaled .log-card { flex: 1 1 auto; min-height: 0; overflow: hidden; }
#stage.scaled .paper-card { flex: 1 1 auto; min-height: 0; overflow: hidden; }
#stage.scaled .players-card { flex: 0 1 auto; min-height: 0; overflow: hidden; }
#stage.scaled .miniboard { --mb: 340px; }
#stage.scaled .mb-icon { font-size: 10px; } #stage.scaled .mb-pips { font-size: 9px; } #stage.scaled .mb-tok { font-size: 17px; }
#stage.scaled .mb-centre { font-size: 30px; }
#stage.scaled .end-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#stage.scaled .end-grid .wide { grid-column: span 2; }
#stage.scaled .setup-grid { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
#stage.scaled .lobby { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); }
#stage.scaled .auc-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
#stage.scaled .overlay { position: absolute; padding: 30px; }
#stage.scaled .spin-wrap { width: 1250px; }
#stage.scaled .auction-box { min-width: 760px; }
#stage.scaled .auction-box.live { min-width: 1080px; }
#stage.scaled #toasts { position: absolute; top: 74px; right: 18px; left: auto; bottom: auto; transform: none; width: 480px; }
#stage.scaled #rent-banner { position: absolute; max-width: 1700px; }
/* many players: compact rows so everyone fits */
#stage.scaled .pl-list li { padding: 6px 8px; margin-bottom: 5px; }
#fit-btn { white-space: nowrap; }
.lobby-join #fit-btn { margin-top: 10px; }

/* compact player list for 5+ players */
.pl-list.compact li { grid-template-rows: auto; padding: 5px 8px; margin-bottom: 4px; }
.pl-list.compact .tok { grid-row: auto; font-size: 1.2em; }
.pl-list.compact .pl-name small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .78em; }
.pl-list.compact .pl-money small { font-size: .78em; }
.pl-home { color: var(--green); }
/* several tokens on one mini-board square: shrink to fit */
#stage .mb-tok.n2 { font-size: 13px; } #stage .mb-tok.n3, #stage .mb-tok.n4 { font-size: 10px; } #stage .mb-tok.n5 { font-size: 8px; }
.mb-toks { overflow: hidden; gap: 0; }

/* Chance / Community Chest cards */
.flipcard { position: relative; width: 260px; height: 170px; margin: 6px auto 14px; perspective: 900px; }
.flipcard .fc-face { position: absolute; inset: 0; border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  backface-visibility: hidden; -webkit-backface-visibility: hidden; padding: 14px; text-align: center; box-shadow: 0 6px 20px rgba(0,0,0,.25);
  transition: transform .7s cubic-bezier(.3,.7,.3,1); }
.flipcard .fc-back { color: #fff; font-family: var(--serif); }
.flipcard.chance .fc-back { background: repeating-linear-gradient(45deg, #f08a24, #f08a24 12px, #e8791a 12px, #e8791a 24px); }
.flipcard.chest .fc-back { background: repeating-linear-gradient(45deg, #2a7fc9, #2a7fc9 12px, #2273b8 12px, #2273b8 24px); }
.fc-mark { font-size: 3.4em; line-height: 1; font-weight: 900; text-shadow: 0 2px 0 rgba(0,0,0,.2); }
.fc-back b { font-size: 1.2em; letter-spacing: .04em; }
.fc-front { background: var(--card); transform: rotateY(180deg); border: 4px solid var(--gold); }
.flipcard.chance .fc-front { border-color: #f08a24; } .flipcard.chest .fc-front { border-color: #2a7fc9; }
.fc-front small { text-transform: uppercase; letter-spacing: .14em; font-weight: 800; color: var(--muted); }
.fc-front p { font-family: var(--serif); font-size: 1.15em; font-weight: 700; margin: 8px 0 0; }
.flipcard.flipped .fc-back { transform: rotateY(-180deg); }
.flipcard.flipped .fc-front { transform: rotateY(0deg); }
.card-modal .flipcard.flipped .fc-back { animation: flipback .7s ease-out; }
.card-modal .flipcard.flipped .fc-front { animation: flipfront .7s ease-out; }
@keyframes flipback { from { transform: rotateY(0); } to { transform: rotateY(-180deg); } }
@keyframes flipfront { from { transform: rotateY(180deg); } to { transform: rotateY(0); } }
.flipcard.big { width: 640px; height: 400px; }
.flipcard.big .fc-front p { font-size: 2.1em; }
.flipcard.big .fc-mark { font-size: 7em; }
.flipcard.big .fc-back b { font-size: 2em; }
.tv-card-wrap { text-align: center; }
.tv-card-who { color: var(--paper); font-size: 1.8em; font-weight: 800; margin-bottom: 18px; }
/* offers */
.offer-box { border-color: var(--green); }
.offer-box h2 { font-size: 1.25em; }
.center-row { justify-content: center; }
.offer-mini { border: 2px solid var(--green); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.homepill { font-style: normal; font-size: .8em; color: var(--green); font-weight: 700; }
/* jail */
#jail-pop { position: fixed; inset: 0; z-index: 36; display: flex; align-items: center; justify-content: center; pointer-events: none; opacity: 0; transition: opacity .3s; }
#jail-pop.show { opacity: 1; pointer-events: auto; background: rgba(20,16,10,.55); }
.jail-box-pop { background: var(--card); border: 5px solid #444; border-radius: 18px; padding: 18px 22px; text-align: center; width: min(380px, 92vw);
  background-image: repeating-linear-gradient(90deg, transparent 0 26px, rgba(0,0,0,.06) 26px 30px); }
.jail-bars { font-size: 3rem; }
#rent-banner.jail { background: #333; }
.mb-cell.jail { position: relative; }
.mb-cell-in { position: absolute; right: 0; top: 0; width: 68%; height: 68%; display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  background: repeating-linear-gradient(90deg, var(--cell) 0 3px, #555 3px 5px); border-left: 1px solid #555; border-bottom: 1px solid #555; }
.mb-cell-in .mb-tok { filter: drop-shadow(0 0 1px #fff); }
.mb-visit { position: absolute; left: 0; bottom: 0; right: 0; top: 0; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: flex-start; pointer-events: none; }
.mb-visit .mb-tok { font-size: 10px; }
.mb-own.adv::after { content: "✕"; position: absolute; inset: -3px; display: flex; align-items: center; justify-content: center; color: #e00; font-weight: 900;
  font-size: 13px; line-height: 1; text-shadow: 0 0 2px #fff, 0 0 2px #fff; }
.qs-note { font-size: .8em; color: var(--muted); border: 0 !important; background: none !important; }
@media (prefers-reduced-motion: reduce) { .flipcard .fc-face, .card-modal .flipcard .fc-face { animation: none !important; transition: none; } }

/* joining & host tools */
.home-error { background: var(--bad-bg); color: var(--red); padding: 10px; border-radius: 10px; }
.resume-box { margin: 18px 0; text-align: left; }
.resume-box summary { cursor: pointer; font-weight: 800; font-family: var(--serif); font-size: 1.1em; text-align: center; }
.wait-spin { font-size: 4rem; animation: breathe 2s ease-in-out infinite; }
.req { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 6px 0; }
.req + .req { border-top: 1px dashed var(--line); }
.req-btns { display: flex; gap: 6px; }
#req-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 40; background: var(--card); border-bottom: 4px solid var(--gold); padding: 8px 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.tv-reqs { border: 4px solid var(--gold); }
.tv-reqs.floating { position: absolute; top: 76px; left: 50%; transform: translateX(-50%); z-index: 30; min-width: 640px; }
.pin-box { margin-top: 12px; padding: 10px; background: var(--paper2); border-radius: 10px; font-size: 1.1em; }
.pin-box b { font-family: var(--serif); letter-spacing: .15em; font-size: 1.3em; }
.pin-box small { display: block; color: var(--muted); font-size: .8em; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .1em; }

.flipcard.tappable { cursor: pointer; }
.flipcard.tappable .fc-back { animation: wobble 2.4s ease-in-out infinite; }
@keyframes wobble { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-2deg) scale(1.02); } }
.tv-card-hint { color: var(--paper); font-size: 1.4em; margin-top: 22px; min-height: 1.5em; }
@media (prefers-reduced-motion: reduce) { .flipcard.tappable .fc-back { animation: none; } }

/* music bar (TV) */
#music-bar { position: fixed; left: 50%; top: 8px; transform: translateX(-50%); z-index: 25; display: flex; align-items: center; gap: 6px;
  background: rgba(29, 26, 22, .9); color: #f5eedc; padding: 6px 10px; border-radius: 999px; font-size: 15px;
  box-shadow: 0 4px 16px rgba(0,0,0,.25); max-width: 600px; }
#stage.scaled #music-bar { position: absolute; }
#music-bar.empty { opacity: .65; }
.mb-btn { background: none; border: 0; color: inherit; font-size: 18px; cursor: pointer; padding: 2px 4px; border-radius: 6px; }
.mb-btn.big { font-size: 22px; }
.mb-btn:hover, .mb-btn:focus { background: rgba(255,255,255,.12); }
.mb-title { max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 6px; }
#mb-folder { background: rgba(255,255,255,.12); color: inherit; border: 0; border-radius: 6px; padding: 3px 6px; max-width: 140px; }
#mb-folder option { color: #000; }
#mb-vol { width: 90px; accent-color: var(--gold); }
.music-remote { display: flex; flex-wrap: wrap; gap: 6px; }

/* token picker */
.tok-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.tok-pick { position: relative; aspect-ratio: 1; font-size: 1.7em; background: var(--surface); border: 2px solid var(--line); border-radius: 12px;
  cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0; line-height: 1; }
.tok-pick.mine { border-color: var(--green); background: var(--good-bg); box-shadow: 0 0 0 3px rgba(30,122,70,.25); }
.tok-pick:disabled { opacity: .35; cursor: not-allowed; }
.tok-pick small { font-size: 9px; position: absolute; bottom: 2px; left: 2px; right: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* mini board on the phone */
.phone-board .miniboard { --mb: min(calc(100vw - 60px), 440px); }
.phone-board .mb-tok { font-size: clamp(10px, 3.6vw, 18px); }
.phone-board .mb-tok.n2 { font-size: 13px; } .phone-board .mb-tok.n3, .phone-board .mb-tok.n4 { font-size: 10px; } .phone-board .mb-tok.n5 { font-size: 8px; }
.phone-board .mb-icon { font-size: 9px; } .phone-board .mb-pips { font-size: 8px; }
.phone-board .mb-centre { font-size: 24px; }
.mb-tok.me { border-radius: 50%; box-shadow: 0 0 0 2px var(--pc); background: rgba(255,255,255,.75); }

body.phone.modal-open #toasts { top: 10px; bottom: auto; }

/* phone header: cash left, details right, your turn centred */
.wallet { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; position: sticky; padding-top: 22px; }
.w-left { min-width: 0; }
.w-right { text-align: right; font-size: .85em; line-height: 1.35; opacity: .92; min-width: 0; }
.w-right b { font-variant-numeric: tabular-nums; }
.w-right .w-home { margin-top: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw; }
.wallet .your-turn { position: absolute; top: 6px; left: 50%; transform: translateX(-50%); margin: 0; }
/* reactions ring in the middle of the phone's mini board */
.phone-board .mb-centre { position: relative; }
.react-ring { position: relative; width: 100%; height: 100%; }
.react-ring button { position: absolute; left: 50%; top: 50%; width: 19%; aspect-ratio: 1; margin: 0; padding: 0; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); font-size: clamp(16px, 5.5vw, 26px); cursor: pointer; line-height: 1;
  transform: translate(-50%, -50%) rotate(calc(var(--i) * 45deg)) translateY(-150%) rotate(calc(var(--i) * -45deg)); }
.react-ring button:active { transform: translate(-50%, -50%) rotate(calc(var(--i) * 45deg)) translateY(-150%) rotate(calc(var(--i) * -45deg)) scale(.88); }
.ring-label { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-family: var(--sans); font-size: 10px; font-weight: 700;
  color: var(--muted); text-align: center; line-height: 1.1; }
/* auction colours + ownership badges */
.auc-band { height: 14px; background: var(--gc, var(--gold)); margin: -18px -18px 10px; border-radius: 12px 12px 0 0; }
.auction-box .auc-band { margin: -30px -44px 16px; height: 22px; border-radius: 14px 14px 0 0; }
.auc-group { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 4px 0 8px; }
.gchip.big { font-size: 1.1em; background: var(--surface); border: 1px solid var(--line); padding: 4px 12px; border-radius: 999px; }
.gchip-row { display: flex; justify-content: center; margin: 2px 0 6px; }
.own-badges { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 4px 0 8px; }
.own-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .82em; font-weight: 700; background: var(--paper2); }
.own-badge.mine { background: var(--good-bg); color: var(--green); }
.own-badge.set { background: var(--hl); color: #7a5a00; border: 2px solid var(--gold); }
.own-badge.other { border-left: 5px solid var(--pc); background: var(--surface); border-top: 1px solid var(--line); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }

/* ------------------------------------------------ dark mode */
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #171513; --paper2: #221f1b; --card: #23201c; --surface: #2c2824; --ink: #efe8d8; --muted: #a8a093;
  --line: #3b3630; --shadow: 0 2px 0 #0d0c0a, 0 8px 24px rgba(0,0,0,.35);
  --newsprint: #24211c; --paper-line: #4a443b; --hl: #4a3e17; --hl2: #3a3220; --good-bg: #1d3526; --bad-bg: #42201d;
  --info-bg: #222a35; --cell: #2f2b26; --cell2: #3a352e; --red: #e5534b; --green: #3fb06d; --gold: #d9ad45; --blue: #5b8be0;
  --btn: #3b3631; --btn-fg: #f3ecdb; --toast-bg: #33302b; --toast-fg: #f3ecdb; --header-bg: #0d0c0b; --header-fg: #f3ecdb;
  --board-line: #575047;
}
:root[data-theme="dark"] .btn { box-shadow: 0 3px 0 #000; }
:root[data-theme="dark"] .btn.huge, :root[data-theme="dark"] .btn.danger { background: var(--red); color: #fff; box-shadow: 0 4px 0 #6e1712; }
:root[data-theme="dark"] .btn.alt { background: #2d5fb8; color: #fff; }
:root[data-theme="dark"] .btn.on { background: #237a47; color: #fff; }
:root[data-theme="dark"] .qr { background: #fff; }
:root[data-theme="dark"] body.tv.scaled { background: #000; }
:root[data-theme="dark"] .trigger { color: var(--ink); }
:root[data-theme="dark"] .toast.big { color: #1d1a16; }
:root[data-theme="dark"] .lesson { color: var(--ink); }
:root[data-theme="dark"] .fc-front { color: var(--ink); }
:root[data-theme="dark"] .tag { color: var(--ink); }
:root[data-theme="dark"] .mb-tok { filter: drop-shadow(0 0 1px #000) drop-shadow(0 1px 1px rgba(0,0,0,.7)); }
:root[data-theme="dark"] .chart .grid { stroke: #3b3630; }
:root[data-theme="dark"] .spin-paper .paper, :root[data-theme="dark"] .auction-box { color: var(--ink); }
:root[data-theme="dark"] .preset.on, :root[data-theme="dark"] .tabs button.on, :root[data-theme="dark"] .code-pill { color: #171513; }
.theme-btn { white-space: nowrap; }

#stage.scaled .lobby { padding-top: 64px; }
.tv-head .head-stats { flex: 0 1 auto; }
.tv-head .host-mini, .tv-head #fit-btn { margin-left: auto; }
.tv-head #fit-btn + .host-mini { margin-left: 0; }
.tv-head .theme-btn { margin-left: auto; }
.tv-head .theme-btn + #fit-btn { margin-left: 0; }
/* add computer */
.ptile.add-ai { border: 3px dashed var(--muted); background: transparent; cursor: pointer; color: var(--ink); font: inherit; }
.ptile.add-ai .tok em { font-style: normal; font-weight: 900; color: var(--green); margin-left: 2px; }
.ptile.add-ai.open { cursor: default; gap: 6px; }
.ptile.add-ai.open .btn { width: 100%; display: flex; flex-direction: column; }
.ptile.add-ai.open .btn small { font-weight: 500; opacity: .8; }
.ptile.ai { position: relative; }
.ptile.ai small { text-align: center; color: var(--muted); }
.ai-x { position: absolute; top: 4px; right: 6px; background: none; border: 0; color: var(--muted); font-size: 1.1em; cursor: pointer; }
.add-ai-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ai-row { border-left-color: var(--muted) !important; border-left-style: dashed !important; }

:root[data-theme="dark"] #music-bar { background: rgba(60, 54, 47, .95); border: 1px solid #4a443b; }

/* adults-only pack */
.card.adult { border: 2px solid #c2185b; }
.card.adult h3 { color: #c2185b; }
.btn.favour { background: #c2185b; color: #fff; margin-top: 10px; width: 100%; }
.favour-wait { background: rgba(194, 24, 91, .12); color: #c2185b; padding: 8px 10px; border-radius: 8px; font-size: .9em; margin-top: 10px; }
.favour-box { border-top: 6px solid #c2185b; }
:root[data-theme="dark"] .card.adult h3, :root[data-theme="dark"] .favour-wait { color: #f48fb1; }
