/* ============================================
   HOME RUN — Design System v5 "Boardwalk"
   Monopoly board-game colour + luxury glass.
   Deep navy felt table, frosted glass panels,
   cream title-deed cards, gold seal moments.
   ============================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --font-display: 'Fraunces', 'Iowan Old Style', serif;
  --font-body: 'IBM Plex Sans', sans-serif;
  --font-mono: 'IBM Plex Mono', 'SF Mono', monospace;

  /* Table felt + glass */
  --color-bg: #0B241A;
  --color-surface: rgba(255, 255, 255, 0.055);
  --color-surface-2: rgba(255, 255, 255, 0.045);
  --color-surface-3: rgba(255, 255, 255, 0.09);
  --color-border: rgba(255, 255, 255, 0.13);
  --color-border-light: rgba(255, 255, 255, 0.22);
  --glass-blur: blur(16px) saturate(1.35);
  --glass-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.10);
  --glass-shadow: 0 10px 30px rgba(4, 8, 20, 0.45);

  /* Ink on glass */
  --color-text: #F1EFDF;
  --color-text-muted: #AEB8A6;
  --color-text-faint: #7D8878;

  /* Board colours */
  --color-primary: #57BE74;
  --color-primary-glow: rgba(87, 190, 116, 0.15);
  --color-primary-dark: #3E9B58;
  --color-danger: #E15B4D;
  --color-danger-glow: rgba(225, 91, 77, 0.16);
  --color-warning: #E8B33C;
  --color-warning-glow: rgba(232, 179, 60, 0.15);
  --color-info: #5BA8E0;
  --color-info-glow: rgba(91, 168, 224, 0.15);
  --color-gold: #D9B44A;
  --color-gold-glow: rgba(217, 180, 74, 0.18);
  --color-orange: #E07B39;
  --color-orange-glow: rgba(224, 123, 57, 0.15);
  --color-purple: #9B85D0;
  --color-purple-glow: rgba(155, 133, 208, 0.15);

  /* Title-deed cards (cream) */
  --deed-cream: #F5EEDD;
  --deed-cream-2: #EBE1C8;
  --deed-ink: #14352A;
  --deed-ink-muted: rgba(20, 53, 42, 0.68);
  --deed-ink-faint: rgba(20, 53, 42, 0.45);
  --deed-border: rgba(20, 53, 42, 0.22);

  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-5: 20px; --space-6: 24px; --space-8: 32px; --space-10: 40px;
  --space-12: 48px; --space-16: 64px;
  --radius-sm: 8px; --radius-md: 12px; --radius-lg: 18px; --radius-xl: 24px;
  --transition: 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
  --transition-slow: 450ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--color-text);
  background:
    radial-gradient(ellipse 90% 55% at 18% -8%, rgba(217, 180, 74, 0.07) 0%, transparent 60%),
    radial-gradient(ellipse 80% 50% at 88% 108%, rgba(87, 190, 116, 0.06) 0%, transparent 60%),
    var(--color-bg);
  background-attachment: fixed;
  line-height: 1.5;
  overflow-x: hidden;
}
#app { max-width: 960px; margin: 0 auto; padding: var(--space-4); min-height: 100dvh; }

/* Custom icons */
.hr-icon { width: 1.15em; height: 1.15em; display: inline-block; vertical-align: -0.2em; }

/* Sound toggle — floats over every screen */
.sound-toggle {
  position: fixed; top: 14px; right: 14px; z-index: 150;
  width: 42px; height: 42px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--color-surface-3);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--color-border);
  box-shadow: var(--glass-highlight), 0 4px 14px rgba(4, 8, 20, 0.4);
  color: var(--color-text); cursor: pointer;
  transition: transform var(--transition), border-color var(--transition), color var(--transition);
}
.sound-toggle .hr-icon { width: 20px; height: 20px; vertical-align: 0; }
.sound-toggle:hover { border-color: var(--color-gold); color: var(--color-gold); transform: scale(1.06); }
.sound-toggle:active { transform: scale(0.94); }

/* === Reusable === */
.panel {
  background: var(--color-surface);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--glass-highlight), var(--glass-shadow);
}
.panel-glow-green { border-top: 3px solid var(--color-primary); }
.panel-glow-red { border-top: 3px solid var(--color-danger); }
.panel-glow-amber { border-top: 3px solid var(--color-warning); }

.heading-xl { font-family: var(--font-display); font-weight: 700; font-optical-sizing: auto; font-size: clamp(2rem, 1.2rem + 2.5vw, 3.2rem); line-height: 1.05; letter-spacing: -0.01em; }
.heading-lg { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.25rem, 1rem + 1vw, 1.75rem); line-height: 1.2; }
.heading-md { font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; line-height: 1.3; }
.heading-sm { font-family: var(--font-display); font-style: italic; font-weight: 500; font-size: 0.85rem; color: var(--color-text-muted); }

