/* Real Estate Tycoon - Dark NYC Theme */
/* Designed for 9:16 portrait mobile aspect ratio */

/* ====== CSS VARIABLES ====== */
:root {
  --bg: #0A0E14;
  --bg-light: #141B25;
  --card: rgba(16, 22, 32, 0.88);
  --accent: #00C9A7;
  --accent-light: #33FFCC;
  --gold: #FFD700;
  --gold-dim: rgba(255, 215, 0, 0.3);
  --success: #4CAF50;
  --danger: #FF5252;
  --warning: #FFC107;
  --text: #FFFFFF;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --text-muted: rgba(255, 255, 255, 0.55);
  --border: rgba(0, 201, 167, 0.25);
  --glass-blur: 20px;
}

/* ====== BASE RESET ====== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

html, body {
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  justify-content: center;
  align-items: center;
}

/* HUD clearance — overlay screens start below the persistent HUD */
:root {
  --hud-clearance: calc(var(--sat, env(safe-area-inset-top, 0px)) + 76px);
}

/* ====== 9:16 ASPECT RATIO ====== */
#game-root {
  width: 100%;
  height: 100dvh;
  max-width: calc(100dvh * 9 / 16);
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--bg);
  overflow: hidden;
  margin: 0 auto;
  padding-top: var(--sat, env(safe-area-inset-top, 0px));
  padding-bottom: var(--sab, env(safe-area-inset-bottom, 0px));
}

@media (min-aspect-ratio: 9/16) {
  #game-root {
    border-left: 1px solid rgba(0, 201, 167, 0.12);
    border-right: 1px solid rgba(0, 201, 167, 0.12);
    box-shadow: 0 0 60px rgba(0, 201, 167, 0.04);
  }
}

/* ====== GLASS MORPHISM ====== */
.glass-card {
  background: var(--card);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.btn-glass {
  position: relative;
  background: rgba(0, 201, 167, 0.12);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--gold);
  font-weight: 800;
  border: 1px solid var(--gold-dim);
  border-radius: 12px;
  cursor: pointer;
  flex-shrink: 0;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: 13px;
  overflow: hidden;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
  transition: transform 0.12s, box-shadow 0.2s, background 0.2s;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  padding: 12px 20px;
}

.btn-glass::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 50%;
  background: linear-gradient(180deg, rgba(255,255,255,0.08) 0%, transparent 100%);
  pointer-events: none;
  border-radius: 11px 11px 0 0;
}

.btn-glass:active {
  transform: scale(0.96);
  background: rgba(0, 201, 167, 0.25);
}

.btn-glass:disabled {
  opacity: 0.4;
  pointer-events: none;
}

.btn-primary {
  background: rgba(0, 201, 167, 0.2);
  border-color: rgba(0, 201, 167, 0.45);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35), 0 0 24px rgba(0, 201, 167, 0.08);
}

.btn-primary:active {
  background: rgba(0, 201, 167, 0.35);
}

.btn-danger {
  background: rgba(255, 82, 82, 0.15);
  border-color: rgba(255, 82, 82, 0.35);
}

.btn-danger:active {
  background: rgba(255, 82, 82, 0.3);
}

.btn-back {
  padding: 10px 16px;
  font-size: 12px;
  min-height: 44px;
}

/* ====== UTILITY ====== */
.gradient-text {
  background: linear-gradient(135deg, var(--gold) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }

.fadeIn {
  animation: fadeIn 0.35s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.slideUp {
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.slideDown {
  animation: slideDown 0.3s ease-in forwards;
}

@keyframes slideDown {
  from { transform: translateY(0); }
  to { transform: translateY(100%); }
}

/* ====== GAME HEADER ====== */
.game-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  gap: 10px;
}

.header-spacer { flex: 1; }

.screen-title-block {
  padding: 0 20px 16px;
}

.screen-title-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.screen-title-main {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.5px;
}

/* ====== TITLE SCREEN ====== */
.title-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 20px 16px;
  text-align: center;
  background: var(--bg);
}

.title-poster {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  width: 100%;
  padding: 0 16px;
}

.title-poster-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 20px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.6),
    0 0 40px rgba(0, 201, 167, 0.12);
}

.title-buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 16px 0;
  padding-bottom: max(16px, var(--sab, env(safe-area-inset-bottom, 0px)));
  flex-shrink: 0;
}

.title-play-btn {
  width: 80%;
  padding: 16px;
  font-size: 16px;
}

.title-exit-btn {
  width: 50%;
  padding: 10px;
  font-size: 12px;
  opacity: 0.7;
}

/* ====== MAP SCREEN ====== */
.map-screen {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}

.map-container {
  flex: 1;
  position: relative;
}

/* When a full-screen panel is open, prevent the MapLibre canvas from
   intercepting touch/click events that should go to the panel buttons. */
