:root {
  --cream: #f3ebd8;
  --cream-dark: #e4d6b8;
  --paper: #efe6d0;
  --red: #c53b32;
  --red-dark: #8f241e;
  --green: #2d8040;
  --green-dark: #1f5c2d;
  --blue: #2b7cb8;
  --blue-dark: #1b5680;
  --board-green: #c5d56b;
  --ink: #2c2418;
  --muted: #6b5c48;
  --gold: #f4e6c8;
  --shadow: 0 18px 50px rgba(40, 20, 10, .35);
  --serif: "Playfair Display", "Palatino Linotype", Palatino, "Times New Roman", serif;
  --cond: "Oswald", "Arial Narrow", "Franklin Gothic Medium", sans-serif;
  --text: "Libre Baskerville", Georgia, serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; height: 100dvh; margin: 0; }
html:fullscreen, html:-webkit-full-screen { height: 100%; background: #c8b896; }
body {
  font-family: var(--text);
  color: var(--ink);
  overflow: hidden;
  user-select: none;
  background-color: #c8b896;
  background-image:
    radial-gradient(ellipse at 18% 8%, #efe6d0 0%, transparent 52%),
    radial-gradient(ellipse at 86% 92%, #d9cbb0 0%, transparent 48%),
    repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(90, 70, 40, .035) 2px, rgba(90, 70, 40, .035) 3px);
}
button { font-family: inherit; cursor: pointer; border: none; color: inherit; }
a { color: inherit; }

#siteBack {
  position: fixed;
  z-index: 80;
  top: max(8px, env(safe-area-inset-top));
  left: max(10px, env(safe-area-inset-left));
  font-family: var(--cond);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--red-dark);
  background: rgba(243, 235, 216, .88);
  padding: 5px 10px;
  border: 1px solid rgba(197, 59, 50, .35);
}
#siteBack:hover { background: var(--cream); }

#app { position: fixed; inset: 0; display: flex; flex-direction: column; padding-top: 36px; }

#topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 12px;
  background: var(--red);
  border-bottom: 3px solid var(--gold);
  box-shadow: 0 4px 16px rgba(80, 20, 16, .25);
  z-index: 20;
  flex-wrap: wrap;
}
.brand {
  font-family: var(--serif);
  font-weight: 900;
  font-size: clamp(20px, 3vw, 28px);
  letter-spacing: .14em;
  color: var(--gold);
  text-shadow: -1px -1px 0 #5a1a14, 1px -1px 0 #5a1a14, -1px 1px 0 #5a1a14, 1px 1px 0 #5a1a14;
  transform: scaleX(.94);
  transform-origin: left center;
}
.turn-pill {
  display: flex; align-items: center; gap: 8px;
  background: rgba(0, 0, 0, .18);
  color: var(--gold);
  font-family: var(--cond);
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 5px 12px;
  border: 1px solid rgba(244, 230, 200, .35);
}
.turn-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 2px rgba(244, 230, 200, .5);
}
.spacer { flex: 1; }
.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: rgba(244, 230, 200, .15);
  border: 1px solid rgba(244, 230, 200, .4);
  color: var(--gold);
  font-size: 18px;
}
.icon-btn.off { opacity: .45; }
.icon-btn:hover { background: rgba(244, 230, 200, .28); }

#table {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  min-height: 0;
  gap: 12px;
  padding: 12px;
}
#boardWrap {
  min-width: 0; min-height: 0;
  display: grid; place-items: center;
}
#board {
  width: min(100%, calc(100dvh - 130px));
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: 1.42fr repeat(9, 1fr) 1.42fr;
  grid-template-rows: 1.42fr repeat(9, 1fr) 1.42fr;
  background: var(--green);
  padding: 7px;
  box-shadow:
    0 0 0 6px var(--red),
    0 0 0 10px var(--cream),
    0 0 0 13px var(--blue),
    var(--shadow);
}

.tile {
  position: relative;
  background: var(--paper);
  border: 1px solid #2c2418;
  display: flex;
  overflow: hidden;
  min-width: 0; min-height: 0;
}
.tile[data-side="bottom"] { flex-direction: column; }
.tile[data-side="top"] { flex-direction: column-reverse; }
.tile[data-side="left"] { flex-direction: row-reverse; }
.tile[data-side="right"] { flex-direction: row; }
.tile.corner { display: block; background: var(--cream); overflow: visible; z-index: 5; }
.tile.hot { outline: 2px solid var(--red); outline-offset: -3px; z-index: 3; }

