:root {
  --felt: #0f3d2e;
  --felt-2: #145240;
  --board: #d9eedb;
  --tile: #f7f4e8;
  --ink: #1b1b1b;
  --muted: #5d625f;
  --line: #20372c;
  --panel: #fffdf6;
  --panel-line: #e1dccb;
  --accent: #c8102e;
  --accent-ink: #fff;
  --gold: #f4c542;
  --radius: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(ellipse at top, var(--felt-2), var(--felt) 70%);
  background-color: var(--felt);
  min-height: 100vh;
}

button, select, input { font: inherit; }

button {
  cursor: pointer;
  border: 1px solid #b9b3a0;
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 0.45em 0.9em;
  font-weight: 600;
  transition: transform 0.08s, background 0.15s, box-shadow 0.15s;
}
button:hover:not(:disabled) { background: #f3efe2; }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primary:hover:not(:disabled) { background: #a50d26; }
button.danger { border-color: #c44; color: #b22; }
button.ghost { background: transparent; }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

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

#app {
  display: flex;
  gap: 18px;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  justify-content: center;
  align-items: flex-start;
}

#board-wrap {
  container-type: inline-size;
  width: min(calc(100vh - 32px), calc(100vw - 32px - 360px), 920px);
  min-width: 300px;
  flex: none;
}

#side {
  width: 340px;
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(100vh - 32px);
}

@media (max-width: 860px) {
  #dock {
    position: sticky;
    bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 5;
    width: min(calc(100vw - 16px), 720px);
    background: var(--panel);
    border-radius: 14px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.35), 0 0 0 3px var(--gold);
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
    font-size: 15px;
  }
  #dock #prompt { max-width: 100%; width: 100%; }
  #dock .prompt-actions button { min-height: 44px; flex: 1 1 auto; }
  #dock .prompt-card { width: 100%; max-width: 360px; }
  #dock .deed { font-size: 0.82em; }
  #dock .deed td { padding: 0 4px; }
  #dock .deed tbody { display: grid; grid-template-columns: 1fr 1fr; column-gap: 14px; }
  #dock .deed tr { display: flex; justify-content: space-between; }
  #dock .deed-head { padding: 0.3em; }
  #dock .deed-head .small { display: none; }
  #dock .deed-icon { font-size: 1.3em; }
  #dock #tools button { min-height: 40px; }
  #dock .prompt-msg:empty { display: none; }


  #app {
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  }
  #board-wrap { width: min(calc(100vw - 16px), 720px); min-width: 0; }
  #side { width: min(calc(100vw - 16px), 720px); max-height: none; }
}

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

#board {
  position: relative;
  aspect-ratio: 1;
  width: 100%;
  display: grid;
  grid-template-columns: 1.6fr repeat(9, 1fr) 1.6fr;
  grid-template-rows: 1.6fr repeat(9, 1fr) 1.6fr;
  gap: 0.18cqw;
  background: var(--line);
  border: 0.5cqw solid var(--line);
  border-radius: 1cqw;
  box-shadow: var(--shadow);
  user-select: none;
}

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--tile);
  overflow: hidden;
  text-align: center;
  font-size: 1.05cqw;
  line-height: 1.1;
  cursor: default;
}
.tile.type-property, .tile.type-station, .tile.type-utility { cursor: pointer; }
.tile.type-property:hover, .tile.type-station:hover, .tile.type-utility:hover { filter: brightness(0.96); }

/* Orient each side so the colour bar faces the centre and text faces outward. */
.tile.side-top { transform: rotate(180deg); }
.tile.side-left { writing-mode: vertical-rl; }
.tile.side-right { writing-mode: vertical-rl; transform: rotate(180deg); }

