:root {
  color-scheme: light;
  --ink: #111827;
  --muted: #687385;
  --paper: #f4f7f1;
  --panel: #fffdf7;
  --line: #d6decf;
  --primary: #118061;
  --primary-dark: #0a5d49;
  --accent: #d63f31;
  --blue: #2563a4;
  --board-green: #d7ead2;
  --shadow: 0 18px 42px rgba(17, 24, 39, 0.16);
  --radius: 8px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 10%, rgba(17, 128, 97, 0.12), transparent 30%),
    radial-gradient(circle at 80% 20%, rgba(214, 63, 49, 0.1), transparent 28%),
    linear-gradient(135deg, #f7fbf4 0%, #eef4e8 48%, #f8f1e8 100%);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 800;
  letter-spacing: 0;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.primary {
  background: var(--primary);
  color: #fff;
}

.primary:hover {
  background: var(--primary-dark);
}

.secondary {
  color: #fff;
  background: var(--blue);
}

.ghost {
  color: var(--ink);
  background: #efe5d4;
  border: 1px solid var(--line);
}

.mini {
  min-height: 32px;
  padding: 0 10px;
  color: #fff;
  background: var(--accent);
}

.wide {
  width: 100%;
}

.app-shell {
  min-height: 100dvh;
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
}

.center-stage {
  min-height: calc(100dvh - var(--safe-top) - var(--safe-bottom));
  display: grid;
  place-items: center;
  padding: 24px;
}

.panel {
  background: rgba(255, 253, 247, 0.94);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  padding: 20px;
}

.compact {
  width: min(100%, 360px);
  text-align: center;
}

.auth-panel,
.install-panel,
.home-panel {
  width: min(100%, 520px);
}

.eyebrow {
  display: block;
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: 34px;
  line-height: 1.05;
}

h2 {
  margin-bottom: 14px;
  font-size: 19px;
}

.muted,
.hint {
  color: var(--muted);
}

.hint {
  margin: 14px 0 0;
  font-size: 13px;
}

.message {
  border-radius: 6px;
  padding: 10px 12px;
  font-weight: 700;
}

.message.error {
  color: #7b2418;
  background: #fde5de;
}

.message.notice {
  color: #174f47;
  background: #dcf3eb;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  font-weight: 800;
}

.field input,
.field select,
.join-form input,
.auction-form input,
.trade-money input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--ink);
  background: #fffdf8;
  font-weight: 700;
}

.field input:focus,
.field select:focus,
.join-form input:focus,
.auction-form input:focus,
.trade-money input:focus {
  outline: 3px solid rgba(42, 111, 104, 0.18);
  border-color: var(--primary);
}

.button-row,
.button-grid,
.split-actions,
.join-form,
.auction-form {
  display: flex;
  gap: 10px;
  align-items: center;
}

.button-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.split-actions {
  align-items: stretch;
}

.join-form {
  flex: 1;
}

.join-form input {
  text-align: center;
  text-transform: uppercase;
}

#licenseKey {
  text-transform: uppercase;
}

.steps {
  display: grid;
  gap: 10px;
  margin: 20px 0;
}

.steps div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffdf8;
}

.steps span {
  color: var(--muted);
}

.lobby-screen {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.topbar,
.game-side-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
}

.topbar h1,
.game-side-head h1 {
  margin-bottom: 0;
}

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

.lobby-grid {
  display: grid;
  grid-template-columns: minmax(250px, 0.8fr) minmax(260px, 0.8fr) minmax(320px, 1.1fr);
  gap: 18px;
}

.token-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.token-choice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  min-height: 54px;
  padding: 8px;
  color: var(--ink);
  background: #fffdf8;
  border: 1px solid var(--line);
  text-align: left;
}

.token-choice.selected {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 2px rgba(17, 128, 97, 0.18);
}

.token-choice-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.players-list {
  display: grid;
  gap: 10px;
}

.players-list.dense {
  gap: 8px;
}

.player-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffdf8;
}

.player-row.self {
  border-color: var(--primary);
}

.player-row.eliminated {
  opacity: 0.58;
}

.player-row div {
  min-width: 0;
}