.map-screen.pointer-blocked .map-container,
.map-screen.pointer-blocked .map-hud-top,
.map-screen.pointer-blocked .map-hud-bottom {
  pointer-events: none;
}

/* Dark theme is now native via vector tile style — no canvas filter needed */

/* ====== MAP HUD ====== */
.map-hud-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 35;
  padding: max(8px, var(--sat, env(safe-area-inset-top, 8px))) 10px 6px;
  background: linear-gradient(180deg, rgba(10, 14, 20, 0.95) 0%, rgba(10, 14, 20, 0.85) 70%, rgba(10, 14, 20, 0.6) 100%);
}

.hud-row {
  display: flex;
  justify-content: space-between;
  gap: 6px;
}

.hud-row-secondary {
  margin-top: 6px;
  justify-content: center;
}

.hud-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

.hud-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.hud-value {
  font-size: 16px;
  font-weight: 800;
  color: var(--gold);
}

.hud-date {
  font-size: 13px;
  color: var(--accent);
}

.hud-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

.hud-pill svg {
  flex-shrink: 0;
  vertical-align: middle;
}

.map-hud-bottom {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  z-index: 10;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px;
  padding-bottom: max(10px, calc(var(--sab, env(safe-area-inset-bottom, 0px)) + 10px));
  background: linear-gradient(0deg, rgba(10, 14, 20, 0.95) 0%, rgba(10, 14, 20, 0.7) 70%, transparent 100%);
}

.hud-btn {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 12px 8px;
  font-size: 11px;
  white-space: nowrap;
}

.hud-btn-icon {
  width: 44px;
  min-width: 44px;
  padding: 10px;
}

.hud-btn-icon svg {
  display: block;
}

/* Mute button — red tint when muted */
.hud-mute-btn.muted {
  border-color: rgba(220, 38, 38, 0.4);
  background: rgba(220, 38, 38, 0.15);
  color: #F87171;
}

/* Exit button — subtle red accent */
.hud-exit-btn {
  border-color: rgba(220, 38, 38, 0.25);
  color: #F87171;
}

.hud-exit-btn:active {
  background: rgba(220, 38, 38, 0.2);
  border-color: rgba(220, 38, 38, 0.5);
}

.hud-btn-main {
  flex: 1.5;
  font-size: 13px;
}

/* ====== PROPERTY DETAIL PANEL ====== */
.property-panel {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 40;
  background: rgba(10, 14, 20, 0.94);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  padding: var(--hud-clearance) 16px 0;
  padding-bottom: max(16px, calc(var(--sab, env(safe-area-inset-bottom, 0px)) + 16px));
  overflow-y: auto;
}

.panel-handle {
  display: none;
}

.panel-header { margin-bottom: 12px; }

.panel-title-row {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
}

.panel-type-badge {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  color: white;
  font-weight: 700;
}

.panel-owned-badge {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--gold);
  color: #000;
  font-weight: 800;
}

.panel-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}

.panel-neighborhood {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.panel-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.panel-stat {
  display: flex;
  flex-direction: column;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.panel-stat-label {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.panel-stat-value {
  font-size: 16px;
  font-weight: 800;
  color: var(--accent);
}

.panel-details { margin-bottom: 12px; }

.panel-detail-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.panel-detail-row span:first-child { color: var(--text-secondary); }

.mortgage-row span:last-child { color: var(--warning); }

.condition-stars {
  color: var(--gold);
  letter-spacing: 2px;
}

.panel-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.panel-close-btn {
  font-size: 11px;
  opacity: 0.7;
  padding: 8px;
}

/* ====== PURCHASE MODAL ====== */
.purchase-modal {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  padding-top: var(--hud-clearance);
}

.modal-backdrop {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
}

.modal-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 360px;
  padding: 24px;
}

.modal-title {
  font-size: 20px;
  font-weight: 800;
  text-align: center;
  margin-bottom: 4px;
}

.modal-property-name {
  text-align: center;
  color: var(--accent);
  font-size: 14px;
  margin-bottom: 16px;
}

.modal-breakdown {
  margin-bottom: 12px;
}

.modal-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.modal-total {
  font-weight: 800;
  color: var(--gold);
  border-bottom: 2px solid var(--gold-dim);
}

.modal-remaining {
  margin-top: 4px;
}

.modal-income-preview {
  display: flex;
  justify-content: space-between;
  padding: 10px;
  background: rgba(76, 175, 80, 0.08);
  border: 1px solid rgba(76, 175, 80, 0.2);
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-actions .btn-glass {
  width: 100%;
  text-align: center;
}

/* ====== PORTFOLIO SCREEN ====== */
.portfolio-screen {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background: rgba(10, 14, 20, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding-top: var(--hud-clearance);
  padding-bottom: max(20px, var(--sab, env(safe-area-inset-bottom, 0px)));
}

.portfolio-summary {
  margin: 0 16px 12px;
  padding: 14px;
}

.portfolio-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 13px;
}

.portfolio-row span:first-child {
  color: var(--text-secondary);
}

.portfolio-value {
  font-size: 18px;
  font-weight: 900;
}

.portfolio-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 6px 0;
}

.portfolio-net {
  font-weight: 700;
  font-size: 14px;
}

.portfolio-progress {
  margin: 0 16px 12px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.progress-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--gold) 100%);
  border-radius: 4px;
  transition: width 0.5s ease;
}

