/* ===============================================================
   Globe Trotter Tycoon — styles
   Theme colours are CSS variables set from js/data.js THEMES.
   =============================================================== */
:root {
  --table: #0e5a3a; --table2: #06301e; --board: #e7efdc; --tile: #fbf6e6; --ink: #1e2a24; --line: #2b2b2b;
  --panel: #fff; --panel-ink: #1f2933; --accent: #e85d04; --muted: #66756d; --token-scale: 1;
  --font-head: 'Fredoka', 'Trebuchet MS', system-ui, sans-serif;
  --font-body: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font-body); color: var(--panel-ink); overflow: hidden;
  background: radial-gradient(ellipse at 30% 15%, var(--table), var(--table2) 85%) fixed, var(--table2);
}
#bg-deco {
  position: fixed; inset: 0; pointer-events: none; opacity: .5;
  background-image: radial-gradient(rgba(255,255,255,.08) 1.5px, transparent 1.6px), radial-gradient(rgba(255,255,255,.05) 1px, transparent 1.2px);
  background-size: 28px 28px, 17px 17px; animation: drift 80s linear infinite;
}
body.no-anim-bg #bg-deco, body.no-anim-bg .title-floaters { animation: none; display: none; }
@keyframes drift { to { background-position: 280px 560px, -170px 340px; } }