.player-row > div strong,
.player-row > div span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-row > div span {
  color: var(--muted);
  font-size: 13px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.inline-field {
  margin-bottom: 0;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffdf8;
  font-weight: 800;
}

.toggle input {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
}

.summary-list {
  display: grid;
  gap: 10px;
}

.summary-list span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.game-screen {
  display: grid;
  grid-template-columns: minmax(560px, 1fr) minmax(340px, 430px);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px 18px;
  min-height: calc(100dvh - var(--safe-top) - var(--safe-bottom));
  height: calc(100dvh - var(--safe-top) - var(--safe-bottom));
  overflow: hidden;
  padding: 18px;
}

.game-status {
  position: sticky;
  top: 0;
  z-index: 40;
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 250, 240, 0.97);
  box-shadow: 0 8px 18px rgba(23, 32, 51, 0.08);
}

.status-block {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.status-block span,
.status-block small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-block strong {
  overflow: hidden;
  font-size: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-dice {
  display: grid;
  justify-content: end;
}

.status-trade-button {
  white-space: nowrap;
}

.button-badge {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  margin-left: 6px;
  padding: 0 6px;
  color: var(--ink);
  background: #fffdf8;
  border-radius: 999px;
  font-size: 12px;
}

.game-board-wrap {
  grid-row: 2;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  perspective: 1400px;
  perspective-origin: 50% 42%;
}

.board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(11, minmax(0, 1fr));
  grid-template-rows: repeat(11, minmax(0, 1fr));
  width: min(100%, 900px, calc(100dvh - 124px - var(--safe-top) - var(--safe-bottom)));
  aspect-ratio: 1;
  border: 3px solid #18342b;
  background: var(--board-green);
  box-shadow:
    0 34px 42px rgba(17, 24, 39, 0.22),
    0 12px 0 #9eb795;
  transform: rotateX(7deg) rotateZ(-1deg);
  transform-origin: var(--camera-x) var(--camera-y);
  transform-style: preserve-3d;
  transition: transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.7s ease;
}

.board.camera-zoom {
  transform: rotateX(10deg) rotateZ(-1deg) scale(1.055);
  box-shadow:
    0 42px 54px rgba(17, 24, 39, 0.28),
    0 16px 0 #8fa786;
}

.board-center {
  grid-row: 2 / 11;
  grid-column: 2 / 11;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 7px;
  padding: 16px;
  text-align: center;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.2)),
    var(--board-green);
  border: 2px solid #18342b;
  transform: translateZ(6px);
}

.board-center strong {
  font-size: 42px;
  line-height: 1;
}

.board-center small {
  color: #394052;
  font-weight: 800;
}

.board-cell {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 2px;
  min-width: 0;
  min-height: 0;
  padding: clamp(3px, 0.65vmin, 6px);
  overflow: hidden;
  border: 1px solid #18342b;
  background: #fff8e9;
  font-size: clamp(8px, 1.05vmin, 12px);
  color: var(--ink);
  text-align: left;
  border-radius: 0;
  transform: translateZ(8px);
  transform-style: preserve-3d;
  box-shadow: inset 0 -2px 0 rgba(17, 24, 39, 0.08);
}

.board-cell:hover,
.board-cell:focus-visible {
  z-index: 8;
  outline: 3px solid rgba(17, 128, 97, 0.36);
  transform: translateZ(22px) scale(1.035);
}

.board-cell.type-start,
.board-cell.type-jail,
.board-cell.type-parking,
.board-cell.type-goToJail {
  background: #efe0c3;
  font-weight: 900;
}

.board-cell.type-tax {
  background: #f7d7cd;
}

.board-cell.type-chance {
  background: #dbeaf2;
}

.board-cell.type-community {
  background: #e5ead5;
}

.board-cell.mortgaged {
  background:
    repeating-linear-gradient(135deg, rgba(23, 32, 51, 0.08) 0 6px, transparent 6px 12px),
    #fff8e9;
}

.cell-title {
  min-width: 0;
  overflow: hidden;
  max-height: 3.25em;
  line-height: 1.08;
  font-weight: 900;
  hyphens: auto;
  overflow-wrap: anywhere;
  text-wrap: pretty;
}

.cell-price {
  color: #4b5563;
  font-size: 0.92em;
  font-weight: 800;
}

.color-strip {
  display: block;
  height: clamp(5px, 0.8vmin, 9px);
  border-radius: 2px;
  background: #9ca3af;
}