.portfolio-list {
  flex: 1;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.portfolio-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 14px;
}
.portfolio-empty-icon { font-size: 48px; margin-bottom: 12px; }
.portfolio-empty-title { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.portfolio-empty-desc { font-size: 13px; line-height: 1.5; color: var(--text-secondary); margin-bottom: 12px; }
.portfolio-empty-hint { font-size: 13px; color: var(--accent); font-weight: 600; }

.portfolio-card {
  padding: 12px;
  cursor: pointer;
}

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

.portfolio-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.portfolio-card-name {
  font-size: 14px;
  font-weight: 700;
  flex: 1;
  margin-right: 8px;
}

.portfolio-card-value {
  font-size: 14px;
  font-weight: 800;
  color: var(--gold);
}

.portfolio-card-details {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--text-secondary);
}

.portfolio-card-mortgage {
  font-size: 11px;
  color: var(--warning);
  margin-top: 4px;
}

/* ====== RENOVATION PANEL ====== */
.renovation-panel {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  z-index: 40;
  background: var(--card);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  padding: 12px 16px;
  padding-bottom: max(16px, calc(var(--sab, env(safe-area-inset-bottom, 0px)) + 16px));
  max-height: 75%;
  overflow-y: auto;
}

.panel-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.renovation-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.renovation-option {
  padding: 12px;
  cursor: pointer;
  transition: transform 0.12s;
}

.renovation-option:active { transform: scale(0.98); }
.renovation-option.disabled { opacity: 0.35; pointer-events: none; }

.reno-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.reno-icon { font-size: 18px; }
.reno-name { flex: 1; font-weight: 700; font-size: 14px; }
.reno-cost { font-weight: 800; color: var(--gold); font-size: 14px; }
.reno-desc { font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }

.reno-stats {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--accent);
}

/* ====== MONTHLY SUMMARY ====== */
.summary-screen {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 0 16px;
  padding-top: var(--hud-clearance);
  padding-bottom: max(20px, var(--sab, env(safe-area-inset-bottom, 0px)));
  gap: 10px;
  background: rgba(10, 14, 20, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.summary-header {
  text-align: center;
  padding: 12px 0;
}

.summary-month {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: var(--accent);
}

.summary-label {
  font-size: 24px;
  font-weight: 900;
  color: var(--gold);
}

.summary-card {
  padding: 12px;
}

.summary-section-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 13px;
}

.summary-row span:first-child { color: var(--text-secondary); }

.summary-note span { color: var(--text-muted); font-size: 12px; }

.summary-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 6px 0;
}

.summary-net {
  font-weight: 800;
  font-size: 15px;
}

.summary-networth {
  font-size: 18px;
  font-weight: 900;
}