.label { font-family: var(--font-display); font-style: italic; font-size: 13px; color: var(--color-text-muted); font-weight: 400; }
.value { font-family: var(--font-mono); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums lining-nums; }
.value-lg { font-family: var(--font-mono); font-size: 1.4rem; font-weight: 600; font-variant-numeric: tabular-nums lining-nums; }
.value-xl { font-family: var(--font-mono); font-size: clamp(1.7rem, 1.1rem + 2vw, 2.4rem); font-weight: 600; font-variant-numeric: tabular-nums lining-nums; }

.text-green { color: var(--color-primary); }
.text-red { color: var(--color-danger); }
.text-amber { color: var(--color-warning); }
.text-blue { color: var(--color-info); }
.text-gold { color: var(--color-gold); }
.text-muted { color: var(--color-text-muted); }
.text-faint { color: var(--color-text-faint); }

/* Buttons — glossy, tactile, board-piece weight */
.btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  padding: var(--space-3) var(--space-5); border-radius: var(--radius-sm);
  font-family: var(--font-body); font-weight: 600; font-size: 14px;
  border: 1px solid transparent; cursor: pointer; white-space: nowrap;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition), border-color var(--transition);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 4px 12px rgba(4, 8, 20, 0.35);
}
.btn::after {
  content: ''; position: absolute; top: 0; bottom: 0; left: -80%; width: 50%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.28), transparent);
  transform: skewX(-20deg); transition: left 500ms ease; pointer-events: none;
}
.btn:hover::after { left: 130%; }
.btn:active { transform: translateY(1px) scale(0.98); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 2px 6px rgba(4, 8, 20, 0.3); }
.btn-primary { background: var(--color-gold); color: #14231A; border-color: #B39238; }
.btn-primary:hover { background: #C6A33F; }
.btn-danger { background: var(--color-danger); color: #FFFFFF; border-color: #B94437; }
.btn-danger:hover { background: #C94A3D; }
.btn-cream { background: var(--deed-cream); color: var(--deed-ink); border-color: var(--deed-border); }
.btn-cream:hover { background: var(--deed-cream-2); }
.btn-outline { background: transparent; border: 1px solid var(--color-border-light); color: var(--color-text); box-shadow: none; }
.btn-outline:hover { background: var(--color-surface-3); border-color: var(--color-text-muted); }
.btn-ghost { background: transparent; color: var(--color-text-muted); padding: var(--space-2) var(--space-3); box-shadow: none; }
.btn-ghost::after { display: none; }
.btn-ghost:hover { color: var(--color-text); background: var(--color-surface-3); }
.btn-lg { padding: var(--space-4) var(--space-8); font-size: 16px; border-radius: var(--radius-md); }
.btn-sm { padding: var(--space-2) var(--space-3); font-size: 13px; }
.btn-block { width: 100%; }
.btn-cta {
  font-family: var(--font-display); font-weight: 700; font-size: 17px;
  padding: var(--space-4) var(--space-8);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 0 0 3px rgba(217, 180, 74, 0.22), 0 6px 18px rgba(4, 12, 8, 0.45);
}
.btn-cta:hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 0 0 5px rgba(217, 180, 74, 0.3), 0 8px 22px rgba(4, 12, 8, 0.5); transform: translateY(-1px); }
.btn-cta:active { transform: translateY(1px) scale(0.98); }
.btn:disabled, .btn-disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

/* Inputs */
.input { padding: var(--space-3) var(--space-4); background: var(--color-surface-3); border: 1px solid var(--color-border); border-radius: var(--radius-sm); color: var(--color-text); font-family: var(--font-mono); font-size: 15px; font-variant-numeric: tabular-nums; transition: border-color var(--transition); width: 100%; }
.input:focus { outline: none; border-color: var(--color-gold); }

/* Slider — gold token thumb */
.slider {
  -webkit-appearance: none; appearance: none; width: 100%; height: 6px;
  background: var(--color-surface-3); border-radius: 3px; outline: none;
  border: 1px solid var(--color-border);
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%;
  background: var(--color-gold); cursor: pointer;
  border: 2px solid #0E1830;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 2px 8px rgba(4, 8, 20, 0.5);
  transition: transform var(--transition);
}
.slider::-webkit-slider-thumb:hover { transform: scale(1.12); }
.slider::-webkit-slider-thumb:active { transform: scale(1.02); }
.slider::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--color-gold); cursor: pointer;
  border: 2px solid #0E1830;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 2px 8px rgba(4, 8, 20, 0.5);
}

/* Progress bar */
.progress-bar { width: 100%; height: 9px; background: var(--color-surface-3); border-radius: 5px; overflow: hidden; border: 1px solid var(--color-border); }
.progress-fill { height: 100%; border-radius: 5px; transition: width 800ms cubic-bezier(0.2, 0.8, 0.2, 1); }

/* Stat grid */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: var(--space-2); }
.stat-card {
  background: var(--color-surface-2);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md); padding: var(--space-3) var(--space-4);
  display: flex; flex-direction: column; gap: var(--space-1);
  box-shadow: var(--glass-highlight);
  transition: border-color var(--transition), background var(--transition);
}
.stat-card:hover { border-color: var(--color-border-light); background: var(--color-surface-3); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }

