/* ==========================================================
   5分钟大富翁：极限炒房 — Crisp Tabletop 9:16 Mini Game CSS
   Zero external fonts/CDN, self-contained & file:// friendly
   ========================================================== */

:root {
  --bg-outer-1: #0f2922;
  --bg-outer-2: #1a3c34;
  --shell-bg: #f6fbf5;
  --mint-light: #e4f7ea;
  --mint-mid: #c1ecd1;
  --mint-deep: #15803d;
  --gold-light: #fef3c7;
  --gold-mid: #f59e0b;
  --gold-dark: #b45309;
  --coral: #ef4444;
  --sky: #0284c7;
  --violet: #7c3aed;
  --ink: #1e293b;
  --ink-soft: #475569;
  --ink-muted: #64748b;
  --card-bg: #ffffff;
  --border-soft: rgba(15, 23, 42, 0.1);
  --shadow-sm: 0 2px 6px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 8px 22px rgba(15, 23, 42, 0.14);
  --shadow-lg: 0 18px 42px rgba(15, 23, 42, 0.25);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 20% 15%, #235347 0%, var(--bg-outer-1) 60%, #091b16 100%);
}

.app-backdrop {
  width: 100%;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.game-shell {
  position: relative;
  width: 100%;
  max-width: 430px;
  height: min(100dvh, 860px);
  background: linear-gradient(180deg, #effaf2 0%, var(--shell-bg) 35%, #edf8f0 100%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.12);
}

@media (min-width: 460px) {
  .game-shell {
    border-radius: 26px;
    border: 3px solid rgba(255, 255, 255, 0.2);
  }
}

.hidden {
  display: none !important;
}

/* ==================== WeChat Top Bar ==================== */
.wx-bar {
  flex: 0 0 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  background: linear-gradient(180deg, #ffffff 0%, #f3fbf5 100%);
  border-bottom: 1px solid rgba(21, 128, 61, 0.12);
  z-index: 20;
}

.wx-back-btn {
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  background: rgba(21, 128, 61, 0.09);
  border: 1px solid rgba(21, 128, 61, 0.16);
  padding: 5px 10px;
  border-radius: 999px;
  transition: transform 0.12s, background 0.15s;
}
.wx-back-btn:active {
  transform: scale(0.95);
  background: rgba(21, 128, 61, 0.18);
}

.wx-title {
  font-size: 14px;
  font-weight: 800;
  color: #14532d;
  letter-spacing: -0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 190px;
}

.wx-capsule {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 999px;
  height: 28px;
  padding: 0 3px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.wx-cap-btn {
  border: none;
  background: transparent;
  width: 28px;
  height: 24px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.wx-cap-btn:active {
  background: rgba(15, 23, 42, 0.08);
}

.wx-cap-divider {
  width: 1px;
  height: 14px;
  background: rgba(15, 23, 42, 0.15);
}

/* ==================== Top HUD ==================== */
.hud-panel {
  flex: 0 0 auto;
  padding: 7px 10px 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 15;
}

.hud-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.hud-cash-box,
.hud-bill-box {
  flex: 1;
  background: #ffffff;
  border-radius: 13px;
  padding: 6px 10px;
  border: 1.5px solid rgba(21, 128, 61, 0.14);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: transform 0.18s ease, border-color 0.2s;
}

.hud-cash-box {
  background: linear-gradient(135deg, #fffdf5 0%, #fef3c7 100%);
  border-color: rgba(245, 158, 11, 0.35);
}

.hud-cash-box.bump {
  animation: cashBump 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes cashBump {
  0% { transform: scale(1); }
  45% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

.hud-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-muted);
  letter-spacing: 0.3px;
}

.hud-cash-val {
  font-size: 20px;
  font-weight: 900;
  color: #b45309;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

.hud-bill-box {
  background: linear-gradient(135deg, #ffffff 0%, #fff5f5 100%);
  border-color: rgba(239, 68, 68, 0.22);
}

.hud-bill-box.safe {
  background: linear-gradient(135deg, #ffffff 0%, #ecfdf5 100%);
  border-color: rgba(16, 185, 129, 0.32);
}

.hud-bill-box.urgent {
  border-color: #ef4444;
  animation: urgentPulse 1.1s infinite ease-in-out;
}

@keyframes urgentPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.28); }
  50% { box-shadow: 0 0 0 5px rgba(239, 68, 68, 0); }
}

.hud-bill-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hud-bill-steps {
  font-size: 10px;
  font-weight: 800;
  color: #dc2626;
  background: rgba(239, 68, 68, 0.1);
  padding: 1px 5px;
  border-radius: 6px;
}

.hud-bill-box.safe .hud-bill-steps {
  color: #059669;
  background: rgba(16, 185, 129, 0.14);
}

.hud-bill-val {
  font-size: 16px;
  font-weight: 900;
  color: #b91c1c;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.hud-bill-box.safe .hud-bill-val {
  color: #047857;
}

.bill-progress-track {
  width: 100%;
  height: 5px;
  background: rgba(15, 23, 42, 0.08);
  border-radius: 999px;
  margin-top: 3px;
  overflow: hidden;
}

.bill-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #f59e0b, #ef4444);
  transition: width 0.35s ease, background 0.3s ease;
}

.hud-bill-box.safe .bill-progress-fill {
  background: linear-gradient(90deg, #34d399, #10b981);
}

.hud-row-sub {
  display: grid;
  grid-template-columns: 1.05fr 1.35fr 0.85fr 1fr;
  gap: 5px;
}

.hud-pill {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.09);
  border-radius: 999px;
  padding: 4px 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-soft);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  font-variant-numeric: tabular-nums;
}

.hud-pill.mood-bull {
  background: #ecfdf5;
  color: #047857;
  border-color: rgba(16, 185, 129, 0.35);
}

.hud-pill.mood-bear {
  background: #fef2f2;
  color: #b91c1c;
  border-color: rgba(239, 68, 68, 0.35);
}

.hud-pill.mood-neutral {
  background: #f0f9ff;
  color: #0369a1;
  border-color: rgba(14, 165, 233, 0.3);
}

.hud-perks-btn {
  cursor: pointer;
  background: linear-gradient(135deg, #fefce8 0%, #fef08a 100%);
  color: #854d0e;
  border-color: rgba(234, 179, 8, 0.4);
  transition: transform 0.12s;
}
.hud-perks-btn:active {
  transform: scale(0.95);
}

/* ==================== 16-Tile Board Stage ==================== */
.board-stage {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  position: relative;
}

.board-wrapper {
  position: relative;
  width: min(100%, 408px);
  max-height: 100%;
  aspect-ratio: 1 / 1;
}

.board-grid {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: 5px;
  padding: 6px;
  border-radius: 20px;
  background: linear-gradient(145deg, #b8e8ca 0%, #8ed5ac 100%);
  border: 2.5px solid #6ec292;
  box-shadow: inset 0 2px 6px rgba(255, 255, 255, 0.65), 0 10px 26px rgba(21, 128, 61, 0.18);
  position: relative;
}

/* Individual Tile */
.tile {
  position: relative;
  background: #ffffff;
  border-radius: 11px;
  border: 1.5px solid rgba(15, 23, 42, 0.1);
  box-shadow: 0 3px 0 rgba(21, 128, 61, 0.22), 0 4px 8px rgba(15, 23, 42, 0.07);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 3px 2px 3px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.18s;
  overflow: hidden;
}

.tile:active {
  transform: translateY(1px) scale(0.97);
}

.tile.active-tile {
  border-color: #f59e0b;
  box-shadow: 0 0 0 2.5px rgba(245, 158, 11, 0.55), 0 4px 12px rgba(245, 158, 11, 0.35);
  z-index: 4;
}

.tile.payout-pulse {
  animation: tilePayoutPulse 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 5;
}

@keyframes tilePayoutPulse {
  0% { transform: scale(1); }
  40% { transform: scale(1.1); box-shadow: 0 0 0 3px #fbbf24, 0 0 18px rgba(251, 191, 36, 0.7); }
  100% { transform: scale(1); }
}

.tile.synergy-glow {
  border-color: #f59e0b;
}

/* Corner Tiles */
.tile-corner {
  background: linear-gradient(160deg, #fffbeb 0%, #fde68a 100%);
  border-color: #f59e0b;
}
.tile-corner.corner-start {
  background: linear-gradient(160deg, #dcfce7 0%, #86efac 100%);
  border-color: #16a34a;
}
.tile-corner.corner-fate {
  background: linear-gradient(160deg, #fef3c7 0%, #fcd34d 100%);
  border-color: #d97706;
}
.tile-corner.corner-stock {
  background: linear-gradient(160deg, #e0f2fe 0%, #7dd3fc 100%);
  border-color: #0284c7;
}
.tile-corner.corner-summit {
  background: linear-gradient(160deg, #f3e8ff 0%, #d8b4fe 100%);
  border-color: #7c3aed;
}

.corner-metro-tag {
  position: absolute;
  top: 2px;
  right: 2px;
  font-size: 8px;
  line-height: 1;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 4px;
  padding: 1px 2px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Street Tile Color Bands */
.tile-band {
  width: calc(100% + 4px);
  height: 6px;
  margin-top: -3px;
  border-radius: 6px 6px 0 0;
  flex-shrink: 0;
}
.band-0 { background: linear-gradient(90deg, #fb7185, #f43f5e); }
.band-1 { background: linear-gradient(90deg, #38bdf8, #0284c7); }
.band-2 { background: linear-gradient(90deg, #34d399, #059669); }
.band-3 { background: linear-gradient(90deg, #a78bfa, #7c3aed); }

/* Owned Building Coloring */
.tile.owned-milk_tea { background: linear-gradient(180deg, #fff1f2 0%, #ffe4e6 100%); border-color: #fb7185; }
.tile.owned-office   { background: linear-gradient(180deg, #f0f9ff 0%, #e0f2fe 100%); border-color: #38bdf8; }
.tile.owned-park     { background: linear-gradient(180deg, #ecfdf5 0%, #d1fae5 100%); border-color: #34d399; }
.tile.owned-amusement{ background: linear-gradient(180deg, #f5f3ff 0%, #ede9fe 100%); border-color: #a78bfa; }
.tile.owned-bank     { background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 100%); border-color: #f59e0b; }

.tile-icon {
  font-size: 21px;
  line-height: 1;
  filter: drop-shadow(0 2px 1px rgba(15, 23, 42, 0.18));
  transition: transform 0.2s;
}

.tile-empty-icon {
  font-size: 16px;
  opacity: 0.42;
}

.tile-name {
  font-size: 9px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.05;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.tile-meta {
  font-size: 8.5px;
  font-weight: 800;
  color: #047857;
  background: rgba(255, 255, 255, 0.88);
  padding: 1px 4px;
  border-radius: 5px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.tile-corner .tile-meta {
  color: var(--ink-soft);
  font-size: 8px;
}

.tile-stars {
  position: absolute;
  top: 2px;
  left: 3px;
  font-size: 8px;
  line-height: 1;
  color: #f59e0b;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.9);
  letter-spacing: -1px;
}

.tile-mult-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  font-size: 8px;
  font-weight: 900;
  color: #ffffff;
  background: linear-gradient(135deg, #f97316, #ef4444);
  padding: 1px 3px;
  border-radius: 5px;
  line-height: 1.05;
  box-shadow: 0 1px 3px rgba(239, 68, 68, 0.35);
}

.tile-shield-badge {
  position: absolute;
  bottom: 14px;
  right: 2px;
  font-size: 9px;
  line-height: 1;
}

/* ==================== Center 3x3 Area ==================== */
.board-center {
  grid-column: 2 / 5;
  grid-row: 2 / 5;
  border-radius: 15px;
  background: radial-gradient(circle at 50% 42%, #ffffff 0%, #ebfaef 65%, #d6f3df 100%);
  border: 1.5px solid rgba(21, 128, 61, 0.22);
  box-shadow: inset 0 2px 10px rgba(21, 128, 61, 0.09);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 6px;
  overflow: hidden;
  position: relative;
}

.ticker-bar {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(20, 83, 45, 0.08);
  border-radius: 8px;
  padding: 3px 6px;
  min-height: 22px;
}

.ticker-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  flex-shrink: 0;
  animation: blinkDot 1.4s infinite;
}

@keyframes blinkDot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.ticker-text {
  font-size: 10px;
  font-weight: 700;
  color: #14532d;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.center-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 2px 0;
}

/* 3D-feel Dice */
.dice-arena {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 64px;
}

.die-3d {
  width: 58px;
  height: 58px;
  background: linear-gradient(145deg, #ffffff 0%, #f8fafc 60%, #e2e8f0 100%);
  border-radius: 14px;
  border: 2px solid #cbd5e1;
  box-shadow:
    inset 0 3px 4px rgba(255, 255, 255, 0.95),
    inset 0 -4px 6px rgba(148, 163, 184, 0.4),
    0 7px 0 #94a3b8,
    0 11px 18px rgba(15, 23, 42, 0.22);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  padding: 8px;
  gap: 3px;
  position: relative;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.die-3d.rolling {
  animation: dieTumble 0.14s infinite linear;
}

.die-3d.landed {
  animation: dieLand 0.34s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes dieTumble {
  0%   { transform: translateY(-6px) rotate(-18deg) scale(1.06); }
  50%  { transform: translateY(3px) rotate(18deg) scale(0.95); }
  100% { transform: translateY(-6px) rotate(-18deg) scale(1.06); }
}

@keyframes dieLand {
  0%   { transform: scale(1.24) translateY(-8px); }
  55%  { transform: scale(0.92) translateY(2px); }
  100% { transform: scale(1) translateY(0); }
}

.pip {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #1e293b;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5);
  margin: auto;
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 0.08s, transform 0.08s;
}

/* Red pips for 1 and 4 (classic Chinese tabletop dice!) */
.die-3d[data-value="1"] .p5,
.die-3d[data-value="4"] .p1,
.die-3d[data-value="4"] .p3,
.die-3d[data-value="4"] .p7,
.die-3d[data-value="4"] .p9 {
  background: #dc2626;
}

.die-3d[data-value="1"] .p5 { opacity: 1; transform: scale(1.35); }
.die-3d[data-value="2"] .p3,
.die-3d[data-value="2"] .p7 { opacity: 1; transform: scale(1); }
.die-3d[data-value="3"] .p3,
.die-3d[data-value="3"] .p5,
.die-3d[data-value="3"] .p7 { opacity: 1; transform: scale(1); }
.die-3d[data-value="4"] .p1,
.die-3d[data-value="4"] .p3,
.die-3d[data-value="4"] .p7,
.die-3d[data-value="4"] .p9 { opacity: 1; transform: scale(1); }
.die-3d[data-value="5"] .p1,
.die-3d[data-value="5"] .p3,
.die-3d[data-value="5"] .p5,
.die-3d[data-value="5"] .p7,
.die-3d[data-value="5"] .p9 { opacity: 1; transform: scale(1); }
.die-3d[data-value="6"] .p1,
.die-3d[data-value="6"] .p3,
.die-3d[data-value="6"] .p4,
.die-3d[data-value="6"] .p6,
.die-3d[data-value="6"] .p7,
.die-3d[data-value="6"] .p9 { opacity: 1; transform: scale(1); }

.center-event-banner {
  text-align: center;
  padding: 5px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(21, 128, 61, 0.14);
  width: 96%;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.05);
}

.event-main {
  font-size: 12px;
  font-weight: 900;
  color: #14532d;
  line-height: 1.25;
}

.event-main.gold {
  color: #b45309;
}

.event-main.hot {
  color: #dc2626;
}

.event-sub {
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-muted);
  margin-top: 2px;
  line-height: 1.2;
}

.center-stats-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  font-weight: 800;
  color: #166534;
  background: rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  padding: 4px 7px;
  font-variant-numeric: tabular-nums;
}

/* ==================== Token & FX Overlays ==================== */
.token-layer,
.fx-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

.fx-layer {
  z-index: 12;
  overflow: visible;
}

.player-token {
  position: absolute;
  width: 34px;
  height: 34px;
  transform: translate(-50%, -50%);
  transition: left 0.16s cubic-bezier(0.34, 1.4, 0.64, 1), top 0.16s cubic-bezier(0.34, 1.4, 0.64, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.token-shadow {
  position: absolute;
  bottom: 2px;
  width: 24px;
  height: 9px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.34);
  filter: blur(1px);
}

.token-body {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(145deg, #fef08a 0%, #f59e0b 65%, #b45309 100%);
  border: 2.5px solid #ffffff;
  box-shadow: 0 3px 10px rgba(180, 83, 9, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
}

.player-token.hopping .token-body {
  animation: tokenHop 0.16s ease-out;
}

@keyframes tokenHop {
  0% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-14px) scale(1.14); }
  100% { transform: translateY(0) scale(1); }
}

/* Floating Coin Popups */
.float-popup {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
  padding: 2px 7px;
  border-radius: 999px;
  color: #78350f;
  background: linear-gradient(135deg, #fef9c3 0%, #fde047 100%);
  border: 1.5px solid #ffffff;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.45);
  animation: floatUpFade 1.15s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

.float-popup.combo {
  font-size: 13px;
  color: #ffffff;
  background: linear-gradient(135deg, #f97316 0%, #dc2626 100%);
  box-shadow: 0 5px 15px rgba(220, 38, 38, 0.5);
}

.float-popup.mega {
  font-size: 15px;
  padding: 4px 10px;
  color: #ffffff;
  background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.55);
}

.float-popup.loss {
  color: #ffffff;
  background: linear-gradient(135deg, #ef4444 0%, #991b1b 100%);
}

@keyframes floatUpFade {
  0% {
    opacity: 0;
    transform: translate(-50%, -10%) scale(0.65);
  }
  18% {
    opacity: 1;
    transform: translate(-50%, -65%) scale(1.08);
  }
  75% {
    opacity: 1;
    transform: translate(-50%, -135%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -175%) scale(0.9);
  }
}

/* ==================== Bottom Controls ==================== */
.controls-bar {
  flex: 0 0 auto;
  position: relative;
  padding: 6px 12px 12px;
  background: linear-gradient(180deg, rgba(237, 248, 240, 0) 0%, #e4f6ea 28%, #daf1e2 100%);
  z-index: 16;
}

.controls-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.btn-remote {
  flex: 0 0 92px;
  border: 2px solid #7c3aed;
  border-radius: 16px;
  background: linear-gradient(180deg, #faf5ff 0%, #ede9fe 100%);
  color: #5b21b6;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 4px;
  box-shadow: 0 4px 0 #6d28d9, 0 6px 14px rgba(109, 40, 217, 0.2);
  transition: transform 0.1s, box-shadow 0.1s, opacity 0.2s;
}
.btn-remote:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #6d28d9;
}
.btn-remote:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.5);
}
.btn-remote-ico {
  font-size: 18px;
  line-height: 1.1;
}
.btn-remote-txt {
  font-size: 11px;
  margin-top: 1px;
}

.btn-roll {
  flex: 1;
  height: 56px;
  border: 2px solid #d97706;
  border-radius: 18px;
  background: linear-gradient(180deg, #fde047 0%, #f59e0b 65%, #d97706 100%);
  color: #451a03;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 5px 0 #b45309, 0 10px 22px rgba(217, 119, 6, 0.35);
  transition: transform 0.1s, box-shadow 0.1s, opacity 0.2s;
  position: relative;
}
.btn-roll:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #b45309;
}
.btn-roll:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.btn-roll-ico {
  font-size: 24px;
}
.btn-roll-label {
  font-size: 19px;
  letter-spacing: 0.5px;
}
.btn-roll-hint {
  position: absolute;
  right: 12px;
  font-size: 10px;
  font-weight: 800;
  color: rgba(69, 26, 3, 0.65);
  background: rgba(255, 255, 255, 0.45);
  padding: 2px 6px;
  border-radius: 6px;
}

/* Remote Picker Popover */
.remote-picker {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 74px;
  background: #ffffff;
  border: 2px solid #8b5cf6;
  border-radius: 16px;
  padding: 10px;
  box-shadow: var(--shadow-lg);
  animation: popUp 0.18s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 30;
}

@keyframes popUp {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.remote-picker-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 800;
  color: #5b21b6;
  margin-bottom: 8px;
}

.remote-close {
  border: none;
  background: #f3e8ff;
  color: #6d28d9;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-weight: 800;
  cursor: pointer;
}

.remote-nums {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

.remote-num-btn {
  height: 40px;
  border: 1.5px solid #c4b5fd;
  border-radius: 11px;
  background: linear-gradient(180deg, #ffffff 0%, #f5f3ff 100%);
  color: #4c1d95;
  font-size: 17px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 3px 0 #c4b5fd;
}
.remote-num-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #c4b5fd;
  background: #ede9fe;
}

/* ==================== Start & End Overlay Screens ==================== */
.overlay-screen {
  position: absolute;
  inset: 44px 0 0 0;
  background: linear-gradient(180deg, rgba(235, 250, 240, 0.98) 0%, rgba(215, 244, 226, 0.98) 100%);
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  overflow-y: auto;
}

.start-card,
.end-card {
  width: 100%;
  background: #ffffff;
  border-radius: 22px;
  padding: 16px 14px;
  border: 2px solid rgba(21, 128, 61, 0.2);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.start-hero {
  text-align: center;
}

.hero-badges {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 6px;
}

.hero-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 21px;
  box-shadow: 0 3px 0 rgba(15, 23, 42, 0.14);
  animation: floatIcon 2.4s ease-in-out infinite;
}
.hero-icon.h1 { background: #ffe4e6; animation-delay: 0s; }
.hero-icon.h2 { background: #e0f2fe; animation-delay: 0.2s; }
.hero-icon.h3 { background: #d1fae5; animation-delay: 0.4s; }
.hero-icon.h4 { background: #ede9fe; animation-delay: 0.6s; }
.hero-icon.h5 { background: #fef3c7; animation-delay: 0.8s; }

@keyframes floatIcon {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.start-kicker {
  display: inline-block;
  font-size: 10px;
  font-weight: 900;
  color: #b45309;
  background: #fef3c7;
  padding: 2px 10px;
  border-radius: 999px;
  letter-spacing: 0.8px;
}

.start-title {
  font-size: 24px;
  font-weight: 900;
  color: #14532d;
  line-height: 1.15;
  margin-top: 5px;
}

.start-title span {
  font-size: 27px;
  background: linear-gradient(90deg, #d97706, #ef4444);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.start-desc {
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.45;
  margin-top: 6px;
  text-align: left;
  background: #f8fafc;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.06);
}

.mode-selector {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.mode-card {
  position: relative;
  text-align: left;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  background: #ffffff;
  padding: 9px 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
}

.mode-card.active {
  border-color: #16a34a;
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  box-shadow: 0 3px 10px rgba(22, 163, 74, 0.15);
}

.mode-card:active {
  transform: scale(0.98);
}

.mode-badge {
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 10px;
  font-weight: 800;
  color: #ffffff;
  background: #16a34a;
  padding: 1px 7px;
  border-radius: 999px;
}

.mode-badge.quick {
  background: #f59e0b;
}

.mode-name {
  font-size: 14px;
  font-weight: 900;
  color: var(--ink);
}

.mode-meta {
  font-size: 11px;
  color: var(--ink-muted);
  margin-top: 2px;
  font-weight: 600;
}

.synergy-mini-guide {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: center;
}

.syn-chip {
  font-size: 10.5px;
  color: var(--ink-soft);
  background: #f1f5f9;
  padding: 3px 7px;
  border-radius: 8px;
  font-weight: 600;
}
.syn-chip b {
  color: #b45309;
}

.best-record-bar {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: #854d0e;
  background: #fefce8;
  border: 1px dashed #eab308;
  border-radius: 10px;
  padding: 6px;
}

.btn-start-play {
  width: 100%;
  height: 50px;
  border: 2px solid #15803d;
  border-radius: 16px;
  background: linear-gradient(180deg, #4ade80 0%, #16a34a 100%);
  color: #ffffff;
  font-size: 17px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 0 #166534, 0 8px 20px rgba(22, 163, 74, 0.35);
  transition: transform 0.1s, box-shadow 0.1s;
}
.btn-start-play:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #166534;
}

/* ==================== Dynamic Modals ==================== */
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.56);
  backdrop-filter: blur(3px);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  animation: fadeIn 0.16s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-sheet {
  width: 100%;
  max-height: 90%;
  background: #ffffff;
  border-radius: 22px;
  border: 2px solid rgba(21, 128, 61, 0.22);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: popUp 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 10px;
  background: linear-gradient(180deg, #f0fdf4 0%, #ffffff 100%);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 900;
  color: #14532d;
}

.modal-close-btn {
  border: none;
  background: #f1f5f9;
  color: var(--ink-soft);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-weight: 800;
  cursor: pointer;
}

.modal-body {
  padding: 12px 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-footer {
  padding: 10px 14px 14px;
  display: flex;
  gap: 8px;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
}

/* Building Selection Cards */
.lot-context-bar {
  font-size: 11.5px;
  font-weight: 700;
  color: #166534;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  padding: 6px 10px;
  border-radius: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.build-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.build-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 14px;
  border: 1.5px solid #e2e8f0;
  background: #ffffff;
  text-align: left;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.15s, background 0.15s;
}
.build-option:hover:not(:disabled) {
  border-color: #16a34a;
  background: #f0fdf4;
}
.build-option:active:not(:disabled) {
  transform: scale(0.98);
}
.build-option:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  background: #f8fafc;
}
.build-option.recommended {
  border-color: #f59e0b;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
}

.build-ico {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.build-info {
  flex: 1;
  min-width: 0;
}

.build-name-row {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.build-name {
  font-size: 13.5px;
  font-weight: 900;
  color: var(--ink);
}

.syn-tag {
  font-size: 10px;
  font-weight: 800;
  color: #ffffff;
  background: linear-gradient(135deg, #f97316, #ef4444);
  padding: 1px 6px;
  border-radius: 999px;
}

.build-desc {
  font-size: 11px;
  color: var(--ink-muted);
  line-height: 1.3;
  margin-top: 2px;
}

.build-est {
  font-size: 11px;
  font-weight: 800;
  color: #059669;
  margin-top: 2px;
}

.build-cost-col {
  flex-shrink: 0;
  text-align: right;
}

.build-cost {
  font-size: 14px;
  font-weight: 900;
  color: #b45309;
  font-variant-numeric: tabular-nums;
}

.build-buy-tag {
  font-size: 10px;
  font-weight: 800;
  color: #ffffff;
  background: #16a34a;
  padding: 2px 7px;
  border-radius: 7px;
  margin-top: 3px;
  display: inline-block;
}
.build-option:disabled .build-buy-tag {
  background: #94a3b8;
}

/* Perk / Event Choice Cards */
.choice-card {
  width: 100%;
  text-align: left;
  border: 2px solid #e2e8f0;
  border-radius: 15px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  padding: 11px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 11px;
  transition: transform 0.12s, border-color 0.15s, background 0.15s;
}
.choice-card:hover {
  border-color: #f59e0b;
  background: #fffbeb;
}
.choice-card:active {
  transform: scale(0.98);
}

.choice-icon {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.choice-title {
  font-size: 14px;
  font-weight: 900;
  color: var(--ink);
}

.choice-desc {
  font-size: 11.5px;
  color: var(--ink-soft);
  margin-top: 2px;
  line-height: 1.35;
}

/* Formula & Property Detail Box */
.formula-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px;
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.5;
}
.formula-total {
  font-size: 18px;
  font-weight: 900;
  color: #059669;
  margin-top: 4px;
}

/* Bill Payment Visual */
.bill-hero {
  text-align: center;
  padding: 8px 6px;
}
.bill-hero-ico {
  font-size: 42px;
  line-height: 1.1;
}
.bill-hero-amt {
  font-size: 30px;
  font-weight: 900;
  color: #dc2626;
  margin: 4px 0;
  font-variant-numeric: tabular-nums;
}
.bill-hero-sub {
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.4;
}

.sell-rescue-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
}

.sell-rescue-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 700;
}

/* Generic Buttons */
.btn-primary,
.btn-secondary,
.btn-danger {
  flex: 1;
  height: 42px;
  border-radius: 13px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  text-decoration: none;
  transition: transform 0.1s;
}
.btn-primary:active,
.btn-secondary:active,
.btn-danger:active {
  transform: scale(0.97);
}
.btn-primary.full {
  width: 100%;
}

.btn-primary {
  background: linear-gradient(180deg, #22c55e 0%, #16a34a 100%);
  color: #ffffff;
  box-shadow: 0 3px 0 #15803d;
}
.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-gold {
  background: linear-gradient(180deg, #fbbf24 0%, #d97706 100%);
  color: #451a03;
  box-shadow: 0 3px 0 #b45309;
}

.btn-secondary {
  background: #f1f5f9;
  color: var(--ink-soft);
  border: 1px solid #cbd5e1;
}

.btn-danger {
  background: linear-gradient(180deg, #f87171 0%, #dc2626 100%);
  color: #ffffff;
  box-shadow: 0 3px 0 #991b1b;
}

.btn-sm {
  height: 30px;
  padding: 0 10px;
  font-size: 11.5px;
  border-radius: 8px;
  flex: 0 0 auto;
}

/* Rules Sheet */
.rules-body {
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-soft);
}
.rule-block h4 {
  font-size: 13px;
  font-weight: 900;
  color: #14532d;
  margin-bottom: 4px;
}
.rule-block ul {
  padding-left: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ==================== End Screen Report ==================== */
.end-header {
  text-align: center;
}
.end-status-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 900;
  padding: 3px 12px;
  border-radius: 999px;
}
.end-status-pill.win {
  background: #dcfce7;
  color: #15803d;
}
.end-status-pill.lose {
  background: #fee2e2;
  color: #b91c1c;
}

.end-title {
  font-size: 20px;
  font-weight: 900;
  color: var(--ink);
  margin-top: 5px;
}

.rank-stamp {
  margin: 8px auto 2px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 18px;
  border-radius: 16px;
  font-size: 20px;
  font-weight: 900;
  border: 2.5px solid;
  transform: rotate(-2deg);
}
.rank-splus {
  background: linear-gradient(135deg, #fef08a 0%, #f59e0b 100%);
  color: #78350f;
  border-color: #b45309;
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.4);
}
.rank-s {
  background: linear-gradient(135deg, #ede9fe 0%, #c4b5fd 100%);
  color: #4c1d95;
  border-color: #7c3aed;
}
.rank-a {
  background: linear-gradient(135deg, #dcfce7 0%, #86efac 100%);
  color: #14532d;
  border-color: #16a34a;
}
.rank-b {
  background: #f1f5f9;
  color: #334155;
  border-color: #94a3b8;
}

.end-networth-box {
  text-align: center;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1.5px solid #fcd34d;
  border-radius: 14px;
  padding: 10px;
}
.end-nw-label {
  font-size: 11px;
  font-weight: 800;
  color: #92400e;
}
.end-nw-val {
  font-size: 30px;
  font-weight: 900;
  color: #b45309;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.new-best-badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 900;
  color: #ffffff;
  background: linear-gradient(135deg, #f97316, #dc2626);
  padding: 2px 8px;
  border-radius: 999px;
  margin-top: 3px;
}

.end-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
}

.end-stat-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 8px 10px;
}
.end-stat-k {
  font-size: 10.5px;
  color: var(--ink-muted);
  font-weight: 700;
}
.end-stat-v {
  font-size: 15px;
  font-weight: 900;
  color: var(--ink);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

.end-summary-strip {
  font-size: 11.5px;
  color: var(--ink-soft);
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 11px;
  padding: 8px 10px;
  line-height: 1.45;
}

.end-actions {
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

/* Active Perks List */
.perk-owned-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: #fefce8;
  border: 1px solid #fde047;
  border-radius: 12px;
}
.perk-owned-ico {
  font-size: 22px;
}
.perk-owned-name {
  font-size: 13px;
  font-weight: 900;
  color: #713f12;
}
.perk-owned-desc {
  font-size: 11px;
  color: #854d0e;
}

/* Compact screen adaptation (<= 700px height) */
@media (max-height: 700px) {
  .wx-bar { flex-basis: 38px; }
  .hud-panel { padding: 4px 8px; gap: 4px; }
  .hud-cash-val { font-size: 18px; }
  .hud-bill-val { font-size: 14px; }
  .controls-bar { padding: 4px 10px 8px; }
  .btn-roll { height: 48px; }
  .die-3d { width: 48px; height: 48px; padding: 6px; }
  .pip { width: 8px; height: 8px; }
  .tile-icon { font-size: 18px; }
}
