:root {
  --board-bg: #cfe4d8; --line: #14261c; --panel: #131c25; --panel2: #1b2733; --ink: #eef3f7; --muted: #8fa1b1;
  --accent: #e4572e; --banner: #0f6b5c; --page1: #14636a; --page2: #061e22; --good: #2fbf71; --warn: #f4a261; --step: .105s;
  --b: min(calc(100vh - 20px), calc(100vw - 440px));
  --u: calc(var(--b) / 100); --uc: calc(var(--b) / 100); --k: 1; --hz: 1.07;
  --cream: #f6faf2;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; color: var(--ink); font: 14px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif; overflow: hidden; }
body { background: radial-gradient(ellipse at 30% 20%, var(--page1) 0%, color-mix(in srgb, var(--page1) 45%, var(--page2)) 45%, var(--page2) 100%); }
body::before { content: ""; position: fixed; inset: 0; background: repeating-linear-gradient(45deg, rgba(255,255,255,.012) 0 2px, transparent 2px 6px); pointer-events: none; }
button { font: inherit; cursor: pointer; }
.hidden { display: none !important; }
#app { display: flex; height: 100vh; gap: 14px; padding: 10px; align-items: center; justify-content: center; position: relative; }
#boardWrap { flex: none; filter: drop-shadow(0 18px 38px rgba(0,0,0,.55)); }

/* ───── Board ───── */
#board {
  width: var(--b); height: var(--b); display: grid; position: relative; border-radius: calc(var(--u) * .9);
  background: var(--board-bg); border: calc(var(--u) * .7) solid color-mix(in srgb, var(--board-bg) 22%, #000); box-shadow: inset 0 0 0 1px rgba(255,255,255,.18), 0 0 0 calc(var(--u) * .25) color-mix(in srgb, var(--board-bg) 40%, #000);
  grid-template-columns: 1.55fr repeat(9, 1fr) 1.55fr; grid-template-rows: 1.55fr repeat(9, 1fr) 1.55fr;
  --u: calc(var(--b) / 100 * var(--k)); /* squares, tokens and text shrink on bigger boards; the centre keeps --uc */
  font-size: calc(var(--u) * 1.05); font-family: "Avenir Next", "Helvetica Neue", sans-serif;
}
.sq { container-type: size; border: 1px solid rgba(10,30,18,.75); position: relative; display: flex; overflow: hidden; color: #0f1a12; cursor: pointer; text-align: center;
  background: linear-gradient(180deg, #fbfdf8 0%, #eaf2e6 100%); transition: transform .12s, box-shadow .12s, filter .12s; }
.sq:hover { transform: scale(var(--hz)); z-index: 6; box-shadow: 0 6px 18px rgba(0,0,0,.4); filter: brightness(1.04); }
.sq.s-bottom { flex-direction: column; } .sq.s-top { flex-direction: column-reverse; }
.sq.s-left { flex-direction: row-reverse; } .sq.s-right { flex-direction: row; }
.band { position: relative; flex: none; display: flex; align-items: center; justify-content: center; gap: 1px; border: 0 solid rgba(10,30,18,.85);
  background: linear-gradient(rgba(255,255,255,.38), rgba(255,255,255,0) 45%, rgba(0,0,0,.16)), var(--gc); }
.s-bottom .band, .s-top .band { height: 24%; } .s-left .band, .s-right .band { width: 24%; }
.s-bottom .band { border-bottom-width: 1px; } .s-top .band { border-top-width: 1px; } .s-left .band { border-left-width: 1px; } .s-right .band { border-right-width: 1px; }
.s-left .band, .s-right .band { flex-direction: column; }
.bld { display: flex; align-items: center; justify-content: center; gap: calc(var(--u) * .25); }
.s-left .bld, .s-right .bld { flex-direction: column; }
.bld i { display: block; width: calc(var(--u) * 1.5); height: calc(var(--u) * 1.5); background: linear-gradient(#4ee07f, #14893f); clip-path: polygon(50% 0, 100% 42%, 100% 100%, 0 100%, 0 42%); filter: drop-shadow(0 1px 0 rgba(0,0,0,.5)); }
.bld.hotel i { width: calc(var(--u) * 3.6); height: calc(var(--u) * 1.9); background: linear-gradient(#ff5a5a, #b31217); clip-path: polygon(0 30%, 12% 30%, 12% 0, 88% 0, 88% 30%, 100% 30%, 100% 100%, 0 100%); }
.sq .body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 3% 2%; min-width: 0; gap: calc(var(--u) * .2); }
.sq .nm { font-weight: 750; font-size: max(11.4cqh, 7.6px); line-height: 1.05; letter-spacing: -0.02em; overflow-wrap: normal; word-break: normal; }
.s-bottom .nm, .s-top .nm { font-size: max(10.4cqw, 7.6px); }
.sq .pr { font-size: max(10cqmin, 6.4px); font-weight: 600; color: #35503f; background: rgba(0,0,0,.06); padding: 0 calc(var(--u) * .5); border-radius: 99px; }
.sq .icon { font-size: 26cqmin; line-height: 1; filter: drop-shadow(0 1px 1px rgba(0,0,0,.25)); }
.t-rail { background: linear-gradient(180deg, #f2f2ee, #d9ddd6); } .t-util { background: linear-gradient(180deg, #fff9df, #f0e6b8); }
.t-chance { background: linear-gradient(160deg, #ffd08a, #f7941d); } .t-chest { background: linear-gradient(160deg, #cdeeff, #5cc1f2); }
.t-chance .icon { color: #b45309; font-weight: 900; } .t-tax { background: linear-gradient(160deg, #fff1b8, #e5c24a); }
.sq.corner { align-items: center; justify-content: center; }
.sq.corner .nm { font-size: calc(var(--u) * 1.6); font-weight: 900; letter-spacing: .02em; text-transform: uppercase; }
.sq.corner .icon { font-size: calc(var(--u) * 4.3); }
.t-go { background: linear-gradient(135deg, #fff, #ffd9d9); } .t-go .nm { color: #d3141b; font-size: calc(var(--u) * 3.2); }
.t-jail { background: linear-gradient(135deg, #ffb347 0 48%, #fff 48% 52%, #f4f1e8 52%); }
.t-parking { background: linear-gradient(135deg, #ffe0e0, #ff8c8c); } .t-gotojail { background: linear-gradient(135deg, #e6f0ff, #7fb0ff); }
.sq.owned { box-shadow: inset 0 0 0 calc(var(--u) * .4) var(--oc); }
.sq.owned:hover { box-shadow: inset 0 0 0 calc(var(--u) * .4) var(--oc), 0 6px 18px rgba(0,0,0,.4); }
.badge { position: absolute; right: calc(var(--u) * .5); bottom: calc(var(--u) * .5); width: calc(var(--u) * 2.5); height: calc(var(--u) * 2.5); border-radius: 50%; display: none; align-items: center; justify-content: center; font-size: calc(var(--u) * 1.4); border: calc(var(--u) * .2) solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.5); z-index: 2; }
.sq.mort { filter: grayscale(.85) brightness(.9); }
.sq.mort::after { content: "MORTGAGED"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: repeating-linear-gradient(45deg, rgba(30,30,30,.5) 0 5px, rgba(70,70,70,.5) 5px 10px); color: #fff; font-weight: 800; font-size: calc(var(--u) * .95); letter-spacing: .04em; text-shadow: 0 1px 2px #000; }
.sq.here { animation: here 1.4s ease-in-out infinite; z-index: 4; }
@keyframes here { 50% { box-shadow: inset 0 0 0 calc(var(--u) * .5) var(--pc), 0 0 calc(var(--u) * 2) var(--pc); } }

/* tokens glide over the board */
#tokens { position: absolute; inset: 0; z-index: 8; pointer-events: none; }
.tk3d { position: absolute; width: calc(var(--u) * 3.4); height: calc(var(--u) * 3.4); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: calc(var(--u) * 2); line-height: 1;
  background: radial-gradient(circle at 32% 28%, #fff 0, var(--c) 55%, color-mix(in srgb, var(--c) 55%, #000) 100%); border: calc(var(--u) * .25) solid #fff;
  box-shadow: 0 calc(var(--u) * .5) calc(var(--u) * .8) rgba(0,0,0,.55), inset 0 -3px 5px rgba(0,0,0,.25);
  transform: translate(calc(-50% + var(--dx, 0) * var(--u)), calc(-50% + var(--dy, 0) * var(--u))); transition: left var(--step) linear, top var(--step) linear; }
.tk3d.cur { z-index: 3; animation: bob .9s ease-in-out infinite; }
@keyframes bob { 50% { transform: translate(calc(-50% + var(--dx, 0) * var(--u)), calc(-50% + var(--dy, 0) * var(--u) - var(--u) * .5)); } }
.tk3d.jailed::after { content: ""; position: absolute; inset: -12%; border-radius: 50%; background: repeating-linear-gradient(90deg, rgba(20,20,20,.9) 0 2px, transparent 2px 7px); border: 2px solid #222; }

/* ───── Board centre ───── */
#center { grid-area: 2 / 2 / 11 / 11; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: calc(var(--uc) * 3.5);
  background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--board-bg) 38%, white) 0%, color-mix(in srgb, var(--board-bg) 88%, white) 60%, color-mix(in srgb, var(--board-bg) 92%, black) 100%); overflow: hidden; }
#center::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(135deg, rgba(255,255,255,.14) 0 calc(var(--uc)*.5), transparent calc(var(--uc)*.5) calc(var(--uc)*2.2)); }
#center .title { position: relative; display: flex; flex-direction: column; align-items: center; gap: calc(var(--uc) * .5); margin-top: calc(var(--uc) * 3.2);
  padding: calc(var(--uc) * 3.6) calc(var(--uc) * 5) calc(var(--uc) * 1.8); font-size: calc(var(--uc) * 6.2); font-weight: 900; letter-spacing: .09em; line-height: 1;
  color: color-mix(in srgb, var(--banner) 72%, black); font-family: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", "Avenir Next", system-ui, sans-serif;
  background: linear-gradient(#fffaf0, #f2e7cd); border-radius: calc(var(--uc) * 1.6);
  box-shadow: 0 0 0 calc(var(--uc) * .35) var(--banner), 0 0 0 calc(var(--uc) * .8) #fffaf0, 0 0 0 calc(var(--uc) * 1.1) var(--banner), 0 16px 30px rgba(0,0,0,.32); }
#center .title .mk { position: absolute; top: calc(var(--uc) * -4.4); left: 50%; width: calc(var(--uc) * 8.6); height: calc(var(--uc) * 8.6); transform: translateX(-50%); filter: drop-shadow(0 4px 5px rgba(0,0,0,.35)); }
#dice { position: relative; display: flex; flex-direction: column; align-items: center; gap: calc(var(--uc) * 1.2); min-height: calc(var(--uc) * 12); }
#dice .pair { display: flex; gap: calc(var(--uc) * 2.4); }
#dice .sum { font-weight: 800; font-size: calc(var(--uc) * 1.9); color: #1d3a2a; background: rgba(255,255,255,.8); padding: 0 calc(var(--uc) * 1.4); border-radius: 99px; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.die { width: calc(var(--uc) * 7.6); height: calc(var(--uc) * 7.6); background: linear-gradient(145deg, #fff, #dcdcd6); border-radius: calc(var(--uc) * 1.6); display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: calc(var(--uc) * 1);
  box-shadow: 0 calc(var(--uc) * .8) calc(var(--uc) * 1.4) rgba(0,0,0,.4), inset 0 calc(var(--uc) * -.4) 0 rgba(0,0,0,.1), inset 0 calc(var(--uc) * .3) 0 #fff; }
.die b { width: 78%; height: 78%; margin: auto; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #555, #000 70%); }
.die.roll { animation: tumble .22s linear infinite; }
@keyframes tumble { 0% { transform: rotate(-14deg) translateY(0); } 50% { transform: rotate(10deg) translateY(calc(var(--uc) * -1.2)); } 100% { transform: rotate(-14deg) translateY(0); } }
.deckbox { position: absolute; width: calc(var(--uc) * 17); height: calc(var(--uc) * 10.5); display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 900; font-size: calc(var(--uc) * 1.5); letter-spacing: .08em; text-align: center; border: calc(var(--uc) * .25) solid #fff; border-radius: calc(var(--uc) * .9); color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.4);
  box-shadow: calc(var(--uc) * .3) calc(var(--uc) * .3) 0 rgba(0,0,0,.18), calc(var(--uc) * .6) calc(var(--uc) * .6) 0 rgba(0,0,0,.12), 0 8px 16px rgba(0,0,0,.25); }
.deckbox span { font-size: calc(var(--uc) * 4); line-height: 1; }
.deckbox.chance { background: linear-gradient(145deg, #ffae42, #e8730c); top: 6%; right: 6%; transform: rotate(10deg); } .deckbox.chest { background: linear-gradient(145deg, #5cc8ff, #1f86c9); bottom: 6%; left: 6%; transform: rotate(10deg); }
#cardPop { position: absolute; z-index: 20; width: 64%; padding: calc(var(--uc) * 2.4); border-radius: calc(var(--uc) * 1.4); border: calc(var(--uc) * .35) solid #fff; box-shadow: 0 20px 50px rgba(0,0,0,.5); text-align: center; color: #111; animation: flip .45s cubic-bezier(.2,.9,.3,1.2); }
#cardPop h4 { margin: 0 0 calc(var(--uc) * 1); font-size: calc(var(--uc) * 1.9); text-transform: uppercase; letter-spacing: .1em; }
#cardPop p { margin: 0; font-size: calc(var(--uc) * 2); font-weight: 650; line-height: 1.25; }
#cardPop.chance { background: linear-gradient(160deg, #ffc46b, #f7941d); } #cardPop.chest { background: linear-gradient(160deg, #a5e1ff, #4eb8ee); }
@keyframes flip { from { transform: perspective(900px) rotateY(90deg) scale(.7); opacity: 0; } }

/* ───── Side panel ───── */
#side { width: 410px; flex: none; height: calc(100vh - 20px); display: flex; flex-direction: column; gap: 8px; min-height: 0; }
#side > * { background: linear-gradient(180deg, rgba(31,44,57,.92), rgba(19,28,37,.95)); border: 1px solid rgba(255,255,255,.06); border-radius: 14px; padding: 10px 12px; box-shadow: 0 4px 14px rgba(0,0,0,.3); }
#turnBar { display: flex; align-items: center; gap: 12px; font-size: 17px; font-weight: 700; }
#turnBar .tk { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 26px; background: radial-gradient(circle at 32% 28%, #fff, var(--c) 60%, color-mix(in srgb, var(--c) 55%, #000)); border: 3px solid #fff; box-shadow: 0 3px 8px rgba(0,0,0,.5); }
#turnBar small { color: var(--muted); font-weight: 500; display: block; font-size: 12.5px; }
#actions { display: flex; flex-direction: column; gap: 8px; min-height: 96px; }
#actions .msg { color: var(--muted); } #actions .msg b { color: var(--ink); }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn { background: linear-gradient(180deg, #38506a, #2b3e52); color: var(--ink); border: 1px solid #496684; padding: 8px 14px; border-radius: 10px; font-weight: 650; transition: transform .06s, filter .15s, box-shadow .15s; box-shadow: 0 2px 0 rgba(0,0,0,.35); }
.btn:hover:not(:disabled) { filter: brightness(1.18); } .btn:active:not(:disabled) { transform: translateY(2px); box-shadow: none; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 84%, white), color-mix(in srgb, var(--accent) 82%, black)); border-color: color-mix(in srgb, var(--accent) 65%, white); box-shadow: 0 3px 0 color-mix(in srgb, var(--accent) 48%, black), 0 6px 14px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn.good { background: linear-gradient(180deg, #2fc97c, #17894f); border-color: #4be39a; box-shadow: 0 3px 0 #0c4f2c; }
.btn.danger { background: linear-gradient(180deg, #9a2a34, #6b1a22); border-color: #c0505b; }
.btn.sm { padding: 4px 9px; font-size: 12.5px; border-radius: 8px; } .btn.big { padding: 13px 20px; font-size: 16px; flex: 1; }
#actions .btn.primary.big { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 3px 0 #7d121b, 0 0 22px rgba(255,90,100,.7); } }
.debt { background: linear-gradient(180deg, #46222a, #2f161c); border: 1px solid #b53a45; padding: 8px 10px; border-radius: 10px; }
#players { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.pl { display: grid; grid-template-columns: 40px 1fr auto; gap: 2px 10px; align-items: center; padding: 6px 10px 6px 8px; border-radius: 11px; background: var(--panel2); border-left: 5px solid var(--pc); transition: background .2s; }
.pl.cur { background: linear-gradient(90deg, rgba(255,255,255,.1), rgba(255,255,255,.04)); box-shadow: 0 0 0 2px var(--pc), 0 0 18px -4px var(--pc); }
.pl.out { opacity: .4; text-decoration: line-through; }
.pl .tk { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 21px; grid-row: span 2; background: radial-gradient(circle at 32% 28%, #fff, var(--pc) 60%, color-mix(in srgb, var(--pc) 55%, #000)); border: 2px solid #fff; box-shadow: 0 2px 5px rgba(0,0,0,.5); }
.pl .nm { font-weight: 700; } .pl .cash { font-variant-numeric: tabular-nums; font-weight: 800; color: #9bf0bf; font-size: 15px; }
.pl.up { animation: flashUp .9s; } .pl.down { animation: flashDown .9s; }
@keyframes flashUp { 0% { background: rgba(47,191,113,.55); } } @keyframes flashDown { 0% { background: rgba(230,57,70,.55); } }
.pl .chips { grid-column: 2 / 4; display: flex; flex-wrap: wrap; gap: 3px; align-items: center; min-height: 4px; }
.chip { width: 15px; height: 20px; border-radius: 3px; border: 1px solid rgba(0,0,0,.65); cursor: pointer; position: relative; box-shadow: inset 0 3px 0 rgba(255,255,255,.3); transition: transform .1s; }
.chip:hover { transform: translateY(-2px) scale(1.12); }
.chip.m { opacity: .35; } .chip.m::after { content: "M"; position: absolute; inset: 0; font-size: 9px; text-align: center; color: #000; font-weight: 800; }
.chip.rail { background: #333; } .chip.util { background: #ddd; }
.tag { font-size: 11px; background: rgba(255,255,255,.12); padding: 1px 7px; border-radius: 99px; margin-left: 5px; font-weight: 600; }
.floater { position: fixed; z-index: 150; font-weight: 900; font-size: 20px; pointer-events: none; text-shadow: 0 2px 6px rgba(0,0,0,.7); animation: floatUp 1.6s ease-out forwards; }
.floater.up { color: #7dffb0; } .floater.down { color: #ff8a93; }
@keyframes floatUp { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-46px); } }
#menu { display: flex; gap: 6px; flex-wrap: wrap; justify-content: space-between; padding: 8px 10px !important; }

/* ───── Dialogs ───── */
#modal { position: fixed; inset: 0; background: rgba(4,9,13,.72); display: flex; align-items: center; justify-content: center; z-index: 100; backdrop-filter: blur(4px); }
.dlg { background: linear-gradient(180deg, #1d2a37, #131c25); border: 1px solid #34495d; border-radius: 18px; padding: 22px 24px; width: min(780px, 94vw); max-height: 92vh; overflow-y: auto; box-shadow: 0 30px 90px rgba(0,0,0,.65); animation: dlgIn .18s ease-out; }
@keyframes dlgIn { from { transform: translateY(14px) scale(.97); opacity: 0; } }
.dlg.narrow { width: min(430px, 94vw); }
.dlg h2 { margin: 0 0 10px; font-size: 21px; } .dlg h3 { margin: 14px 0 6px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.dlg .x { float: right; }
.deed { background: #fffef9; color: #111; border: 2px solid #111; border-radius: 8px; overflow: hidden; margin-bottom: 12px; box-shadow: 0 8px 22px rgba(0,0,0,.35); }
.deed .hd { padding: 12px; text-align: center; font-weight: 800; font-size: 18px; border-bottom: 2px solid #111; text-transform: uppercase; letter-spacing: .03em; }
.deed table { width: 100%; border-collapse: collapse; } .deed td { padding: 3px 14px; } .deed td:last-child { text-align: right; font-weight: 700; }
.deed tr:nth-child(even) td { background: rgba(0,0,0,.04); }
.deed .ft { padding: 8px 14px; font-size: 12.5px; color: #444; border-top: 1px solid #ccc; }
.grp { margin-bottom: 8px; } .prow { display: grid; grid-template-columns: 10px 1.5fr 70px 1fr; gap: 8px; align-items: center; padding: 5px 0; border-bottom: 1px solid rgba(255,255,255,.07); }
.prow .sw { width: 10px; height: 26px; border-radius: 3px; box-shadow: inset 0 3px 0 rgba(255,255,255,.3); } .prow .btns { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.plist { max-height: 250px; overflow-y: auto; border: 1px solid #34495d; border-radius: 10px; padding: 4px 8px; background: rgba(0,0,0,.18); }
.plist label { display: flex; align-items: center; gap: 8px; padding: 3px 0; cursor: pointer; }
.plist .sw { width: 9px; height: 16px; border-radius: 2px; flex: none; }
input[type=text], input[type=number], select { background: #0d141b; color: var(--ink); border: 1px solid #3a4f63; border-radius: 9px; padding: 7px 10px; font: inherit; width: 100%; }
input:focus, select:focus { outline: 2px solid #4d9de0; outline-offset: 1px; }
.err { color: #ff8a93; min-height: 20px; margin-top: 8px; } .ok { color: #7ee2a8; }
.setup-row { display: grid; grid-template-columns: 44px 1fr 90px 130px; gap: 8px; margin-bottom: 8px; align-items: center; }
.big-tk { font-size: 28px; text-align: center; }
.muted { color: var(--muted); } .center { text-align: center; }
.auc .big { font-size: 38px; font-weight: 900; text-align: center; margin: 6px 0; color: #9bf0bf; text-shadow: 0 0 20px rgba(80,230,150,.4); }
#toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #7a1f27; color: #fff; padding: 10px 18px; border-radius: 12px; z-index: 200; box-shadow: 0 8px 24px rgba(0,0,0,.4); max-width: 80vw; border: 1px solid #c0505b; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Game settings in the new-game dialog */
.rules-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; }
.rule { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px 10px; background: rgba(255,255,255,.04); border: 1px solid #2c3d4e; border-radius: 10px; }
.rule span { display: flex; flex-direction: column; font-size: 14px; min-width: 0; }
.rule small { color: var(--muted); font-size: 11px; margin-top: 2px; }
.rule input[type=number] { width: 92px; text-align: right; }
.rule select { width: 200px; max-width: 58%; flex: none; }
.rule input[type=checkbox] { width: 20px; height: 20px; accent-color: #2a9d8f; }
@media (max-width: 760px) { .rules-grid { grid-template-columns: 1fr; } }

/* Property editor */
.dlg.wide { width: min(1060px, 97vw); }
table.cp { width: 100%; border-collapse: collapse; font-size: 13px; }
table.cp th { text-align: left; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; padding: 4px 4px; position: sticky; top: -22px; background: #1a2733; z-index: 1; }
table.cp td { padding: 2px 3px; }
table.cp input { width: 66px; padding: 5px 6px; text-align: right; }
table.cp input[type=text] { width: 100%; text-align: left; }
table.cp input.chg { border-color: #f4a261; background: rgba(244,162,97,.12); }
td.nmc { display: flex; align-items: center; gap: 6px; min-width: 190px; }
td.nmc .sw { flex: none; width: 12px; height: 24px; border-radius: 3px; border: 1px solid rgba(255,255,255,.25); }
table.cp2 td { padding: 3px 6px; }

.shady { display: flex; gap: 8px; align-items: flex-start; margin: 10px 0; padding: 8px 10px; border: 1px dashed #8a6d3b; border-radius: 10px; background: rgba(138,109,59,.12); font-size: 13px; cursor: pointer; }
.shady input { margin-top: 3px; }

/* Skyscraper: a tall glassy tower above the hotel */
.bld.sky i { width: calc(var(--u) * 2.4); height: calc(var(--u) * 3.1); background: linear-gradient(90deg, rgba(255,255,255,.35), rgba(255,255,255,0) 40%, rgba(0,0,0,.25)), repeating-linear-gradient(0deg, transparent 0 2px, rgba(255,255,255,.55) 2px 3px), linear-gradient(#5b6b8c, #1c2540);
  clip-path: polygon(30% 0, 70% 0, 70% 8%, 100% 8%, 100% 100%, 0 100%, 0 8%, 30% 8%); }
.s-bottom .band, .s-top .band { overflow: visible; } .s-left .band, .s-right .band { overflow: visible; }

/* Bigger boards: names are tiny until you hover (the hovered square zooms in) */
/* Square text scales with the square (cqmin); on very small squares only the icon is left and the hover card gives the details */
@container (max-width: 62px) or (max-height: 56px) { .sq:not(.corner) .pr { display: none; } }
@container (max-width: 36px) or (max-height: 36px) { .sq:not(.corner) .nm { display: none; } .sq:not(.corner) .icon { font-size: 34cqmin; } }
/* Row (street) name labels in the centre of the board */
.rowlbl { position: absolute; z-index: 2; display: flex; align-items: center; gap: calc(var(--uc) * .6); padding: calc(var(--uc) * .45) calc(var(--uc) * 1.4); border-radius: 99px; cursor: pointer;
  font-size: calc(var(--uc) * 1.9); font-weight: 800; letter-spacing: .03em; color: #1d3a2a; background: rgba(255,255,255,.72); border: calc(var(--uc) * .25) solid rgba(29,58,42,.25); white-space: nowrap; box-shadow: 0 2px 6px rgba(0,0,0,.18); transition: transform .12s, background .12s; }
.rowlbl:hover { background: #fff; transform: var(--tf) scale(1.06); }
.rowlbl.mine { border-color: var(--oc); box-shadow: 0 0 0 calc(var(--uc) * .3) var(--oc), 0 2px 6px rgba(0,0,0,.18); }
.rowlbl.r0 { --tf: translateX(-50%); bottom: 2.2%; left: 50%; transform: var(--tf); } .rowlbl.r2 { --tf: translateX(-50%); top: 2.2%; left: 50%; transform: var(--tf); }
.rowlbl.r1 { --tf: translateY(-50%) rotate(180deg); left: 1.6%; top: 50%; writing-mode: vertical-rl; transform: var(--tf); } .rowlbl.r3 { --tf: translateY(-50%); right: 1.6%; top: 50%; writing-mode: vertical-rl; transform: var(--tf); }
.rowlbl .crown { font-size: 1.1em; }
.rowdlg .rowlist { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; margin: 10px 0; font-size: 13px; }
.rowdlg .rowlist div { display: flex; align-items: center; gap: 6px; padding: 3px 6px; background: rgba(255,255,255,.04); border-radius: 8px; }
.rowdlg .rowlist .sw { width: 10px; height: 16px; border-radius: 2px; flex: none; }
.rowdlg input[type=text] { width: 100%; margin: 6px 0 10px; }
/* A hovered square grows into the board, never off its edge */
.sq.s-left { transform-origin: left center; } .sq.s-right { transform-origin: right center; }
.sq.s-top { transform-origin: center top; } .sq.s-bottom { transform-origin: center bottom; }

/* Station shops */
.sq .shops { position: absolute; left: 5%; bottom: 4%; display: none; gap: 0; font-size: calc(var(--u) * 1.7); line-height: 1; filter: drop-shadow(0 1px 1px rgba(0,0,0,.45)); pointer-events: none; z-index: 2; }

/* Save / load dialog */
.slot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; margin-bottom: 6px; background: rgba(255,255,255,.05); border: 1px solid #2c3d4e; border-radius: 10px; }
.slot > div:first-child { display: flex; flex-direction: column; min-width: 0; } .slot b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .slot small { color: var(--muted); font-size: 12px; }
.slot .btns { display: flex; gap: 5px; flex: none; }
#menu { flex-wrap: wrap; }

.jetbox { margin: 8px 0 12px; padding: 8px 12px; border: 1px dashed #4d7aa8; border-radius: 10px; background: rgba(77,122,168,.12); font-size: 13px; }
.jetbox .btn { margin-left: 6px; }

/* New-game dialog: the settings scroll, the Start / Resume buttons stay pinned at the bottom */
.dlg.setup { display: flex; flex-direction: column; overflow: hidden; padding: 0; max-height: min(92vh, 920px); }
.dlg.setup .sbody { flex: 1; min-height: 0; overflow-y: auto; padding: 22px 24px 12px; }
.dlg.setup .sfoot { flex: none; display: flex; flex-wrap: wrap; gap: 10px; padding: 12px 24px 16px; border-top: 1px solid #2c3d4e; background: linear-gradient(180deg, #17222d, #131c25); border-radius: 0 0 18px 18px; }
h4.sect { margin: 16px 0 8px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }

/* Hover card for a board square */
#tip { position: fixed; z-index: 200; pointer-events: none; min-width: 190px; max-width: 280px; padding: 10px 12px 11px; border-radius: 12px; background: linear-gradient(180deg, #1d2a37, #131c25); border: 1px solid #34495d; box-shadow: 0 14px 40px rgba(0,0,0,.55); color: var(--ink); font-size: 13px; line-height: 1.35; opacity: 0; transform: translateY(4px); transition: opacity .08s, transform .08s; }
#tip.show { opacity: 1; transform: none; }
#tip .band { height: 8px; margin: -10px -12px 8px; border-radius: 12px 12px 0 0; }
#tip h5 { margin: 0 0 2px; font-size: 16px; font-weight: 800; }
#tip .sub { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
#tip .ln { display: flex; justify-content: space-between; gap: 14px; padding: 2px 0; border-top: 1px solid rgba(255,255,255,.06); } #tip .ln b { font-weight: 700; }

/* Banner sub-title (edition name) and the look & feel controls in the setup dialog */
#center .title small { display: block; margin-top: calc(var(--uc) * .2); font-size: .3em; font-weight: 800; letter-spacing: .32em; text-transform: uppercase; color: var(--banner); opacity: .95; }
.look-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; }
.look-colors { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.look-colors label { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid #2c3d4e; border-radius: 10px; background: rgba(255,255,255,.04); font-size: 13px; }
.look-colors input[type=color] { width: 34px; height: 26px; padding: 0; border: 1px solid #456; border-radius: 6px; background: none; cursor: pointer; }
.rule input[type=text] { width: 120px; }
@media (max-width: 760px) { .look-grid { grid-template-columns: 1fr; } }

.brandmark { width: 30px; height: 30px; vertical-align: -8px; margin-right: 6px; }

/* ───── Phones, tablets and touch ───── */
html { -webkit-text-size-adjust: 100%; }
body { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
#app { padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); padding-top: max(10px, env(safe-area-inset-top)); padding-bottom: max(10px, env(safe-area-inset-bottom)); }
@supports (height: 100dvh) {
  :root { --b: min(calc(100dvh - 20px), calc(100vw - 440px)); }
  #app { height: 100dvh; }
  #side { height: calc(100dvh - 20px); }
  .dlg { max-height: 92dvh; }
  .dlg.setup { max-height: min(92dvh, 920px); }
}
@media (pointer: coarse) {
  .btn { min-height: 44px; } .btn.sm { min-height: 38px; }
  input, select, textarea { font-size: 16px; }
  #tip { display: none; }
  .sq:hover { transform: none; box-shadow: none; filter: none; }
}
/* Short landscape screens (phones turned sideways): a narrower side panel so the board can stay big */
@media (orientation: landscape) and (max-height: 560px) {
  :root { --b: min(calc(100vh - 12px), calc(100vw - 360px)); }
  #app { gap: 8px; padding-top: max(6px, env(safe-area-inset-top)); padding-bottom: max(6px, env(safe-area-inset-bottom)); }
  #side { width: 340px; height: calc(100vh - 12px); gap: 5px; }
  #side > * { padding: 6px 9px; }
  #turnBar { font-size: 15px; } #turnBar .tk { width: 34px; height: 34px; font-size: 20px; }
  #actions { min-height: 0; gap: 5px; }
  .btn.big { padding: 8px 14px; }
  }
/* "Zoom board" button: only useful when the board is squeezed into a narrow column */
.zoombtn { display: none; }
/* Portrait (phones and tablets held upright): your turn controls on top, the board under them, the rest below — the page scrolls */
@media (orientation: portrait), (max-width: 700px) {
  html, body { height: auto; min-height: 100%; overflow-y: auto; overflow-x: hidden; }
  :root { --b: min(calc(100vw - 14px), 880px); }
  #app { flex-direction: column; height: auto; min-height: 100vh; justify-content: flex-start; align-items: center; gap: 8px; padding-top: max(8px, env(safe-area-inset-top)); }
  @supports (height: 100dvh) { #app { min-height: 100dvh; } }
  #side { display: contents; }
  #side > * { width: var(--b); flex: none; }
  #turnBar { order: 1; } #actions { order: 2; min-height: 0; } #boardWrap { order: 3; }
  .zoombtn { display: inline-flex; }
  html.zoomboard { --b: 720px; }
  html.zoomboard #boardWrap { width: calc(100vw - 14px); overflow: auto; -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y; border-radius: 14px; max-height: 80dvh; }
  #players { order: 4; max-height: none; overflow: visible; }   .dlg { width: min(780px, 96vw); padding: 16px 14px; }
  .dlg.setup { padding: 0; } .dlg.setup .sbody { padding: 16px 14px 10px; } .dlg.setup .sfoot { padding: 10px 14px 12px; }
  .rules-grid, .look-grid { grid-template-columns: 1fr; }
  .setup-row { grid-template-columns: 38px 1fr 74px 104px; gap: 6px; }
  .dlg h2 { font-size: 18px; }
  table.cp { font-size: 12px; } table.cp input { width: 54px; } td.nmc { min-width: 150px; }
  #center .title { font-size: calc(var(--uc) * 5.4); }
}

/* Game log dialog */
.logbox { max-height: 62vh; overflow-y: auto; font-size: 13px; color: #b6c4d0; }
.logbox div { padding: 3px 0; border-bottom: 1px solid rgba(255,255,255,.06); } .logbox div:last-child { color: #fff; font-weight: 600; }

/* Online play */
#netbar { position: fixed; top: max(8px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 300; background: #7a5a1f; color: #fff; padding: 7px 16px; border-radius: 99px; border: 1px solid #d9a441; font-weight: 600; box-shadow: 0 6px 20px rgba(0,0,0,.4); }
.code { font-family: ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .24em; background: rgba(255,255,255,.1); padding: 2px 10px; border-radius: 8px; }
.seats { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.seat { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid #2c3d4e; border-radius: 10px; background: rgba(255,255,255,.04); }
.seat.me { border-color: var(--accent); } .seat .stk { font-size: 22px; }
.seatchips { display: flex; flex-wrap: wrap; gap: 6px; } .seatchip { padding: 3px 10px; border-radius: 99px; font-size: 13px; border: 1px solid #2c3d4e; } .seatchip.on { background: rgba(47,191,113,.15); border-color: #2fbf71; } .seatchip.off { opacity: .55; }
.chatbox { max-height: 40vh; min-height: 90px; overflow-y: auto; padding: 8px 10px; border: 1px solid #2c3d4e; border-radius: 10px; background: rgba(0,0,0,.2); font-size: 13px; }
.chatbox .cm { padding: 2px 0; } .chatbox .cm.mine b { color: var(--accent); }