.stack { display: flex; flex-direction: column; }
.gap-1 { gap: var(--space-1); } .gap-2 { gap: var(--space-2); } .gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); } .gap-6 { gap: var(--space-6); } .gap-8 { gap: var(--space-8); }
.row { display: flex; align-items: center; }
.row-between { display: flex; justify-content: space-between; align-items: center; }
.flex-1 { flex: 1; }
.divider { height: 1px; background: var(--color-border); margin: var(--space-4) 0; }

.badge { display: inline-flex; align-items: center; gap: var(--space-1); padding: 3px var(--space-2); border-radius: 6px; font-size: 12px; font-weight: 600; border: 1px solid currentColor; }
.badge-green { background: var(--color-primary-glow); color: #7FD698; }
.badge-red { background: var(--color-danger-glow); color: #F0968B; }
.badge-amber { background: var(--color-warning-glow); color: #F0CB74; }
.badge-blue { background: var(--color-info-glow); color: #93C6EC; }

.tip { font-family: var(--font-display); font-size: 12.5px; color: var(--color-text-faint); font-style: italic; }
.subtitle { font-size: 15px; color: var(--color-text-muted); max-width: 480px; }
.disclaimer-note { font-size: 11.5px; color: var(--color-text-faint); line-height: 1.55; text-align: center; margin: var(--space-2) auto 0; }

/* ============================================
   PHASE SCREENS
   ============================================ */
.phase-screen { min-height: 100dvh; display: flex; flex-direction: column; gap: var(--space-6); padding: var(--space-6) 0; }
.phase-hero { text-align: center; display: flex; flex-direction: column; align-items: center; gap: var(--space-4); }
.hero-icon {
  width: 80px; height: 80px; display: flex; align-items: center; justify-content: center;
  background: var(--color-gold-glow); border: 2px solid var(--color-gold); border-radius: 50%;
  font-size: 36px; position: relative; transform: rotate(-6deg);
  box-shadow: 0 0 0 6px rgba(212, 175, 55, 0.08), var(--glass-shadow);
  animation: sealStamp 550ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.hero-icon::before { content: ''; position: absolute; inset: 5px; border: 1px solid rgba(212, 175, 55, 0.5); border-radius: 50%; }
@keyframes sealStamp {
  0% { transform: rotate(-6deg) scale(1.7); opacity: 0; }
  100% { transform: rotate(-6deg) scale(1); opacity: 1; }
}
.phase-header { display: flex; flex-direction: column; gap: var(--space-2); border-bottom: 1px solid var(--color-border); padding-bottom: var(--space-4); }
.phase-content { display: flex; flex-direction: column; gap: var(--space-3); }
.result-panel {
  background: var(--color-surface);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  box-shadow: var(--glass-highlight), var(--glass-shadow);
}

/* Chat log */
.chat-log { max-height: 240px; overflow-y: auto; display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-3) 0; margin-bottom: var(--space-4); scrollbar-width: thin; scrollbar-color: var(--color-border) transparent; }
.chat-bubble { padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); max-width: 85%; animation: slideUp 300ms ease; border: 1px solid var(--color-border); }
.chat-bubble.you { background: var(--color-primary-glow); border-color: rgba(63, 163, 90, 0.35); align-self: flex-end; border-bottom-right-radius: 4px; }
.chat-bubble.seller { background: var(--color-surface-3); align-self: flex-start; border-bottom-left-radius: 4px; }
.chat-who { font-family: var(--font-display); font-style: italic; font-size: 12px; font-weight: 500; color: var(--color-text-muted); margin-bottom: 2px; }
.chat-text { font-size: 14px; line-height: 1.5; }
@keyframes slideUp { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.negotiation-controls { display: flex; flex-direction: column; gap: var(--space-3); }

/* Bank cards */
.bank-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-3); }
.bank-card { background: var(--color-surface-2); border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: var(--space-4); cursor: pointer; transition: border-color var(--transition); display: flex; flex-direction: column; gap: var(--space-2); }
.bank-card:hover { border-color: var(--color-border-light); }
@media (max-width: 640px) { .bank-grid { grid-template-columns: 1fr; } }

/* Budget */
.budget-bar-container { padding: var(--space-3) 0; }
.budget-bar { height: 24px; background: var(--color-surface-3); border-radius: 12px; border: 1px solid var(--color-border); display: flex; overflow: hidden; gap: 2px; }
.budget-seg { height: 100%; min-width: 2px; transition: width 500ms cubic-bezier(0.2, 0.8, 0.2, 1); }
.budget-seg-deposit { background: var(--color-primary); }
.budget-seg-legal { background: var(--color-warning); }
.budget-seg-extras { background: var(--color-info); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }
.dot-deposit { background: var(--color-primary); }
.dot-legal { background: var(--color-warning); }
.dot-extras { background: var(--color-info); }
.dot-remaining { background: var(--color-text-faint); }
.dot-overflow { background: var(--color-danger); }

.extras-grid { display: flex; flex-direction: column; gap: var(--space-2); }
.warning-banner { background: var(--color-danger-glow); border: 1px solid rgba(225, 91, 77, 0.4); border-left-width: 3px; border-radius: var(--radius-sm); padding: var(--space-3) var(--space-4); font-size: 14px; font-weight: 500; color: #F0968B; }
.warning-banner.warning-amber { background: var(--color-warning-glow); border-color: rgba(232, 179, 60, 0.4); color: #F0CB74; }
.warning-banner.warning-red { background: var(--color-danger-glow); border-color: rgba(225, 91, 77, 0.4); color: #F0968B; }

/* ============================================
   GAME SCREEN
   ============================================ */
.game-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--space-3) 0; border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-4);
}
.game-header .logo {
  font-family: var(--font-display); font-weight: 700; font-size: 1.2rem;
  color: var(--color-text); display: flex; align-items: center; gap: var(--space-2);
}
.game-header .logo .hr-icon { color: var(--color-gold); width: 1.3em; height: 1.3em; }
.month-badge {
  padding: var(--space-1) var(--space-3); background: var(--color-surface-3);
  border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  font-family: var(--font-mono); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums;
}

.game-top-grid { display: grid; grid-template-columns: 1fr 120px; gap: var(--space-4); margin-bottom: var(--space-4); align-items: stretch; }
@media (max-width: 640px) { .game-top-grid { grid-template-columns: 1fr 100px; gap: var(--space-3); } }

.balance-display { text-align: center; padding: var(--space-5) var(--space-4); display: flex; flex-direction: column; justify-content: center; }
.balance-label { font-family: var(--font-display); font-style: italic; font-size: 13px; color: var(--color-text-muted); font-weight: 400; margin-bottom: var(--space-2); }
.balance-amount { font-family: var(--font-mono); font-weight: 600; font-size: clamp(1.4rem, 1rem + 3vw, 2.3rem); font-variant-numeric: tabular-nums lining-nums; line-height: 1; margin-bottom: var(--space-3); }

/* === UNDERWATER METER === */
.underwater-meter { display: flex; flex-direction: column; gap: var(--space-2); }
.underwater-header { display: flex; flex-direction: column; gap: 2px; }
.underwater-header .label { font-size: 11px; white-space: nowrap; }
.underwater-header .value { font-size: 11px; }
.underwater-bar {
  position: relative; flex: 1; min-height: 160px;
  background: var(--color-surface-2);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md); overflow: hidden;
  box-shadow: var(--glass-highlight);
}
.underwater-water {
  position: absolute; bottom: 0; left: 0; right: 0;
  transition: height 1000ms cubic-bezier(0.2, 0.8, 0.2, 1), background 500ms ease;
  opacity: 0.4;
}
.underwater-waves {
  position: absolute; top: -3px; left: 0; right: 0; height: 6px;
  background: repeating-linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2) 10px, transparent 20px);
  animation: waveMove 3s linear infinite;
}
@keyframes waveMove { 0% { transform: translateX(0); } 100% { transform: translateX(20px); } }
.underwater-person {
  position: absolute; left: 50%; transform: translateX(-50%) translateY(50%);
  font-size: 24px; transition: bottom 1000ms cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: 2;
}
.underwater-marks { position: absolute; inset: 0; }
.mark-line { position: absolute; left: 0; right: 0; height: 1px; background: var(--color-border); }