.summary-event {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.event-icon { font-size: 16px; }
.event-text { flex: 1; color: var(--text-secondary); }
.event-impact { font-weight: 700; font-size: 12px; }

.market-update {
  text-align: center;
}

.market-update-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.summary-continue-btn {
  width: 100%;
  padding: 14px;
  font-size: 14px;
  margin-top: auto;
  flex-shrink: 0;
}

/* ====== MARKET NEWS ====== */
.market-screen {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding-top: var(--hud-clearance);
  padding-bottom: max(20px, var(--sab, env(safe-area-inset-bottom, 0px)));
  background: rgba(10, 14, 20, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.market-phase {
  margin: 0 16px 10px;
  padding: 14px;
}

.phase-header {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.phase-icon { font-size: 28px; }
.phase-name { font-size: 18px; font-weight: 800; color: var(--gold); }
.phase-desc { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

.phase-cycle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.cycle-dot {
  font-size: 14px;
  color: var(--text-muted);
  padding: 2px 4px;
}

.cycle-dot.active { color: var(--gold); font-size: 18px; }
.cycle-dot.phase-growth { color: var(--success); }
.cycle-dot.phase-peak { color: var(--gold); }
.cycle-dot.phase-decline { color: var(--warning); }
.cycle-dot.phase-recession { color: var(--danger); }
.cycle-dot.phase-recovery { color: var(--accent); }

.cycle-line {
  width: 12px;
  height: 2px;
  background: rgba(255, 255, 255, 0.15);
}

.market-rates, .market-neighborhoods {
  margin: 0 16px 10px;
  padding: 14px;
}

.market-rates h3, .market-neighborhoods h3 {
  font-size: 14px;
  margin-bottom: 8px;
  color: var(--text);
}

.rate-row, .neighborhood-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.rate-row span:first-child, .neighborhood-row span:first-child {
  color: var(--text-secondary);
}

/* ====== GAME OVER ====== */
.gameover-screen {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 40px 20px;
  padding-top: var(--hud-clearance);
  padding-bottom: max(20px, var(--sab, env(safe-area-inset-bottom, 0px)));
  background: rgba(10, 14, 20, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.gameover-header {
  text-align: center;
  margin-bottom: 24px;
}

.gameover-icon { font-size: 64px; margin-bottom: 8px; }

.gameover-title {
  font-size: 36px;
  font-weight: 900;
}

.gameover-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 6px;
}

.gameover-stats {
  width: 100%;
  padding: 16px;
  margin-bottom: 24px;
}

.gameover-stat-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13px;
}

.gameover-stat-row span:first-child {
  color: var(--text-secondary);
}

.gameover-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 8px 0;
}

.gameover-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.gameover-actions .btn-glass {
  width: 100%;
  text-align: center;
  padding: 14px;
}

/* ====== COUNTDOWN BAR ====== */
.countdown-bar-wrap {
  height: 3px;
  background: rgba(255, 255, 255, 0.06);
  margin-top: 6px;
  border-radius: 2px;
  overflow: hidden;
}

.countdown-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--gold) 100%);
  border-radius: 2px;
  transition: none; /* updated via rAF, no CSS transition */
}

/* ====== PAUSE / PLAY BUTTON ====== */
.btn-pause-play {
  width: 48px;
  min-width: 48px;
  flex: 0 0 48px !important;
  padding: 12px 0 !important;
  font-size: 18px !important;
  text-align: center;
  letter-spacing: 0 !important;
}

/* ====== SPEED PILLS ====== */
.speed-pills {
  display: flex;
  gap: 2px;
  align-items: center;
}

.speed-pill {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  padding: 8px 12px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.speed-pill.active {
  background: rgba(0, 201, 167, 0.2);
  border-color: rgba(0, 201, 167, 0.4);
  color: var(--accent);
}

.speed-pill:active {
  transform: scale(0.95);
}

/* ====== MONTH TOAST ====== */
.month-toast {
  position: absolute;
  top: calc(var(--sat, env(safe-area-inset-top, 0px)) + 82px);
  left: 12px;
  right: 12px;
  z-index: 12;
  pointer-events: none;
  animation: toastSlideIn 0.3s ease-out;
}

.month-toast .toast-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(16, 22, 32, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
}

.month-toast-positive .toast-content {
  border: 1px solid rgba(76, 175, 80, 0.4);
  box-shadow: 0 4px 16px rgba(76, 175, 80, 0.1);
}

.month-toast-negative .toast-content {
  border: 1px solid rgba(255, 82, 82, 0.4);
  box-shadow: 0 4px 16px rgba(255, 82, 82, 0.1);
}

.toast-date {
  color: var(--accent);
  font-weight: 800;
}

.toast-sep {
  color: var(--text-muted);
  font-size: 10px;
}

.toast-net {
  font-weight: 800;
}

.toast-event {
  color: var(--text-secondary);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

.month-toast-fade {
  animation: toastFadeOut 0.4s ease-in forwards;
}

@keyframes toastFadeOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-8px); }
}

/* ====== NEIGHBORHOOD UNLOCK SCREEN ====== */
.unlock-screen {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 45;
  display: flex;
  flex-direction: column;
  background: rgba(10, 14, 20, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: max(12px, var(--sat, env(safe-area-inset-top, 12px))) 16px;
  padding-bottom: max(16px, calc(var(--sab, env(safe-area-inset-bottom, 0px)) + 16px));
  overflow-y: auto;
}

.unlock-header {
  text-align: center;
  padding: 16px 0 12px;
  flex-shrink: 0;
}

.unlock-icon {
  font-size: 48px;
  margin-bottom: 8px;
}

.unlock-title {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.unlock-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  letter-spacing: 1px;
}

.unlock-counter {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  margin-top: 8px;
  letter-spacing: 1px;
}

.unlock-neighborhoods-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  flex: 1;
  padding: 8px 0 16px;
  align-content: start;
}

.unlock-card {
  padding: 12px;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s;
  border: 1px solid var(--border);
}

.unlock-card:active {
  transform: scale(0.97);
}

.unlock-card.selected {
  border-color: var(--gold);
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.2), inset 0 0 12px rgba(255, 215, 0, 0.06);
}

.unlock-card-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 6px;
}

.unlock-card-name {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}

.unlock-card-borough {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
}

.unlock-card-stats {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.unlock-stat {
  font-size: 10px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
  padding: 2px 6px;
  border-radius: 6px;
}

.unlock-card-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.3;
}

.unlock-confirm-btn {
  width: 100%;
  padding: 16px;
  font-size: 14px;
  flex-shrink: 0;
  margin-top: auto;
}

