/* HOTEL — The Board Game. Dark chrome frame around a bright resort island. */

:root {
  --ink: #0e0e13;
  --panel: #17171e;
  --panel-2: #1d1d26;
  --line: #2a2a35;
  --text: #ececf1;
  --muted: #9a9aa6;
  --gold: #e5c158;
  --gold-soft: #f4e3ac;
  --paper: #f5efdf;
  --paper-ink: #2b2620;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  background: radial-gradient(1200px 700px at 50% -10%, #1c1c26, var(--ink) 70%);
  color: var(--text);
  font-family: 'Archivo', system-ui, sans-serif;
  font-size: 15px;
  overflow: hidden;
}

.hidden { display: none !important; }

/* ---------- chrome logotype ---------- */

.logo {
  font-family: 'Michroma', sans-serif;
  font-weight: 400;
  letter-spacing: 0.12em;
  transform: skewX(-8deg);
  display: inline-block;
  background: linear-gradient(178deg, #fbfbfd 18%, #b9bfca 40%, #6f7683 50%, #e9edf3 62%, #9ba1ad 88%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 1px rgba(0,0,0,.55));
}
.logo-sub {
  font-size: 11px;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--muted);
}
.logo-block { text-align: center; }
.logo-block h1.logo { font-size: 64px; }
.logo-block.small { display: flex; align-items: baseline; gap: 14px; text-align: left; }
.logo-block.small .logo { font-size: 26px; }
.logo-block.small .logo-sub { letter-spacing: 0.3em; }

/* ---------- buttons ---------- */