/* Costs details */
.costs-details {
  background: var(--color-surface);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: 0 var(--space-4);
  box-shadow: var(--glass-highlight);
}
.costs-details[open] { padding-bottom: var(--space-4); }
.costs-details summary { list-style: none; }
.costs-details summary::-webkit-details-marker { display: none; }

/* Action panel */
.action-panel {
  background: var(--color-surface);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--color-border); border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--glass-highlight), var(--glass-shadow);
}
.action-tabs { display: flex; border-bottom: 1px solid var(--color-border); }
.action-tab {
  flex: 1; padding: var(--space-3); text-align: center; font-size: 13px; font-weight: 600;
  color: var(--color-text-muted); cursor: pointer; background: none; border: none;
  border-bottom: 2px solid transparent; transition: color var(--transition), border-color var(--transition), background var(--transition);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.action-tab .hr-icon { width: 16px; height: 16px; }
.action-tab:hover { color: var(--color-text); background: var(--color-surface-2); }
.action-tab.active { color: var(--color-gold); border-bottom-color: var(--color-gold); }
.action-content { padding: var(--space-5); }

/* Timeline */
.timeline { max-height: 300px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--color-border) transparent; }
.timeline-item { display: flex; gap: var(--space-3); padding: var(--space-3) 0; border-bottom: 1px solid var(--color-border); font-size: 13px; align-items: flex-start; }
.timeline-item:last-child { border-bottom: none; }
.timeline-month { font-family: var(--font-mono); font-weight: 600; min-width: 55px; color: var(--color-text-muted); font-variant-numeric: tabular-nums; }
.timeline-text { flex: 1; }
.timeline-amount { font-family: var(--font-mono); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Event overlay — title-deed cards */
.event-overlay { position: fixed; inset: 0; background: rgba(6, 10, 22, 0.7); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; z-index: 100; animation: fadeIn 250ms ease; padding: var(--space-4); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.event-card {
  background: var(--deed-cream); color: var(--deed-ink);
  border: 1px solid var(--deed-border); border-top: 10px solid var(--color-gold);
  border-radius: var(--radius-md); padding: var(--space-6);
  max-width: 480px; width: 100%; text-align: center;
  box-shadow: 0 24px 60px rgba(4, 8, 20, 0.6);
  animation: dealCard 380ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.event-card:has(.event-icon.good) { border-top-color: var(--color-primary); }
.event-card:has(.event-icon.bad) { border-top-color: var(--color-danger); }
.event-card:has(.event-icon.neutral) { border-top-color: var(--color-warning); }
@keyframes dealCard { from { transform: translateY(24px) rotate(-1.5deg) scale(0.96); opacity: 0; } to { transform: translateY(0) rotate(0) scale(1); opacity: 1; } }
.event-icon { width: 56px; height: 56px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; font-size: 28px; margin-bottom: var(--space-3); border: 2px solid; background: rgba(27, 42, 74, 0.05); }
.event-icon.bad { border-color: var(--color-danger); }
.event-icon.good { border-color: var(--color-primary); }
.event-icon.neutral { border-color: var(--color-warning); }
.event-title { font-family: var(--font-display); font-weight: 600; font-size: 1.25rem; margin-bottom: var(--space-2); color: var(--deed-ink); }
.event-desc { color: var(--deed-ink-muted); font-size: 14px; margin-bottom: var(--space-3); line-height: 1.6; }
.event-impact { padding: var(--space-3) var(--space-4); background: var(--deed-cream-2); border: 1px solid var(--deed-border); border-radius: var(--radius-sm); font-family: var(--font-mono); font-weight: 600; font-size: 14px; margin-bottom: var(--space-4); display: inline-block; white-space: pre-line; color: var(--deed-ink); }
.event-choices { display: flex; flex-direction: column; gap: var(--space-2); }
.event-card .text-green { color: #27724A; }
.event-card .text-red { color: #C24437; }
.event-card .text-amber { color: #A87B18; }
.event-card .label, .event-card .heading-sm { color: var(--deed-ink-muted); }
.event-card .text-muted { color: var(--deed-ink-muted); }
.event-card .btn-outline { border-color: rgba(20, 53, 42, 0.35); color: var(--deed-ink); }
.event-card .btn-outline:hover { background: var(--deed-cream-2); border-color: var(--deed-ink); }
.event-card .btn-ghost { color: var(--deed-ink-muted); }
.event-card .btn-ghost:hover { color: var(--deed-ink); background: var(--deed-cream-2); }

/* Decision buttons — title-deed tiles */
.decision-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-3); }
@media (max-width: 640px) { .decision-grid { grid-template-columns: 1fr; } }

.decision-btn {
  display: flex; flex-direction: column; align-items: center; gap: var(--space-1);
  padding: var(--space-4) var(--space-3);
  background: var(--deed-cream); color: var(--deed-ink);
  border: 1px solid var(--deed-border); border-top: 7px solid var(--deed-ink);
  border-radius: var(--radius-sm);
  cursor: pointer; text-align: center; position: relative; min-height: 92px;
  font-family: var(--font-body);
  box-shadow: 0 3px 10px rgba(4, 8, 20, 0.3);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.decision-btn:hover { transform: translateY(-3px) rotate(-0.4deg); box-shadow: 0 10px 22px rgba(4, 8, 20, 0.4); }
.decision-btn:active { transform: translateY(0) scale(0.98); }
.decision-btn.chosen { border-top-color: var(--color-primary); box-shadow: 0 0 0 2px var(--color-primary), 0 8px 18px rgba(4, 8, 20, 0.4); }
.decision-icon { font-size: 24px; margin-bottom: 2px; }
.decision-label { font-size: 14px; font-weight: 600; line-height: 1.3; }
.decision-check {
  font-family: var(--font-display); font-style: italic; font-size: 12px; font-weight: 700; color: #27724A;
  margin-top: 2px; border: 1.5px solid #27724A; border-radius: 6px;
  padding: 1px 7px; transform: rotate(-3deg); display: inline-block;
}
.decision-hint { font-size: 11px; color: var(--deed-ink-faint); margin-top: 2px; }

/* Year-end summary card (rides on .event-card cream) */
.year-end-card { max-width: 520px; max-height: 85vh; overflow-y: auto; }
.year-end-results { display: flex; flex-direction: column; gap: var(--space-3); margin: var(--space-4) 0; text-align: left; }
.year-end-item {
  background: var(--deed-cream-2); border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4); border-left: 3px solid var(--deed-border);
  animation: slideUp 300ms ease; color: var(--deed-ink);
}
.year-end-item.positive { border-left-color: var(--color-primary); }
.year-end-item.negative { border-left-color: var(--color-danger); }
.year-end-item-header { display: flex; justify-content: space-between; align-items: center; font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.year-end-item-desc { font-size: 13px; color: var(--deed-ink-muted); line-height: 1.5; margin-bottom: 4px; }
.year-end-item-impact { font-family: var(--font-mono); font-size: 13px; font-weight: 600; }
.year-end-net {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--space-3) var(--space-4); background: var(--deed-cream-2);
  border-radius: var(--radius-sm); margin-bottom: var(--space-4);
  font-weight: 600; font-size: 15px; color: var(--deed-ink);
  border: 1px solid var(--deed-border);
}
.year-end-net.positive { border-color: var(--color-primary); }
.year-end-net.negative { border-color: var(--color-danger); }

/* Timer ring */
.timed-overlay .event-card { border-top-color: var(--color-warning); }
.timed-card { position: relative; }
.timer-ring-wrapper { width: 72px; height: 72px; margin: 0 auto var(--space-3); position: relative; display: flex; align-items: center; justify-content: center; }
.timer-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer-bg { fill: none; stroke: var(--deed-cream-2); stroke-width: 6; }
.timer-progress { fill: none; stroke: var(--color-warning); stroke-width: 6; stroke-linecap: round; transition: stroke-dashoffset 100ms linear, stroke 200ms ease; }
.timer-text { position: absolute; z-index: 1; font-family: var(--font-mono); font-weight: 700; font-size: 1.2rem; color: #A87B18; }
.timer-text.urgent { color: #C24437; animation: pulse 500ms infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }
.timed-choices .btn { animation: slideUp 250ms ease; }

/* Victory / Game over */
.victory-screen, .gameover-screen { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: var(--space-6); padding: var(--space-8) var(--space-4); }
.victory-icon, .gameover-icon { width: 88px; height: 88px; display: flex; align-items: center; justify-content: center; border-radius: 50%; font-size: 42px; border: 2px solid; transform: rotate(-4deg); box-shadow: var(--glass-shadow); }
.victory-icon { background: var(--color-gold-glow); border-color: var(--color-gold); }
.gameover-icon { background: var(--color-danger-glow); border-color: var(--color-danger); }
.score-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-2); max-width: 420px; width: 100%; }
.score-item {
  background: var(--color-surface-2);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--color-border); border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4); text-align: left;
  box-shadow: var(--glass-highlight);
}
@media (max-width: 480px) { .score-grid { grid-template-columns: 1fr; } }

/* Score report (why you scored X) */
.score-report {
  background: var(--color-surface);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--glass-highlight), var(--glass-shadow);
}
.score-lines { display: flex; flex-direction: column; }
.score-line { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-3); font-size: 13.5px; padding: 7px 0; border-bottom: 1px dashed var(--color-border); color: var(--color-text-muted); }
.score-line:last-child { border-bottom: none; }
.score-line-pts { font-family: var(--font-mono); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.score-line.plus .score-line-pts { color: var(--color-primary); }
.score-line.minus .score-line-pts { color: var(--color-danger); }
.score-line.base { color: var(--color-text); }
.score-line.penalty .score-line-pts { color: var(--color-danger); }
.score-line.total { border-top: 1px solid var(--color-border-light); margin-top: var(--space-1); padding-top: var(--space-3); color: var(--color-text); font-weight: 600; }
.score-line.total .score-line-pts { color: var(--color-gold); font-size: 15px; }
.coach-list { display: flex; flex-direction: column; gap: var(--space-2); }
.coach-item { font-size: 13.5px; line-height: 1.55; color: var(--color-text-muted); padding: var(--space-2) var(--space-3); border-left: 3px solid var(--color-border); border-radius: 0; background: var(--color-surface-2); }
.coach-good .coach-item { border-left-color: var(--color-primary); }
.coach-improve .coach-item { border-left-color: var(--color-warning); }

/* Bank negotiation grid */
.bank-negotiate-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-3); }
@media (max-width: 640px) { .bank-negotiate-grid { grid-template-columns: 1fr; } }
.bank-neg-card { background: var(--color-surface-2); border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: var(--space-3); transition: border-color var(--transition); box-shadow: var(--glass-highlight); }
.bank-neg-card.declined { opacity: 0.45; border-style: dashed; }
.bank-neg-card.accepted { border-color: var(--color-primary); background: var(--color-primary-glow); }
.bank-neg-header { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-2); }
.bank-neg-icon { font-size: 20px; }
.bank-neg-name { font-family: var(--font-display); font-weight: 600; font-size: 14px; }