/* ====== MapLibre Overrides ====== */
.maplibregl-ctrl-attrib {
  font-size: 8px !important;
  background: rgba(0, 0, 0, 0.5) !important;
  color: rgba(255, 255, 255, 0.4) !important;
}

.maplibregl-ctrl-attrib a {
  color: rgba(255, 255, 255, 0.5) !important;
}

/* Hide default MapLibre UI */
.maplibregl-ctrl-logo { display: none !important; }

/* ====== TITLE SCREEN — CONTINUE BUTTON ====== */
.title-continue-btn {
  width: 80%;
  padding: 16px;
  font-size: 16px;
}

/* ====== HUD — INCOME INDICATOR ====== */
.hud-income {
  font-size: 10px;
  font-weight: 700;
  color: var(--success);
  margin-top: 1px;
}

/* ====== EXPAND BADGE (HUD) ====== */
.expand-badge {
  position: relative;
  background: rgba(255, 215, 0, 0.15) !important;
  border-color: rgba(255, 215, 0, 0.4) !important;
  animation: expandPulse 2s ease-in-out infinite;
}

@keyframes expandPulse {
  0%, 100% { box-shadow: 0 0 6px rgba(255, 215, 0, 0.15); }
  50% { box-shadow: 0 0 16px rgba(255, 215, 0, 0.35); }
}

/* ====== SAVE BUTTON (HUD) ====== */
.hud-save-btn {
  width: 44px;
  min-width: 44px;
  flex: 0 0 44px !important;
  padding: 10px 0 !important;
  font-size: 16px !important;
  letter-spacing: 0 !important;
}

/* ====== PORTFOLIO — FINANCIALS BUTTON ====== */
.btn-financials {
  padding: 8px 14px;
  font-size: 12px;
}

/* ====== PORTFOLIO — TENANT ROW ====== */
.portfolio-card-tenant-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}

.portfolio-card-sat {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.portfolio-sat-bar {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
}

.portfolio-sat-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s ease;
}

.portfolio-sat-pct {
  font-size: 10px;
  font-weight: 700;
  min-width: 28px;
  text-align: right;
}

.portfolio-card-stars {
  font-size: 11px;
  color: var(--gold);
  letter-spacing: 1px;
}

.portfolio-trend {
  font-size: 12px;
  margin-left: 4px;
}

/* ====== PROPERTY DETAIL — TENANT SUMMARY ====== */
.panel-tenant-summary {
  margin-bottom: 12px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.panel-tenant-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 13px;
}

.panel-tenant-label {
  color: var(--text-secondary);
}

.panel-tenant-value {
  font-weight: 700;
  color: var(--text);
}

.panel-sat-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-sat-bar {
  width: 80px;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
}

.panel-sat-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.panel-sat-pct {
  font-size: 12px;
  font-weight: 700;
}

.panel-tenant-stars {
  font-size: 14px;
  color: var(--gold);
  letter-spacing: 2px;
}

.panel-amenity-row {
  display: flex;
  gap: 4px;
  padding: 4px 0;
  flex-wrap: wrap;
}

.panel-amenity-icon {
  font-size: 14px;
  padding: 6px 8px;
  min-width: 36px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 215, 0, 0.1);
  border-radius: 8px;
}

/* ====== NEIGHBORHOOD UNLOCK — DEFER BUTTON ====== */
.unlock-btn-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
  margin-top: auto;
}

.unlock-btn-row .unlock-confirm-btn {
  margin-top: 0;
}

.unlock-defer-btn {
  width: 100%;
  padding: 12px;
  font-size: 12px;
  opacity: 0.7;
}

/* ====== MONTH TOAST — TREND ====== */
.toast-trend {
  font-size: 10px;
  margin-left: 2px;
}

/* ====== EVENT DECISION SCREEN ====== */
.event-decision-screen {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  background: rgba(10, 14, 20, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: var(--hud-clearance) 16px;
  padding-bottom: max(16px, calc(var(--sab, env(safe-area-inset-bottom, 0px)) + 16px));
  overflow-y: auto;
}

.event-decision-header {
  text-align: center;
  padding: 20px 0 16px;
  margin-bottom: 16px;
  flex-shrink: 0;
}

.event-severity-badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2px;
  color: white;
  margin-bottom: 12px;
}

.event-icon-large {
  font-size: 48px;
  margin-bottom: 8px;
}

.event-title {
  font-size: 22px;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 4px;
}

.event-property-name {
  font-size: 13px;
  color: var(--accent);
}

.event-description {
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 16px;
}

.event-choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.event-choice-card {
  padding: 14px;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.2s, box-shadow 0.2s;
}

.event-choice-card:active {
  transform: scale(0.98);
  border-color: var(--gold);
  box-shadow: 0 0 16px rgba(255, 215, 0, 0.15);
}

.choice-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.choice-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.choice-cost {
  font-size: 14px;
  font-weight: 800;
}