.side-corner .cell-title {
  font-size: 1.08em;
}

.self-cell {
  box-shadow: inset 0 0 0 3px rgba(42, 111, 104, 0.58);
}

.turn-cell::after {
  position: absolute;
  inset: 3px;
  pointer-events: none;
  border: 2px dashed rgba(200, 75, 49, 0.72);
  border-radius: 4px;
  content: "";
}

.movement-layer {
  position: absolute;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  transform: translateZ(44px);
}

.move-step {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(214, 63, 49, 0.72);
  box-shadow: 0 0 0 5px rgba(214, 63, 49, 0.12);
  opacity: 0;
  transform: translate(-50%, -50%);
  animation: trail-pop 1.15s ease var(--step-delay) both;
}

.move-token {
  position: absolute;
  left: var(--from-x);
  top: var(--from-y);
  animation: board-run 1.25s cubic-bezier(0.18, 0.9, 0.2, 1) both;
}

.move-token .token {
  width: 34px;
  height: 34px;
  font-size: 8px;
}

.group-brown {
  background: #7f5539;
}

.group-sky {
  background: #67b7dc;
}

.group-pink {
  background: #d45087;
}

.group-orange {
  background: #f4a261;
}

.group-red {
  background: #d94f45;
}

.group-yellow {
  background: #f2c94c;
}

.group-green {
  background: #2a9d8f;
}

.group-blue {
  background: #335c81;
}

.group-railroad {
  background: #363f4f;
}

.group-utility {
  background: #8a6f42;
}

.owned-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 10px;
  height: 10px;
  border: 1px solid #fff;
  border-radius: 50%;
}