/* Category/tier selection */
.category-grid { display: flex; flex-direction: column; gap: var(--space-3); }
.category-card { background: var(--color-surface-2); border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: var(--space-3); box-shadow: var(--glass-highlight); }
.category-header { display: flex; justify-content: space-between; align-items: center; font-size: 14px; font-weight: 600; margin-bottom: var(--space-2); }
.tier-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: var(--space-2); }
.tier-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: var(--space-2); background: var(--color-surface-3);
  border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  cursor: pointer; transition: border-color var(--transition), background var(--transition), transform var(--transition);
  font-family: var(--font-body); color: var(--color-text); text-align: center;
}
.tier-btn:hover { border-color: var(--color-info); transform: translateY(-1px); }
.tier-btn:active { transform: translateY(0) scale(0.97); }
.tier-btn.active { border-color: var(--color-info); background: var(--color-info-glow); }
.tier-label { font-size: 12px; font-weight: 600; }
.tier-cost { font-family: var(--font-mono); font-size: 11px; color: var(--color-text-muted); font-variant-numeric: tabular-nums; }

/* Money moves (merged Banking controls) */
.money-move-panel { background: var(--color-surface-2); box-shadow: var(--glass-highlight); }

/* Bailout panel */
.bailout-panel { background: var(--color-danger-glow); border: 1px solid rgba(225, 91, 77, 0.4); border-left-width: 3px; border-radius: var(--radius-sm); padding: var(--space-4); }