.choice-effect-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  background: rgba(0, 201, 167, 0.12);
  color: var(--accent);
  margin-right: 4px;
  margin-bottom: 4px;
}

.choice-risk {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.choice-cant-afford {
  font-size: 11px;
  color: var(--danger);
  font-weight: 700;
  margin-top: 4px;
}

.fadeOut {
  animation: fadeOut 0.25s ease-in forwards;
}

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

/* ====== BUY OFFER TOAST ====== */
.buy-offer-toast {
  position: absolute;
  bottom: calc(var(--sab, env(safe-area-inset-bottom, 0px)) + 80px);
  left: 10px;
  right: 10px;
  z-index: 15;
  animation: toastSlideIn 0.4s ease-out;
}

.offer-toast-content {
  padding: 14px;
}

.offer-toast-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.offer-toast-icon {
  font-size: 28px;
}

.offer-toast-info {
  display: flex;
  flex-direction: column;
}

.offer-toast-type {
  font-size: 13px;
  font-weight: 800;
  color: var(--gold);
}

.offer-toast-npc {
  font-size: 11px;
  color: var(--text-secondary);
}

.offer-toast-flavor {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
  line-height: 1.4;
}

.offer-toast-price {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}

.offer-price-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.offer-price-value {
  font-size: 18px;
  font-weight: 800;
  color: var(--gold);
}

.offer-toast-actions {
  display: flex;
  gap: 8px;
}

.offer-accept-btn {
  flex: 1;
  padding: 10px !important;
  font-size: 12px !important;
  background: rgba(76, 175, 80, 0.15) !important;
  border-color: rgba(76, 175, 80, 0.35) !important;
  color: var(--success) !important;
}

.offer-accept-btn:active {
  background: rgba(76, 175, 80, 0.3) !important;
}

.offer-decline-btn {
  flex: 1;
  padding: 10px !important;
  font-size: 12px !important;
  opacity: 0.6;
}

/* ====== BALANCE SHEET SCREEN ====== */
.balance-sheet {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding-top: var(--hud-clearance);
  padding-bottom: max(20px, var(--sab, env(safe-area-inset-bottom, 0px)));
  background: rgba(10, 14, 20, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.bs-section {
  margin: 0 16px 10px;
  padding: 14px;
}

.bs-section-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.bs-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 13px;
}

.bs-row span:first-child {
  color: var(--text-secondary);
}

.bs-row-sub {
  padding-left: 12px;
}

.bs-row-sub span:first-child {
  color: var(--text-muted);
  font-size: 12px;
}

.bs-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 6px 0;
}

.bs-total {
  font-weight: 800;
  font-size: 14px;
}

.bs-equity {
  border: 1px solid var(--gold-dim);
  background: rgba(255, 215, 0, 0.03);
}

.bs-equity-value {
  font-size: 22px;
  font-weight: 900;
}

.bs-delta {
  text-align: center;
  margin-top: 6px;
  font-size: 12px;
}

/* ====== SPARKLINE CHARTS ====== */
.sparkline-container {
  margin: 10px 0;
}

.sparkline-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.sparkline-svg {
  width: 100%;
  height: 50px;
  display: block;
}

/* ====== PORTFOLIO CHART ====== */
.portfolio-chart {
  padding: 14px 16px;
  margin: 0 16px 12px;
}
.portfolio-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.portfolio-chart-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}
.portfolio-chart-value {
  font-size: 16px;
  font-weight: 700;
}
.portfolio-chart-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

/* ====== PROPERTY VALUE CHART ====== */
.panel-value-chart {
  padding: 12px 16px;
  margin: 0 0 8px;
  background: rgba(255,255,255,0.03);
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.06);
}
.panel-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.panel-chart-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}
.panel-chart-value {
  font-size: 14px;
  font-weight: 700;
}
.panel-chart-stats {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  gap: 8px;
}
.panel-chart-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}
.panel-chart-stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.panel-chart-stat span:last-child {
  font-size: 13px;
  font-weight: 600;
}

/* ====== TENANT MANAGEMENT PANEL ====== */
.tenant-panel {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  z-index: 40;
  background: var(--card);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  padding: 12px 16px;
  padding-bottom: max(16px, calc(var(--sab, env(safe-area-inset-bottom, 0px)) + 16px));
  max-height: 80%;
  overflow-y: auto;
}