.houses {
  align-self: end;
  overflow: hidden;
  color: var(--accent);
  font-size: 9px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mortgage-mark {
  overflow: hidden;
  color: #7b2418;
  font-size: 9px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tokens {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  align-self: end;
  min-height: 18px;
}

.token {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 31px;
  height: 31px;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 999px;
  color: #fff;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.34), rgba(0, 0, 0, 0.08)),
    var(--piece-color, var(--primary));
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0;
  box-shadow:
    0 7px 10px rgba(17, 24, 39, 0.28),
    inset 0 -4px 0 rgba(0, 0, 0, 0.16);
  transform: translateZ(28px);
}

.piece span {
  display: block;
  max-width: 100%;
  overflow: hidden;
  padding: 0 2px;
  font-size: 0;
  text-overflow: clip;
  white-space: nowrap;
}

.piece::before,
.piece::after {
  position: absolute;
  display: block;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  content: "";
}

.piece::before {
  width: 58%;
  height: 42%;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: inset 0 -2px 0 rgba(17, 24, 39, 0.18);
}

.piece-car::before {
  width: 66%;
  height: 28%;
  border-radius: 8px 8px 5px 5px;
}

.piece-car::after {
  bottom: 7px;
  top: auto;
  width: 62%;
  height: 5px;
  border-radius: 999px;
  background: radial-gradient(circle at 18% 50%, #18342b 0 3px, transparent 3px), radial-gradient(circle at 82% 50%, #18342b 0 3px, transparent 3px);
  transform: translateX(-50%);
}

.piece-hat::before {
  width: 48%;
  height: 48%;
  border-radius: 4px 4px 2px 2px;
  clip-path: polygon(22% 0, 78% 0, 78% 72%, 100% 72%, 100% 100%, 0 100%, 0 72%, 22% 72%);
}

.piece-ship::before {
  width: 66%;
  height: 48%;
  clip-path: polygon(0 45%, 78% 45%, 100% 72%, 18% 100%);
}

.piece-shoe::before {
  width: 68%;
  height: 34%;
  border-radius: 12px 12px 6px 6px;
  clip-path: polygon(0 36%, 50% 36%, 68% 8%, 86% 20%, 100% 72%, 94% 100%, 0 100%);
}

.piece-rocket::before {
  width: 48%;
  height: 64%;
  border-radius: 50% 50% 12px 12px;
  clip-path: polygon(50% 0, 82% 30%, 76% 76%, 100% 100%, 62% 88%, 50% 100%, 38% 88%, 0 100%, 24% 76%, 18% 30%);
}

.piece-key::before {
  width: 62%;
  height: 48%;
  background:
    radial-gradient(circle at 24% 50%, transparent 0 6px, rgba(255, 255, 255, 0.92) 7px 10px, transparent 11px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.92) 35%, rgba(255, 255, 255, 0.92) 100%);
  clip-path: polygon(0 18%, 42% 18%, 42% 38%, 100% 38%, 100% 58%, 88% 58%, 88% 76%, 74% 76%, 74% 58%, 42% 58%, 42% 82%, 0 82%);
}

.piece-crown::before {
  width: 64%;
  height: 52%;
  clip-path: polygon(0 100%, 0 38%, 24% 66%, 38% 18%, 50% 58%, 66% 18%, 80% 66%, 100% 38%, 100% 100%);
}

.piece-gem::before {
  width: 58%;
  height: 58%;
  clip-path: polygon(50% 0, 100% 34%, 82% 100%, 18% 100%, 0 34%);
}

.preview-piece {
  width: 34px;
  height: 34px;
}

.board-cell .token {
  width: 22px;
  height: 22px;
  border-width: 1px;
  font-size: 6px;
}

.game-side {
  grid-row: 2;
  display: grid;
  align-content: start;
  gap: 12px;
  min-width: 0;
  max-height: 100%;
  overflow: auto;
  padding-right: 4px;
}

.game-side .panel {
  box-shadow: none;
}

.compact-panel {
  padding: 14px;
}

.action-panel {
  display: grid;
  gap: 12px;
}

.current-player {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 32px;
}

.dice-readout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 142px;
  color: #394052;
  font-size: 12px;
  font-weight: 900;
}

.dice-set {
  display: flex;
  gap: 6px;
  align-items: center;
}

.die {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  width: 32px;
  height: 32px;
  padding: 5px;
  border: 1px solid rgba(23, 32, 51, 0.2);
  border-radius: 7px;
  background: #fffdf8;
  box-shadow: 0 2px 5px rgba(23, 32, 51, 0.18);
}

.pip {
  width: 5px;
  height: 5px;
  align-self: center;
  justify-self: center;
  border-radius: 50%;
  background: var(--ink);
  opacity: 0;
}

.face-1 .pip:nth-child(5),
.face-2 .pip:nth-child(1),
.face-2 .pip:nth-child(9),
.face-3 .pip:nth-child(1),
.face-3 .pip:nth-child(5),
.face-3 .pip:nth-child(9),
.face-4 .pip:nth-child(1),
.face-4 .pip:nth-child(3),
.face-4 .pip:nth-child(7),
.face-4 .pip:nth-child(9),
.face-5 .pip:nth-child(1),
.face-5 .pip:nth-child(3),
.face-5 .pip:nth-child(5),
.face-5 .pip:nth-child(7),
.face-5 .pip:nth-child(9),
.face-6 .pip:nth-child(1),
.face-6 .pip:nth-child(3),
.face-6 .pip:nth-child(4),
.face-6 .pip:nth-child(6),
.face-6 .pip:nth-child(7),
.face-6 .pip:nth-child(9) {
  opacity: 1;
}

.dice-readout.rolling .die,
.die.rolling {
  animation: dice-roll 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}

.board-center .dice-readout.rolling .die {
  animation: dice-board-drop 0.72s cubic-bezier(0.18, 0.9, 0.24, 1) infinite;
}

.dice-readout.rolling .die:nth-child(2),
.die.rolling:nth-child(2) {
  animation-delay: 0.08s;
}

.dice-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 58px;
  color: #fff;
  background: var(--primary);
  touch-action: none;
  user-select: none;
  transform: translate(var(--shake-x, 0), var(--shake-y, 0));
  transition: transform 0.12s ease, background 0.16s ease;
}

.dice-button:hover {
  background: var(--primary-dark);
}

.dice-button .die {
  background: #fff;
}

.dice-button .pip {
  background: var(--ink);
}

.dice-button.shaking {
  background: var(--accent);
  box-shadow: 0 10px 20px rgba(214, 63, 49, 0.24);
}

.quick-actions-panel h2 {
  margin-bottom: 10px;
}

.quick-actions {
  display: grid;
  gap: 8px;
}

.owned-list {
  display: grid;
  gap: 8px;
}

.owned-card {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffdf8;
}