/* Slider group */
.slider-group { display: flex; flex-direction: column; gap: var(--space-1); }
.slider-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 2px; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border-light); border-radius: 3px; }

/* Mobile */
@media (max-width: 640px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .action-tab { font-size: 11px; padding: var(--space-2); }
  .event-card { padding: var(--space-4); }
  .decision-btn { padding: var(--space-3) var(--space-2); min-height: 80px; }
}

#confetti-canvas { position: fixed; inset: 0; pointer-events: none; z-index: 200; }

/* ============================================
   BRANDING / MISC
   ============================================ */
.bankerx-presents {
  font-family: var(--font-display); font-style: italic;
  font-size: 13px; font-weight: 500;
  color: var(--color-gold);
  margin-bottom: var(--space-1);
}

.powered-by-footer {
  font-size: 12px; color: var(--color-text-faint);
  margin-top: var(--space-6); padding-top: var(--space-3);
  border-top: 1px dashed var(--color-border);
}
.powered-by-footer a { color: var(--color-text-muted); text-decoration: underline; text-decoration-color: var(--color-border); text-underline-offset: 2px; transition: color var(--transition); }
.powered-by-footer a:hover { color: var(--color-gold); }

.bankerx-signup { text-align: center; padding: var(--space-3) 0; }
.bankerx-signup a {
  display: inline-flex; align-items: center; gap: var(--space-2);
  font-size: 13px; font-weight: 600; color: var(--color-text-muted);
  text-decoration: none; padding: var(--space-2) var(--space-4);
  border: 1px dashed var(--color-border-light); border-radius: var(--radius-sm);
  transition: color var(--transition), border-color var(--transition);
  background: var(--color-surface-2);
}
.bankerx-signup a:hover { color: var(--color-gold); border-color: var(--color-gold); }
.bankerx-glow a { color: var(--color-gold); border-color: var(--color-gold); border-style: solid; font-size: 14px; padding: var(--space-3) var(--space-5); }