.stripe {
  flex: 0 0 22%;
  min-height: 10px; min-width: 10px;
  background: var(--g, #888);
  border: 0 solid #2c2418;
}
.tile[data-side="bottom"] .stripe { border-bottom-width: 1px; }
.tile[data-side="top"] .stripe { border-top-width: 1px; }
.tile[data-side="left"] .stripe { border-left-width: 1px; }
.tile[data-side="right"] .stripe { border-right-width: 1px; }

.body {
  flex: 1;
  min-width: 0; min-height: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: space-between;
  padding: 2px 3px 3px;
  position: relative;
}
.tile[data-side="left"] .body,
.tile[data-side="right"] .body {
  writing-mode: vertical-rl;
  text-orientation: mixed;
}
.tile[data-side="left"] .body { transform: rotate(180deg); }

.name {
  font-family: var(--cond);
  font-weight: 600;
  font-size: clamp(5px, 0.72vw, 9px);
  letter-spacing: .02em;
  text-transform: uppercase;
  text-align: center;
  line-height: 1.08;
  max-width: 100%;
}
.price {
  font-family: var(--cond);
  font-size: clamp(6px, 0.75vw, 10px);
  color: var(--muted);
}
.icon-tile {
  font-size: clamp(10px, 1.3vw, 16px);
  line-height: 1;
}

.builds {
  position: absolute;
  display: flex; gap: 2px;
  pointer-events: none;
}
.tile[data-side="bottom"] .builds { top: 2px; left: 50%; transform: translateX(-50%); }
.tile[data-side="top"] .builds { bottom: 2px; left: 50%; transform: translateX(-50%); }
.tile[data-side="left"] .builds { right: 2px; top: 50%; transform: translateY(-50%); flex-direction: column; }
.tile[data-side="right"] .builds { left: 2px; top: 50%; transform: translateY(-50%); flex-direction: column; }
.builds i {
  width: 7px; height: 6px;
  background: var(--green-dark);
  border: 1px solid #14351c;
  display: block;
}
.builds i.hotel {
  width: 12px; height: 8px;
  background: var(--red);
  border-color: var(--red-dark);
}

.pawns {
  position: absolute;
  inset: 12% 2% 4%;
  display: flex; flex-wrap: wrap;
  align-items: flex-end; justify-content: center;
  gap: 3px;
  pointer-events: none;
  z-index: 4;
}
.tile.corner .pawns { inset: 22% 4% 4%; }
.pawn {
  width: 16px; height: 20px;
  border-radius: 50% 50% 40% 40%;
  background:
    radial-gradient(circle at 50% 28%, rgba(255,255,255,.55), transparent 42%),
    var(--c);
  border: 1.5px solid rgba(20, 12, 8, .45);
  box-shadow: 0 2px 0 rgba(0,0,0,.28);
  display: grid; place-items: end center;
  font-size: 8px;
  line-height: 1;
  color: #fff;
  text-shadow: 0 1px 1px #000;
}
.pawn.you { box-shadow: 0 0 0 2px #fff, 0 2px 0 rgba(0,0,0,.28); }
.pawn.fig {
  width: 32px; height: 42px;
  background: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
  color: var(--c);
  overflow: visible;
}
.pawn.fig.bike { width: 40px; height: 34px; }
.pawn.fig svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 1px 1px rgba(0,0,0,.55)); }
.pawn.fig.you { box-shadow: none; filter: drop-shadow(0 0 0 1.5px #fff); }
.pl .dot.fig,
.turn-dot.fig {
  width: 24px; height: 30px;
  border: none;
  border-radius: 0;
  background: none;
  box-shadow: none;
  padding: 0;
  color: var(--c);
}
.pl .dot.fig.bike,
.turn-dot.fig.bike { width: 32px; height: 24px; }
.pl .dot.fig svg,
.turn-dot.fig svg { width: 100%; height: 100%; display: block; }

.owner-pip {
  position: absolute;
  width: 100%; height: 4px;
  background: var(--oc);
  z-index: 2;
}
.tile[data-side="bottom"] .owner-pip { bottom: 0; }
.tile[data-side="top"] .owner-pip { top: 0; }
.tile[data-side="left"] .owner-pip { left: 0; width: 3px; height: 100%; }
.tile[data-side="right"] .owner-pip { right: 0; width: 3px; height: 100%; }
.tile.corner .owner-pip { display: none; }

.corner-inner {
  height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2px;
  padding: 4px;
  text-align: center;
}
.corner-inner .cname {
  font-family: var(--cond);
  font-weight: 700;
  font-size: clamp(8px, 1.05vw, 13px);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.corner-inner .csub {
  font-size: clamp(7px, .8vw, 10px);
  color: var(--muted);
  font-family: var(--cond);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.tile.go { background: #f7e4c4; }
.tile.go .cname { color: var(--red); font-family: var(--serif); font-weight: 900; font-size: clamp(14px, 2vw, 22px); letter-spacing: .12em; }
.arrow-via {
  width: 0; height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-left: 22px solid var(--red);
  margin-top: 4px;
}
.tile.jail { background: repeating-linear-gradient(90deg, #efe6d0 0 8px, #d9cbb0 8px 9px); }
.tile.gotojail { background: #f3d5c8; }
.tile.gotojail .cname { color: var(--red-dark); }
.tile.park { background: #dce8c0; }

.center {
  grid-column: 2 / span 9;
  grid-row: 2 / span 9;
  position: relative;
  background:
    linear-gradient(135deg, rgba(243,235,216,.2), transparent 40%),
    var(--board-green);
  border: 1px solid #2c2418;
  overflow: hidden;
}
.geo-green, .geo-red, .geo-blue {
  position: absolute;
  pointer-events: none;
}
.geo-green { left: 6%; top: 8%; width: 38%; height: 38%; background: var(--green); opacity: .55; }
.geo-red { left: 0; top: 28%; width: 72%; height: 14%; background: var(--red); opacity: .7; z-index: 1; }
.geo-blue { right: 6%; bottom: 14%; width: 48%; height: 36%; background: var(--blue); opacity: .5; }
.center-logo {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%) rotate(-32deg) scaleX(.92);
  font-family: var(--serif);
  font-weight: 900;
  font-size: clamp(22px, 5.2vw, 64px);
  letter-spacing: .12em;
  color: var(--gold);
  background: var(--red);
  padding: .08em .38em .12em;
  border: 3px solid var(--gold);
  box-shadow: 0 0 0 4px var(--red), 4px 6px 0 rgba(44, 36, 24, .25);
  z-index: 3;
  line-height: 1;
  white-space: nowrap;
}
.piles {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}
.pile {
  position: absolute;
  width: 30%;
  aspect-ratio: 1.6 / 1;
  display: grid; place-items: center;
  font-family: var(--cond);
  font-size: clamp(7px, .85vw, 11px);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink);
  border: 2px solid var(--ink);
  transform: rotate(-32deg);
  background: var(--cream);
  box-shadow: 3px 3px 0 rgba(44, 36, 24, .2);
  padding: 4px;
  text-align: center;
  line-height: 1.15;
}
.pile.chance { left: 10%; bottom: 16%; background: #f0c27a; }
.pile.chest { right: 8%; top: 14%; background: #f4e6c8; }

#side {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
  padding-right: 2px;
}
#players { display: flex; flex-direction: column; gap: 6px; }
.pl {
  background: var(--cream);
  border: 1px solid rgba(44, 36, 24, .2);
  padding: 8px 10px;
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 6px 8px;
  align-items: center;
  box-shadow: 0 1px 0 rgba(255,255,255,.4) inset;
}
.pl.current { outline: 2px solid var(--red); }
.pl .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--c); border: 1px solid rgba(0,0,0,.3); }
.pl .nm { font-family: var(--cond); text-transform: uppercase; letter-spacing: .05em; font-size: 13px; }
.pl .mn { font-family: var(--cond); font-weight: 700; font-size: 15px; }
.pl .meta { grid-column: 2 / -1; font-size: 11px; color: var(--muted); }
.pl.broke { opacity: .45; filter: grayscale(.6); }

#diceRow {
  display: flex; justify-content: center; gap: 12px;
  padding: 8px 0;
}
.die {
  width: 52px; height: 52px;
  background: #f7f1e4;
  border: 2px solid var(--ink);
  border-radius: 8px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  padding: 7px;
  box-shadow: 2px 3px 0 rgba(44, 36, 24, .25);
}
.die.rolling { animation: wobble .12s linear infinite; }
@keyframes wobble {
  0% { transform: rotate(-8deg) translateY(-1px); }
  50% { transform: rotate(8deg) translateY(1px); }
  100% { transform: rotate(-8deg); }
}
.die i {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: transparent;
  place-self: center;
}
.die i.show { background: var(--ink); }

#actions { display: flex; flex-direction: column; gap: 6px; }
.btn {
  font-family: var(--cond);
  letter-spacing: .08em;
  text-transform: uppercase;
  font-weight: 600;
  padding: 10px 14px;
  background: var(--red);
  color: var(--gold);
  border: 2px solid var(--red-dark);
  box-shadow: 0 3px 0 var(--red-dark);
  text-align: center;
  text-decoration: none;
  display: block;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--red-dark); }
.btn:disabled { opacity: .4; cursor: not-allowed; filter: grayscale(.4); }
.btn.start { background: var(--red); }
.btn.ghost {
  background: var(--cream);
  color: var(--ink);
  border-color: rgba(44, 36, 24, .35);
  box-shadow: 0 3px 0 rgba(44, 36, 24, .2);
}
.btn.blue { background: var(--blue); border-color: var(--blue-dark); box-shadow: 0 3px 0 var(--blue-dark); color: #f4e6c8; }
.btn.green { background: var(--green); border-color: var(--green-dark); box-shadow: 0 3px 0 var(--green-dark); color: #f4e6c8; }

.build-list { display: flex; flex-direction: column; gap: 4px; }
.build-row {
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(255,255,255,.35);
  border: 1px solid rgba(44,36,24,.15);
  padding: 4px 6px;
  font-size: 12px;
  font-family: var(--cond);
  text-transform: uppercase;
}
.build-row button { padding: 4px 8px; font-size: 11px; }

#log {
  flex: 1;
  min-height: 80px;
  background: rgba(243, 235, 216, .72);
  border: 1px solid rgba(44, 36, 24, .18);
  padding: 8px;
  font-size: 11px;
  line-height: 1.4;
  overflow: auto;
  color: var(--muted);
}
#log div + div { margin-top: 4px; }
#log b { color: var(--ink); }

.overlay {
  position: fixed; inset: 0;
  z-index: 50;
  background: rgba(44, 36, 24, .45);
  display: grid; place-items: center;
  padding: 16px;
}
.overlay.hidden { display: none; }

.home-stack {
  width: min(440px, 100%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(100dvh - 32px);
  overflow: auto;
}
.home-box {
  width: 100%;
  aspect-ratio: 1;
  position: relative;
  background: var(--cream);
  box-shadow: var(--shadow), 0 0 0 1px #d9ccb0;
  overflow: hidden;
  flex: 0 0 auto;
}
.home-panel {
  background: var(--cream);
  border: 3px solid var(--red);
  padding: 14px;
  box-shadow: var(--shadow);
}
.box-green {
  position: absolute;
  left: 5%; top: 4%;
  width: 50%; height: 50%;
  background: var(--green);
  z-index: 1;
}
.mini-board {
  position: absolute;
  inset: 8%;
  background: var(--board-green);
  border: 2px solid #2c2418;
  display: grid; place-items: center;
  z-index: 3;
}
.mini-board::before {
  content: "";
  position: absolute; inset: 10%;
  border: 2px solid #2c2418;
  background:
    linear-gradient(#2c2418, #2c2418) top / 100% 2px no-repeat,
    linear-gradient(#2c2418, #2c2418) bottom / 100% 2px no-repeat,
    linear-gradient(#2c2418, #2c2418) left / 2px 100% no-repeat,
    linear-gradient(#2c2418, #2c2418) right / 2px 100% no-repeat;
}
.mini-name {
  font-family: var(--serif);
  font-weight: 900;
  font-size: 13px;
  letter-spacing: .1em;
  color: var(--gold);
  background: var(--red);
  padding: 2px 8px;
  transform: rotate(-28deg);
  border: 1px solid var(--gold);
  z-index: 2;
}
.mini-via {
  position: absolute;
  right: 4px; bottom: 3px;
  font-family: var(--serif);
  font-weight: 900;
  color: var(--red);
  font-size: 10px;
  letter-spacing: .08em;
}
.box-red {
  position: absolute;
  left: 0; top: 27%;
  width: 100%; height: 15%;
  background: var(--red);
  z-index: 2;
  display: flex; align-items: center; justify-content: flex-end;
  padding-right: 6%;
}
.box-red-text {
  color: #fff;
  text-align: right;
  font-family: var(--text);
  line-height: 1.2;
}
.box-red-text strong { display: block; font-size: 14px; font-weight: 700; }
.box-red-text span { display: block; font-size: 12px; font-style: italic; opacity: .92; }
.box-blue {
  position: absolute;
  left: 10%; top: 42%;
  width: 78%; height: 36%;
  background: var(--blue);
  z-index: 1;
  padding: 28px 16px 10px;
  color: #f4e6c8;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.box-eg {
  margin: 0;
  font-family: var(--cond);
  font-size: 13px;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.box-eg-sub {
  margin: 4px 0 0;
  font-family: var(--text);
  font-size: 11px;
  font-style: italic;
  opacity: .9;
}
.home-controls { display: flex; flex-direction: column; gap: 6px; }
.opt-label {
  font-family: var(--cond);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  margin: 0;
  color: var(--red-dark);
}
.pcount, .diffrow { display: flex; gap: 6px; }
.chip {
  flex: 1;
  font-family: var(--cond);
  letter-spacing: .06em;
  text-transform: uppercase;
  font-size: 13px;
  padding: 8px 0;
  background: rgba(197, 59, 50, .1);
  color: var(--ink);
  border: 1px solid rgba(44, 36, 24, .25);
}
.chip.on { background: var(--red); color: var(--gold); border-color: var(--red-dark); }
.home-controls .btn { padding: 10px 10px; font-size: 14px; }
.box-logo-bar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 22%;
  background: var(--red);
  z-index: 4;
  display: grid; place-items: center;
  font-family: var(--serif);
  font-weight: 900;
  font-size: clamp(34px, 9vw, 54px);
  letter-spacing: .12em;
  color: var(--gold);
  text-shadow: -1px -1px 0 #5a1a14, 1px -1px 0 #5a1a14, -1px 1px 0 #5a1a14, 1px 1px 0 #5a1a14;
  transform: scaleX(.94);
}

.panel-card, .modal-card {
  width: min(420px, 100%);
  background: var(--cream);
  border: 6px solid var(--red);
  box-shadow: 0 0 0 4px var(--cream), var(--shadow);
  padding: 22px 22px 18px;
  color: var(--ink);
}
.panel-card h2, .modal-card h2 {
  font-family: var(--serif);
  font-weight: 900;
  letter-spacing: .06em;
  margin: 0 0 10px;
  color: var(--red);
}
.panel-card p, .modal-card p { font-size: 14px; line-height: 1.5; margin: 0 0 12px; }
.panel-card ul { margin: 0 0 16px; padding-left: 1.1rem; font-size: 13px; line-height: 1.5; }
.panel-card .btn + .btn, .panel-card a.btn { margin-top: 8px; }
.modal-card .deed-head {
  height: 28px;
  margin: -8px -8px 12px;
  background: var(--g, var(--red));
  border: 1px solid #2c2418;
}
.modal-card .price-lg {
  font-family: var(--cond);
  font-size: 22px;
  letter-spacing: .06em;
}
.modal-btns { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.card-face {
  min-height: 160px;
  border: 2px dashed var(--ink);
  padding: 16px;
  background: #f7efdc;
  font-style: italic;
}
.card-face.chance { background: #f3d19a; }
.card-kicker {
  font-family: var(--cond);
  letter-spacing: .16em;
  text-transform: uppercase;
  font-size: 11px;
  margin-bottom: 8px;
  color: var(--red);
}

.end-card { text-align: center; }
.end-kicker {
  font-family: var(--cond);
  letter-spacing: .18em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--blue);
}
.end-card h2 {
  font-size: 36px;
  letter-spacing: .1em;
}

@media (max-width: 860px) {
  #table {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    padding: 8px;
    gap: 8px;
  }
  #board {
    width: min(100%, calc(100dvw - 16px));
    max-height: 56dvh;
  }
  #side {
    max-height: 38dvh;
    flex-direction: row;
    flex-wrap: wrap;
  }
  #players { flex: 1 1 100%; flex-direction: row; overflow: auto; }
  .pl { min-width: 140px; }
  #diceRow { flex: 0 0 auto; }
  #actions { flex: 1 1 160px; }
  #log { flex: 1 1 100%; min-height: 60px; max-height: 90px; }
  .pawn { width: 12px; height: 15px; }
  .pawn.fig { width: 24px; height: 32px; }
  .pawn.fig.bike { width: 32px; height: 26px; }
  #siteBack { font-size: 11px; }
}

@media (max-width: 420px) {
  .home-box { aspect-ratio: 1 / 0.92; }
  .box-red-text strong { font-size: 12px; }
}