.btn {
  font-family: 'Archivo', sans-serif;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.04em;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-2);
  color: var(--text);
  padding: 9px 18px;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.12s ease;
}
.btn:hover:not(:disabled) { filter: brightness(1.15); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.btn-gold {
  background: linear-gradient(180deg, #f0d98c, #cda43c);
  border-color: #8a6d1f;
  color: #241c05;
  text-shadow: 0 1px 0 rgba(255,255,255,.35);
}
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover:not(:disabled) { color: var(--text); }
.btn-big { font-size: 17px; padding: 13px 34px; }

/* ---------- setup screen ---------- */

.setup {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  overflow: auto;
  padding: 30px 16px;
}
/* The home page alone scrolls: the card holds the first screen, the rules sit
   under it. The other setup screens stay centred as they were. */
#setup { display: block; }
.setup-hero {
  min-height: calc(100vh - 60px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px;
}
.scroll-cue {
  color: var(--muted); text-decoration: none;
  font-size: 12px; letter-spacing: .18em; text-transform: uppercase;
  padding: 8px 4px;
}
.scroll-cue:hover { color: var(--gold-soft); }
.scroll-cue span { display: inline-block; margin-left: 4px; }

.setup-card {
  width: min(520px, 100%);
  background: linear-gradient(180deg, #1b1b24, #14141b);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 40px 38px 30px;
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
  display: flex; flex-direction: column; align-items: center; gap: 20px;
}
.setup-tag { text-align: center; color: var(--muted); line-height: 1.55; }
.setup-row { display: flex; align-items: center; gap: 16px; }
.setup-label { text-transform: uppercase; letter-spacing: .2em; font-size: 11px; color: var(--muted); }
.count-group { display: flex; gap: 6px; }
.count-btn {
  width: 42px; height: 42px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel-2);
  color: var(--muted); font: 700 17px 'Archivo', sans-serif; cursor: pointer;
}
.count-btn.active { background: var(--gold); border-color: #8a6d1f; color: #241c05; }
.count-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.setup-slots { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.slot {
  display: flex; align-items: center; gap: 12px;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 14px;
}
.player-dot {
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--pc); box-shadow: 0 0 0 2px rgba(255,255,255,.15);
  flex: none;
}
.slot-name {
  flex: 1; min-width: 0;
  background: transparent; border: none; border-bottom: 1px solid var(--line);
  color: var(--text); font: 600 15px 'Archivo', sans-serif; padding: 4px 2px;
}
.slot-name:focus { outline: none; border-bottom-color: var(--gold); }
.slot-kind { display: flex; gap: 4px; }
.kind-btn {
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  font: 600 12px 'Archivo', sans-serif; border-radius: 7px; padding: 5px 10px; cursor: pointer;
}
.kind-btn.active { background: #343442; color: var(--text); border-color: #4a4a5e; }
.setup-credit { font-size: 11.5px; color: #62626e; text-align: center; line-height: 1.5; }

/* ---------- app layout ---------- */

.app { height: 100vh; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 22px 8px;
}
.main {
  flex: 1; min-height: 0;
  display: flex; gap: 16px;
  padding: 0 16px 14px;
}
.board-wrap {
  flex: 1; min-width: 0; position: relative;
  border-radius: 16px; overflow: hidden;
  border: 1px solid var(--line);
  background: #101018;
}
#board { width: 100%; height: 100%; display: block; }




.sidebar {
  width: 330px; flex: none;
  display: flex; flex-direction: column; gap: 12px;
  min-height: 0;
}

/* ---------- turn card & dice ---------- */

.turn-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px 16px;
}
.turn-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.turn-caption { font-size: 10px; letter-spacing: .25em; text-transform: uppercase; color: var(--muted); }
.turn-label { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.turn-dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }

.dice-tray { display: flex; align-items: center; gap: 14px; margin-top: 12px; }
.die {
  width: 52px; height: 52px; border-radius: 11px;
  background: linear-gradient(160deg, #fdfdfd, #d8d8de);
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.18), 0 3px 8px rgba(0,0,0,.4);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  padding: 8px; gap: 2px;
}
.die.rolling { animation: shake 0.12s infinite; }
@keyframes shake {
  0% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } 100% { transform: rotate(-3deg); }
}
.pip { border-radius: 50%; background: #23232b; opacity: 0; align-self: center; justify-self: center; width: 8px; height: 8px; }
.die[data-value="1"] .pip:nth-child(5),
.die[data-value="2"] .pip:nth-child(1), .die[data-value="2"] .pip:nth-child(9),
.die[data-value="3"] .pip:nth-child(1), .die[data-value="3"] .pip:nth-child(5), .die[data-value="3"] .pip:nth-child(9),
.die[data-value="4"] .pip:nth-child(1), .die[data-value="4"] .pip:nth-child(3),
.die[data-value="4"] .pip:nth-child(7), .die[data-value="4"] .pip:nth-child(9),
.die[data-value="5"] .pip:nth-child(1), .die[data-value="5"] .pip:nth-child(3), .die[data-value="5"] .pip:nth-child(5),
.die[data-value="5"] .pip:nth-child(7), .die[data-value="5"] .pip:nth-child(9),
.die[data-value="6"] .pip:nth-child(1), .die[data-value="6"] .pip:nth-child(3), .die[data-value="6"] .pip:nth-child(4),
.die[data-value="6"] .pip:nth-child(6), .die[data-value="6"] .pip:nth-child(7), .die[data-value="6"] .pip:nth-child(9)
{ opacity: 1; }

.build-die {
  width: 52px; height: 52px; border-radius: 11px;
  display: grid; place-items: center;
  font: 800 18px 'Archivo', sans-serif;
  color: #fff;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.25), 0 3px 8px rgba(0,0,0,.4);
  background: #3a3a46;
}
.build-die.rolling { animation: shake 0.12s infinite; }
.build-die.face-idle { color: #71717e; }
.build-die.face-green { background: linear-gradient(160deg, #4fbc6b, #2c8a45); }
.build-die.face-red { background: linear-gradient(160deg, #d8574a, #a52f24); }
.build-die.face-h { background: linear-gradient(160deg, #f0d98c, #c9a227); color: #241c05; }
.build-die.face-double { background: linear-gradient(160deg, #8e6fd8, #5f3fa8); }

#sell-btn { margin-left: auto; }
#roll-btn { min-width: 84px; }

/* ---------- players panel ---------- */

.players { display: flex; flex-direction: column; gap: 8px; }
.player-card {
  background: var(--panel); border: 1px solid var(--line);
  border-left: 4px solid var(--pc);
  border-radius: 12px; padding: 9px 12px;
  transition: box-shadow .2s ease, border-color .2s ease;
}
.player-card.current { border-color: var(--pc); box-shadow: 0 0 0 1px var(--pc), 0 4px 18px rgba(0,0,0,.35); }
.player-card.out { opacity: .45; }
.player-top { display: flex; align-items: center; gap: 8px; }
.player-name { font-weight: 700; }
.player-cash {
  margin-left: auto;
  font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--gold-soft);
}
.ai-badge {
  font-size: 9.5px; font-weight: 700; letter-spacing: .12em;
  color: var(--muted); border: 1px solid var(--line);
  border-radius: 5px; padding: 1.5px 5px;
}
.player-wealth {
  display: flex; justify-content: space-between; gap: 10px;
  margin-top: 3px;
  font-size: 11px; color: var(--muted);
}
.player-wealth b {
  color: #c9c9d4; font-weight: 700; font-variant-numeric: tabular-nums;
}
.player-props { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; }
.chip {
  font-size: 10.5px; font-weight: 700;
  color: #fff; background: var(--chip);
  border-radius: 6px; padding: 2px 7px;
  text-shadow: 0 1px 1px rgba(0,0,0,.4);
}
.noprops { font-size: 11px; color: #55555f; }

/* ---------- log ---------- */

.log-card {
  flex: 1; min-height: 90px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px 14px 8px;
  display: flex; flex-direction: column;
}
.log-title { font-size: 10px; letter-spacing: .25em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.log { flex: 1; overflow-y: auto; min-height: 0; display: flex; flex-direction: column; gap: 5px; padding-right: 4px; }
.log-entry { font-size: 12.5px; line-height: 1.45; color: #c9c9d4; }
.log-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.log-money { color: var(--gold-soft); }
.log-rent { color: #f0a35e; }
.log-bad { color: #e8766a; }
.log-buy { color: #6fd3c7; }
.log-build { color: #8fd38f; }
.log-roll { color: #9a9aa6; }

/* ---------- pick bar & toast ---------- */

.pick-bar {
  position: absolute; left: 50%; bottom: 16px; transform: translate(-50%, 80px);
  display: flex; align-items: center; gap: 14px;
  background: rgba(14,14,19,.92); border: 1px solid var(--gold);
  border-radius: 12px; padding: 10px 16px;
  font-weight: 600;
  transition: transform .25s ease;
  z-index: 5;
}
.pick-bar.show { transform: translate(-50%, 0); }

.toast {
  position: absolute; left: 50%; top: 14px; transform: translate(-50%, -70px);
  background: rgba(14,14,19,.92); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 16px;
  font-weight: 600; font-size: 13.5px;
  transition: transform .25s ease;
  z-index: 5;
}
.toast.show { transform: translate(-50%, 0); }

/* ---------- modals ---------- */

/* Dialogs float over the lower board without dimming it — the board and the
   players' money stay visible. The overlay still swallows clicks so the game
   state can't be poked mid-decision. */
.overlay {
  position: fixed; inset: 0; z-index: 20;
  background: transparent;
  display: grid; place-items: end center;
  padding: 20px 20px 30px;
}
@media (min-width: 981px) {
  .overlay { padding-right: 366px; } /* keep clear of the sidebar */
}
.modal {
  width: min(460px, 96vw);
  max-height: 72vh; overflow-y: auto;
  background: rgba(24, 24, 32, .93);
  backdrop-filter: blur(7px);
  border: 1px solid #3f3f4e;
  border-radius: 16px;
  padding: 22px 24px 18px;
  box-shadow: 0 18px 60px rgba(0,0,0,.75), 0 0 0 1px rgba(0,0,0,.4);
}
.modal-wide { width: min(760px, 96vw); }
.modal h2 {
  font-family: 'Michroma', sans-serif; font-weight: 400;
  font-size: 15px; letter-spacing: .06em;
  color: var(--gold-soft);
  margin-bottom: 14px;
}
.modal-body p { color: #c9c9d4; line-height: 1.5; margin-bottom: 10px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.hint { font-size: 13px; color: var(--muted); }

.balance-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 9px; padding: 8px 12px; margin-bottom: 12px;
  font-size: 13.5px;
}
.balance-bar b { color: var(--gold-soft); font-variant-numeric: tabular-nums; }
.link-btn {
  background: none; border: none; padding: 0;
  color: var(--gold); font: 600 13px 'Archivo', sans-serif;
  text-decoration: underline; cursor: pointer;
}
.link-btn:hover { color: var(--gold-soft); }
.deed-option.unaffordable .deed, .build-option.unaffordable { opacity: .45; }

.stay-card {
  border-radius: 12px; overflow: hidden;
  border: 1px solid var(--line);
}
.stay-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: linear-gradient(180deg, var(--deed-color), var(--deed-dark));
  padding: 10px 14px;
}
.stay-stars { color: #ffd23c; font-size: 18px; letter-spacing: .1em; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.stay-owner { color: #fff; font-size: 13px; }
.stay-rate { padding: 12px 14px 0; font-size: 15px; }
.stay-rate b { color: var(--gold-soft); }
.stay-card .hint { padding: 6px 14px 12px; margin: 0; }
.winner { font-size: 18px; text-align: center; padding: 12px 0; }

.bid-input {
  width: 100%; margin-top: 8px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px;
  color: var(--gold-soft); font: 700 18px 'Archivo', sans-serif;
  padding: 10px 12px;
}
.bid-input:focus { outline: none; border-color: var(--gold); }

/* ---------- deed cards ---------- */

.deed-row { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.deed-option { flex: 1 1 280px; max-width: 340px; cursor: pointer; position: relative; }
.deed-option input { position: absolute; opacity: 0; }
.deed-option .deed { transition: box-shadow .12s ease, transform .12s ease; }
.deed-option input:checked + .deed {
  box-shadow: 0 0 0 3px var(--gold);
  transform: translateY(-2px);
}
.deed-option input:focus-visible + .deed { box-shadow: 0 0 0 3px #fff; }
.deed-price { text-align: center; margin-top: 8px; color: var(--gold-soft); font-size: 13.5px; }

.deed {
  background: var(--paper);
  color: var(--paper-ink);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(0,0,0,.45);
  font-size: 12.5px;
}
.deed-head {
  background: linear-gradient(180deg, var(--deed-color), var(--deed-dark));
  color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px;
}
.deed-name {
  font-family: 'Michroma', sans-serif;
  font-size: 14px; letter-spacing: .06em;
  text-shadow: 0 1px 2px rgba(0,0,0,.45);
}
.deed-owner {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  background: rgba(0,0,0,.3); border-radius: 6px; padding: 2px 8px;
  box-shadow: inset 0 0 0 1.5px var(--oc, transparent);
}
.deed-owner.free { font-style: italic; opacity: .85; }
.deed-land {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 7px 12px;
  border-bottom: 1px dashed #b9ac91;
  font-weight: 700; font-size: 11.5px;
}
.deed-table { width: 100%; border-collapse: collapse; }
.deed-table th {
  text-align: left; font-size: 9.5px; text-transform: uppercase; letter-spacing: .1em;
  color: #8a7d63; padding: 5px 12px 2px;
}
.deed-table td { padding: 3.5px 12px; border-top: 1px solid #e6dcc4; }
.deed-table td:first-child { color: #c9a227; font-size: 10px; white-space: nowrap; }
.deed-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.deed-table tr.built td { background: #eae0c4; font-weight: 700; }
.deed-table tr.fac td { border-top: 2px solid #b9ac91; }

/* ---------- build list ---------- */

.build-list { display: flex; flex-direction: column; gap: 7px; margin-top: 10px; }
.build-option {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 14px;
  cursor: pointer;
}
.build-option:hover { border-color: #4a4a5e; }
.build-option input { accent-color: var(--gold); }
.build-option span:nth-of-type(2) { flex: 1; }
.build-cost { margin-left: auto; font-weight: 700; color: var(--gold-soft); font-variant-numeric: tabular-nums; }
.build-cost .worth { color: var(--muted); font-weight: 600; margin-right: 6px; }

/* ================= BOARD OVERLAYS (over the painted map) ================= */

/* Squares carry no visible marker — the printed board speaks for itself.
   The ring exists only as a click target for highlight flows. */
.space-ring { fill: transparent; stroke: none; }
.space { cursor: default; }


.hotel-overlay { pointer-events: none; }

.plot { cursor: pointer; }
/* The estate boundary is never drawn — the painted board already shows where
   each hotel sits. This only catches clicks for the deed card. */
.plot-region { fill: transparent; stroke: none; }

/* Who owns the estate, named in their own colour. */
.owner-tag { pointer-events: none; }
.owner-tag-pill { stroke: #fff; stroke-width: 2.5; filter: drop-shadow(0 1px 3px rgba(0,0,0,.55)); }
.owner-tag-name { font: 800 14px 'Archivo', sans-serif; fill: #fff; }



.ent-base { fill: #f2ca35; stroke: #7a5c0e; stroke-width: 1.8; }
.ent-rail { fill: #c79c1d; }
.ent-step { fill: #5d4708; }
.ent-flag, .entrance-flag { stroke: #fff; stroke-width: 1.8; }
.entrance { filter: drop-shadow(0 2px 2px rgba(0,0,0,.45)); }

.car-body { stroke: rgba(0,0,0,.45); stroke-width: 1.6; }
.car-glass { fill: #cfe8f5; stroke: rgba(0,0,0,.3); stroke-width: 1; }
.car-wheel { fill: #1c1c22; }
.car { filter: drop-shadow(0 2px 3px rgba(0,0,0,.5)); }
.car-out { opacity: 0; }

/* Slow aura pulse on the car whose turn it is */
.car-aura { opacity: 0; }
.car.car-active .car-aura {
  animation: car-pulse 2s ease-in-out infinite;
}
@keyframes car-pulse {
  0%, 100% { r: 26px; opacity: .6; }
  50% { r: 46px; opacity: .12; }
}

.space-highlight {
  fill: rgba(229,193,88,.3);
  stroke: var(--gold);
  stroke-width: 4;
  animation: pulse 1s ease-in-out infinite;
  pointer-events: none;
}
@keyframes pulse {
  0%, 100% { stroke-opacity: 1; }
  50% { stroke-opacity: .45; }
}
svg.picking .space { cursor: pointer; }

/* Ghost stairwells offered during entrance placement */
.entrance-ghost {
  cursor: pointer;
  animation: ghost-pulse 1.6s ease-in-out infinite;
}
.entrance-ghost-halo {
  fill: rgba(229,193,88,.22);
  stroke: var(--gold);
  stroke-width: 3;
}
.entrance-ghost:hover { animation: none; opacity: 1; }
.entrance-ghost:hover .entrance-ghost-halo { fill: rgba(229,193,88,.4); }
@keyframes ghost-pulse {
  0%, 100% { opacity: .95; }
  50% { opacity: .45; }
}


/* ---------- board editor ---------- */

.setup-link { color: var(--gold-soft); }

#editor {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  background: var(--ink);
  z-index: 10;
}
.ed-topbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
}
.ed-title {
  font-family: 'Michroma', sans-serif; font-size: 13px;
  letter-spacing: .1em; color: var(--gold-soft);
}
/* Controls keep their width; the status line is the one thing that gives, so
   the bar stays on a single row however many switches sit on it. */
.ed-title, .ed-modes, .ed-view, .ed-actions { flex: none; }
.ed-actions { display: flex; gap: 8px; }
.ed-actions .btn { text-decoration: none; }
.ed-title, .ed-mode, .ed-view-label, .ed-actions .btn { white-space: nowrap; }
.ed-status {
  color: var(--muted); font-size: 13px;
  flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.ed-main { flex: 1; min-height: 0; display: flex; gap: 12px; padding: 12px; }
.ed-board {
  flex: 1; min-width: 0;
  border: 1px solid var(--line); border-radius: 12px;
  background: #101018; overflow: hidden;
}
#ed-svg { width: 100%; height: 100%; display: block; }

.ed-panel {
  width: 320px; flex: none; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 16px;
}
.ed-panel h3 { font-size: 16px; margin-bottom: 10px; }
.ed-coords { color: var(--muted); font-size: 12px; font-weight: 400; }
.ed-hint { color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.ed-label {
  font-size: 10px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 6px;
}
.ed-group { margin-bottom: 16px; display: flex; flex-direction: column; gap: 5px; }
.ed-type, .ed-adj {
  display: flex; align-items: center; gap: 8px;
  font-size: 13.5px; cursor: pointer;
  padding: 3px 4px; border-radius: 6px;
}
.ed-type:hover, .ed-adj:hover { background: var(--panel-2); }
.ed-type input, .ed-adj input { accent-color: var(--gold); }
.ed-swatch {
  width: 13px; height: 13px; border-radius: 4px; display: inline-block;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.4);
}
.ed-danger { color: #e8766a; }

.ed-modes { display: flex; gap: 4px; }
.ed-mode {
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  font: 700 12.5px 'Archivo', sans-serif; border-radius: 8px;
  padding: 6px 12px; cursor: pointer;
}
.ed-mode.active { background: #343442; color: var(--text); border-color: #4a4a5e; }
.ed-mode:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* Base board or finished resort — a view switch, not an editing mode, so it
   sits apart from them behind its own label. */
.ed-view { display: flex; gap: 4px; align-items: center; margin-left: 6px; }
.ed-view-label {
  font: 700 10px 'Archivo', sans-serif; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); margin-right: 2px;
}
.ed-buildings { pointer-events: none; }

.ed-ref-square { fill: rgba(255,255,255,.22); pointer-events: none; }

.ed-region {
  fill: var(--hc); fill-opacity: .1;
  stroke: var(--hc); stroke-width: 3; stroke-dasharray: 9 7;
  stroke-linejoin: round; cursor: pointer;
}
.ed-region.selected { fill-opacity: .16; stroke-width: 5; stroke-dasharray: none; }

.ed-vert { cursor: grab; }
.ed-vert-dot {
  fill: #fff; stroke: var(--hc); stroke-width: 4;
}
.ed-vert.selected .ed-vert-dot { fill: var(--gold); stroke: #fff; }

/* The owner's name tag, shown where and how it will appear in play. Dashed
   until it has been placed by hand, so an inherited centre is obvious. */
.ed-nametag { cursor: grab; }
.ed-nametag rect {
  stroke: #fff; stroke-width: 2.5; stroke-dasharray: 5 4; opacity: .8;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,.55));
}
.ed-nametag.placed rect { stroke-dasharray: none; opacity: 1; }
.ed-nametag.selected rect { stroke: var(--gold); stroke-width: 3.5; }
.ed-nametag-text { font: 800 14px 'Archivo', sans-serif; fill: #fff; pointer-events: none; }

.ed-pad-txt { font: 800 15px 'Archivo', sans-serif; fill: #fff; pointer-events: none; }

.ed-region-faint { fill: none; stroke-width: 1.6; opacity: .45; }
.ed-ref-idx {
  font: 700 11px 'Archivo', sans-serif; fill: rgba(255,255,255,.55);
  pointer-events: none;
}
.ed-ent { cursor: grab; }
.ed-ent.selected .ent-base { stroke: #ffffff; stroke-width: 3; }
.ed-knob-line { stroke: var(--gold); stroke-width: 2; stroke-dasharray: 3 4; pointer-events: none; }
.ed-knob { cursor: grab; }
.ed-knob-dot { fill: var(--gold); stroke: #fff; stroke-width: 2.5; }
.ed-knob-txt { font: 800 14px 'Archivo', sans-serif; fill: #241c05; pointer-events: none; }
.ed-rot-row { display: flex; gap: 6px; }
.ed-rot-row .btn { flex: 1; }

.ed-hotel-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

.ed-board { position: relative; }
#ed-overlay { position: absolute; inset: 0; z-index: 3; pointer-events: none; }

.ed-field { display: flex; align-items: center; gap: 8px; }
.ed-field label { flex: none; width: 105px; font-size: 12.5px; color: var(--muted); }
.ed-field input, .ed-stage input {
  flex: 1; min-width: 0;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 7px;
  color: var(--text); font: 600 13px 'Archivo', sans-serif;
  padding: 6px 8px;
}
.ed-field input:focus, .ed-stage input:focus { outline: none; border-color: var(--gold); }
.ed-stage { display: grid; grid-template-columns: 1fr 68px 68px; gap: 6px; }
.ed-stage input[type=number] { font-variant-numeric: tabular-nums; }
.ed-hotel {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  font: 600 13px 'Archivo', sans-serif; border-radius: 8px;
  padding: 8px 10px; cursor: pointer; text-align: left;
}
.ed-hotel:hover { border-color: #4a4a5e; }
.ed-hotel.selected { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }

.ed-order {
  fill: none; stroke: rgba(255,255,255,.55);
  stroke-width: 3; stroke-dasharray: 2 6; stroke-linejoin: round;
}
.ed-marker { cursor: grab; }
.ed-dot { stroke: rgba(0,0,0,.65); stroke-width: 2.5; opacity: .92; }
.ed-marker.selected .ed-dot { stroke: #ffffff; stroke-width: 4.5; }
.ed-idx {
  font: 800 16px 'Archivo', sans-serif; fill: #14141b;
  pointer-events: none; user-select: none;
}
.ed-adjdot { stroke: #fff; stroke-width: 1.4; }
.ed-tick-label { font: 800 13px 'Archivo', sans-serif; paint-order: stroke; stroke: rgba(0,0,0,.7); stroke-width: 3; }

.ed-export {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(5,5,9,.72); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 20px;
}
.ed-export-card {
  width: min(680px, 94vw);
  background: var(--panel); border: 1px solid #33333f; border-radius: 14px;
  padding: 18px 20px;
  display: flex; flex-direction: column; gap: 12px;
}
.ed-export-card h3 { font-size: 15px; color: var(--gold-soft); }
#ed-export-text {
  width: 100%; height: 320px; resize: vertical;
  background: #101017; color: #cdd6c9;
  border: 1px solid var(--line); border-radius: 8px;
  font: 12px/1.5 ui-monospace, 'SF Mono', Menlo, monospace;
  padding: 10px;
}
#ed-export-close { align-self: flex-end; }

/* ---------- responsive ---------- */

@media (max-width: 980px) {
  body { overflow: auto; }
  .app { height: auto; }
  .main { flex-direction: column; }
  .board-wrap { height: 68vw; min-height: 340px; }
  .sidebar { width: 100%; }
  .log-card { min-height: 180px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- home, lobby & waiting room ---------- */

.home-choices { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.home-choices .btn { width: 100%; }

.lobby-field { width: 100%; display: flex; flex-direction: column; gap: 6px; }
.lobby-field label {
  font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted);
}
.lobby-field input, #lobby-code {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px;
  color: var(--text); font: 600 16px 'Archivo', sans-serif; padding: 10px 12px;
}
.lobby-field input:focus, #lobby-code:focus { outline: none; border-color: var(--gold); }
.lobby-or {
  color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .2em;
}
.lobby-join-row { display: flex; gap: 8px; width: 100%; }
#lobby-code {
  flex: 1; min-width: 0; text-align: center;
  font: 800 20px 'Michroma', sans-serif; letter-spacing: .2em;
}
.lobby-error {
  color: #e8766a; font-size: 13px; min-height: 0; opacity: 0; transition: opacity .15s;
}
.lobby-error.show { opacity: 1; }

/* Arriving from an invite link: joining that game is the point, so it leads
   and the divider before it goes away. */
.lobby-invite { color: var(--text); font-size: 14px; }
.lobby-invite b { color: var(--gold-soft); letter-spacing: .12em; }
#lobby.invited .lobby-or { display: none; }
/* Join sits straight under the name; starting a fresh game drops below it.
   The logo, invite line and name field keep the default order of 0. */
#lobby.invited .lobby-join-row { order: 1; }
#lobby.invited #lobby-create { order: 2; font-size: 13px; }
#lobby.invited .lobby-error { order: 3; }
#lobby.invited #lobby-back { order: 4; }

/* The invite link itself: readable at a glance, selectable as a fallback. */
.waiting-share { display: flex; gap: 8px; width: 100%; }
.share-url {
  flex: 1; min-width: 0;
  font: 500 12.5px ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--muted); text-overflow: ellipsis;
}
.share-url:focus { color: var(--text); }

.waiting {
  position: absolute; inset: 0; z-index: 8;
  display: grid; place-items: center;
  background: rgba(10,10,14,.86); backdrop-filter: blur(3px);
}
.waiting-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 28px 34px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  max-width: 420px;
}
.waiting-label {
  font-size: 10px; letter-spacing: .25em; text-transform: uppercase; color: var(--muted);
}
.waiting-code {
  font: 400 46px 'Michroma', sans-serif; letter-spacing: .18em;
  color: var(--gold-soft); margin-left: .18em;
}
.waiting-players { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }

/* ---------- How to play ---------- */

.topbar-actions { display: flex; gap: 8px; }

.rules-page {
  max-width: 860px;
  margin: 0 auto;
  padding: 10px 20px 90px;
}
.rules-title {
  font-family: 'Michroma', sans-serif; font-weight: 400; font-size: 21px;
  color: var(--gold-soft); letter-spacing: .04em;
  padding-bottom: 14px; margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

/* Shared by the page and the in-game dialog. */
.rules-body { color: var(--text); line-height: 1.62; }
.rules-body h3 {
  font-size: 12px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--gold-soft); margin: 26px 0 8px;
}
.rules-body h3:first-of-type { margin-top: 18px; }
.rules-body p { margin: 0 0 10px; }
.rules-body ul { margin: 0 0 10px; padding-left: 20px; }
.rules-body li { margin-bottom: 8px; }
.rules-body b { color: #fff; font-weight: 700; }
.rules-lede { font-size: 16.5px; color: var(--gold-soft); }
.rules-note { color: var(--muted); font-size: 12.5px; }

/* The planning die faces, coloured as they are on the die itself. These are
   <b> too, so they have to outrank the plain-bold rule above. */
.rules-body b.rules-go { color: #6fcf7f; }
.rules-body b.rules-no { color: #e8766a; }
.rules-body b.rules-h  { color: var(--gold); }
.rules-body b.rules-x2 { color: #e0a34a; }

.rules-table-wrap { overflow-x: auto; margin: 12px 0 4px; }
.rules-table {
  /* Capped: three short columns spread over the full width leave the numbers
     stranded away from the names they belong to. */
  width: 100%; max-width: 560px; min-width: 320px;
  border-collapse: collapse; font-size: 13.5px;
}
.rules-table th, .rules-table td {
  text-align: left; vertical-align: baseline;
  padding: 7px 14px 7px 0;
  border-bottom: 1px solid var(--line);
}
.rules-table th:last-child, .rules-table td:last-child { padding-right: 0; }
.rules-table thead th {
  font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; white-space: nowrap;
}
.rules-num { text-align: right !important; white-space: nowrap; }

/* Each estate opens its own run of buildings. */
.estate-head th {
  padding-top: 22px; padding-bottom: 6px;
  border-bottom-color: #3a3a48;
  font-weight: 700; font-size: 15px; color: var(--text);
}
.rules-table tbody tr:first-child th { padding-top: 8px; }
.estate-meta {
  display: block; margin-top: 3px;
  font-size: 11.5px; font-weight: 400; letter-spacing: .02em; color: var(--muted);
}
.estate-leisure td:first-child { color: var(--gold-soft); }
.rules-stars { color: var(--gold); letter-spacing: -1px; margin-right: 5px; }
.rules-dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  margin-right: 8px; vertical-align: middle;
}

/* A dialog button that refuses to close explains itself here. */
.modal-error {
  display: none;
  margin: 10px 0 0;
  padding: 9px 12px;
  border-radius: 9px;
  background: rgba(232, 118, 106, .12);
  border: 1px solid rgba(232, 118, 106, .4);
  color: #f0a79d; font-size: 13px; line-height: 1.45;
}
.modal-error.show { display: block; }
/* A standing condition, rather than a reaction to what was just entered. */
.modal-note {
  margin-top: 10px; color: var(--muted); font-size: 13px; line-height: 1.5;
}
.modal-note b { color: var(--text); }