.bar {
  flex: none;
  inline-size: 100%;
  block-size: 22%;
  border-block-end: 0.15cqw solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.2cqw;
}
.buildings { display: flex; gap: 0.25cqw; writing-mode: horizontal-tb; }
.side-left .buildings, .side-right .buildings { flex-direction: column; }
.house, .hotel {
  display: block;
  width: 1.45cqw;
  height: 1.45cqw;
  background: #1a9b3c;
  border: 0.15cqw solid #0a4d1c;
  border-radius: 0.2cqw;
  box-shadow: 0 0 0 0.15cqw #fff;
}
.hotel { width: 3cqw; background: #d6242c; border-color: #6d0a0e; }
.side-left .hotel, .side-right .hotel { width: 1.45cqw; height: 3cqw; }

.tname {
  padding: 0.35cqw 0.25cqw 0;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-size: 0.95cqw;
  overflow-wrap: anywhere;
  hyphens: auto;
}
.tshort { display: none; }
.ticon { font-size: 2.6cqw; line-height: 1; margin: auto 0; }
.tprice { margin-top: auto; padding-block-end: 0.9cqw; font-size: 0.95cqw; color: #333; }

.owner-strip {
  position: absolute;
  inset-block-end: 0;
  inset-inline: 0;
  block-size: 0.7cqw;
}
/* Owned tiles take a light wash of the owner's colour and show their token. */
.tile.owned { background: color-mix(in srgb, var(--oc) 16%, var(--tile)); }
.obadge {
  display: inline-grid;
  place-items: center;
  width: 2.3cqw;
  height: 2.3cqw;
  font-size: 1.35cqw;
  line-height: 1;
  border-radius: 25%;
  background: var(--c);
  box-shadow: inset 0 0 0 0.2cqw rgba(0, 0, 0, 0.25);
  writing-mode: horizontal-tb;
}
.tile.mortgaged > :not(.tokens):not(.tprice) { filter: grayscale(1); opacity: 0.5; }
.tile.mortgaged .obadge { filter: grayscale(1); opacity: 0.7; }
.tile.mortgaged::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.22) 0 0.4cqw, transparent 0.4cqw 1.1cqw);
  pointer-events: none;
}

.tile.corner {
  writing-mode: horizontal-tb;
  transform: none;
  justify-content: center;
  background: #f1ecd9;
}
.tile.corner .tname { font-size: 1.35cqw; padding: 0 0.5cqw; }
.tile.corner .ticon { font-size: 4.6cqw; margin: 0.4cqw 0; }
.tile.corner .tprice { margin-top: 0; padding: 0; }
.type-go .tname { color: var(--accent); font-family: "Archivo Black", Inter, sans-serif; font-size: 2.6cqw !important; }

.tokens {
  position: absolute;
  inset: 22% 0 0.7cqw;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 0.2cqw;
  writing-mode: horizontal-tb;
  pointer-events: none;
}
.side-top .tokens, .side-right .tokens { transform: rotate(180deg); }
.side-left .tokens, .side-right .tokens { inset: 0 22% 0 0; }
.side-right .tokens { inset: 0 0 0 22%; }
.corner .tokens { inset: auto 0 0 0; height: 42%; align-content: center; background: rgba(241, 236, 217, 0.85); }
.corner .tokens:empty { display: none; }

.tok {
  display: inline-grid;
  place-items: center;
  width: 2.8cqw;
  height: 2.8cqw;
  min-width: 18px;
  min-height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 0.35cqw solid var(--c);
  font-size: 1.6cqw;
  box-shadow: 0 0.2cqw 0.4cqw rgba(0, 0, 0, 0.35);
  line-height: 1;
  flex: none;
}
#board .tok { min-width: 0; min-height: 0; }
#board .tokens.crowd .tok { width: 2.2cqw; height: 2.2cqw; font-size: 1.25cqw; border-width: 0.25cqw; }
.corner .tokens.crowd { gap: 0; }
.tok.current { animation: bob 1s ease-in-out infinite; z-index: 2; }
.tok.jailed { filter: grayscale(0.6); }
@keyframes bob { 50% { transform: translateY(-0.5cqw); } }

/* ---------------------------------------------------------- centre */

#center {
  grid-area: 2 / 2 / 11 / 11;
  background: var(--board);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.4cqw;
  padding: 2cqw;
  overflow: auto;
  font-size: clamp(12px, 1.55cqw, 16px);
  text-align: center;
}

.brand {
  font-family: "Archivo Black", Inter, sans-serif;
  font-size: 5.6cqw;
  line-height: 0.95;
  color: #fff;
  background: var(--accent);
  padding: 0.6cqw 2.4cqw;
  border: 0.45cqw solid #fff;
  outline: 0.3cqw solid var(--accent);
  transform: rotate(-8deg);
  letter-spacing: 0.04em;
  box-shadow: 0 0.6cqw 1.2cqw rgba(0, 0, 0, 0.2);
  margin-bottom: 1cqw;
}