.screen { position: fixed; inset: 0; display: none; overflow: auto; }
.screen.active { display: flex; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
kbd { font: 700 11px var(--font-body); background: rgba(0,0,0,.18); border-radius: 5px; padding: 1px 6px; margin-left: 6px; }
code { background: rgba(0,0,0,.07); padding: 1px 5px; border-radius: 4px; }

/* ---------- buttons & inputs ---------- */
.btn {
  font: 800 15px var(--font-body); border: 0; border-radius: 12px; padding: 10px 16px; cursor: pointer;
  background: #fff; color: #1f2933; box-shadow: 0 3px 0 rgba(0,0,0,.22), 0 6px 16px rgba(0,0,0,.12);
  transition: transform .12s, filter .12s, box-shadow .12s; display: inline-flex; align-items: center; justify-content: center; gap: 4px;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.05); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,.22); }
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn.primary { background: linear-gradient(180deg, #ffad33, var(--accent)); color: #fff; text-shadow: 0 1px 1px rgba(0,0,0,.25); }
.btn.danger { background: linear-gradient(180deg, #ef4444, #b91c1c); color: #fff; }
.btn.ghost { background: transparent; color: inherit; box-shadow: none; border: 1.5px solid currentColor; opacity: .85; }
.btn.big { font-size: 18px; padding: 14px 26px; border-radius: 16px; }
.btn.sm { font-size: 12px; padding: 5px 9px; border-radius: 8px; box-shadow: 0 2px 0 rgba(0,0,0,.18); }
.btn.ghost.sm { box-shadow: none; }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; filter: grayscale(.6); }
input[type=text], input[type=number], input[type=url], select, textarea {
  font: 600 14px var(--font-body); padding: 7px 10px; border-radius: 9px; border: 1.5px solid rgba(0,0,0,.18);
  background: #fff; color: #1f2933; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
input.short { width: 72px; text-align: center; }
input[type=color] { width: 44px; height: 34px; padding: 2px; border: 1.5px solid rgba(0,0,0,.2); border-radius: 8px; background: #fff; cursor: pointer; }
input[type=range] { accent-color: var(--accent); width: 160px; }
.switch { position: relative; display: inline-block; width: 48px; height: 27px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #c3c9cf; border-radius: 27px; transition: .2s; cursor: pointer; }
.switch span::before { content: ''; position: absolute; width: 21px; height: 21px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(21px); }
.switch input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.chip { border: 0; padding: 6px 14px; border-radius: 20px; background: rgba(0,0,0,.07); color: inherit; font: 800 14px var(--font-body); cursor: pointer; }
.chip.on { background: var(--accent); color: #fff; }

/* ---------- title ---------- */
#screen-title { align-items: center; justify-content: center; color: #fff; text-align: center; padding: 20px; }
.title-wrap { position: relative; z-index: 1; }
.title-globe { font-size: clamp(80px, 14vw, 130px); line-height: 1; animation: bob 5s ease-in-out infinite; filter: drop-shadow(0 14px 24px rgba(0,0,0,.45)); }
#title-name {
  font: 700 clamp(40px, 8vw, 86px)/1 var(--font-head); margin: .15em 0 .1em; letter-spacing: .5px;
  background: linear-gradient(90deg, #ffe066, #ffad33 40%, #ff6b8b); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 0 rgba(0,0,0,.25));
}
.title-sub { font-size: clamp(16px, 2.4vw, 22px); font-weight: 700; opacity: .9; margin: 0 0 30px; }
.title-btns { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; max-width: 640px; margin: 0 auto; }
.title-btns .btn.ghost { color: #fff; }
.title-foot { margin-top: 34px; font-size: 13px; opacity: .65; }
.title-floaters { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
.title-floaters span { position: absolute; bottom: -80px; opacity: .35; animation: rise linear infinite; }
@keyframes rise { 0% { transform: translateY(0) rotate(-10deg); } 50% { transform: translateY(-60vh) rotate(10deg); } 100% { transform: translateY(-120vh) rotate(-10deg); } }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-6deg); } 50% { transform: translateY(-14px) rotate(6deg); } }

/* ---------- setup ---------- */
#screen-setup { flex-direction: column; color: #fff; }
.setup-head { display: flex; align-items: center; gap: 12px; padding: 14px 20px 10px; flex-wrap: wrap; }
.setup-head h2 { flex: 1; margin: 0; font: 600 26px var(--font-head); }
.setup-head .btn.ghost { color: #fff; }
.tabs { display: flex; gap: 6px; padding: 0 20px; flex-wrap: wrap; }
.tabs button {
  border: 0; background: rgba(255,255,255,.14); color: #fff; font: 800 15px var(--font-body); padding: 10px 16px;
  border-radius: 12px 12px 0 0; cursor: pointer; transition: background .15s;
}
.tabs button:hover { background: rgba(255,255,255,.24); }
.tabs button.active { background: var(--panel); color: var(--panel-ink); }
.tab-body { flex: 1 0 auto; margin: 0 20px 20px; background: var(--panel); color: var(--panel-ink); border-radius: 0 18px 18px 18px; padding: 22px 26px; box-shadow: 0 20px 50px rgba(0,0,0,.35); }
.form { column-width: 420px; column-gap: 48px; }
.fsec { font: 600 19px var(--font-head); margin: 18px 0 4px; break-after: avoid; color: var(--accent); }
.fsec:first-child { margin-top: 0; }
.frow { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid rgba(127,127,127,.18); break-inside: avoid; }
.frow > label { font-weight: 700; }
.frow > label small { display: block; color: var(--muted); font-weight: 600; font-size: 12px; }
.fin { display: flex; align-items: center; gap: 8px; flex: none; }
.fin output { min-width: 54px; text-align: right; font-weight: 800; font-size: 13px; }
.fin input[type=number] { width: 110px; }
.fin select { max-width: 230px; }

.pcount { display: flex; align-items: center; gap: 8px; font-weight: 800; margin-bottom: 16px; flex-wrap: wrap; }
.prow { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 14px; background: rgba(127,127,127,.09); border-left: 6px solid var(--pc); margin-bottom: 8px; flex-wrap: wrap; }
.seat { font: 700 18px var(--font-head); width: 22px; text-align: center; opacity: .6; }
.tokbtn { font-size: 30px; width: 56px; height: 56px; border-radius: 50%; border: 3px solid var(--pc); background: #fff; cursor: pointer; transition: transform .15s; }
.tokbtn:hover { transform: scale(1.1) rotate(-8deg); }
.prow input[type=text] { flex: 1; min-width: 130px; }
.ptools { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 6px; }
.tok-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 6px; margin-bottom: 12px; }
.tok-grid button { font-size: 30px; padding: 6px; border-radius: 12px; border: 2px solid transparent; background: rgba(127,127,127,.12); cursor: pointer; }
.tok-grid button:hover { border-color: var(--accent); transform: scale(1.08); }

.board-ed { display: grid; grid-template-columns: 250px minmax(300px, 1fr) 330px; gap: 22px; align-items: start; }
.board-ed h3 { font: 600 17px var(--font-head); margin: 0 0 8px; }
.be-side h3:not(:first-child) { margin-top: 18px; }
.be-side > .btn { display: flex; width: 100%; margin-bottom: 6px; }
.be-g { display: flex; gap: 6px; align-items: center; margin-bottom: 5px; }
.be-g input[type=text] { flex: 1; }
.be-tool { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; font-weight: 700; font-size: 13px; }
.mini-board { display: grid; aspect-ratio: 1; width: 100%; max-width: 620px; gap: 2px; background: #333; padding: 2px; border-radius: 8px; }
.mini-cell { background: #fbf6e6; color: #222; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; position: relative; overflow: hidden; min-width: 0; font-size: clamp(11px, 1.5vw, 20px); padding-top: 12%; }
.mini-cell small { font-size: clamp(6px, .55vw, 9px); line-height: 1.05; text-align: center; font-weight: 700; padding: 0 1px; }
.mini-cell .mb { position: absolute; top: 0; left: 0; right: 0; height: 16%; }
.mini-cell:hover { background: #fff3c9; }
.mini-cell.sel { outline: 3px solid var(--accent); outline-offset: -3px; background: #fff3c9; z-index: 1; }
.mini-center { display: flex; flex-direction: column; align-items: center; justify-content: center; background: #e7efdc; color: #2a3b30; text-align: center; gap: 4px; }
.mini-center div { font-size: 46px; }
.mini-center b { font: 600 20px var(--font-head); }
.mini-center span { font-size: 12px; opacity: .7; }
.be-form { background: rgba(127,127,127,.08); border-radius: 14px; padding: 14px; }
.be-form h4 { margin: 12px 0 6px; display: flex; justify-content: space-between; align-items: center; }
.ff { display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px; font-size: 12px; font-weight: 800; color: var(--muted); }
.ff input, .ff select, .ff textarea { color: #1f2933; width: 100%; }
.ff input.short { width: 72px; }
.ff-arr { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; }

.deck-tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.deck-meta { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 10px; }
.deck-meta .ff { width: auto; }
.card-row { display: grid; grid-template-columns: minmax(200px, 1fr) 210px 240px 40px; gap: 10px; align-items: start; padding: 10px; border-left: 5px solid var(--dc); border-radius: 10px; background: rgba(127,127,127,.07); margin-bottom: 8px; }
.card-row textarea { width: 100%; resize: vertical; min-height: 52px; }
.card-list { margin-bottom: 12px; }
.data-tab section { margin-bottom: 22px; }
.data-tab h3 { font: 600 19px var(--font-head); margin: 0 0 6px; color: var(--accent); }
.data-tab .btn { margin: 4px 4px 4px 0; }
.json-box { display: block; width: 100%; min-height: 90px; margin: 10px 0 6px; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }

/* ---------- game layout ---------- */
#screen-game { gap: 14px; padding: 10px; }
#board-area { flex: 1; display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 0; }
#board, #lens-board {
  position: relative; display: grid; gap: 1px; padding: 1px; background: var(--line);
  border-radius: 6px; box-shadow: 0 0 0 6px rgba(0,0,0,.18), 0 30px 70px rgba(0,0,0,.5); user-select: none; font-size: 10px;
}
#sidebar { width: 370px; flex: 0 0 370px; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; background: rgba(0,0,0,.3); color: #fff; border-radius: 14px; padding: 6px 10px; }
.tb-info { display: flex; gap: 12px; font-weight: 800; font-size: 14px; }
.icon-btn { background: none; border: 0; font-size: 20px; cursor: pointer; padding: 4px 6px; border-radius: 8px; transition: background .15s; }
.icon-btn:hover { background: rgba(255,255,255,.18); }
.icon-btn.off { opacity: .35; }

/* tiles */
.tile { position: relative; background: var(--tile); color: var(--ink); display: flex; overflow: hidden; cursor: pointer; transition: filter .15s; min-width: 0; min-height: 0; }
.tile:hover { filter: brightness(1.08) saturate(1.1); z-index: 2; }
.tile.side-bottom { flex-direction: column; }
.tile.side-top { flex-direction: column-reverse; }
.tile.side-left { flex-direction: row-reverse; }
.tile.side-right { flex-direction: row; }
.band { flex: 0 0 23%; display: flex; align-items: center; justify-content: center; box-shadow: inset 0 0 0 1px rgba(0,0,0,.25); }
.side-left .band, .side-right .band { flex-basis: 20%; }
.bld { display: flex; gap: .05em; font-size: .95em; line-height: 1; filter: drop-shadow(0 1px 1px rgba(0,0,0,.4)); }
.side-left .bld, .side-right .bld { flex-direction: column; }
.bld i { font-style: normal; }
.bld .hotel { font-size: 1.5em; }
.tbody { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: .2em .15em; min-height: 0; min-width: 0; gap: .15em; }
.side-left .tbody, .side-right .tbody { flex-direction: row; justify-content: flex-start; text-align: left; padding: .2em .45em; gap: .45em; }
.temoji { font-size: 2.2em; line-height: 1; }
.ttext { min-width: 0; }
.tname { font-weight: 800; font-size: .95em; line-height: 1.08; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.tprice { font-size: .9em; font-weight: 800; opacity: .7; margin-top: .1em; }
body.no-prices .tprice { display: none; }
.type-card .temoji { animation: wiggle 4s ease-in-out infinite; }
@keyframes wiggle { 0%, 90%, 100% { transform: rotate(0); } 93% { transform: rotate(-12deg); } 96% { transform: rotate(12deg); } }
.own { position: absolute; background: var(--own); display: none; }
.tile.owned .own { display: block; }
.side-bottom .own { left: 0; right: 0; bottom: 0; height: .5em; }
.side-top .own { left: 0; right: 0; top: 0; height: .5em; }
.side-left .own { top: 0; bottom: 0; left: 0; width: .5em; }
.side-right .own { top: 0; bottom: 0; right: 0; width: .5em; }
.mstamp { display: none; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) rotate(-28deg); font: 900 .62em var(--font-body); color: #c1121f; border: .15em solid #c1121f; padding: 0 .25em; background: rgba(255,255,255,.85); border-radius: .2em; letter-spacing: .05em; }
.tile.mortgaged .mstamp { display: block; }
.tile.mortgaged .tbody { opacity: .4; filter: grayscale(1); }
.tile.flash { animation: flash 1.1s ease-out; z-index: 3; }
@keyframes flash { 0% { box-shadow: inset 0 0 0 .5em var(--accent); filter: brightness(1.3); } 100% { box-shadow: inset 0 0 0 0 transparent; } }

.tile.side-corner { align-items: center; justify-content: center; }
.corner-in { text-align: center; padding: .3em; }
.cemoji { font-size: 4em; line-height: 1.05; }
.cname { font: 600 1.25em/1.05 var(--font-head); }
.type-start { background: linear-gradient(135deg, #d9f99d, #86efac); color: #14532d; }
.type-jail { background: repeating-linear-gradient(45deg, #fed7aa 0 .8em, #fdba74 .8em 1.6em); color: #7c2d12; }
.type-free { background: linear-gradient(135deg, #bae6fd, #fde68a); color: #0c4a6e; }
.type-gotojail { background: linear-gradient(135deg, #fecaca, #f87171); color: #7f1d1d; }

/* centre */
.center {
  position: relative; background: var(--board); display: flex; align-items: center; justify-content: center; overflow: hidden;
  background-image: radial-gradient(circle at 50% 50%, rgba(255,255,255,.55), transparent 60%), repeating-radial-gradient(circle at 50% 50%, transparent 0 3em, rgba(0,0,0,.025) 3em 3.1em);
  background-color: var(--board); color: var(--ink);
}
.c-globe { position: absolute; font-size: 26em; opacity: .07; animation: spin 120s linear infinite; pointer-events: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.c-mid { position: relative; z-index: 1; text-align: center; display: flex; flex-direction: column; align-items: center; }
.c-title {
  font: 700 3.1em/1 var(--font-head); color: var(--accent); letter-spacing: .02em; padding: .15em .6em; transform: rotate(-4deg);
  background: var(--tile); border: .12em solid var(--line); border-radius: .3em; box-shadow: .12em .14em 0 var(--line);
}
.c-sub { font-weight: 800; font-size: 1.15em; margin-top: .7em; opacity: .75; }
.c-turn { margin-top: 1.1em; font-size: 1.3em; font-weight: 800; min-height: 1.6em; }
.c-pot { margin-top: .6em; font-size: 1.2em; font-weight: 800; }
.c-pot:empty { display: none; }
.deck-pile {
  position: absolute; width: 9.5em; height: 6em; border-radius: .7em; background: var(--tile); border: .3em solid var(--dc);
  display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 1em; color: var(--dc);
  box-shadow: .25em .25em 0 rgba(0,0,0,.15), .5em .5em 0 rgba(0,0,0,.08);
}
.deck-pile span { font-size: 2.2em; line-height: 1.1; }
.deck-pile b { font: 600 1.05em var(--font-head); }
.dp-a { top: 9%; left: 8%; transform: rotate(-24deg); }
.dp-b { bottom: 9%; right: 8%; transform: rotate(-24deg); }

/* dice */
.dice { display: flex; gap: 1em; justify-content: center; margin-top: 1em; min-height: 4.6em; cursor: pointer; }
.die {
  width: 4.4em; height: 4.4em; border-radius: .85em; background: linear-gradient(145deg, #fff, #e5e5e5);
  box-shadow: 0 .35em .7em rgba(0,0,0,.35), inset 0 -.3em 0 rgba(0,0,0,.09), inset 0 .15em 0 #fff; color: #1a1a1a;
}
.die.pips { display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: .55em; }
.die.pips i { border-radius: 50%; margin: .13em; }
.die.pips i.on { background: radial-gradient(circle at 35% 35%, #555, #0d0d0d); }
.die.num { display: flex; align-items: center; justify-content: center; }
.die.num span { font: 700 2.1em var(--font-head); }
.dice.rolling .die { animation: shake .13s infinite alternate; }
.dice.rolling .die:nth-child(2) { animation-delay: -.06s; }
@keyframes shake { from { transform: rotate(-14deg) translateY(-.3em); } to { transform: rotate(14deg) translateY(.2em); } }

/* tokens */
.token {
  position: absolute; z-index: 5; pointer-events: none;
  width: calc(2.8em * var(--token-scale)); height: calc(2.8em * var(--token-scale));
  margin-left: calc(-1.4em * var(--token-scale)); margin-top: calc(-1.4em * var(--token-scale));
  border-radius: 50%; background: #fff; border: .25em solid var(--pc); display: flex; align-items: center; justify-content: center;
  box-shadow: 0 .3em .6em rgba(0,0,0,.45); transition: left var(--mv, .17s) ease-out, top var(--mv, .17s) ease-out;
}
.token span { font-size: calc(1.55em * var(--token-scale)); line-height: 1; }
.token.current { z-index: 6; animation: pulse 1.4s ease-in-out infinite; }
.token.jailed { filter: grayscale(.4); }
.token.jailed::after { content: '🔒'; position: absolute; font-size: .9em; right: -.5em; bottom: -.4em; }
.token.hop span { animation: hop var(--mv, .17s) ease-out; }
@keyframes hop { 50% { transform: translateY(-.7em) scale(1.2); } }
@keyframes pulse { 0%, 100% { box-shadow: 0 .3em .6em rgba(0,0,0,.45), 0 0 0 0 var(--pc); } 50% { box-shadow: 0 .3em .6em rgba(0,0,0,.45), 0 0 0 .45em transparent; } }
.floater { position: absolute; z-index: 9; font: 700 1.9em var(--font-head); transform: translate(-50%, -50%); pointer-events: none; animation: floatup 1.5s ease-out forwards; text-shadow: 0 0 .2em #fff, 0 0 .4em #fff; }
@keyframes floatup { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.6); } 15% { opacity: 1; transform: translate(-50%, -80%) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -280%) scale(1); } }

/* players */
#players { display: flex; flex-direction: column; gap: 6px; max-height: 46vh; overflow: auto; padding: 4px; margin: -4px; }
.pcard {
  display: flex; align-items: center; gap: 10px; background: var(--panel); color: var(--panel-ink); border-radius: 14px; padding: 8px 10px;
  border-left: 6px solid var(--pc); cursor: pointer; transition: transform .2s, box-shadow .2s;
}
.pcard:hover { transform: translateX(3px); }
.pcard.active { box-shadow: 0 0 0 3px var(--pc), 0 8px 20px rgba(0,0,0,.3); }
.pcard.bankrupt { opacity: .45; filter: grayscale(1); }
.ptok { font-size: 26px; width: 44px; height: 44px; border-radius: 50%; background: #fff; border: 3px solid var(--pc); display: flex; align-items: center; justify-content: center; flex: none; }
.pinfo { flex: 1; min-width: 0; }
.pname { font-weight: 900; display: flex; gap: 4px; align-items: center; flex-wrap: wrap; font-size: 15px; }
.tag { font-size: 10.5px; background: rgba(127,127,127,.18); padding: 1px 7px; border-radius: 20px; font-weight: 800; }
.tag.warn { background: #fed7aa; color: #7c2d12; }
.pcash { font: 600 19px var(--font-head); }
.pcash.up { animation: cashup 1s; }
.pcash.down { animation: cashdown 1s; }
@keyframes cashup { 0% { color: #16a34a; transform: scale(1.18); } 100% { transform: none; } }
@keyframes cashdown { 0% { color: #dc2626; transform: scale(1.18); } 100% { transform: none; } }
.pchips { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 3px; }
.pchips i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; box-shadow: inset 0 0 0 1px rgba(0,0,0,.2); }
.pchips i.m { opacity: .3; }
.pworth { text-align: right; font-weight: 800; font-size: 13px; color: var(--muted); flex: none; }
.pworth small { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .05em; }
.pn { background: var(--pc); color: #fff; padding: 0 .45em; border-radius: 1em; white-space: nowrap; text-shadow: 0 1px 1px rgba(0,0,0,.3); font-weight: 800; }

#actions { background: var(--panel); border-radius: 14px; padding: 10px 12px; color: var(--panel-ink); }
#actions:empty { display: none; }
.act-who { font-size: 15px; margin-bottom: 8px; border-left: 4px solid var(--pc); padding-left: 8px; }
.act-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.act-btns .btn.big { flex: 1 1 100%; }
.act-btns .btn.primary.big { animation: glow 1.8s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 3px 0 rgba(0,0,0,.22), 0 0 0 6px rgba(255,173,51,.35); } }
.log-wrap { flex: 1; min-height: 140px; background: rgba(0,0,0,.3); border-radius: 14px; color: #f1f1f1; display: flex; flex-direction: column; overflow: hidden; }
.log-head { font: 600 14px var(--font-head); padding: 8px 12px 4px; opacity: .8; }
#log { overflow: auto; padding: 0 12px 8px; font-size: 13px; line-height: 1.5; }
.log-item { padding: 4px 0; border-bottom: 1px solid rgba(255,255,255,.07); animation: fadein .3s; }
.log-item:first-child { color: #fff; }

/* ---------- modals ---------- */
#modal-root { position: fixed; inset: 0; pointer-events: none; z-index: 50; }
.modal-back { position: fixed; inset: 0; background: rgba(5,10,20,.55); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 16px; pointer-events: auto; animation: fadein .2s; }
.modal-back.closing { animation: fadeout .16s forwards; }
.modal {
  background: var(--panel); color: var(--panel-ink); border-radius: 20px; max-width: min(500px, 100%); width: 100%;
  max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 30px 80px rgba(0,0,0,.5); animation: pop .3s cubic-bezier(.2, 1.4, .4, 1);
}
.modal.wide { max-width: min(880px, 100%); }
.modal-head { display: flex; align-items: center; padding: 16px 20px 0; gap: 10px; }
.modal-head h2 { flex: 1; margin: 0; font: 600 22px var(--font-head); }
.modal-body { padding: 14px 20px; overflow: auto; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 0 20px 18px; flex-wrap: wrap; }
.x { background: none; border: 0; font-size: 20px; cursor: pointer; color: inherit; opacity: .6; }
.x:hover { opacity: 1; }
@keyframes fadein { from { opacity: 0; } }
@keyframes fadeout { to { opacity: 0; } }
@keyframes pop { from { transform: scale(.85) translateY(20px); opacity: 0; } }
.warn-note { background: #fff3cd; color: #7a4f00; border-radius: 10px; padding: 8px 12px; font-weight: 700; font-size: 13px; }

/* deed */
.deed-modal { max-width: 420px; }
.deed { border: 4px solid var(--gc); border-radius: 14px; overflow: hidden; text-align: center; background: var(--panel); }
.deed-band { background: var(--gc); color: #fff; font: 600 14px var(--font-head); padding: 7px; text-transform: uppercase; letter-spacing: .12em; text-shadow: 0 1px 2px rgba(0,0,0,.45); }
.deed-photo { height: 180px; display: flex; align-items: center; justify-content: center; font-size: 90px; background: linear-gradient(135deg, rgba(127,127,127,.08), rgba(127,127,127,.22)); background-size: cover; background-position: center; position: relative; transition: background-image .3s; }
.deed-photo span { animation: bob 4s ease-in-out infinite; }
.deed-photo.has-img span { font-size: 40px; position: absolute; right: 10px; bottom: 6px; filter: drop-shadow(0 2px 4px rgba(0,0,0,.6)); }
.deed-title { font: 700 25px var(--font-head); margin-top: 10px; }
.deed-country { color: var(--muted); font-weight: 800; font-size: 14px; }
.deed-desc { margin: 6px 16px; font-style: italic; font-size: 14px; }
.deed-extract { font-size: 12.5px; color: var(--muted); margin: 4px 16px 8px; text-align: left; line-height: 1.45; }
.deed-extract:empty { display: none; }
.deed-extract a { color: var(--accent); font-weight: 800; }
.deed-rent { width: calc(100% - 32px); margin: 6px 16px 12px; border-collapse: collapse; font-size: 14px; }
.deed-rent td { padding: 4px 4px; border-bottom: 1px dashed rgba(127,127,127,.3); text-align: left; }
.deed-rent td:last-child { text-align: right; font-weight: 900; white-space: nowrap; }
.deed-rent tr.sep td { border-top: 2px solid rgba(127,127,127,.35); }
.deed-owner { margin: 0 16px 14px; padding: 7px; border-radius: 10px; background: var(--pc); color: #fff; font-weight: 800; text-shadow: 0 1px 1px rgba(0,0,0,.3); }
.deed-owner.free { background: rgba(127,127,127,.12); color: inherit; text-shadow: none; }
.deed-modal .manage-list { margin-top: 12px; }

/* cards */
.card-modal { max-width: 400px; background: transparent; box-shadow: none; }
.card-modal .modal-body { overflow: visible; perspective: 900px; }
.card-modal .modal-foot { justify-content: center; }
.gcard {
  background: #fffdf5; color: #222; border-radius: 18px; border: 7px solid var(--dc); padding: 20px 22px; text-align: center;
  animation: flipin .7s cubic-bezier(.2, 1.3, .4, 1); box-shadow: 0 25px 60px rgba(0,0,0,.45);
  background-image: radial-gradient(circle at 100% 0, color-mix(in srgb, var(--dc) 22%, transparent), transparent 55%);
}
.gc-top { font: 700 21px var(--font-head); color: var(--dc); text-transform: uppercase; letter-spacing: .08em; }
.gc-icon { font-size: 54px; margin: 10px 0 4px; animation: bob 3s ease-in-out infinite; }
.gc-text { font-size: 19px; font-weight: 800; line-height: 1.35; margin: 8px 0 14px; }
.gc-who { font-size: 13px; }
@keyframes flipin { from { transform: rotateY(100deg) scale(.6); opacity: 0; } }

/* manage */
.manage-cash { font-size: 15px; margin-bottom: 8px; }
.mrow { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid rgba(127,127,127,.18); flex-wrap: wrap; }
.sw { width: 14px; height: 14px; border-radius: 4px; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.2); display: inline-block; }
.mn { flex: 1; font-weight: 800; min-width: 150px; }
.mb { min-width: 40px; }
.mbtns { display: flex; gap: 4px; flex-wrap: wrap; }
.mrow.is-m .mn { opacity: .55; }

/* trade */
.trade { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; }
.tmid { align-self: center; font-size: 30px; opacity: .6; }
.tcol h4 { margin: 0 0 8px; font: 600 17px var(--font-head); }
.tcol select { width: 100%; margin-bottom: 8px; }
.tprops { max-height: 250px; overflow: auto; border: 1.5px solid rgba(127,127,127,.25); border-radius: 12px; padding: 6px; margin-bottom: 8px; }
.tp { display: flex; gap: 6px; align-items: center; padding: 4px; cursor: pointer; border-radius: 6px; font-weight: 700; font-size: 14px; }
.tp:hover { background: rgba(127,127,127,.1); }
.tcash { display: flex; gap: 8px; align-items: center; font-weight: 800; }
.tcash input { width: 120px; }
.trade-hint { margin-top: 12px; text-align: center; font-size: 15px; min-height: 22px; }
.trade-sum { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; background: rgba(127,127,127,.08); border-radius: 12px; padding: 12px; line-height: 1.6; }
.trade-sum h4 { margin: 0 0 6px; }

/* auction */
.auction-modal { max-width: 520px; }
.auc-info { text-align: center; color: var(--muted); font-weight: 800; }
.auc-high { font: 700 34px var(--font-head); text-align: center; margin: 6px 0 12px; }
.auc-high small { font: 700 15px var(--font-body); display: block; }
.auc-bidders { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.auc-b { padding: 4px 10px; border-radius: 20px; border: 2px solid var(--pc); font-weight: 800; font-size: 13px; transition: .2s; }
.auc-b.out { opacity: .3; text-decoration: line-through; }
.auc-b.now { background: var(--pc); color: #fff; transform: scale(1.1); }
.auc-ctrl { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; align-items: center; margin-top: 14px; min-height: 40px; }
.auc-ctrl p { width: 100%; text-align: center; margin: 0 0 4px; }
.auc-custom { width: 100px; }
.auc-win { font: 700 22px var(--font-head); animation: pop .4s; }

/* victory & help */
.victory { text-align: center; }
.victory h2 { font: 700 34px var(--font-head); margin: 0 0 12px; }
.win-crown { font-size: 70px; animation: bob 2s ease-in-out infinite; }
.win-tok { font-size: 54px; margin-top: -10px; }
.rank { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
.rank td { padding: 7px 6px; border-bottom: 1px solid rgba(127,127,127,.2); font-weight: 800; text-align: left; }
.rank tr.out { opacity: .55; }
.howto ol { padding-left: 20px; line-height: 1.7; }
.ig-form { column-width: 340px; }

/* toasts & fx */
#toasts { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; z-index: 60; pointer-events: none; align-items: center; width: max-content; max-width: 92vw; }
.toast { background: rgba(17,22,34,.94); color: #fff; padding: 9px 18px; border-radius: 30px; font-weight: 800; font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.35); border-left: 5px solid var(--tc, var(--accent)); animation: tin .35s cubic-bezier(.2, 1.4, .4, 1); transition: opacity .4s, transform .4s; }
.toast.out { opacity: 0; transform: translateY(-10px); }
@keyframes tin { from { opacity: 0; transform: translateY(-16px) scale(.9); } }
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 70; }

/* ---------- responsive ---------- */
@media (max-width: 1250px) {
  .board-ed { grid-template-columns: 1fr 1fr; }
  .be-side { grid-column: 1 / -1; }
  .card-row { grid-template-columns: 1fr 1fr; }
  .card-row textarea { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  body { overflow: auto; }
  #screen-game { flex-direction: column; padding: 8px; gap: 10px; }
  #board-area { flex: none; width: 100%; }
  #sidebar { width: 100%; flex: none; }
  #players { max-height: none; order: 2; }
  #actions { order: 1; position: sticky; bottom: 6px; z-index: 4; box-shadow: 0 8px 24px rgba(0,0,0,.35); }
  .log-wrap { min-height: 220px; order: 3; }
  .board-ed { grid-template-columns: 1fr; }
  .tab-body { margin: 0 8px 12px; padding: 16px; }
  .tabs, .setup-head { padding-left: 8px; padding-right: 8px; }
  .frow { flex-wrap: wrap; }
}
@media (max-width: 560px) {
  .trade, .trade-sum { grid-template-columns: 1fr; }
  .tmid { display: none; }
  .card-row { grid-template-columns: 1fr; }
  .btn.big { font-size: 16px; padding: 12px 18px; }
  input[type=range] { width: 120px; }
}
/* phones: tiles are only ~27 px, too small for names — show a big emoji and the price instead.
   Names stay readable in the magnifier (touch and hold) and on each space's card (tap). */
#board { -webkit-touch-callout: none; }
#board.compact .tname, #board.compact .cname, #board.compact .c-sub, #board.compact .deck-pile b { display: none; }
#board.compact .tbody, #board.compact .side-left .tbody, #board.compact .side-right .tbody { flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: .1em; gap: .15em; }
#board.compact .temoji { font-size: 3.3em; }
#board.compact .tprice { font-size: 1.75em; opacity: .85; margin-top: 0; letter-spacing: -.02em; white-space: nowrap; }
#board.compact .cemoji { font-size: 6em; }
#board.compact .c-title { font-size: 3.6em; }
#board.compact .c-turn { font-size: 2.7em; }
#board.compact .c-pot { font-size: 2.2em; }
#board.compact .dice { font-size: 1.5em; }
#board.compact .deck-pile span { font-size: 3em; }
#board.compact .bld { font-size: 1.6em; }
#board.compact .side-bottom .own, #board.compact .side-top .own { height: 1em; }
#board.compact .side-left .own, #board.compact .side-right .own { width: 1em; }
#board.compact .mstamp { font-size: 1.4em; }
#board.compact .token { width: calc(4.6em * var(--token-scale)); height: calc(4.6em * var(--token-scale)); margin-left: calc(-2.3em * var(--token-scale)); margin-top: calc(-2.3em * var(--token-scale)); border-width: .4em; }
#board.compact .token span { font-size: calc(2.6em * var(--token-scale)); }
/* the magnifier */
#lens { position: fixed; z-index: 80; width: 230px; height: 160px; border-radius: 22px; overflow: hidden; pointer-events: none; background: var(--line);
  border: 3px solid #fff; box-shadow: 0 0 0 2px rgba(0,0,0,.35), 0 18px 40px rgba(0,0,0,.55); }
#lens[hidden] { display: none; }
#lens > #lens-board { position: absolute; left: 0; top: 0; transform-origin: 0 0; margin: 0; box-shadow: none; }
#lens::after { content: ''; position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; margin: -5px; border-radius: 50%; border: 2px solid rgba(255,255,255,.9); box-shadow: 0 0 0 1px rgba(0,0,0,.5); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