/* Community feed */
.whatsapp-feed {
  margin-top: var(--space-4);
  background: var(--color-surface-2);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--color-border); border-radius: var(--radius-md);
  padding: var(--space-3); max-height: 180px; overflow-y: auto;
  box-shadow: var(--glass-highlight);
}
.whatsapp-header { font-family: var(--font-display); font-style: italic; font-size: 13px; font-weight: 500; color: var(--color-text-muted); margin-bottom: var(--space-2); padding-bottom: var(--space-2); border-bottom: 1px dashed var(--color-border); }
.whatsapp-msg { padding: var(--space-2) 0; font-size: 13px; line-height: 1.5; border-bottom: 1px dashed var(--color-border); animation: slideUp 300ms ease; }
.whatsapp-msg:last-child { border-bottom: none; }
.whatsapp-name { font-weight: 700; color: var(--color-primary); margin-right: var(--space-1); }
.whatsapp-text { color: var(--color-text-muted); }

/* Amortization breakdown */
.amort-breakdown { display: flex; align-items: center; justify-content: center; gap: var(--space-2); margin-top: var(--space-3); padding-top: var(--space-3); border-top: 1px dashed var(--color-border); font-size: 13px; }
.amort-item { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.amort-item .value { font-family: var(--font-mono); }
.amort-item .label { font-size: 11px; color: var(--color-text-faint); }
.amort-divider { color: var(--color-text-faint); font-size: 16px; }

/* Investment grid */
.investment-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--space-2); }
.invest-btn {
  display: flex; flex-direction: column; align-items: center; gap: var(--space-1);
  padding: var(--space-3); background: var(--color-surface-3);
  border: 1px solid var(--color-border); border-radius: var(--radius-md);
  cursor: pointer; transition: border-color var(--transition), background var(--transition), transform var(--transition);
  font-family: var(--font-body); color: var(--color-text); text-align: center;
}
.invest-btn:hover { border-color: var(--color-gold); background: var(--color-gold-glow); transform: translateY(-2px); }
.invest-btn:active { transform: translateY(0) scale(0.97); }
.invest-icon { font-size: 24px; }
.invest-name { font-size: 12px; font-weight: 700; line-height: 1.3; }
.invest-detail { font-size: 11px; color: var(--color-text-muted); line-height: 1.4; }
.invest-meta { font-size: 10px; color: var(--color-text-faint); margin-top: 2px; }