#dice { display: flex; gap: 1.6cqw; }

.rules-psst { font-style: italic; opacity: 0.75; margin-top: 12px; }
.brand { cursor: pointer; }
.brand.spin { animation: brand-spin 1s ease-in-out; }
@keyframes brand-spin { to { transform: rotate(352deg) scale(1.1); } }
.money-rain { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 60; }
.money-rain span { position: absolute; top: -50px; animation: money-fall linear forwards; }
@keyframes money-fall { to { transform: translateY(110vh) rotate(540deg); } }
.die {
  width: 6.2cqw;
  height: 6.2cqw;
  min-width: 34px;
  min-height: 34px;
  background: #fff;
  border-radius: 18%;
  box-shadow: inset 0 -0.4cqw 0 #ddd, 0 0.4cqw 0.8cqw rgba(0, 0, 0, 0.25);
  display: grid;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  padding: 14%;
}
.die i { border-radius: 50%; margin: 12%; }
.die i.on { background: #222; }
#dice.rolling .die { animation: shake 0.14s linear infinite; }
@keyframes shake { 25% { transform: rotate(-12deg); } 75% { transform: rotate(12deg); } }

#prompt { display: flex; flex-direction: column; align-items: center; gap: 0.8em; max-width: 92%; }
.prompt-msg { line-height: 1.45; }
.prompt-actions { display: flex; flex-wrap: wrap; gap: 0.5em; justify-content: center; }
.reach-note { font-size: 0.78em; color: var(--muted); margin-top: 0.4em; }
.reach-note i { display: inline-block; width: 0.9em; height: 0.9em; vertical-align: -0.1em; border: 2px solid rgba(240, 180, 0, 0.9); border-radius: 2px; }
.reach-note b { color: #c62828; }
.prompt-actions button { font-size: 1em; }
.prompt-card { width: min(100%, 300px); }

#tools { display: flex; align-items: center; gap: 0.5em; }
#tools[hidden] { display: none; }
#tools .tok { width: 28px; height: 28px; font-size: 16px; border-width: 3px; }
#pot { font-weight: 700; color: #0b6b2f; }
#ticker { display: none; }
#dock:empty { display: none; }

/* OK button that will continue on its own: a bar drains across it. */
button.auto { position: relative; overflow: hidden; }
button.auto::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 100%;
  background: rgba(255, 255, 255, 0.8);
  transform-origin: left;
  animation: drain var(--t) linear forwards;
}
@keyframes drain { to { transform: scaleX(0); } }
#pot:empty { display: none; }
#event { font-size: 0.85em; background: #fff8d6; border: 1px solid #e6c84a; border-radius: 999px; padding: 3px 12px; cursor: help; }
#event:empty { display: none; }

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

.card {
  background: #fff;
  border-radius: 10px;
  padding: 0.9em 1em;
  border: 3px solid;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}
.card.chance { border-color: #f7941d; background: #fff6ea; }
.card.chest { border-color: #2e86c1; background: #eef6fc; }
.card.event { border-color: #e6c84a; background: #fffbe8; }
.card-title { font-family: "Archivo Black", Inter, sans-serif; letter-spacing: 0.03em; margin-bottom: 0.3em; }
.card p { margin: 0; }

.deed {
  background: #fff;
  border: 2px solid #222;
  border-radius: 6px;
  padding: 6px;
  text-align: center;
  font-size: 0.92em;
}
.deed-head { padding: 0.5em; border: 1px solid #222; display: flex; flex-direction: column; gap: 2px; text-transform: uppercase; }
.deed .deed-head .small { color: inherit; opacity: 0.75; margin: 0; letter-spacing: 0.06em; }
.deed-icon { font-size: 1.8em; }
.deed table { width: 100%; border-collapse: collapse; margin: 0.4em 0; }
.deed td { padding: 1px 4px; text-align: left; }
.deed td:last-child { text-align: right; font-weight: 600; }
.deed .small, .small { font-size: 0.85em; color: var(--muted); margin: 0.3em 0; }
.deed-owner { margin: 0.4em 0 0; font-size: 0.9em; }
.deed .tok, .standings .tok { width: 22px; height: 22px; font-size: 12px; border-width: 2px; vertical-align: middle; }

/* ---------------------------------------------------------- side panel */

#players { display: flex; flex-direction: column; gap: 8px; }
.player {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 10px 12px;
  border-left: 6px solid var(--c);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: box-shadow 0.2s, transform 0.2s;
}
.player.active { box-shadow: 0 0 0 3px var(--gold), 0 4px 14px rgba(0, 0, 0, 0.3); }
.player.bankrupt { opacity: 0.45; }
.phead { display: flex; align-items: center; gap: 8px; }
.phead .tok { width: 30px; height: 30px; font-size: 17px; border-width: 3px; }
.pname { font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pname small { font-weight: 600; font-size: 0.7em; background: #e6e1d2; padding: 1px 5px; border-radius: 4px; vertical-align: middle; }
.pcash { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 1.1em; }
.pmeta { font-size: 0.78em; color: var(--muted); margin: 3px 0 0 38px; }
.pprops { display: flex; flex-wrap: wrap; gap: 3px; margin: 6px 0 0 38px; }
.pprops:empty { display: none; }
.chip {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.35);
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: #111;
}
.chip.mort { opacity: 0.35; }

.log-wrap {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  min-height: 180px;
  flex: 1;
  overflow: hidden;
}
.log-head { display: flex; justify-content: space-between; align-items: baseline; }
.log-head h3 { margin: 0 0 6px; font-size: 0.95em; }
#round { font-size: 0.8em; color: var(--muted); }
.pname .persona { cursor: help; }
#log {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  font-size: 0.8em;
  line-height: 1.4;
  flex: 1;
  max-height: 360px;
}
#log li { padding: 2px 0 2px 8px; border-left: 3px solid var(--c, transparent); margin-bottom: 2px; }
#log li.strong { font-weight: 700; margin-top: 6px; }

#menu { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
#menu button.ghost { color: #fff; border-color: rgba(255, 255, 255, 0.4); }
#menu button.ghost:hover { background: rgba(255, 255, 255, 0.12); }
#menu label { color: #fff; font-size: 0.85em; display: flex; gap: 6px; align-items: center; margin-right: auto; }
#menu select { border-radius: 6px; padding: 3px 6px; }

/* ---------------------------------------------------------- modal & toast */

#modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 20, 14, 0.62);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 50;
}
#modal[hidden] { display: none; }
.modal-box {
  background: var(--panel);
  border-radius: 14px;
  box-shadow: var(--shadow);
  width: min(100%, 380px);
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 18px 20px;
  animation: pop 0.18s ease-out;
}
.modal-box.wide { width: min(100%, 560px); }
@keyframes pop { from { transform: scale(0.94); opacity: 0; } }
.modal-box h2 { margin: 0 0 10px; font-size: 1.2em; }
.modal-buttons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; flex-wrap: wrap; align-items: center; }
.handoff { margin-right: auto; font-weight: 700; }

.logo-mini {
  font-family: "Archivo Black", Inter, sans-serif;
  background: var(--accent);
  color: #fff;
  padding: 2px 10px;
  letter-spacing: 0.04em;
}

.setup-row { display: grid; grid-template-columns: auto 1fr auto auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.setup-row .tok { width: 38px; height: 38px; font-size: 20px; border-width: 3px; padding: 0; cursor: pointer; }
.setup-row input, .setup-row select { padding: 6px 8px; border: 1px solid #c9c2ad; border-radius: 6px; min-width: 0; }
.setup-row .sdel { padding: 6px 10px; }
#add-player { margin-bottom: 12px; }
.setup-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; font-size: 0.92em; border-top: 1px solid var(--panel-line); padding-top: 12px; }
.setup-opts label { display: flex; gap: 6px; align-items: center; }
.setup-opts select { padding: 3px 6px; border-radius: 6px; }
@media (max-width: 480px) { .setup-opts { grid-template-columns: 1fr; } }

.manage-list { display: flex; flex-direction: column; gap: 6px; }
.manage-row {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  gap: 6px;
  align-items: center;
  font-size: 0.9em;
  padding: 4px 0;
  border-bottom: 1px solid var(--panel-line);
}
.mbtns { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.manage-row button { padding: 4px 8px; font-size: 0.85em; white-space: nowrap; }
.manage-row.mortgaged .mname { color: var(--muted); }
.mname { display: flex; flex-direction: column; }
.mname small { color: var(--muted); }
.mname small.mhint { color: #a05a00; font-style: italic; }
.swatch { width: 24px; height: 24px; border-radius: 5px; border: 1px solid rgba(0, 0, 0, 0.3); display: inline-grid; place-items: center; font-size: 12px; flex: none; }
@media (max-width: 480px) {
  .manage-row { grid-template-columns: 26px 1fr; }
  .mbtns { grid-column: 1 / 3; }
}

.trade-with { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.trade-with select { padding: 4px 8px; border-radius: 6px; flex: 1; min-width: 0; max-width: 100%; }
.trade-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.trade-cols h3 { margin: 0 0 6px; font-size: 0.95em; }
.trade-prop { display: flex; gap: 6px; align-items: center; font-size: 0.86em; margin-bottom: 4px; }
.trade-prop .swatch { width: 18px; height: 18px; font-size: 10px; }
.trade-cash { display: flex; gap: 4px; align-items: center; margin-top: 8px; font-size: 0.9em; }
.trade-cash input { width: 90px; padding: 4px 6px; border: 1px solid #c9c2ad; border-radius: 6px; }
.trade-msg { color: var(--accent); font-weight: 600; min-height: 1.2em; margin: 8px 0 0; }
.trade-msg .counter-yes { padding: 4px 14px; margin-left: 6px; }
.trade-msg .small { font-weight: 400; color: inherit; opacity: 0.8; }
@media (max-width: 480px) { .trade-cols { grid-template-columns: 1fr; } }

.standings { padding-left: 1.4em; }
.standings li { margin: 6px 0; }
.standings li span:last-child { float: right; font-weight: 700; }
.rules { padding-left: 1.2em; line-height: 1.5; font-size: 0.93em; }
.rules li { margin-bottom: 4px; }
kbd { background: #eee; border: 1px solid #bbb; border-radius: 4px; padding: 0 4px; font-size: 0.9em; }

#toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 30px);
  background: #111;
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 60;
  max-width: calc(100vw - 32px);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Small boards: drop the long names, keep icons & prices legible. */
@container (max-width: 560px) {
  .tile .tname { display: none; }
  .tile.corner .tname { display: block; font-size: 1.9cqw; }
  .tshort {
    display: block;
    font-size: 1.75cqw;
    font-weight: 700;
    line-height: 1.1;
    padding: 0.6cqw 0.2cqw 0;
    hyphens: manual;
  }
  .corner .tprice { display: none; }
  .corner .tshort { display: none; }
  .tile:not(.corner) .ticon { display: none; }
  /* Everything reads the same way up: top row upright, both side columns top-to-bottom. */
  .tile.side-top { transform: none; flex-direction: column-reverse; }
  .tile.side-top .bar { border-block-end: 0; border-block-start: 0.15cqw solid var(--line); }
  .tile.side-top .tprice { margin-top: 0; margin-bottom: auto; padding-block: 1.2cqw 0; }
  .tile.side-top .owner-strip, .tile.side-right .owner-strip { inset-block-end: auto; inset-block-start: 0; }
  .tile.side-right { transform: none; flex-direction: column-reverse; }
  .tile.side-right .bar { border-block-end: 0; border-block-start: 0.15cqw solid var(--line); }
  .tile.side-right .tprice { margin-top: 0; margin-bottom: auto; padding-block: 1.2cqw 0; }
  .side-top .tokens, .side-right .tokens { transform: none; }
  .side-top .tokens { inset: 0.7cqw 0 22% 0; }
  .tprice { font-size: 1.9cqw; padding-block-end: 1.2cqw; }
  .obadge { width: 4.2cqw; height: 4.2cqw; font-size: 2.6cqw; }
  .house { width: 1.6cqw; height: 1.6cqw; }
  .hotel { width: 3.4cqw; height: 1.6cqw; }
  .side-left .hotel, .side-right .hotel { width: 1.6cqw; height: 3.4cqw; }
  .buildings { gap: 0.2cqw; }
  .ticon { font-size: 3.4cqw; }
  .brand { display: none; }
  #center { gap: 3cqw; padding: 3cqw; justify-content: center; }
  #ticker {
    display: block;
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
    font-size: clamp(11px, 3.1cqw, 14px);
    text-align: left;
    line-height: 1.35;
  }
  #ticker li { padding: 2px 0 2px 8px; border-left: 3px solid var(--c, transparent); margin-bottom: 3px; }
  #ticker li:last-child { font-weight: 700; }
  #ticker li.strong { font-weight: 700; }
  .tok { width: 4cqw; height: 4cqw; font-size: 2.4cqw; }
  #dice { gap: 4cqw; }
  .die { width: 15cqw; height: 15cqw; }
  .prompt-card { font-size: 0.9em; }
}

/* Phones: compact player list, toasts at the top so they don't cover the controls.
   (Kept at the end so it overrides the base panel styles.) */
@media (max-width: 860px) {
  #players { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .player { padding: 7px 9px; border-left-width: 4px; }
  .phead { gap: 6px; }
  .phead .tok { width: 24px; height: 24px; font-size: 13px; border-width: 2px; }
  .pname { font-size: 0.9em; }
  .pname small { display: none; }
  .pname small.persona { display: inline; background: none; padding: 0; font-size: 0.85em; }
  .pname small.persona span { display: none; }
  .pcash { font-size: 0.95em; }
  .pmeta, .pprops { margin-left: 0; }
  .pmeta { font-size: 0.72em; }
  .chip { width: 16px; height: 16px; font-size: 9px; }
  /* Speech sits inside the speaker's own card, not over the neighbouring ones. */
  .player .bubble { position: static; display: block; max-width: none; margin-top: 4px; border-radius: 8px; box-shadow: none; padding: 2px 8px; }
  /* Pinned to the top edge of the control dock rather than over the board. */
  #dock #toast { position: absolute; top: 0; bottom: auto; font-size: 0.85em; padding: 6px 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transform: translate(-50%, -50%) scale(0.9); }
  #dock #toast.show { transform: translate(-50%, -50%); }
}

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

/* Squares the player about to roll could reach, with what landing there costs. */
.tile.reach { box-shadow: inset 0 0 0 0.3cqw rgba(240, 180, 0, 0.9); }
.rent-tag {
  position: absolute;
  inset-block-start: 26%;
  inset-inline: 0;
  margin-inline: auto;
  width: max-content;
  max-width: 100%;
  writing-mode: horizontal-tb;
  font-size: 1cqw;
  font-weight: 800;
  padding: 0.15cqw 0.4cqw;
  border-radius: 999px;
  background: #fff;
  color: #333;
  border: 0.12cqw solid #bbb;
  z-index: 3;
  pointer-events: none;
}
.rent-tag:empty { display: none; }
.rent-tag.danger { background: #c62828; color: #fff; border-color: #8e0000; }
@container (max-width: 560px) {
  .rent-tag { font-size: 2cqw; padding: 0.2cqw 0.6cqw; inset-block-start: 30%; }
}

.trade-hint { margin: 8px 0 0; font-size: 0.92em; min-height: 1.2em; }
#manage-undo { margin-top: 8px; font-size: 0.85em; padding: 4px 10px; }

/* End-of-game stats */
.stats-head { margin: 16px 0 4px; font-size: 1em; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.85em; margin-bottom: 4px; }
.chart-legend i, .chart-tip i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 5px; }
.stats-chart { position: relative; }
.stats-chart svg { width: 100%; height: auto; display: block; touch-action: pan-y; }
.stats-chart .grid { stroke: #e9e3d2; stroke-width: 1; }
.stats-chart .axis { fill: #8a8370; font-size: 11px; }
.stats-chart .crosshair { stroke: #8a8370; stroke-width: 1; stroke-dasharray: 3 3; }
.chart-tip {
  position: absolute;
  top: 4px;
  transform: translateX(-50%);
  background: #fff;
  border: 1px solid var(--panel-line);
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
  padding: 6px 10px;
  font-size: 0.8em;
  pointer-events: none;
  min-width: 140px;
}
.chart-tip div { display: flex; align-items: center; gap: 2px; }
.chart-tip span { margin-left: auto; padding-left: 10px; font-weight: 700; }
.chart-table-wrap { font-size: 0.85em; margin: 4px 0 8px; }
.chart-table { border-collapse: collapse; margin-top: 6px; width: 100%; }
.chart-table th, .chart-table td { padding: 2px 6px; text-align: right; border-bottom: 1px solid var(--panel-line); }
.chart-table th:first-child, .chart-table td:first-child { text-align: left; }
.stat-facts { list-style: none; padding: 0; margin: 8px 0 0; font-size: 0.92em; line-height: 1.6; }
.stat-facts details { display: inline; margin-left: 6px; }
.stat-facts ul { margin: 4px 0; padding-left: 1.2em; font-size: 0.92em; }

/* Single-player: mode tiles, scenarios, career, achievements, chatter */
.modes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 12px; }
.mode.due { border-color: #e58a00; box-shadow: 0 0 0 2px #ffd58a inset; }
.mode, .scenario { display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 2px; padding: 10px 12px; border-radius: 10px; }
.mode small, .scenario small { font-weight: 400; color: var(--muted); font-size: 0.8em; }
@media (max-width: 480px) { .modes { grid-template-columns: 1fr; } }
.scenario-list { display: flex; flex-direction: column; gap: 8px; }
.scenario { flex-direction: row; align-items: center; gap: 12px; width: 100%; }
.scenario > span:last-child { display: flex; flex-direction: column; gap: 2px; }
.sc-icon { font-size: 1.8em; }
.career-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0 12px; }
.career-tiles div { background: #fff; border: 1px solid var(--panel-line); border-radius: 10px; padding: 8px; text-align: center; display: flex; flex-direction: column; }
.career-tiles b { font-size: 1.3em; }
.career-tiles small { color: var(--muted); font-size: 0.75em; }
@media (max-width: 480px) { .career-tiles { grid-template-columns: repeat(2, 1fr); } }
.career-table { border-collapse: collapse; width: 100%; font-size: 0.9em; margin-bottom: 6px; }
.career-table th, .career-table td { text-align: left; padding: 3px 6px; border-bottom: 1px solid var(--panel-line); }
.feat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.feat { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center; background: #fff8dd; border: 1px solid #e6c84a; border-radius: 8px; padding: 6px 8px; font-size: 0.85em; }
.feat small { grid-column: 2; color: var(--muted); font-size: 0.85em; }
.feat-icon { grid-row: span 2; font-size: 1.5em; }
.feat.locked { background: #f1efe8; border-color: var(--panel-line); }
.feat.locked .feat-icon { filter: grayscale(1); opacity: 0.45; }
.feat.locked b { color: var(--muted); }
.solo-result { margin-top: 12px; padding: 8px 10px; background: #fff; border: 1px solid var(--panel-line); border-radius: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.copy-result { margin-left: auto; padding: 4px 10px; font-size: 0.85em; }
.copy-fallback { width: 100%; min-height: 4.5em; font: inherit; font-size: 0.85em; }
.player { position: relative; }
.bubble {
  position: absolute;
  right: 10px;
  bottom: calc(100% - 10px);
  max-width: 75%;
  background: #fff;
  color: #222;
  border: 1px solid var(--panel-line);
  border-radius: 12px 12px 2px 12px;
  padding: 4px 10px;
  font-size: 0.8em;
  font-style: italic;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
  z-index: 4;
}
.bubble.fresh { animation: bubble-in 0.2s ease-out; }
@keyframes bubble-in { from { opacity: 0; transform: translateY(4px); } }

.feat .medal { font-size: 0.95em; }
.feat small.next { grid-column: 2; font-style: italic; color: #8a6d00; }
.medal-count { font-weight: 400; color: var(--muted); font-size: 0.8em; margin-left: 6px; }

/* Career: daily calendar, rivals, cosmetics; results recap */
.career-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 560px) { .career-cols { grid-template-columns: 1fr; } }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.cal-nav { padding: 0 10px; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; text-align: center; font-size: 0.8em; }
.cal i { font-style: normal; color: var(--muted); font-size: 0.85em; }
.cal span { padding: 4px 0; border-radius: 6px; background: #f1efe8; color: var(--muted); }
.cal span:empty { background: none; }
.cal span.played { background: #d8dde6; color: var(--ink); }
.cal span.won { background: #2e9d55; color: #fff; font-weight: 700; }
.cal span.today { outline: 2px solid var(--accent); outline-offset: -2px; }
.cal-key span { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin: 0 2px 0 8px; vertical-align: -1px; }
.cal-key span.won { background: #2e9d55; }
.cal-key span.played { background: #d8dde6; }
.nemesis { font-size: 0.8em; color: #a01d1d; font-weight: 600; }
.looks { display: flex; flex-direction: column; gap: 8px; margin-bottom: 6px; }
.look-row > b { display: block; font-size: 0.85em; margin-bottom: 4px; }
.look-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; }
.look { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px; font-weight: 400; }
.look > span { font-size: 1.5em; line-height: 1.2; }
.look small { font-size: 0.72em; color: var(--muted); text-align: center; line-height: 1.2; }
.look.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.look:disabled { opacity: 0.6; cursor: default; background: #f1efe8; }
.swatch { display: inline-block; width: 1.4em; height: 1em; border-radius: 4px; border: 2px solid; vertical-align: middle; }
.swatch-classic { background: #d9eedb; border-color: #20372c; }
.swatch-night { background: #1d2738; border-color: #0a0f18; }
.swatch-vintage { background: #ecdcb8; border-color: #5a3e26; }
.mini-die { display: inline-block; width: 1em; height: 1em; border-radius: 22%; background: #fff; border: 1px solid #bbb; vertical-align: middle; position: relative; }
.mini-die::after { content: ""; position: absolute; inset: 35%; border-radius: 50%; background: #222; }
.mini-die.die-casino { background: #c8102e; border-color: #7a0a1c; }
.mini-die.die-casino::after { background: #fff; }
.mini-die.die-gold { background: linear-gradient(135deg, #ffe58a, #d9a400); border-color: #a77c00; }
.mini-die.die-gold::after { background: #5a3b00; }
.recap { margin: 4px 0 0; padding-left: 1.2em; font-size: 0.92em; line-height: 1.5; }
.recap li { margin-bottom: 3px; }

/* Board themes */
body.theme-night { --felt: #0b1220; --felt-2: #18233a; }
body.theme-night #board { --board: #1d2738; --tile: #2a3548; --line: #0a0f18; color: #e8edf5; }
body.theme-night #board .tprice { color: #b9c4d6; }
body.theme-night #center { color: #e8edf5; }
body.theme-night #board .tile.corner { background: #222c3d; }
body.theme-night #board .corner .tokens { background: rgba(34, 44, 61, 0.85); }
body.theme-night #board #tools button.ghost { color: #e8edf5; border-color: rgba(255, 255, 255, 0.35); }
body.theme-night #board .reach-note { color: #b9c4d6; }
body.theme-night .tile.owned { background: color-mix(in srgb, var(--oc) 28%, var(--tile)); }
body.theme-vintage { --felt: #3b2a1c; --felt-2: #5a412b; }
body.theme-vintage #board { --board: #ecdcb8; --tile: #f4e8cc; --line: #5a3e26; color: #3a2a1a; }
body.theme-vintage #board .tile { filter: sepia(0.25); }
body.theme-vintage #board .tile.corner { background: #e6d3a8; }

/* Dice styles */
body.dice-casino .die { background: #c8102e; box-shadow: inset 0 -0.4cqw 0 #8e0b20, 0 0.4cqw 0.8cqw rgba(0, 0, 0, 0.3); }
body.dice-casino .die i.on { background: #fff; }
body.dice-gold .die { background: linear-gradient(135deg, #fff1b0, #e0ad1a); box-shadow: inset 0 -0.4cqw 0 #b88a00, 0 0.4cqw 0.8cqw rgba(0, 0, 0, 0.3); }
body.dice-gold .die i.on { background: #5a3b00; }
body.theme-night #board :is(.deed, .card, .prompt-card) { color: var(--ink); }