.card-actions {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ghost-mini {
  color: var(--ink);
  background: #efe5d4;
  border: 1px solid var(--line);
}

.debt-panel {
  border-color: #e27b64;
}

.trade-panel {
  display: grid;
  gap: 12px;
}

.trade-form {
  display: grid;
  gap: 10px;
}

.trade-money,
.trade-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.trade-money label,
.trade-columns > div,
.trade-card {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffdf8;
}

.trade-money span,
.mini-text {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.check-row {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
  color: #394052;
  font-size: 13px;
}

.check-row input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.check-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trade-list {
  display: grid;
  gap: 8px;
}

.trade-card span {
  color: #475467;
  font-size: 13px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding:
    max(16px, var(--safe-top))
    max(16px, var(--safe-right))
    max(16px, var(--safe-bottom))
    max(16px, var(--safe-left));
  background: rgba(23, 32, 51, 0.42);
}

.modal-panel {
  width: min(720px, 100%);
  max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 32px);
  overflow: auto;
}

.property-card-modal {
  width: min(430px, 100%);
  overflow: hidden;
  border: 2px solid #18342b;
  border-radius: 10px;
  background: #fffdf8;
  box-shadow: 0 28px 60px rgba(17, 24, 39, 0.34);
}

.property-card-head {
  display: grid;
  gap: 6px;
  padding: 18px;
  color: #fff;
  background: var(--primary);
  text-align: center;
}

.property-card-head span {
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.property-card-head h2 {
  margin: 0;
  font-size: 26px;
}

.property-card-head.group-yellow,
.property-card-head.group-sky,
.property-card-head.group-community,
.property-card-head.group-chance {
  color: var(--ink);
}

.property-card-body {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.property-card-body p {
  margin: 0;
}

.card-price {
  justify-self: center;
  min-width: 120px;
  padding: 8px 14px;
  border-radius: 999px;
  color: #fff;
  background: #18342b;
  font-weight: 900;
  text-align: center;
}

.card-warning {
  color: #8f1f13;
  font-weight: 900;
}

.rent-table {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.rent-table span,
.rent-table strong {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}

.rent-table span:nth-last-child(2),
.rent-table strong:last-child {
  border-bottom: 0;
}

.rent-table strong {
  text-align: right;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.modal-head h2 {
  margin-bottom: 0;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  min-width: 42px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
}

.orientation-lock {
  display: none;
}

.orientation-lock > div {
  width: min(440px, 92vw);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 247, 0.97);
  box-shadow: var(--shadow);
  text-align: center;
}

.orientation-lock strong {
  display: block;
  margin-bottom: 8px;
  font-size: 30px;
}

.owned-card .color-strip {
  width: 8px;
  height: 100%;
  min-height: 42px;
}

.owned-card div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.owned-card strong,
.owned-card span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.owned-card span {
  color: var(--muted);
  font-size: 12px;
}

.log-panel {
  max-height: 290px;
  overflow: hidden;
}

.log-list {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  padding-right: 4px;
}

.log-list p {
  margin: 0;
  color: #475467;
  font-size: 13px;
  line-height: 1.35;
}

.loader {
  width: 34px;
  height: 34px;
  margin: 0 auto 14px;
  border: 4px solid #e2d4bd;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes dice-roll {
  0% {
    transform: translateY(0) rotate(0deg);
  }

  35% {
    transform: translateY(-7px) rotate(92deg);
  }

  70% {
    transform: translateY(3px) rotate(178deg);
  }

  100% {
    transform: translateY(0) rotate(360deg);
  }
}

@keyframes dice-board-drop {
  0% {
    transform: translateY(-34px) translateZ(46px) rotateX(0deg) rotateZ(0deg);
  }

  55% {
    transform: translateY(5px) translateZ(12px) rotateX(210deg) rotateZ(120deg);
  }

  72% {
    transform: translateY(-8px) translateZ(26px) rotateX(250deg) rotateZ(190deg);
  }

  100% {
    transform: translateY(0) translateZ(18px) rotateX(360deg) rotateZ(300deg);
  }
}

@keyframes board-run {
  0% {
    left: var(--from-x);
    top: var(--from-y);
    transform: translate(-50%, -50%) translateZ(42px) scale(1);
  }

  45% {
    left: var(--to-x);
    top: calc(var(--to-y) - 3%);
    transform: translate(-50%, -50%) translateZ(78px) scale(1.14);
  }

  100% {
    left: var(--to-x);
    top: var(--to-y);
    transform: translate(-50%, -50%) translateZ(42px) scale(1);
  }
}

@keyframes trail-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.3);
  }

  30% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.4);
  }
}