/* Score rating ring — gold medallion */
.score-rating-ring {
  width: 148px; height: 148px; border-radius: 50%;
  border: 4px double var(--score-color, var(--color-gold));
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  margin: var(--space-4) auto; position: relative;
  background: var(--color-surface);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-highlight), 0 0 0 8px rgba(255, 255, 255, 0.04), var(--glass-shadow);
}
.score-ring-value { font-family: var(--font-mono); font-weight: 700; font-size: 2.4rem; line-height: 1; color: var(--score-color, var(--color-gold)); }
.score-ring-label { font-size: 14px; color: var(--color-text-muted); font-weight: 600; margin-top: -2px; }
.score-ring-rating { font-family: var(--font-display); font-style: italic; font-size: 13px; font-weight: 500; margin-top: var(--space-1); }

/* Leaderboard / benchmarks */
.leaderboard { display: flex; flex-direction: column; gap: var(--space-2); }
.leaderboard-row {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  font-size: 14px; border-left: 3px solid transparent;
  box-shadow: var(--glass-highlight);
}
.leaderboard-row.is-player { border-left-color: var(--color-gold); border-color: rgba(212, 175, 55, 0.45); background: var(--color-gold-glow); }
.leaderboard-rank { font-family: var(--font-mono); font-weight: 700; color: var(--color-text-muted); min-width: 28px; }
.leaderboard-row.is-player .leaderboard-rank { color: var(--color-gold); }
.leaderboard-name { flex: 1; font-weight: 600; }
.leaderboard-score { font-family: var(--font-mono); font-weight: 700; font-variant-numeric: tabular-nums; color: var(--color-text-muted); }
.leaderboard-row.is-player .leaderboard-score { color: var(--color-gold); }
.leaderboard-years { font-family: var(--font-mono); font-size: 12px; color: var(--color-text-faint); min-width: 32px; text-align: right; }

/* Decision review */
.decision-review { display: flex; flex-direction: column; gap: var(--space-2); }
.decision-review-summary { display: flex; justify-content: center; gap: var(--space-4); font-size: 14px; font-weight: 600; padding: var(--space-2) 0; margin-bottom: var(--space-2); }
.review-year { background: var(--deed-cream-2); border: 1px solid var(--deed-border); border-radius: var(--radius-sm); padding: var(--space-2) var(--space-3); margin-bottom: var(--space-1); color: var(--deed-ink); }
.review-year-label { font-family: var(--font-display); font-style: italic; font-size: 13px; font-weight: 500; color: var(--deed-ink-muted); margin-bottom: var(--space-1); }
.review-dec { font-size: 13px; padding: 2px 0; display: flex; align-items: center; gap: var(--space-2); }
.review-dec.positive { color: #27724A; }
.review-dec.negative { color: #C24437; }

/* Rent popup overlay */
.rent-popup-card { border-top-color: var(--color-warning); }

/* Achievements toast (if styled elsewhere keep base) */

/* Motion respect */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* Keyboard focus — visible gold ring, only for keyboard users */
.btn:focus-visible, .action-tab:focus-visible, .decision-btn:focus-visible,
.tier-btn:focus-visible, .invest-btn:focus-visible, .sound-toggle:focus-visible,
.slider:focus-visible, .input:focus-visible, .costs-details summary:focus-visible {
  outline: 2px solid var(--color-gold); outline-offset: 2px;
}

/* Older browsers without backdrop-filter: solid felt panels instead of glass */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .panel, .result-panel, .action-panel, .stat-card, .score-item, .score-report,
  .costs-details, .whatsapp-feed, .underwater-bar, .leaderboard-row, .sound-toggle {
    background: #10301F;
  }
}

/* v10: Help button + how-to-play */
.help-toggle { top: 64px; font-family: var(--font-display); font-weight: 700; font-size: 19px; }
.howto-list { display: flex; flex-direction: column; gap: var(--space-3); }
.howto-item { display: flex; gap: var(--space-3); align-items: flex-start; font-size: 14px; line-height: 1.55; color: var(--deed-ink); }
.howto-item .howto-icon { font-size: 20px; flex-shrink: 0; margin-top: 1px; }
.howto-item strong { font-weight: 700; }

/* v10: Resume banner on the intro */
.resume-banner { margin: var(--space-4) 0 0; border-top: 3px solid var(--color-gold); animation: slideUp 350ms ease; }
