@import url("https://fonts.googleapis.com/css2?family=Roboto+Condensed:wght@700;800&display=swap");
/* Business Board — isometric Monopoly-style recreation */
:root {
  --bg: #A5C9E8;
  --bg-deep: #7BA3C9;
  --grass-a: #A8D06A;
  --grass-b: #8FBC52;
  --road: #555555;
  --road-line: #F5D76E;
  --tile: #F5F8FC;
  --tile-edge: #D0D8E0;
  --pink: #E91E63;
  --pink-dark: #C2185B;
  --blue-btn: #2D8CFF;
  --blue-btn-dark: #1A6FDB;
  --cream: #FFF8F0;
  --shadow: rgba(0, 0, 0, 0.25);
  --hud-bg: rgba(255, 255, 255, 0.92);
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

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

html, body {
  height: 100%;
  font-family: var(--font);
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
  color: #222;
  overflow: hidden;
  user-select: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
}
button:disabled { opacity: 0.5; cursor: not-allowed; }

.hidden { display: none !important; }

/* ========== SETUP ========== */
#setup-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  background: linear-gradient(160deg, #7EB8E0, #A5C9E8 40%, #6A9BC4);
}
.setup-card {
  background: var(--cream);
  border-radius: 20px;
  padding: 2rem 2.5rem;
  box-shadow: 0 20px 60px var(--shadow);
  max-width: 420px; width: 92%;
  text-align: center;
}
.setup-card h1 {
  font-size: 1.8rem;
  color: var(--pink-dark);
  margin-bottom: 0.25rem;
}
.setup-card .tagline {
  color: #666; font-size: 0.9rem; margin-bottom: 1.5rem;
}
.setup-card label { display: block; font-weight: 600; margin-bottom: 0.5rem; }
.player-count {
  display: flex; gap: 0.5rem; justify-content: center; margin-bottom: 1.25rem;
}
.player-count button {
  width: 56px; height: 56px; border-radius: 12px;
  background: #E3F2FD; font-size: 1.4rem; font-weight: 700; color: #1565C0;
  transition: transform 0.1s, background 0.15s;
}
.player-count button.selected {
  background: var(--blue-btn); color: #fff;
  box-shadow: 0 4px 12px rgba(45, 140, 255, 0.4);
}
.player-count button:hover { transform: scale(1.05); }
.name-inputs { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1.25rem; }
.name-inputs input {
  padding: 0.6rem 0.8rem; border-radius: 10px;
  border: 2px solid #ddd; font-size: 1rem;
}
.name-inputs input:focus { border-color: var(--blue-btn); outline: none; }
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  background: linear-gradient(180deg, var(--blue-btn), var(--blue-btn-dark));
  color: #fff; font-weight: 700; font-size: 1.1rem;
  padding: 0.85rem 2rem; border-radius: 999px;
  box-shadow: 0 6px 0 #0D47A1, 0 8px 20px rgba(0,0,0,0.2);
  transition: transform 0.1s;
}
.btn-primary:active { transform: translateY(3px); box-shadow: 0 3px 0 #0D47A1; }
.btn-primary.pink {
  background: linear-gradient(180deg, var(--pink), var(--pink-dark));
  box-shadow: 0 6px 0 #880E4F, 0 8px 20px rgba(0,0,0,0.2);
}

/* ========== GAME SHELL ========== */
#game-screen {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
}
.top-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.5rem 1rem;
  background: rgba(255,255,255,0.35);
  backdrop-filter: blur(8px);
  z-index: 20;
  flex-shrink: 0;
}
.top-bar h2 { font-size: 1.1rem; color: #1565C0; }
.top-actions { display: flex; gap: 0.5rem; align-items: center; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  background: #fff; font-size: 1.1rem;
  box-shadow: 0 2px 8px var(--shadow);
}
.turn-banner {
  font-weight: 700; font-size: 0.95rem;
  padding: 0.35rem 0.9rem; border-radius: 999px;
  background: #fff; box-shadow: 0 2px 8px var(--shadow);
}

/* ========== BOARD STAGE ========== */
.board-stage {
  flex: 1; position: relative;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  min-height: 0;
}

.corner-avatar {
  position: absolute;
  z-index: 15; /* above board */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  filter: drop-shadow(0 8px 14px rgba(0,0,0,0.35));
}
.corner-avatar img {
  width: 128px;
  height: auto;
  display: block;
  background: rgba(255,255,255,0.85);
  border-radius: 18px;
  padding: 6px;
  border: 3px solid #fff;
}
.corner-avatar span {
  font-family: "Roboto Condensed", sans-serif;
  font-weight: 800;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #37474F;
  background: rgba(255,255,255,0.9);
  padding: 2px 10px;
  border-radius: 999px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.corner-avatar.tl { top: 4%; left: 1%; }
.corner-avatar.tr { top: 4%; right: 1%; }
.corner-avatar.bl { bottom: 14%; left: 1%; }
.corner-avatar.br { bottom: 14%; right: 1%; }
.corner-avatar.active-seat img {
  outline: 3px solid #FFD600;
  outline-offset: 2px;
  border-radius: 12px;
}
.corner-avatar.active-seat span {
  background: #FFD600;
  color: #333;
}
@media (max-width: 700px) {
  .corner-avatar img { width: 72px; }
  .corner-avatar span { font-size: 0.7rem; }
}

.board-wrap {
  position: relative;
  width: min(94vmin, 760px);
  height: min(94vmin, 760px);
  transform: scale(1);
  perspective: 900px;
}

.board {
  position: absolute; inset: 6%;
  transform: rotateX(52deg) rotateZ(45deg);
  transform-style: preserve-3d;
  background: #8FBC5A;
  border-radius: 6px;
  box-shadow:
    0 0 0 10px #B0BEC5,
    10px 12px 0 10px #78909C,
    18px 28px 0 6px #546E7A,
    28px 42px 50px rgba(0,0,0,0.4);
}

.board-field {
  position: absolute;
  inset: 12%;
  background: var(--grass-a);
  background-image:
    repeating-linear-gradient(
      90deg,
      var(--grass-a) 0 22px,
      var(--grass-b) 22px 44px
    );
  border-radius: 2px;
  pointer-events: none;
  z-index: 0;
}

.board-road {
  position: absolute;
  inset: 12.8%;
  border: 22px solid var(--road);
  border-radius: 3px;
  pointer-events: none;
  box-sizing: border-box;
  z-index: 1;
  box-shadow: inset 0 0 0 2px #3A3A3A;
}
.board-road::before {
  content: "";
  position: absolute;
  inset: -12px;
  border: 2.5px dashed #F0F0F0;
  border-radius: 2px;
  opacity: 0.9;
}
.board-road::after {
  content: "";
  position: absolute;
  inset: -18px;
  border: 1.5px solid rgba(245, 215, 110, 0.55);
  border-radius: 2px;
  pointer-events: none;
}

.road-flag {
  position: absolute;
  width: 0; height: 0;
  z-index: 2;
}
.road-flag::before {
  content: "";
  position: absolute;
  width: 3px; height: 18px;
  background: #5D4037;
  left: 0; top: 0;
}
.road-flag::after {
  content: "";
  position: absolute;
  left: 3px; top: 1px;
  width: 0; height: 0;
  border-style: solid;
  border-width: 5px 0 5px 12px;
  border-color: transparent transparent transparent #FF9800;
}
.road-flag.tl { top: -6px; left: -6px; }
.road-flag.tr { top: -6px; right: -6px; }
.road-flag.bl { bottom: 8px; left: -6px; }
.road-flag.br { bottom: 8px; right: -6px; }

.tiles-layer {
  position: absolute; inset: 0;
  transform-style: preserve-3d;
  z-index: 3;
}

.tile {
  position: absolute;
  width: 11.11%;
  height: 11.11%;
  background: linear-gradient(160deg, #FFFFFF 0%, var(--tile) 70%);
  border: 1.5px solid #C5D0DA;
  border-radius: 2px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end;
  padding: 3px 4px 4px;
  transform-style: preserve-3d;
  transition: box-shadow 0.2s, outline 0.2s;
  box-shadow: 1px 1px 0 rgba(0,0,0,0.06);
  z-index: 2;
  overflow: visible;
}
.tile.corner { background: linear-gradient(160deg, #F0F6FF, #E3EEFB); }
.tile.tile-start { background: linear-gradient(160deg, #FFF0F5, #FCE4EC); }
.tile.highlight {
  outline: 3px solid #3FA9F5;
  outline-offset: -2px;
  z-index: 5;
  box-shadow: 0 0 14px rgba(63, 169, 245, 0.85);
}
.tile .band {
  position: absolute; top: 0; left: 0; right: 0;
  height: 20%;
  border-bottom: 1px solid rgba(0,0,0,0.12);
  box-shadow: 0 1px 0 rgba(255,255,255,0.35) inset;
}
.tile .tname {
  /* Fit inside tile squares — smaller than before */
  position: absolute;
  left: 50%;
  top: 55%;
  font-family: "Roboto Condensed", "Arial Narrow", "Segoe UI", sans-serif;
  font-size: clamp(7px, 1.35vmin, 10px);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-align: center;
  line-height: 1.05;
  text-transform: uppercase;
  color: #222;
  text-shadow: 0 0 2px #fff, 0 1px 0 #fff;
  transform: translate(-50%, -50%) rotateZ(-45deg) rotateX(-52deg);
  transform-origin: center center;
  max-width: 5.8em;
  width: max-content;
  white-space: normal;
  overflow-wrap: break-word;
  pointer-events: none;
  z-index: 8;
  padding: 0 1px;
}
.tile.corner .tname {
  font-size: clamp(6.5px, 1.2vmin, 9px);
  color: #0B3D91;
  font-weight: 700;
  max-width: 6.5em;
  top: 58%;
}
.tile .tprice {
  display: none !important; /* prices only in buy modal */
}
.tile.owned .tname { color: #000; }
.tile .ticon {
  position: absolute; top: 18%; left: 50%;
  transform: translateX(-50%) rotate(-45deg) scale(0.58);
  width: 72%; height: auto;
  pointer-events: none;
  opacity: 0.98;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.2));
  z-index: 1;
}
.tile .owner-flag {
  position: absolute; top: 14%; right: 6%;
  width: 10px; height: 10px; border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.45);
  z-index: 4;
}
/* Owned tile tinted to player color */
.tile.owned {
  background: #fff !important;
  background: color-mix(in srgb, var(--owner) 42%, #fff) !important;
  box-shadow:
    inset 0 0 0 2.5px var(--owner),
    0 3px 0 rgba(0,0,0,0.18);
}
.tile.owned .band {
  box-shadow: 0 1px 0 rgba(0,0,0,0.15);
}
.tile.owned[data-build="1"],
.tile.owned[data-build="2"] {
  background: color-mix(in srgb, var(--owner) 52%, #fff) !important;
}
.tile.owned[data-build="3"] {
  background: color-mix(in srgb, var(--owner) 62%, #ffe082) !important;
}
.tile .houses-ind {
  position: absolute;
  top: 8%;
  left: 50%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  /* Billboard — big, camera-facing */
  transform: translate(-50%, 0) rotateZ(-45deg) rotateX(-52deg) translateZ(14px) scale(0.72);
  transform-origin: center bottom;
  z-index: 10;
  pointer-events: none;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.45));
}
/* LAND — flat colored plot only */
.tile .build-land {
  width: 28px;
  height: 14px;
  border-radius: 3px;
  background: var(--owner, #888);
  border: 2px solid #fff;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,0.2);
}
/* HOUSE 1 — single small house in player color */
.tile .build-house {
  position: relative;
  display: block;
}
.tile .build-house .wall {
  display: block;
  background: var(--owner, #E53935);
  border: 2px solid rgba(0,0,0,0.25);
  border-radius: 2px 2px 1px 1px;
}
.tile .build-house .roof {
  display: block;
  width: 0; height: 0;
  margin: 0 auto;
  border-style: solid;
  border-color: transparent transparent color-mix(in srgb, var(--owner, #E53935) 70%, #000) transparent;
}
.tile .build-house .door {
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.35);
  border-radius: 1px 1px 0 0;
  display: block;
}
.tile .build-house.h1 .wall { width: 28px; height: 22px; }
.tile .build-house.h1 .roof {
  border-width: 0 18px 13px 18px;
  margin-bottom: -2px;
}
.tile .build-house.h1 .door { width: 7px; height: 10px; }

/* HOUSE 2 — two larger houses */
.tile .build-house-row {
  display: flex;
  gap: 4px;
  align-items: flex-end;
}
.tile .build-house.h2 .wall { width: 32px; height: 28px; }
.tile .build-house.h2 .roof {
  border-width: 0 20px 15px 20px;
  margin-bottom: -2px;
}
.tile .build-house.h2 .door { width: 8px; height: 11px; }

/* HOTEL — much bigger tower */
.tile .build-hotel {
  position: relative;
  width: 38px;
  height: 52px;
}
.tile .build-hotel .base {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 40px;
  background: var(--owner, #E53935);
  border: 2px solid rgba(0,0,0,0.3);
  border-radius: 3px 3px 2px 2px;
  display: block;
}
.tile .build-hotel .mid {
  position: absolute;
  left: 4px; right: 4px; bottom: 38px;
  height: 7px;
  background: color-mix(in srgb, var(--owner, #E53935) 75%, #000);
  border-radius: 2px;
  display: block;
}
.tile .build-hotel .top {
  position: absolute;
  left: 8px; right: 8px; bottom: 44px;
  height: 6px;
  background: color-mix(in srgb, var(--owner, #E53935) 55%, #fff);
  border-radius: 2px 2px 0 0;
  display: block;
}
.tile .build-hotel .win {
  position: absolute;
  width: 5px; height: 5px;
  background: #81D4FA;
  border: 1px solid rgba(0,0,0,0.25);
  border-radius: 1px;
  left: 5px; bottom: 20px;
  display: block;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.35);
}
.tile .build-hotel .win.w2 { left: 12px; bottom: 20px; }
.tile .build-hotel .win.w3 { left: 19px; bottom: 20px; }


/* Billboard labels on every side */
.tile[data-side] .tname {
  transform: translate(-50%, -50%) rotateZ(-45deg) rotateX(-52deg) translateZ(8px);
}
.tile[data-side="sw"] .ticon,
.tile[data-side="nw"] .ticon,
.tile[data-side="ne"] .ticon,
.tile[data-side="se"] .ticon,
.tile[data-side="corner"] .ticon {
  transform: translateX(-50%) rotateZ(-45deg) rotateX(-60deg) scale(0.42);
  opacity: 0.85;
}

/* Tokens */
.tokens-layer {
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 10;
  transform-style: preserve-3d;
}
.token {
  position: absolute;
  width: 28px; height: 36px;
  margin-left: -14px; margin-top: -30px;
  transition: left 0.28s ease, top 0.28s ease;
  z-index: 12;
  filter: drop-shadow(1px 2px 2px rgba(0,0,0,0.35));
  /* Counter board rotateX(58) rotateZ(45) so token faces camera */
  transform: rotateZ(-45deg) rotateX(-52deg);
  transform-style: preserve-3d;
}
.token .marker {
  position: absolute; top: -10px; left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid var(--tc, #E53935);
}
.token .body {
  width: 24px; height: 30px;
  margin: 0 auto;
  background: var(--tc, #E53935);
  border-radius: 10px 10px 4px 4px;
  position: relative;
  border: 2px solid rgba(0,0,0,0.15);
}
.token .body::before {
  content: "";
  position: absolute; top: 3px; left: 50%; transform: translateX(-50%);
  width: 12px; height: 12px; border-radius: 50%;
  background: #FFCCBC;
  border: 1px solid rgba(0,0,0,0.1);
}
.token.hopping {
  animation: hop 0.28s ease;
}
@keyframes hop {
  0%, 100% { transform: rotateZ(-45deg) rotateX(-52deg) translateY(0); }
  50% { transform: rotateZ(-45deg) rotateX(-52deg) translateY(-18px) scale(1.08); }
}

/* Center UI (dice / roll) */
.center-ui {
  position: absolute;
  left: 50%; top: 52%;
  transform: translate(-50%, -50%);
  z-index: 15;
  display: flex; flex-direction: column; align-items: center; gap: 0.6rem;
  pointer-events: auto;
  background: rgba(255,255,255,0.82);
  padding: 0.85rem 1.15rem 1rem;
  border-radius: 18px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.3);
  border: 2px solid rgba(255,255,255,0.95);
  backdrop-filter: blur(4px);
}
.dice-sum {
  background: #fff; color: #1565C0;
  font-size: 1.45rem; font-weight: 900;
  padding: 0.15rem 0.95rem; border-radius: 8px;
  min-width: 48px; text-align: center;
  border: 3px solid #42A5F5;
  box-shadow: 0 4px 12px var(--shadow);
}
.dice-sum.hidden-vis { visibility: hidden; }
.dice-row {
  display: flex; gap: 14px; align-items: center;
}
.die {
  width: 54px; height: 54px;
  background: linear-gradient(145deg, #FF80AB 0%, #F06292 40%, #E91E63 100%);
  border-radius: 11px;
  box-shadow:
    3px 4px 0 #AD1457,
    5px 7px 14px rgba(173, 20, 87, 0.45),
    inset 0 2px 0 rgba(255,255,255,0.35);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  padding: 8px;
  gap: 2px;
  border: 1px solid rgba(255,255,255,0.25);
}
.die .pip {
  width: 8px; height: 8px; border-radius: 50%;
  background: #fff; margin: auto;
  opacity: 0;
  box-shadow: 0 1px 1px rgba(0,0,0,0.2);
}
.die.show-1 .pip:nth-child(5) { opacity: 1; }
.die.show-2 .pip:nth-child(1), .die.show-2 .pip:nth-child(9) { opacity: 1; }
.die.show-3 .pip:nth-child(1), .die.show-3 .pip:nth-child(5), .die.show-3 .pip:nth-child(9) { opacity: 1; }
.die.show-4 .pip:nth-child(1), .die.show-4 .pip:nth-child(3),
.die.show-4 .pip:nth-child(7), .die.show-4 .pip:nth-child(9) { opacity: 1; }
.die.show-5 .pip:nth-child(1), .die.show-5 .pip:nth-child(3), .die.show-5 .pip:nth-child(5),
.die.show-5 .pip:nth-child(7), .die.show-5 .pip:nth-child(9) { opacity: 1; }
.die.show-6 .pip:nth-child(1), .die.show-6 .pip:nth-child(3), .die.show-6 .pip:nth-child(4),
.die.show-6 .pip:nth-child(6), .die.show-6 .pip:nth-child(7), .die.show-6 .pip:nth-child(9) { opacity: 1; }

.die.rolling { animation: shake 0.4s ease; }
@keyframes shake {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-12deg) scale(1.05); }
  75% { transform: rotate(12deg) scale(1.05); }
}

.btn-roll {
  background: linear-gradient(180deg, #42A5F5, #1E88E5);
  color: #fff; font-weight: 800; font-size: 1.15rem;
  letter-spacing: 0.08em;
  padding: 0.7rem 2.2rem; border-radius: 999px;
  box-shadow: 0 5px 0 #0D47A1, 0 0 20px rgba(45,140,255,0.5);
  text-transform: uppercase;
}
.btn-roll:hover:not(:disabled) { filter: brightness(1.08); }
.btn-roll:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 2px 0 #0D47A1; }

.double-bubble {
  position: absolute;
  left: 12%; top: 28%;
  background: #fff;
  color: var(--pink);
  font-weight: 900; font-size: 1.6rem;
  padding: 0.6rem 1.2rem;
  border-radius: 40px;
  box-shadow: 0 8px 24px var(--shadow);
  z-index: 16;
  animation: popIn 0.35s ease;
  pointer-events: none;
}
@keyframes popIn {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ========== PLAYER HUD ========== */
.hud-rail {
  display: flex; gap: 0.5rem;
  padding: 0.5rem 0.75rem 0.75rem;
  overflow-x: auto;
  flex-shrink: 0;
  background: rgba(255,255,255,0.25);
  backdrop-filter: blur(6px);
  z-index: 20;
}
.hud-card {
  flex: 1; min-width: 140px;
  background: var(--hud-bg);
  border-radius: 14px;
  padding: 0.55rem 0.75rem;
  box-shadow: 0 4px 14px var(--shadow);
  border-left: 5px solid var(--pc, #E53935);
  transition: transform 0.15s, box-shadow 0.15s;
}
.hud-card.active {
  transform: translateY(-4px);
  box-shadow: 0 8px 22px rgba(45,140,255,0.35);
  outline: 2px solid var(--blue-btn);
}
.hud-card.broke { opacity: 0.45; filter: grayscale(0.6); }
.hud-card .pname { font-weight: 700; font-size: 0.95rem; }
.hud-card .pcash {
  font-size: 1.05rem; font-weight: 800; color: #2E7D32;
  display: flex; align-items: center; gap: 0.25rem;
}
.hud-card .buffs {
  display: flex; flex-wrap: wrap; gap: 0.25rem; margin-top: 0.25rem;
}
.buff-chip {
  font-size: 0.65rem; font-weight: 700;
  padding: 0.15rem 0.4rem; border-radius: 999px;
  background: #FFF3E0; color: #E65100;
}
.buff-chip.champ { background: #E8F5E9; color: #1B5E20; }
.buff-chip.jail { background: #FFEBEE; color: #B71C1C; }
.buff-chip.pass { background: #E3F2FD; color: #0D47A1; }

/* ========== MODALS ========== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(20, 40, 70, 0.45);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
  padding: 1rem;
}
.modal {
  background: var(--cream);
  border-radius: 18px;
  width: min(420px, 96vw);
  box-shadow: 0 24px 60px rgba(0,0,0,0.4);
  overflow: hidden;
  animation: popIn 0.28s ease;
}
.modal-header {
  background: linear-gradient(180deg, var(--pink), var(--pink-dark));
  color: #fff;
  padding: 0.85rem 1.2rem;
  font-weight: 800; font-size: 1.25rem;
  letter-spacing: 0.04em;
  display: flex; align-items: center; justify-content: space-between;
  text-transform: uppercase;
}
.modal-header .close-x {
  background: transparent; color: #fff; font-size: 1.4rem; line-height: 1;
  width: 32px; height: 32px; border-radius: 50%;
}
.modal-header .close-x:hover { background: rgba(255,255,255,0.2); }
.modal-body { padding: 1.1rem 1.2rem 1.3rem; text-align: center; }

.buy-levels {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem;
  margin-bottom: 1rem;
}
.buy-level {
  background: #fff; border-radius: 12px; padding: 0.5rem 0.25rem;
  border: 3px solid transparent;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
  position: relative;
}
.buy-level:hover { transform: translateY(-2px); }
.buy-level.selected { border-color: #43A047; }
.buy-level.locked { opacity: 0.4; pointer-events: none; }
.buy-level img { width: 40px; height: 36px; object-fit: contain; margin: 0 auto; display: block; }
.buy-level .lvl-name { font-size: 0.7rem; font-weight: 700; margin-top: 0.2rem; }
.buy-level .check {
  position: absolute; top: 4px; right: 4px;
  width: 18px; height: 18px; background: #43A047; color: #fff;
  border-radius: 50%; font-size: 11px; line-height: 18px;
  display: none;
}
.buy-level.selected .check { display: block; }

.rent-line {
  font-size: 1.05rem; font-weight: 700; margin-bottom: 0.75rem;
  display: flex; align-items: center; justify-content: center; gap: 0.35rem;
}
.rent-line img { height: 22px; }
.rebuy-line {
  font-size: 0.8rem; color: #555; margin-top: 0.75rem;
}

/* Chance modal — parchment style */
.chance-modal {
  background: #F5E6C8;
  border: 8px solid #5D4037;
  border-radius: 12px;
  width: min(360px, 94vw);
  box-shadow: 0 24px 60px rgba(0,0,0,0.45);
  overflow: visible;
  position: relative;
  padding-top: 0.5rem;
}
.chance-ribbon {
  background: linear-gradient(180deg, #1E88E5, #1565C0);
  color: #fff;
  font-weight: 800; font-size: 1.1rem;
  text-align: center;
  padding: 0.55rem 1rem;
  margin: 0 1rem;
  border-radius: 4px;
  box-shadow: 0 4px 0 #0D47A1;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.chance-ribbon.power {
  background: linear-gradient(180deg, #E53935, #B71C1C);
  box-shadow: 0 4px 0 #7F0000;
}
.chance-art {
  width: 120px; height: 120px;
  margin: 1rem auto;
  background: #fff;
  border-radius: 12px;
  border: 3px solid #8D6E63;
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem;
}
.chance-art.power { border-color: #E53935; box-shadow: 0 0 16px rgba(229,57,53,0.4); }
.chance-text {
  text-align: center;
  padding: 0 1.2rem 1rem;
  color: #4E342E;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.35;
}
.chance-modal .btn-primary { margin: 0 1.2rem 1.2rem; width: calc(100% - 2.4rem); }

/* Jail modal */
.jail-options {
  display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.75rem;
}
.jail-options button {
  padding: 0.7rem 1rem; border-radius: 12px;
  font-weight: 700; background: #fff; border: 2px solid #ddd;
}
.jail-options button:hover { border-color: var(--blue-btn); }

/* Target picker for destroy power */
.target-list {
  max-height: 240px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 0.4rem;
  text-align: left; margin: 0.75rem 0;
}
.target-item {
  padding: 0.6rem 0.8rem; border-radius: 10px;
  background: #fff; border: 2px solid #eee;
  cursor: pointer; font-weight: 600;
  display: flex; justify-content: space-between; align-items: center;
}
.target-item:hover { border-color: #E53935; background: #FFEBEE; }

/* Toast / log */
.toast {
  position: fixed; bottom: 100px; left: 50%;
  transform: translateX(-50%);
  background: #263238; color: #fff;
  padding: 0.65rem 1.2rem; border-radius: 999px;
  font-weight: 600; font-size: 0.9rem;
  z-index: 60; box-shadow: 0 8px 24px var(--shadow);
  animation: popIn 0.25s ease;
  max-width: 90vw; text-align: center;
}

/* Win overlay */
.win-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 80;
}
.win-card {
  background: var(--cream); border-radius: 20px;
  padding: 2rem; text-align: center;
  box-shadow: 0 24px 60px rgba(0,0,0,0.4);
  max-width: 400px; width: 92%;
}
.win-card h2 { color: var(--pink-dark); font-size: 1.8rem; margin-bottom: 0.5rem; }

/* Message modal generic */
.msg-modal .modal-body p { margin-bottom: 1rem; line-height: 1.4; }

@media (max-width: 700px) {
  .board-wrap { width: 98vmin; height: 98vmin; }
  .die { width: 40px; height: 40px; padding: 6px; }
  .die .pip { width: 6px; height: 6px; }
  .hud-card { min-width: 120px; }
}

#board-inner {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}


/* ========== ONLINE LOBBY / MENU ========== */
#menu-screen, #lobby-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  background: linear-gradient(160deg, #7EB8E0, #A5C9E8 40%, #6A9BC4);
  overflow: auto;
  padding: 1rem;
}
.menu-card, .lobby-card {
  background: var(--cream);
  border-radius: 20px;
  padding: 1.75rem 2rem;
  box-shadow: 0 20px 60px var(--shadow);
  max-width: 460px; width: 94%;
  text-align: center;
}
.menu-card h1, .lobby-card h1 {
  font-size: 1.7rem; color: var(--pink-dark); margin-bottom: 0.25rem;
}
.menu-actions { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 1.25rem; }
.menu-actions .btn-primary { width: 100%; }
.room-code-display {
  font-size: 2rem; font-weight: 900; letter-spacing: 0.2em;
  color: #1565C0; background: #E3F2FD; border-radius: 12px;
  padding: 0.6rem 1rem; margin: 0.75rem 0;
}
.share-link {
  font-size: 0.8rem; word-break: break-all; color: #444;
  background: #f5f5f5; padding: 0.5rem; border-radius: 8px; margin-bottom: 0.75rem;
}
.color-seats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin: 0.75rem 0 1rem;
}
.color-seat {
  border-radius: 12px; padding: 0.75rem 0.5rem; border: 3px solid transparent;
  font-weight: 700; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.35);
  min-height: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.2rem;
}
.color-seat.taken { opacity: 0.55; cursor: not-allowed; }
.color-seat.mine { border-color: #111; box-shadow: 0 0 0 3px rgba(255,255,255,0.8); }
.color-seat .seat-nick { font-size: 0.85rem; }
.waiting-chip {
  display: inline-block; background: #FFF3E0; color: #E65100;
  font-weight: 700; padding: 0.35rem 0.75rem; border-radius: 999px; margin: 0.5rem 0;
}
.conn-status { font-size: 0.8rem; color: #666; margin-top: 0.5rem; }
.conn-status.err { color: #C62828; }
.field-row { display: flex; flex-direction: column; gap: 0.35rem; text-align: left; margin-bottom: 0.75rem; }
.field-row input {
  padding: 0.65rem 0.8rem; border-radius: 10px; border: 2px solid #ddd; font-size: 1rem;
}
.field-row input:focus { border-color: var(--blue-btn); outline: none; }
.btn-secondary {
  background: #ECEFF1; color: #37474F; font-weight: 700;
  padding: 0.7rem 1.25rem; border-radius: 999px; width: 100%;
}
.mode-hint { font-size: 0.8rem; color: #666; margin-top: 1rem; }
.turn-wait {
  position: absolute; left: 50%; bottom: 18%; transform: translateX(-50%);
  background: rgba(0,0,0,0.7); color: #fff; font-weight: 700;
  padding: 0.5rem 1rem; border-radius: 999px; z-index: 20;
  pointer-events: none;
}

/* World Championships rent multiplier on tile */
.champ-badge {
  position: absolute;
  bottom: 6%;
  left: 50%;
  transform: translate(-50%, 0) rotateZ(-45deg) rotateX(-52deg) translateZ(24px);
  z-index: 12;
  pointer-events: none;
  background: linear-gradient(180deg, #FFD54F, #FF8F00);
  color: #1a1a1a;
  font-family: "Roboto Condensed", sans-serif;
  font-weight: 800;
  font-size: 0.7rem;
  padding: 2px 7px;
  border-radius: 999px;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
  letter-spacing: 0.02em;
}
.champ-badge.hidden { display: none; }