.tenant-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.tenant-stat {
  display: flex;
  flex-direction: column;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.tenant-stat-label {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.tenant-stat-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.tenant-stars {
  color: var(--gold);
  letter-spacing: 2px;
}

/* ====== SATISFACTION SECTION ====== */
.satisfaction-section {
  margin-bottom: 14px;
}

.satisfaction-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 6px;
}

.satisfaction-header span:first-child {
  color: var(--text-secondary);
}

.satisfaction-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.satisfaction-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

/* ====== RENT SECTION ====== */
.rent-section {
  margin-bottom: 14px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.rent-header {
  margin-bottom: 8px;
}

.rent-header span {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.rent-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.rent-label {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.rent-value {
  font-size: 16px;
  font-weight: 800;
  color: var(--gold);
}

.rent-slider-wrap {
  margin-bottom: 8px;
}

.rent-slider {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  outline: none;
}

.rent-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gold);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.rent-slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
}

.rent-warning {
  font-size: 11px;
  color: var(--danger);
  margin-bottom: 8px;
}

.rent-apply-btn {
  width: 100%;
  padding: 10px;
  font-size: 12px;
}

/* ====== AMENITIES SECTION ====== */
.amenities-section {
  margin-bottom: 12px;
}

.amenities-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 10px;
}

.amenities-subtitle {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 10px 0 8px;
}

.amenities-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.amenity-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 10px;
  min-height: 44px;
  border-radius: 10px;
  font-size: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  transition: transform 0.12s, border-color 0.2s;
}

.amenity-installed {
  border-color: rgba(255, 215, 0, 0.3);
  background: rgba(255, 215, 0, 0.05);
}

.amenity-chip-icon {
  font-size: 16px;
}

.amenity-chip-name {
  flex: 1;
  font-weight: 600;
  color: var(--text);
}

.amenity-chip-check {
  color: var(--success);
  font-weight: 700;
}

.amenity-chip-cost {
  font-size: 10px;
  font-weight: 700;
  color: var(--gold);
}

.amenity-available {
  cursor: pointer;
}

.amenity-available:active {
  transform: scale(0.97);
  border-color: var(--accent);
}

.amenity-disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

.no-amenities {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  padding: 8px;
}

/* ====== EVENT SIDE PANEL ====== */
.event-side-panel {
  position: absolute;
  top: calc(var(--sat, env(safe-area-inset-top, 0px)) + 100px);
  z-index: 20;
  width: min(260px, 72vw);
  pointer-events: auto;
  display: flex;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s ease;
  opacity: 0;
}

.event-side-panel-left {
  left: 0;
  transform: translateX(-100%);
  flex-direction: row;
}

.event-side-panel-right {
  right: 0;
  transform: translateX(100%);
  flex-direction: row-reverse;
}

.event-side-panel.show {
  opacity: 1;
}

.event-side-panel-left.show {
  transform: translateX(0);
}

.event-side-panel-right.show {
  transform: translateX(0);
}

.event-side-panel.hide {
  opacity: 0;
}

.event-side-panel-left.hide {
  transform: translateX(-100%);
}

.event-side-panel-right.hide {
  transform: translateX(100%);
}

.esp-severity-stripe {
  width: 4px;
  flex-shrink: 0;
  border-radius: 4px 0 0 4px;
}

.event-side-panel-right .esp-severity-stripe {
  border-radius: 0 4px 4px 0;
}

.esp-content {
  flex: 1;
  background: rgba(16, 22, 32, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  padding: 12px;
  min-width: 0;
}

.event-side-panel-left .esp-content {
  border-radius: 0 14px 14px 0;
  border-left: none;
}

.event-side-panel-right .esp-content {
  border-radius: 14px 0 0 14px;
  border-right: none;
}

.esp-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.esp-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.esp-title-block {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.esp-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.esp-property {
  font-size: 11px;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.esp-timer-bar {
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 10px;
}

.esp-timer-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--warning) 100%);
  border-radius: 2px;
  transition: none;
}

.esp-actions {
  display: flex;
  gap: 6px;
}

.esp-btn {
  flex: 1;
  padding: 8px 0 !important;
  font-size: 12px !important;
  text-align: center;
}

.esp-btn-handle {
  background: rgba(0, 201, 167, 0.15) !important;
  border-color: rgba(0, 201, 167, 0.35) !important;
  color: var(--accent) !important;
}

.esp-btn-handle:active {
  background: rgba(0, 201, 167, 0.3) !important;
}

.esp-btn-dismiss {
  opacity: 0.6;
}

/* Expanded state — choices visible */
.event-side-panel.expanded {
  width: min(300px, 80vw);
}

.esp-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.esp-choice-card {
  padding: 10px;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.2s;
}

.esp-choice-card:active {
  transform: scale(0.97);
  border-color: var(--gold);
}

.esp-choice-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.esp-choice-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.esp-choice-cost {
  font-size: 12px;
  font-weight: 800;
}

/* ====== iOS SCROLL SMOOTHNESS ====== */
.property-panel,
.portfolio-screen,
.summary-screen,
.market-screen,
.gameover-screen,
.balance-sheet,
.tenant-panel,
.renovation-panel,
.unlock-screen,
.event-decision-screen {
  -webkit-overflow-scrolling: touch;
}

/* ====== MAP LOADING SKELETON ====== */
.map-container {
  background: #0d0d1a;
}

.map-loading-skeleton {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 2;
  pointer-events: none;
}

.map-loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(0, 201, 167, 0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: mapSpin 0.8s linear infinite;
}