@media (max-width: 980px) {
  .game-screen,
  .lobby-grid {
    grid-template-columns: 1fr;
  }

  .game-screen {
    grid-template-rows: auto auto auto;
    height: auto;
    min-height: calc(100dvh - var(--safe-top) - var(--safe-bottom));
    overflow: visible;
    padding: 10px;
  }

  .game-status {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .status-dice {
    justify-content: stretch;
  }

  .status-dice .dice-readout,
  .status-trade-button {
    width: 100%;
  }

  .game-board-wrap,
  .game-side {
    grid-row: auto;
  }

  .game-side {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .board {
    width: min(100%, 94svw);
  }
}

@media (max-width: 940px) and (orientation: landscape) {
  .game-screen {
    grid-template-columns: minmax(0, calc(100dvh - 74px - var(--safe-top) - var(--safe-bottom))) minmax(250px, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    height: calc(100dvh - var(--safe-top) - var(--safe-bottom));
    min-height: calc(100dvh - var(--safe-top) - var(--safe-bottom));
    overflow: hidden;
    gap: 8px;
    padding: 8px;
  }

  .game-status {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    gap: 8px;
    padding: 7px 8px;
  }

  .status-trade-button {
    grid-column: 3;
  }

  .status-dice {
    display: none;
  }

  .game-board-wrap,
  .game-side {
    grid-row: 2;
  }

  .game-side {
    max-height: 100%;
    overflow: auto;
  }

  .game-side-head,
  .players-list.dense,
  .log-panel {
    display: none;
  }

  .board {
    width: min(100%, calc(100dvh - 78px - var(--safe-top) - var(--safe-bottom)));
    transform: rotateX(5deg) rotateZ(-1deg);
  }

  .board.camera-zoom {
    transform: rotateX(7deg) rotateZ(-1deg) scale(1.035);
  }

  .board-center strong {
    font-size: 24px;
  }

  .board-center small,
  .board-center .eyebrow {
    display: none;
  }

  .board-cell {
    font-size: clamp(6.5px, 1.7dvh, 9px);
  }
}

@media (orientation: portrait) {
  .game-screen {
    display: grid;
    min-height: calc(100dvh - var(--safe-top) - var(--safe-bottom));
  }

  .game-screen > :not(.orientation-lock) {
    display: none !important;
  }

  .orientation-lock {
    display: grid;
    place-items: center;
    min-height: calc(100dvh - var(--safe-top) - var(--safe-bottom));
    padding: 16px;
  }
}

@media (max-width: 640px) and (orientation: portrait) {
  .center-stage,
  .lobby-screen {
    padding: 14px;
  }

  h1 {
    font-size: 28px;
  }

  .button-row,
  .button-grid,
  .split-actions,
  .join-form,
  .auction-form,
  .topbar,
  .game-side-head {
    align-items: stretch;
    flex-direction: column;
  }

  .button-grid,
  .trade-money,
  .trade-columns {
    grid-template-columns: 1fr;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .game-status {
    grid-template-columns: 1fr;
  }

  .status-block strong {
    font-size: 16px;
  }

  .dice-readout {
    justify-content: flex-start;
    min-width: 0;
  }

  .dice-button {
    min-height: 52px;
  }

  .die {
    width: 28px;
    height: 28px;
    padding: 4px;
  }

  .pip {
    width: 4px;
    height: 4px;
  }

  .board-cell {
    padding: 2px;
    font-size: clamp(6.5px, 1.7vw, 8.5px);
  }

  .board-center strong {
    font-size: 28px;
  }

  .board-center {
    padding: 8px;
  }

  .board-center .dice-readout,
  .board-center small:nth-of-type(3) {
    display: none;
  }

  .color-strip {
    height: 5px;
  }

  .cell-title {
    max-height: 3.15em;
  }

  .cell-price,
  .houses {
    display: none;
  }

  .board-cell .token {
    width: 14px;
    height: 14px;
    font-size: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dice-readout.rolling .die,
  .die.rolling,
  .loader {
    animation: none;
  }
}