.map-loading-text {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

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

/* ====== ACTIVE STATES FOR HUD ELEMENTS ====== */
.hud-pill:active {
  transform: scale(0.95);
  background: rgba(255, 255, 255, 0.12);
}

.esp-btn-dismiss:active {
  transform: scale(0.96);
  opacity: 1;
}

/* ====== WILL-CHANGE HINTS ====== */
.event-side-panel {
  will-change: transform, opacity;
}

.expand-badge {
  will-change: box-shadow;
}

/* ====== SMALL SCREEN BREAKPOINT ====== */
@media (max-width: 375px) {
  .unlock-neighborhoods-grid {
    grid-template-columns: 1fr;
  }

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

  .tenant-stats-grid {
    grid-template-columns: 1fr;
  }

  .panel-stats {
    grid-template-columns: 1fr;
  }

  .hud-value {
    font-size: 14px;
  }

  .hud-label {
    font-size: 9px;
  }

  .hud-pill {
    font-size: 10px;
    padding: 3px 7px;
  }

  .map-hud-bottom {
    gap: 5px;
    padding: 8px;
  }

  .hud-btn-icon {
    width: 40px;
    min-width: 40px;
    padding: 8px;
  }
}

/* ====== MILESTONE CELEBRATION TOAST ====== */
.milestone-toast {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 60;
  text-align: center;
  pointer-events: none;
  animation: milestoneAppear 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.milestone-toast-inner {
  background: rgba(16, 22, 32, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 2px solid var(--gold);
  border-radius: 20px;
  padding: 24px 32px;
  box-shadow:
    0 0 40px rgba(255, 215, 0, 0.25),
    0 8px 32px rgba(0, 0, 0, 0.5);
}

.milestone-toast-icon {
  font-size: 48px;
  margin-bottom: 8px;
}

.milestone-toast-title {
  font-size: 20px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--gold) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
}

.milestone-toast-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
}

@keyframes milestoneAppear {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.milestone-toast-fade {
  animation: milestoneFade 0.4s ease-in forwards;
}

@keyframes milestoneFade {
  from { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  to { opacity: 0; transform: translate(-50%, -50%) scale(0.8) translateY(-20px); }
}

/* ====== PROPERTY LEGEND (MAP) ====== */
.map-legend {
  position: absolute;
  bottom: calc(var(--sab, env(safe-area-inset-bottom, 0px)) + 68px);
  left: 10px;
  z-index: 8;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 10px;
  background: rgba(10, 14, 20, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  opacity: 0.8;
  transition: opacity 0.3s;
}

.map-legend:active {
  opacity: 1;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 9px;
  color: var(--text-secondary);
  letter-spacing: 0.3px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* ====== NET WORTH TREND BADGE ====== */
.nw-trend-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 6px;
}

.nw-trend-up {
  background: rgba(76, 175, 80, 0.15);
  color: var(--success);
}

.nw-trend-down {
  background: rgba(255, 82, 82, 0.15);
  color: var(--danger);
}

/* ====== CONFIRM DIALOG (replaces browser confirm) ====== */
.confirm-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 55;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.6);
  animation: fadeIn 0.2s ease-out;
}

.confirm-card {
  width: 100%;
  max-width: 300px;
  padding: 24px;
  text-align: center;
}

.confirm-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 8px;
}

.confirm-message {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.4;
}

.confirm-actions {
  display: flex;
  gap: 8px;
}

.confirm-actions .btn-glass {
  flex: 1;
  text-align: center;
  padding: 12px;
}

/* ====== CONFETTI PARTICLES ====== */
.confetti-container {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 59;
  pointer-events: none;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  width: 8px;
  height: 12px;
  top: -20px;
  opacity: 0;
  animation: confettiFall 2.5s ease-in forwards;
}

@keyframes confettiFall {
  0% { opacity: 1; transform: translateY(0) rotate(0deg) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateY(100vh) rotate(720deg) scale(0.5); }
}

/* ====== ANIMATED NUMBER COUNTER ====== */
.counter-animate {
  transition: opacity 0.15s;
}

.counter-flash {
  animation: counterFlash 0.4s ease-out;
}

@keyframes counterFlash {
  0% { transform: scale(1); }
  30% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* ====== PROPERTY PANEL SLIDE-IN ====== */
.property-panel {
  animation: panelSlideUp 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes panelSlideUp {
  from { opacity: 0; transform: translateY(40px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ====== PULSE DOT FOR LIVE DATA ====== */
.live-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  margin-right: 4px;
  animation: livePulse 2s ease-in-out infinite;
}

@keyframes livePulse {
  0%, 100% { opacity: 0.4; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* ====== SKELETON SHIMMER (reusable) ====== */
.shimmer {
  background: linear-gradient(90deg,
    rgba(255,255,255,0.03) 0%,
    rgba(255,255,255,0.08) 50%,
    rgba(255,255,255,0.03) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
