/* ============================================
   InvestQuest - CSS Styles
   ============================================ */

/* Self-hosted pixel font (was Google Fonts — bundled so the public
   deploy has zero third-party requests). Press Start 2P, OFL license. */
@font-face {
  font-family: 'Press Start 2P';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/press-start-2p-latin.woff2') format('woff2');
}

/* --- Reset & Variables --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Light theme */
  --bg-primary: #f8f9fc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f0f2f8;
  --text-primary: #1a1a2e;
  --text-secondary: #4a4a6a;
  --text-tertiary: #8888a8;
  --border-color: #e2e4ec;
  --accent: #6366f1;
  --accent-light: #818cf8;
  --accent-bg: #eef2ff;
  --success: #10b981;
  --success-bg: #d1fae5;
  --danger: #ef4444;
  --danger-bg: #fee2e2;
  --warning: #f59e0b;
  --warning-bg: #fef3c7;
  --candle-up: #10b981;
  --candle-down: #ef4444;
  --chart-bg: #ffffff;
  --chart-grid: #f0f0f0;
  --chart-text: #666;
  --sidebar-bg: #1e1e38;
  --sidebar-text: #c8c8e0;
  --sidebar-active: #6366f1;
  --sidebar-hover: rgba(99, 102, 241, 0.1);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --transition: 0.2s ease;
}

[data-theme="dark"] {
  --bg-primary: #0f0f1a;
  --bg-secondary: #1a1a2e;
  --bg-tertiary: #252540;
  --text-primary: #e8e8f0;
  --text-secondary: #a0a0c0;
  --text-tertiary: #686888;
  --border-color: #2a2a45;
  --accent: #818cf8;
  --accent-light: #a5b4fc;
  --accent-bg: #1e1b4b;
  --success: #34d399;
  --success-bg: #064e3b;
  --danger: #f87171;
  --danger-bg: #7f1d1d;
  --warning: #fbbf24;
  --warning-bg: #78350f;
  --chart-bg: #1a1a2e;
  --chart-grid: #2a2a45;
  --chart-text: #888;
  --sidebar-bg: #0a0a18;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.5);
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* --- Layout --- */
#app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 280px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-header {
  padding: 20px 20px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.5px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 2px;
  text-decoration: none;
  color: var(--sidebar-text);
  font-size: 0.9rem;
  position: relative;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.nav-item.active {
  background: var(--sidebar-active);
  color: #fff;
  font-weight: 600;
}

.nav-item.locked {
  opacity: 0.4;
  cursor: not-allowed;
}

.nav-item.completed .nav-icon {
  color: var(--success);
}

.nav-icon {
  font-size: 1.25rem;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}

.nav-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-status {
  font-size: 0.75rem;
  flex-shrink: 0;
}

/* The sidebar is a hidden drawer at every width — the game owns the screen.
   A floating ☰ button (hud-fab) opens it. */
.sidebar {
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  box-shadow: var(--shadow-lg);
}
.sidebar.open { transform: translateX(0); }

.main-content {
  flex: 1;
  margin-left: 0;
  min-height: 100vh;
  /* flex items refuse to shrink below content width without this —
     the wide map must scroll inside its strip, not stretch the page */
  min-width: 0;
}

/* Global game HUD bar: menu on the left, stats on the right */
.hud-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--bg-secondary);
  border-bottom: 3px solid var(--border-color);
}
.hud-bar button {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 3px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 1.1rem;
  cursor: pointer;
}
.hud-bar button:hover { border-color: var(--accent); }
.hud-stats {
  display: flex;
  gap: 8px;
}
.hud-stats span {
  background: var(--bg-tertiary);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  padding: 6px 12px;
  font-weight: 800;
  font-size: 0.8rem;
  white-space: nowrap;
}

.main-content { padding-top: 56px; }
.sidebar { z-index: 200; }

/* --- Full-bleed home screen: hero + ticker + map fill the viewport --- */
.page-content.full-bleed {
  max-width: none;
  padding: 0;
  margin: 0;
}
.home-full {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 56px);
}
.home-hero {
  text-align: center;
  padding: 22px 16px 14px;
}
.home-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 26px;
}
.home-logo-word {
  font-family: 'Press Start 2P', 'Courier New', monospace;
  font-size: 2rem;
  letter-spacing: 6px;
  color: var(--accent);
  text-shadow: 4px 4px 0 rgba(0,0,0,0.45);
}
.home-logo-bear, .home-logo-bull {
  font-size: 3.1rem;
  line-height: 1;
}
/* The trader color language survives as glow auras: red bear, green bull */
.home-logo-bear {
  filter: drop-shadow(3px 3px 0 rgba(0,0,0,0.35)) drop-shadow(0 0 16px rgba(239,68,68,0.65));
}
.home-logo-bull {
  filter: drop-shadow(3px 3px 0 rgba(0,0,0,0.35)) drop-shadow(0 0 16px rgba(16,185,129,0.65));
}
.home-logo-bear { animation: faceoffL 2.6s ease infinite; }
.home-logo-bull { animation: faceoffR 2.6s ease infinite; }
@keyframes faceoffL {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(5px); }
}
@keyframes faceoffR {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(-5px); }
}
.home-tagline {
  color: var(--text-tertiary);
  font-size: 1rem;
  margin-top: 12px;
}

.home-map {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  max-width: 100vw;
}
.home-map .trail-status {
  margin: 0;
  border-radius: 0;
  border-left: none;
  border-right: none;
}
.home-map .sh-wrap {
  flex: 1;
  margin: 0;
  padding-bottom: 0;
  display: flex;
  min-width: 0;
  max-width: 100%;
}
.home-map .street-h {
  height: auto;
  min-height: 440px;
  flex: 1;
  border-radius: 0;
}
.home-full .tf-disclaimer { margin: 8px 0 10px; }

.mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
}

.mobile-menu-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-primary);
  padding: 4px;
}

.mobile-logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.page-content {
  padding: 32px;
  max-width: 1100px;
  margin: 0 auto;
  animation: fadeIn 0.3s ease;
}

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

/* --- Theme Toggle --- */
.theme-toggle {
  background: rgba(255,255,255,0.1);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.theme-toggle:hover {
  background: rgba(255,255,255,0.2);
  transform: scale(1.1);
}

/* --- XP Bar --- */
.xp-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.xp-label {
  font-size: 0.8rem;
  color: var(--sidebar-text);
  display: flex;
  justify-content: space-between;
}

.xp-bar-container {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  overflow: hidden;
}

.xp-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  border-radius: 3px;
  transition: width 0.5s ease;
}

/* --- Home Page --- */
.home-header {
  text-align: center;
  margin-bottom: 40px;
}

.home-header h1 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--accent), #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.home-header p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

.home-stats {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 20px;
  flex-wrap: wrap;
}

.stat-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-secondary);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.stat-chip .stat-value {
  font-weight: 700;
  color: var(--accent);
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

/* --- Module Card --- */
.module-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.module-card:hover:not(.locked) {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
}

.module-card.locked {
  opacity: 0.55;
  cursor: not-allowed;
}

.module-card.completed {
  border-color: var(--success);
}

.module-card-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 12px;
}

.module-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.module-card-info {
  flex: 1;
}

.module-card-number {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.module-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-top: 2px;
  color: var(--text-primary);
}

.module-card-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 16px;
}

.module-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.module-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

.module-card-badge {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-locked {
  background: var(--bg-tertiary);
  color: var(--text-tertiary);
}

.badge-available {
  background: var(--accent-bg);
  color: var(--accent);
}

.badge-in-progress {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge-completed {
  background: var(--success-bg);
  color: var(--success);
}

/* --- Module Page --- */
.module-page {
  max-width: 800px;
  margin: 0 auto;
}

.module-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-tertiary);
  margin-bottom: 24px;
}

.module-breadcrumb a {
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
}

.module-breadcrumb a:hover {
  text-decoration: underline;
}

.module-title-section {
  margin-bottom: 32px;
}

.module-title-section h1 {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.module-progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 16px;
}

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

/* --- Lesson Content --- */
.lesson-container {
  animation: fadeIn 0.3s ease;
}

.lesson-header {
  margin-bottom: 32px;
}

.lesson-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.lesson-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.lesson-body {
  line-height: 1.8;
  color: var(--text-primary);
}

.lesson-body h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 28px 0 12px;
}

.lesson-body p {
  margin-bottom: 16px;
}

.lesson-body ul, .lesson-body ol {
  margin-bottom: 16px;
  padding-left: 24px;
}

.lesson-body li {
  margin-bottom: 8px;
}

/* --- Education Components --- */
.analogy-card {
  background: linear-gradient(135deg, var(--accent-bg), rgba(168, 85, 247, 0.08));
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin: 24px 0;
}

.analogy-card .analogy-icon {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.analogy-card .analogy-title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 8px;
  color: var(--accent);
}

.analogy-card .analogy-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.key-term {
  background: var(--bg-secondary);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 16px 20px;
  margin: 20px 0;
  box-shadow: var(--shadow-sm);
}

.key-term .term-word {
  font-weight: 700;
  color: var(--accent);
  font-size: 1rem;
  margin-bottom: 4px;
}

.key-term .term-def {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.formula-box {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin: 24px 0;
  text-align: center;
}

.formula-box .formula-title {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.formula-box .formula-text {
  font-family: 'Courier New', monospace;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 1px;
}

.interactive-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin: 28px 0;
  box-shadow: var(--shadow-sm);
}

.interactive-section .interactive-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 8px;
  color: var(--accent);
}

.interactive-section .interactive-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.chart-container {
  width: 100%;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--chart-bg);
  border: 1px solid var(--border-color);
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 0.9rem;
}

.comparison-table th {
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 600;
  padding: 12px 16px;
  text-align: left;
}

.comparison-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.comparison-table tr:hover td {
  background: var(--bg-tertiary);
}

/* --- Controls --- */
.controls-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.control-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.control-select {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.85rem;
  cursor: pointer;
}

.control-select:focus {
  outline: none;
  border-color: var(--accent);
}

.slider-control {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 180px;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
}

.slider-label {
  font-weight: 600;
  color: var(--text-secondary);
}

.slider-value {
  font-weight: 700;
  color: var(--accent);
}

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--bg-tertiary);
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--bg-secondary);
  box-shadow: var(--shadow-sm);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--bg-secondary);
  box-shadow: var(--shadow-sm);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
}

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

.btn-primary:hover {
  background: var(--accent-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-secondary);
  border-color: var(--accent);
}

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

.btn-success:hover {
  filter: brightness(1.1);
}

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

.btn-sm {
  padding: 6px 14px;
  font-size: 0.82rem;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* --- Lesson Navigation --- */
.lesson-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
}

.lesson-dots {
  display: flex;
  gap: 6px;
}

.lesson-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all var(--transition);
}

.lesson-dot.active {
  background: var(--accent);
  border-color: var(--accent);
  transform: scale(1.3);
}

.lesson-dot.completed {
  background: var(--success);
  border-color: var(--success);
}

/* --- Quiz --- */
.quiz-container {
  max-width: 700px;
  margin: 0 auto;
  animation: fadeIn 0.3s ease;
}

.quiz-header {
  text-align: center;
  margin-bottom: 32px;
}

.quiz-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.quiz-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-tertiary);
  margin-bottom: 16px;
}

.quiz-progress-bar {
  width: 200px;
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
}

.quiz-progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s ease;
}

.quiz-question {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 24px;
  line-height: 1.5;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quiz-option {
  padding: 14px 20px;
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.95rem;
  text-align: left;
  /* buttons don't inherit these — without them, dark mode shows
     near-black UA-default text on a dark background */
  color: var(--text-primary);
  font-family: inherit;
}

.quiz-option:hover:not(.selected):not(.disabled) {
  border-color: var(--accent);
  background: var(--accent-bg);
}

.quiz-option.selected {
  border-color: var(--accent);
  background: var(--accent-bg);
  font-weight: 600;
}

.quiz-option.correct {
  border-color: var(--success);
  background: var(--success-bg);
}

.quiz-option.incorrect {
  border-color: var(--danger);
  background: var(--danger-bg);
}

.quiz-option.disabled {
  cursor: default;
  opacity: 0.7;
}

.quiz-feedback {
  margin-top: 16px;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  line-height: 1.6;
  animation: fadeIn 0.3s ease;
}

.quiz-feedback.correct {
  background: var(--success-bg);
  border: 1px solid var(--success);
  color: var(--success);
}

.quiz-feedback.incorrect {
  background: var(--danger-bg);
  border: 1px solid var(--danger);
  color: var(--danger);
}

.quiz-results {
  text-align: center;
  padding: 40px 20px;
  animation: fadeIn 0.3s ease;
}

/* The license stamp — big, official, slightly crooked */
.license-stamp {
  display: inline-block;
  font-family: 'Press Start 2P', 'Courier New', monospace;
  font-size: 1.1rem;
  line-height: 2;
  color: var(--success);
  border: 4px solid var(--success);
  border-radius: 10px;
  padding: 14px 26px;
  transform: rotate(-5deg);
  letter-spacing: 2px;
  margin-bottom: 16px;
  animation: tfStamp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.license-rewards {
  font-size: 1rem;
  font-weight: 800;
  color: var(--warning);
}

/* Uncle's memo at the top of every class */
.uncle-memo {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--bg-tertiary);
  border-left: 4px solid var(--warning);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 14px 18px;
  margin: 0 0 20px;
  font-size: 0.92rem;
  font-style: italic;
  color: var(--text-secondary);
  line-height: 1.55;
}
.uncle-memo-face { font-size: 1.7rem; line-height: 1; }
.uncle-memo strong { font-style: normal; color: var(--text-primary); }

.quiz-results .result-icon {
  font-size: 4rem;
  margin-bottom: 16px;
}

.quiz-results h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.quiz-results .result-score {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--accent);
  margin: 16px 0;
}

.quiz-results .result-message {
  color: var(--text-secondary);
  margin-bottom: 24px;
  font-size: 1rem;
}

/* --- Strategy Builder --- */
.strategy-builder {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 24px 0;
}

.strategy-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.strategy-panel h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.desk-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: -8px 0 6px;
}

.desk-presets-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.desk-preset-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}

.desk-preset-btn:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.desk-preset-note {
  font-size: 0.78rem;
  font-style: italic;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.desk-warn {
  display: none;
  background: var(--warning-bg);
  color: var(--warning);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-top: 10px;
  font-size: 0.8rem;
}

.desk-warn div + div {
  margin-top: 6px;
}

.rule-card {
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 12px;
  font-size: 0.88rem;
}

.rule-card .rule-label {
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.rule-card .rule-value {
  color: var(--accent);
  font-weight: 700;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
}

.toggle-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-tertiary);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  transition: all var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  top: 2px;
  background: #fff;
  border-radius: 50%;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--accent);
  border-color: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* --- Backtest Results --- */
.backtest-results {
  animation: fadeIn 0.3s ease;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.metric-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
}

.metric-card .metric-value {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.metric-card .metric-value.positive {
  color: var(--success);
}

.metric-card .metric-value.negative {
  color: var(--danger);
}

.metric-card .metric-label {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.trade-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-top: 20px;
}

.trade-table th {
  background: var(--bg-tertiary);
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.trade-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.trade-table .positive { color: var(--success); font-weight: 600; }
.trade-table .negative { color: var(--danger); font-weight: 600; }

/* --- Celebration Overlay --- */
.celebration-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
}

.celebration-overlay.hidden {
  display: none;
}

.celebration-content {
  text-align: center;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 48px;
  box-shadow: var(--shadow-lg);
  animation: celebrationPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 400px;
}

@keyframes celebrationPop {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.celebration-icon {
  font-size: 4rem;
  margin-bottom: 16px;
}

.celebration-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.celebration-message {
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.celebration-xp {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 24px;
}

.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1001;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  top: -10px;
  animation: confettiFall linear forwards;
}

@keyframes confettiFall {
  to {
    top: 110vh;
    transform: rotate(720deg);
  }
}

/* --- Mobile Overlay --- */
.mobile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}

.mobile-overlay.hidden {
  display: none;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .page-content {
    padding: 20px 16px;
  }

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

  .home-header h1 {
    font-size: 1.5rem;
  }

  .strategy-builder {
    grid-template-columns: 1fr;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .lesson-nav {
    flex-direction: column;
    gap: 16px;
  }

  .controls-bar {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 480px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Utility --- */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-sm { font-size: 0.85rem; }
.text-muted { color: var(--text-tertiary); }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.gap-2 { gap: 8px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* ============================================
   TRADING FLOOR (the game)
   ============================================ */

/* --- Sidebar additions --- */
.nav-section-label {
  padding: 14px 20px 6px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
}

.nav-coins {
  font-size: 0.75rem;
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  padding: 2px 8px;
  border-radius: 10px;
}

/* --- Home hero banner --- */
.tf-hero {
  display: flex;
  align-items: center;
  gap: 18px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 28px;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: transform var(--transition), box-shadow var(--transition);
}

.tf-hero:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.tf-hero-icon { font-size: 2.5rem; }
.tf-hero-title { font-size: 1.25rem; font-weight: 800; }
.tf-hero-new {
  font-size: 0.65rem;
  font-weight: 800;
  background: #fbbf24;
  color: #78350f;
  padding: 2px 8px;
  border-radius: 8px;
  vertical-align: middle;
  margin-left: 6px;
  letter-spacing: 1px;
}
.tf-hero-sub { font-size: 0.9rem; opacity: 0.9; }
.tf-hero-cta {
  margin-left: auto;
  font-weight: 700;
  background: rgba(255,255,255,0.18);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

/* --- Scenario picker --- */
.tf-picker-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.tf-wallet {
  text-align: right;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 18px;
  box-shadow: var(--shadow-sm);
}
.tf-wallet-coins { font-size: 1.3rem; font-weight: 800; color: var(--warning); }
.tf-wallet-label { font-size: 0.75rem; color: var(--text-tertiary); }

.tf-howto {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px 20px;
  background: var(--accent-bg);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.tf-scenario-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.tf-scenario-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  box-shadow: var(--shadow-sm);
}

.tf-scenario-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}

.tf-scenario-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.tf-scenario-emoji { font-size: 2rem; }
.tf-grade-chip {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 10px;
}
.tf-scenario-name { font-weight: 700; font-size: 1.05rem; }
.tf-scenario-stars { color: var(--warning); font-size: 0.8rem; letter-spacing: 2px; }
.tf-scenario-tagline {
  font-size: 0.85rem;
  color: var(--text-secondary);
  flex: 1;
  margin-bottom: 8px;
}
.tf-play-btn { width: 100%; }

.tf-history {
  margin-top: 28px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 18px;
}
.tf-history h3 { font-size: 0.95rem; margin-bottom: 10px; }
.tf-history-row {
  display: grid;
  grid-template-columns: 1fr 40px 70px 80px 70px;
  gap: 8px;
  align-items: center;
  font-size: 0.85rem;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-color);
}
.tf-history-row:last-child { border-bottom: none; }
.tf-history-grade { font-weight: 800; }
.tf-history-coins { color: var(--warning); text-align: right; }

.tf-disclaimer {
  margin-top: 24px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

/* --- Run screen --- */
.tf-run { max-width: 1100px; margin: 0 auto; }

.tf-topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.tf-topbar-title {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}
.tf-company { font-weight: 700; }
.tf-ticker-sym {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  font-weight: 600;
  background: var(--bg-tertiary);
  padding: 1px 6px;
  border-radius: 6px;
}
.tf-scenario-label { font-size: 0.8rem; color: var(--text-tertiary); }

.tf-day-counter {
  margin-left: auto;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
}

.tf-speed-controls { display: flex; gap: 4px; }
.tf-speed-btn {
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
}
.tf-speed-btn:hover { border-color: var(--accent); color: var(--accent); }
.tf-speed-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.tf-main {
  display: grid;
  grid-template-columns: 1fr 230px;
  gap: 14px;
}

.tf-chart-wrap {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.tf-side {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tf-stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  transition: box-shadow 0.3s ease;
}
.tf-stat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  font-weight: 700;
}
.tf-stat-value { font-size: 1.4rem; font-weight: 800; }
.tf-stat-sub { font-size: 0.8rem; color: var(--text-tertiary); }
.tf-stat-sub-lg { font-size: 0.95rem; font-weight: 600; }
.tf-stat-sub.positive, .positive { color: var(--success); }
.tf-stat-sub.negative, .negative { color: var(--danger); }

.tf-portfolio-card.flash-buy { animation: tfFlashGreen 0.6s ease; }
.tf-portfolio-card.flash-sell { animation: tfFlashRed 0.6s ease; }
@keyframes tfFlashGreen {
  0% { box-shadow: 0 0 0 3px var(--success); }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@keyframes tfFlashRed {
  0% { box-shadow: 0 0 0 3px var(--danger); }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.tf-buy-btn, .tf-sell-btn, .tf-alloc-half-btn {
  border: none;
  border-radius: var(--radius-md);
  padding: 13px;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  letter-spacing: 1px;
  transition: transform 0.1s ease, opacity var(--transition);
}
.tf-buy-btn { background: var(--success); color: #fff; }
.tf-sell-btn { background: var(--danger); color: #fff; }
.tf-alloc-half-btn { background: var(--warning); color: #fff; }
.tf-buy-btn:hover:not(:disabled), .tf-sell-btn:hover:not(:disabled), .tf-alloc-half-btn:hover:not(:disabled) { transform: scale(1.03); }
.tf-buy-btn:active:not(:disabled), .tf-sell-btn:active:not(:disabled), .tf-alloc-half-btn:active:not(:disabled) { transform: scale(0.97); }
.tf-buy-btn:disabled, .tf-sell-btn:disabled, .tf-alloc-half-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.tf-btn-hint { font-size: 0.7rem; opacity: 0.7; font-weight: 600; }

.tf-side-note {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  text-align: center;
  line-height: 1.5;
}

.tf-chart-legend {
  position: absolute;
  top: 8px;
  left: 12px;
  z-index: 10;
  font-size: 0.72rem;
  color: var(--text-tertiary);
  background: color-mix(in srgb, var(--bg-secondary) 80%, transparent);
  padding: 3px 8px;
  border-radius: 6px;
  pointer-events: none;
}
.tf-chart-legend i {
  display: inline-block;
  width: 14px;
  height: 2px;
  border-radius: 1px;
  vertical-align: middle;
  margin-right: 4px;
}

.tf-race-card { padding-bottom: 8px; }
.tf-race-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 4px 0;
  border-bottom: 1px solid var(--border-color);
}
.tf-race-row:last-of-type { border-bottom: none; }
.tf-race-row.tf-race-you { font-weight: 800; }
.tf-ghost-pos {
  margin-top: 6px;
  font-size: 0.72rem;
  color: var(--text-tertiary);
  border-top: 1px dashed var(--border-color);
  padding-top: 6px;
}

.tf-quipbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  font-size: 0.88rem;
  color: var(--text-secondary);
  min-height: 44px;
}
.tf-quip-avatar { font-size: 1.3rem; }

/* --- Event overlay & popups --- */
.tf-event-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 15, 26, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  padding: 16px;
}

/* Trading 101 — the first-run tutorial popup */
.tf-tut { max-width: 540px; }

.tf-tut-title {
  font-weight: 800;
  font-size: 1.05rem;
  margin-bottom: 12px;
}

.tf-tut-title em {
  font-weight: 600;
  font-style: normal;
  color: var(--text-secondary);
}

.tf-tut-body {
  text-align: left;
  font-size: 0.92rem;
  color: var(--text-secondary);
}

.tf-tut-body p { margin: 8px 0; }
.tf-tut-body strong { color: var(--text-primary); }

.tf-tut-candles {
  display: flex;
  justify-content: center;
  gap: 36px;
  margin: 12px 0;
}

.tf-tut-fig {
  text-align: center;
  font-size: 0.8rem;
  line-height: 1.35;
}

.tf-tut-demo {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
}

.tf-tut-demo-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.84rem;
  text-align: left;
}

.tf-tut-demo-row button {
  flex: 0 0 110px;
  padding: 9px 6px;
  font-size: 0.8rem;
  pointer-events: none;
}

.tf-tut-dots {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin: 14px 0 10px;
}

.tf-tut-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-color);
}

.tf-tut-dot.active { background: var(--accent); }

.tf-tut-nav {
  display: flex;
  justify-content: center;
  gap: 10px;
}

/* The live UI elements the tutorial points at glow through the overlay */
.tf-tut-glow {
  animation: tutGlow 1.2s ease-in-out infinite;
  position: relative;
  z-index: 60;
}

@keyframes tutGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
  50% { box-shadow: 0 0 0 6px rgba(99, 102, 241, 0.5); }
}

.tf-popup {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  max-width: 460px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: tfPopIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-align: center;
}

@keyframes tfPopIn {
  0% { transform: scale(0.7); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.tf-popup-emoji { font-size: 2.6rem; margin-bottom: 6px; }
.tf-popup.tf-intro { max-width: 560px; }
.tf-intro h2 { margin-bottom: 4px; }
.tf-intro-blurb { color: var(--text-tertiary); font-style: italic; margin-bottom: 14px; }
.tf-intro-mission {
  background: var(--accent-bg);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.9rem;
  text-align: left;
  margin-bottom: 12px;
}
.tf-intro-tip { font-size: 0.8rem; color: var(--text-tertiary); margin-bottom: 16px; }
.tf-popup-action { width: 100%; font-size: 1rem; }

/* The Gauntlet's pre-fight screen: build your strategies, then deploy.
   The overlay pins to the VIEWPORT and scrolls — the popup can be as tall
   as it needs, and the DEPLOY button is always reachable. */
.tf-event-overlay.tf-overlay-fund {
  position: fixed;
  inset: 0;
  z-index: 999;
  align-items: flex-start;
  overflow-y: auto;
  padding: 3vh 16px;
}
.tf-popup.tf-intro-fund {
  max-width: 920px;
  width: 100%;
  margin: 0 auto;
}
.tf-intro-desks {
  text-align: left;
  margin: 12px 0;
}
.tf-popup-action:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Allocation buttons grey out while the kid's fund is driving */
.tf-buy-btn:disabled,
.tf-sell-btn:disabled,
.tf-alloc-half-btn:disabled {
  opacity: 0.4;
  filter: grayscale(0.8);
  cursor: not-allowed;
}

.tf-vs-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-bottom: 8px;
}
.tf-vs-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-weight: 800;
  font-size: 0.85rem;
}
.tf-vs-emoji { font-size: 2.4rem; }
.tf-vs-mid {
  font-family: 'Press Start 2P', 'Courier New', monospace;
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--danger);
  letter-spacing: 1px;
}
.tf-boss-taunt {
  font-style: italic;
  color: var(--text-tertiary);
  font-size: 0.85rem;
  margin-bottom: 12px;
}

.tf-boss-ladder {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 2px 0 4px;
}
.tf-boss-face {
  font-size: 1.15rem;
  position: relative;
  filter: grayscale(1);
  opacity: 0.45;
}
.tf-boss-face.beaten {
  filter: none;
  opacity: 1;
}
.tf-boss-face.beaten::after {
  content: '✓';
  position: absolute;
  bottom: -4px;
  right: -6px;
  font-size: 0.65rem;
  font-weight: 900;
  color: var(--success);
}
.tf-boss-face.current {
  filter: none;
  opacity: 1;
  transform: scale(1.25);
  animation: tfBossPulse 1.6s ease infinite;
}
@keyframes tfBossPulse {
  0%, 100% { transform: scale(1.25); }
  50% { transform: scale(1.4); }
}

.tf-scenario-card.locked {
  opacity: 0.75;
  cursor: default;
}
.tf-scenario-card.locked:hover {
  transform: none;
  border-color: var(--border-color);
  box-shadow: var(--shadow-sm);
}

.tf-gear-card.locked {
  opacity: 0.55;
  cursor: not-allowed;
}
.tf-gear-card.locked:hover {
  transform: none;
  border-color: var(--border-color);
  box-shadow: none;
}

.tf-hired-chip {
  margin-top: 4px;
  font-size: 0.72rem;
  font-weight: 800;
  color: #f59e0b;
}

.tf-gear-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 8px;
}

.tf-gear-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.tf-gear-card {
  font-family: inherit;
  background: var(--bg-tertiary);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.tf-gear-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.tf-gear-emoji { font-size: 1.8rem; }
.tf-gear-name { font-weight: 800; font-size: 0.88rem; color: var(--text-primary); }
.tf-gear-desc { font-size: 0.72rem; color: var(--text-secondary); line-height: 1.45; }

.tf-rsi-caption {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  padding: 2px 12px 8px;
  background: var(--bg-secondary);
}

/* --- The Wall Street Bugle (tabloid news) --- */
.tf-popup.bugle {
  background: #f7f1e3;
  color: #1d1a14;
  border: 1px solid #d8cdb4;
  max-width: 480px;
  text-align: left;
  transform: rotate(-1deg);
  animation: bugleSpin 0.55s cubic-bezier(0.25, 1, 0.4, 1);
  font-family: Georgia, 'Times New Roman', serif;
}
@keyframes bugleSpin {
  0% { transform: rotate(-540deg) scale(0.05); opacity: 0; }
  100% { transform: rotate(-1deg) scale(1); opacity: 1; }
}
.bugle-masthead {
  font-size: 1.6rem;
  font-weight: 900;
  text-align: center;
  letter-spacing: 1px;
  border-bottom: 3px double #1d1a14;
  padding-bottom: 4px;
  font-variant: small-caps;
}
.bugle-strip {
  display: flex;
  justify-content: space-between;
  font-size: 0.62rem;
  font-style: italic;
  color: #6b6354;
  border-bottom: 1px solid #b9ad92;
  padding: 3px 2px 5px;
  margin-bottom: 10px;
}
.bugle-headline {
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1.25;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.bugle-body {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}
.bugle-photo {
  flex-shrink: 0;
  width: 74px;
  text-align: center;
  border: 1px solid #b9ad92;
  background: #efe6d0;
  padding: 8px 4px 4px;
}
.bugle-photo span { font-size: 2rem; display: block; }
.bugle-photo em { font-size: 0.58rem; color: #6b6354; line-height: 1.2; display: block; }
.bugle-quote {
  font-style: italic;
  font-size: 0.92rem;
  line-height: 1.5;
  color: #3a3429;
}
.tf-popup.bugle .tf-popup-buttons { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }

/* --- Bull mood meter --- */
.tf-mood {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 12px;
}
.tf-mood-bull {
  position: relative;
  font-size: 1.7rem;
  line-height: 1;
}
.tf-mood-badge {
  position: absolute;
  bottom: -4px;
  right: -8px;
  font-size: 0.95rem;
}
.tf-mood-text {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.3;
  font-weight: 600;
}
.tf-mood.panic {
  border-color: var(--danger);
  animation: moodShake 0.4s ease infinite;
}
@keyframes moodShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-2px); }
  75% { transform: translateX(2px); }
}

/* --- Market weather tints --- */
.tf-run.tf-weather-bull .tf-chart-wrap { border-top: 4px solid #f59e0b; }
.tf-run.tf-weather-bubble .tf-chart-wrap { border-top: 4px solid #ec4899; }
.tf-run.tf-weather-bear .tf-chart-wrap { border-top: 4px solid #64748b; }
.tf-run.tf-weather-chop .tf-chart-wrap { border-top: 4px solid #0ea5e9; }
.tf-run.tf-weather-crash .tf-chart-wrap { border-top: 4px solid #ef4444; }

.tf-news-tag {
  display: inline-block;
  background: var(--danger);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  padding: 3px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
  animation: tfPulse 1.2s ease infinite;
}
@keyframes tfPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.tf-news-headline {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 14px;
}

.tf-news-rival {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}
.tf-rival-avatar { font-size: 1.6rem; }

.tf-popup-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.tf-bait-btn {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid var(--warning);
  font-weight: 700;
}
.tf-bait-btn:hover { background: var(--warning); color: #fff; }
.tf-resist-btn {
  background: var(--accent-bg);
  color: var(--accent);
  border: 1px solid var(--accent);
  font-weight: 700;
}
.tf-resist-btn:hover { background: var(--accent); color: #fff; }

/* --- Results screen --- */
.tf-results { max-width: 900px; margin: 0 auto; }

.tf-results-header {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-bottom: 22px;
}

.tf-grade-stamp {
  font-family: 'Press Start 2P', 'Courier New', monospace;
  font-size: 2.4rem;
  font-weight: 900;
  width: 92px;
  height: 92px;
  flex-shrink: 0;
  border: 4px solid;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: tfStamp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  background: var(--bg-secondary);
  box-shadow: var(--shadow-md);
}
@keyframes tfStamp {
  0% { transform: scale(2.4) rotate(-12deg); opacity: 0; }
  100% { transform: scale(1) rotate(-4deg); opacity: 1; }
}

.tf-results-title h1 { font-size: 1.5rem; margin-bottom: 2px; }
.tf-results-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.tf-badge {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 12px;
}

.tf-results-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.tf-result-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.tf-result-card.you { border-color: var(--accent); border-width: 2px; }
.tf-result-who { font-size: 0.85rem; font-weight: 700; color: var(--text-secondary); }
.tf-result-ret { font-size: 1.7rem; font-weight: 800; margin: 4px 0 2px; }
.tf-result-val { font-size: 0.8rem; color: var(--text-tertiary); }

.tf-legend {
  display: flex;
  gap: 18px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.tf-legend i {
  display: inline-block;
  width: 14px;
  height: 3px;
  border-radius: 2px;
  vertical-align: middle;
  margin-right: 5px;
}

.tf-debrief, .tf-ghost-explain {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin-top: 18px;
}
.tf-debrief h3, .tf-ghost-explain h3 { margin-bottom: 10px; font-size: 1.05rem; }

.tf-mistake {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 0.9rem;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
}
.tf-mistake:last-child { border-bottom: none; }
.tf-mistake span:first-child { font-size: 1.2rem; }

.tf-result-dip {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* The "you beat the boss but not Bob" lesson — the win's fine print */
.tf-bob-lesson {
  background: var(--bg-tertiary);
  border-left: 3px solid var(--warning);
  border-bottom: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 10px 14px;
  margin-bottom: 8px;
}

.tf-ghost-rules { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.tf-ghost-rule {
  background: var(--bg-tertiary);
  border-left: 3px solid #a855f7;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 10px 14px;
  font-size: 0.88rem;
}

.tf-results-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 26px;
  flex-wrap: wrap;
}

/* ============================================
   THE STREET — side-scrolling world map (very 1989)
   ============================================ */
.pixel-font, .sh-tag, .street-sign, .street-you span, .home-header h1 {
  font-family: 'Press Start 2P', 'Courier New', monospace;
}
.home-header h1 { font-size: 1.6rem; letter-spacing: 2px; }

.sh-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  margin: 10px -8px 24px;
  padding-bottom: 10px;
  scroll-behavior: smooth;
}

.street-h {
  position: relative;
  display: flex;
  align-items: center;
  height: 470px;
  width: max-content;
  padding: 0 60px;
  background: linear-gradient(180deg,
    color-mix(in srgb, #7ec8ff 22%, var(--bg-primary)) 0%,
    var(--bg-primary) 62%);
  border-radius: var(--radius-lg);
}

.sh-sky { position: absolute; inset: 0; pointer-events: none; }
.sh-sky span {
  position: absolute;
  font-size: 2.4rem;
  opacity: 0.85;
  animation: shDrift 38s linear infinite alternate;
}
.sh-sky span.big { font-size: 3.6rem; opacity: 0.7; animation-duration: 55s; }
.sh-sky .sky-sun, .sh-sky .sky-moon { font-size: 3.2rem; opacity: 1; animation: none; }
.sh-sky .sky-star {
  font-size: 1rem;
  color: #ffe9a8;
  animation: starTwinkle 2.2s ease infinite;
}
.sh-sky .sky-star:nth-child(even) { animation-delay: 1.1s; }
/* Day sky shows the sun; the Blackworks night shows moon and stars */
[data-theme="light"] .sky-moon, [data-theme="light"] .sky-star { display: none; }
[data-theme="dark"] .sky-sun { display: none; }
@keyframes shDrift {
  from { transform: translateX(0); }
  to { transform: translateX(80px); }
}
@keyframes starTwinkle {
  0%, 100% { opacity: 0.9; }
  50% { opacity: 0.25; }
}

.sh-road {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 0;
  border-top: 7px dotted var(--border-color);
  transform: translateY(-3px);
}

.sh-ground {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 110px;
  border-radius: 0;
  background: linear-gradient(90deg,
    #3f9b4f 0%, #57a85c 18%,      /* ranch grass */
    #b89b5e 38%, #9b9b8a 55%,     /* dusty highway */
    #6f7480 75%, #3c4252 100%);   /* city asphalt */
  opacity: 0.55;
}

.sh-stop {
  position: relative;
  flex-shrink: 0;
  width: 250px;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 2;
}
.sh-slot {
  height: 215px;
  display: flex;
  align-items: flex-end;
  padding-bottom: 16px;
}
.sh-slot.bottom { align-items: flex-start; padding: 16px 0 0; }

.sh-dot {
  flex-shrink: 0;
  width: 78px;
  height: 78px;
  border-radius: 14px;
  background: var(--bg-secondary);
  border: 4px solid var(--border-color);
  box-shadow: 5px 5px 0 rgba(0,0,0,0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  position: relative;
}
.sh-dot img {
  width: 86%;
  height: 86%;
  border-radius: 9px;
  object-fit: cover;
}

/* The daily bonus ? block — bonk it */
.sh-dot.q-block {
  background: #f5b021;
  border-color: #9a6a00;
  color: #7a4d00;
  font-weight: 900;
}
.sh-stop.active .sh-dot.q-block { animation: qBounce 1.6s ease infinite; }
@keyframes qBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

.sh-card {
  background: var(--bg-secondary);
  border: 3px solid var(--border-color);
  border-radius: 8px;
  padding: 14px 16px;
  width: 232px;
  box-shadow: 5px 5px 0 rgba(0,0,0,0.22);
  transition: transform var(--transition), border-color var(--transition);
}
.sh-tag {
  font-size: 0.6rem;
  color: var(--accent);
  letter-spacing: 1px;
  margin-bottom: 7px;
}
.street-card-title { font-weight: 800; font-size: 1.02rem; line-height: 1.3; }
.street-card-sub { font-size: 0.82rem; color: var(--text-tertiary); line-height: 1.45; margin-top: 5px; }
.street-card-action {
  margin-top: 8px;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--accent);
}

.sh-stop.active .sh-dot { border-color: var(--accent); cursor: pointer; }
.sh-stop.active .sh-card { cursor: pointer; }
.sh-stop.active .sh-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 rgba(0,0,0,0.22);
  border-color: var(--accent);
}
.sh-stop.done .sh-dot { border-color: var(--success); }
.sh-stop.done .sh-card { opacity: 0.85; }
.sh-stop.locked .sh-dot { opacity: 0.6; filter: grayscale(0.7); }
.sh-stop.locked .sh-card { opacity: 0.65; }

.sh-cloud {
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 2rem;
  z-index: 3;
}

.sh-walker {
  position: absolute;
  top: 50%;
  margin-top: -66px;
  font-size: 2.5rem;
  z-index: 10;
  transform: translateX(-50%);
  transition: left 1.8s ease-in-out;
  pointer-events: none;
}
.sh-walker span {
  display: inline-block;
  animation: shHop 0.45s ease infinite;
}
.sh-walker::after {
  content: '💨';
  position: absolute;
  left: -18px;
  bottom: 2px;
  font-size: 0.9rem;
}
@keyframes shHop {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
.street-h.walking .street-you { opacity: 0; }

/* ── Equipment issued: gear award popup + fly-to-desk ───────── */
.gear-award-kicker {
  font-size: 0.65rem;
  letter-spacing: 2px;
  color: var(--text-tertiary);
  font-weight: 800;
  margin-bottom: 6px;
}
.gear-award-emoji {
  font-size: 4.5rem;
  line-height: 1;
  margin: 4px 0 12px;
  animation: gearPop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 0 18px rgba(99, 102, 241, 0.55));
}
@keyframes gearPop {
  0% { transform: scale(0) rotate(-20deg); }
  60% { transform: scale(1.25) rotate(6deg); }
  100% { transform: scale(1) rotate(0); }
}
.gear-award-uncle {
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.88rem;
  line-height: 1.5;
  margin: 12px 0 16px;
  text-align: left;
}
.gear-fly {
  position: fixed;
  z-index: 10000;
  font-size: 4.5rem;
  line-height: 1;
  transform: translate(-50%, -50%) scale(1);
  transition: left 0.85s cubic-bezier(0.5, -0.2, 0.75, 0.6),
              top 0.85s cubic-bezier(0.5, -0.2, 0.75, 0.6),
              transform 0.85s ease, opacity 0.85s ease;
  pointer-events: none;
}
#menu-fab.gear-received { animation: gearReceived 0.6s ease; }
@keyframes gearReceived {
  0%, 100% { transform: scale(1); }
  40% { transform: scale(1.35); }
}

/* ============ First Trade mini-sim (Module 1) ============ */
.ft-board {
  position: relative; /* anchors the Bugle popup overlay */
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-top: 12px;
}
.ft-stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.ft-stat {
  flex: 1;
  min-width: 90px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ft-label {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.ft-num {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.ft-num.positive { color: var(--success); }
.ft-num.negative { color: var(--danger); }
.ft-chart {
  background: var(--chart-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}
.ft-chart svg { display: block; width: 100%; height: 140px; }
.ft-msg {
  min-height: 44px;
  font-size: 0.92rem;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  margin-bottom: 10px;
  line-height: 1.5;
}
.ft-msg-win { background: var(--success-bg); }
.ft-msg-loss { background: var(--danger-bg); }
.ft-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* The bull arrives at a waypoint — the stop gives a little bounce */
.sh-dot.sh-bump { animation: shBump 0.45s ease; }
@keyframes shBump {
  0% { transform: scale(1); }
  40% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

.street-ladder { display: flex; gap: 5px; margin: 3px 0; }
.street-boss { font-size: 0.95rem; filter: grayscale(1); opacity: 0.45; }
.street-boss.beaten { filter: none; opacity: 1; }

.street-you {
  position: absolute;
  top: -58px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 2rem;
  animation: streetBounce 1.4s ease infinite;
  white-space: nowrap;
  z-index: 2;
}
.street-you span {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 1px;
  background: var(--accent);
  color: #fff;
  padding: 2px 10px;
  border-radius: 9px;
}
@keyframes streetBounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-6px); }
}

/* --- Scenery columns: from the ranch to Wall Street --- */
.street-scenery {
  position: relative;
  flex-shrink: 0;
  width: 190px;
  height: 100%;
  align-self: stretch;
  z-index: 1;
}
.street-sign {
  position: absolute;
  top: 26%;
  left: 50%;
  transform: translateX(-50%) rotate(-1.5deg);
  background: #1a7a3c;
  color: #fff;
  font-size: 0.62rem;
  letter-spacing: 1px;
  line-height: 1.7;
  text-align: center;
  padding: 10px 14px;
  border-radius: 5px;
  border: 3px solid #fff;
  box-shadow: 5px 5px 0 rgba(0,0,0,0.3);
  width: max-content;
  max-width: 180px;
}
/* Landscape sits ON the ground strip, not floating in the air */
.street-deco {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 2.1rem;
  letter-spacing: 10px;
  text-align: center;
  white-space: nowrap;
  opacity: 0.95;
}

/* The Opening Bell overlay bits */
.bell-swing { animation: bellSwing 0.8s ease 2; display: inline-block; }
@keyframes bellSwing {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-25deg); }
  75% { transform: rotate(25deg); }
}
.bell-dice {
  display: flex;
  gap: 16px;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 800;
  margin: 10px 0;
}
.bell-dice span {
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  animation: tfPopIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.bell-dice span:last-child { animation-delay: 0.15s; animation-fill-mode: backwards; }
.bell-payout {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--warning);
}

/* --- Oregon Trail: status bar, CRT cards, fog, tombstone --- */
.trail-status {
  position: relative; /* anchors the bell-call chip */
  font-family: 'Press Start 2P', 'Courier New', monospace;
  font-size: 0.62rem;
  line-height: 1.8;
  color: #33ff66;
  background: #0a1408;
  border: 3px solid #1d4d2b;
  border-radius: 6px;
  padding: 10px 0;
  margin: 4px 0 12px;
  letter-spacing: 1px;
  background-image: repeating-linear-gradient(0deg, transparent 0 2px, rgba(0,0,0,0.25) 2px 4px);
  overflow: hidden;
  white-space: nowrap;
}
.trail-ticker {
  display: inline-flex;
  animation: tickerScroll 40s linear infinite;
}

/* Daily bell reminder pinned over the ticker */
.bell-call {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: #f5b021;
  color: #7a4d00;
  border: 2px solid #9a6a00;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 6px 10px;
  cursor: pointer;
  z-index: 2;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.35);
}
.bell-call:hover { transform: translateY(-50%) scale(1.06); }
.trail-ticker span { padding-right: 8px; }
.trail-status:hover .trail-ticker { animation-play-state: paused; }
@keyframes tickerScroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.crt-card {
  font-family: 'Press Start 2P', 'Courier New', monospace;
  background: #0a1408;
  color: #33ff66;
  border: 4px solid #1d4d2b;
  border-radius: 8px;
  max-width: 460px;
  width: 100%;
  padding: 26px 26px 20px;
  text-align: center;
  font-size: 0.62rem;
  line-height: 2;
  letter-spacing: 0.5px;
  background-image: repeating-linear-gradient(0deg, transparent 0 2px, rgba(0,0,0,0.25) 2px 4px);
  animation: tfPopIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.crt-title { font-size: 0.8rem; margin-bottom: 14px; color: #7dffa0; }
.crt-delta { font-size: 0.8rem; color: #ffe14d; margin: 10px 0; }
.crt-pump { font-size: 0.85rem; color: #ffe14d; animation: tfPulse 0.4s ease infinite; }
.crt-scam-name { font-size: 0.8rem; color: #ffe14d; }
.crt-btn {
  font-family: inherit;
  font-size: 0.6rem;
  background: #14301a;
  color: #7dffa0;
  border: 3px solid #33ff66;
  border-radius: 4px;
  padding: 10px 14px;
  cursor: pointer;
  margin-top: 12px;
  letter-spacing: 1px;
  animation: crtBlink 1.4s step-end infinite;
}
.crt-btn:hover { background: #1d4d2b; animation: none; }
.crt-btn.danger { border-color: #ff5d5d; color: #ff8d8d; animation: none; }
.crt-btn.danger:hover { background: #4d1d1d; }
@keyframes crtBlink {
  0%, 70% { opacity: 1; }
  71%, 100% { opacity: 0.55; }
}
.crt-card .intro-letter {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #14301a;
  border-left-color: #33ff66;
  color: #c9ffd8;
  font-size: 0.8rem;
  line-height: 1.6;
}

.sh-stop.fog .sh-dot {
  border-style: dashed;
  opacity: 0.45;
  filter: grayscale(1);
  box-shadow: none;
}
.sh-fogtag {
  font-family: 'Press Start 2P', 'Courier New', monospace;
  font-size: 0.7rem;
  color: var(--text-tertiary);
  opacity: 0.6;
  padding-top: 6px;
}

.trail-tomb {
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: center;
  background: #2a2a35;
  color: #c9cbd8;
  border: 4px solid #4a4a5c;
  border-radius: 10px;
  padding: 16px 22px;
  margin-top: 18px;
  font-family: 'Press Start 2P', 'Courier New', monospace;
  font-size: 0.58rem;
  line-height: 2.1;
  letter-spacing: 1px;
  text-align: center;
}
.trail-tomb-stone { font-size: 2.6rem; }
.trail-tomb em { color: #8d92a8; font-style: italic; }

/* --- Blackworks Capital branding --- */
.street-dot img {
  width: 86%;
  height: 86%;
  border-radius: 50%;
  object-fit: cover;
}

.intro-fund-logo {
  width: 92px;
  height: 92px;
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  box-shadow: var(--shadow-md);
}

.sidebar-brand {
  margin-top: 14px;
  text-align: center;
  opacity: 0.55;
}
.sidebar-brand img {
  width: 60%;
  max-width: 150px;
  display: block;
  margin: 0 auto 2px;
}
.sidebar-brand span {
  font-size: 0.6rem;
  letter-spacing: 0.5px;
  color: var(--sidebar-text);
}

/* --- The Offer Letter --- */
.offer-letter {
  background: #f9f5ea;
  color: #1d1a14;
  border-radius: var(--radius-md);
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: tfPopIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-family: Georgia, 'Times New Roman', serif;
}
.offer-letterhead {
  background: #0d0d0f;
  text-align: center;
  padding: 22px 20px 14px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.offer-letterhead img {
  width: 65%;
  max-width: 280px;
}
.offer-letterhead-sub {
  color: #8a8578;
  font-size: 0.6rem;
  letter-spacing: 3px;
  margin-top: 6px;
}
.offer-body {
  padding: 22px 30px 8px;
  font-size: 0.92rem;
  line-height: 1.65;
}
.offer-body p { margin-bottom: 10px; }
.offer-stamp {
  display: inline-block;
  border: 2px solid #8c2f2f;
  color: #8c2f2f;
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 2px;
  padding: 3px 12px;
  transform: rotate(-2deg);
  margin-bottom: 14px;
}
.offer-sign { margin-top: 16px; }
.offer-ps {
  font-size: 0.8rem;
  font-style: italic;
  color: #6b6354;
  border-top: 1px solid #d8cdb4;
  padding-top: 10px;
}

/* Intro overlay */
.street-intro-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 15, 26, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}
.street-intro-overlay.hidden { display: none; }

.street-intro-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 480px;
  width: 100%;
  padding: 30px 32px 22px;
  text-align: center;
  animation: tfPopIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.intro-emoji { font-size: 3.2rem; margin-bottom: 10px; letter-spacing: 6px; }
.intro-sprite .pixel-sprite {
  width: 88px;
  height: auto;
  filter: drop-shadow(4px 4px 0 rgba(0,0,0,0.4));
}
.street-intro-card h2 { margin-bottom: 10px; }
.street-intro-card p { color: var(--text-secondary); font-size: 0.95rem; margin-bottom: 10px; }
.intro-letter {
  text-align: left;
  background: var(--bg-tertiary);
  border-left: 3px solid var(--warning);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 12px 16px;
  font-style: italic;
}
.intro-sign { font-size: 0.8rem; color: var(--text-tertiary); }
.intro-name-row { margin: 16px 0 6px; }
.intro-name-row label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.intro-name-row input {
  width: 70%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--accent);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 1rem;
  text-align: center;
  font-weight: 700;
}
.intro-buttons {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 18px;
}
.intro-dots { display: flex; gap: 6px; justify-content: center; margin-top: 14px; }
.intro-dots span {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border-color);
}
.intro-dots span.on { background: var(--accent); }

@media (max-width: 700px) {
  .home-logo { gap: 14px; }
  .home-logo-word { font-size: 1.2rem; letter-spacing: 3px; }
  .home-logo-bear, .home-logo-bull { font-size: 1.8rem; }
  .hud-stats span { padding: 5px 8px; font-size: 0.72rem; }
}

/* ============================================
   YOUR DESK
   ============================================ */
.desk-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}
.desk-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 14px;
}
.desk-panel h3 { font-size: 0.95rem; margin-bottom: 10px; }
.desk-row .desk-panel { margin-bottom: 0; }

.desk-shelf {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  border-bottom: 6px solid #8b6f47;
  padding-bottom: 8px;
}
.desk-trophy, .desk-gear {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 1.6rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: 8px 12px 4px;
  min-width: 64px;
}
.desk-trophy span, .desk-gear span {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-tertiary);
  margin-top: 2px;
}
.desk-trophy.gold { background: #f59e0b22; border: 1px solid #f59e0b66; }
.desk-gear.locked { opacity: 0.5; }

.desk-license {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 1.4rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: 8px 10px 4px;
  min-width: 54px;
  opacity: 0.45;
}
.desk-license.earned {
  opacity: 1;
  background: #10b98118;
  border: 1px solid #10b98155;
}
.desk-license span {
  font-size: 0.62rem;
  font-weight: 800;
  color: var(--text-tertiary);
  margin-top: 2px;
  font-family: 'Press Start 2P', 'Courier New', monospace;
  font-size: 0.5rem;
}
.desk-empty { font-size: 0.82rem; color: var(--text-tertiary); font-style: italic; padding: 8px 0; }

.desk-corkboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  background: #b98e5a33;
  border: 4px solid #8b6f47;
  border-radius: var(--radius-sm);
  padding: 12px;
}
.desk-boss-card {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  text-align: center;
  padding: 12px 8px;
  transform: rotate(-1deg);
  box-shadow: var(--shadow-sm);
}
.desk-boss-card:nth-child(even) { transform: rotate(1.5deg); }
.desk-boss-card::before {
  content: '📌';
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.8rem;
}
.desk-boss-face { font-size: 2rem; display: block; }
.desk-boss-name { font-size: 0.72rem; font-weight: 700; display: block; }
.desk-boss-hint { font-size: 0.62rem; color: var(--text-tertiary); font-style: italic; }
.desk-stamp {
  position: absolute;
  top: 32%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-18deg);
  border: 3px solid var(--danger);
  color: var(--danger);
  font-weight: 900;
  font-size: 0.85rem;
  letter-spacing: 2px;
  padding: 1px 8px;
  border-radius: 4px;
  opacity: 0.9;
}
.desk-boss-card.beaten .desk-boss-face { filter: grayscale(0.7); opacity: 0.75; }

.desk-items {
  display: flex;
  gap: 18px;
  justify-content: center;
  font-size: 1.5rem;
  margin-top: 6px;
  opacity: 0.9;
}
.desk-items span { cursor: help; }

@media (max-width: 700px) {
  .desk-row { grid-template-columns: 1fr; }
}

/* --- Responsive --- */
@media (max-width: 900px) {
  .tf-main { grid-template-columns: 1fr; }
  .tf-side {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .tf-side .tf-stat-card { flex: 1 1 140px; }
  .tf-buy-btn, .tf-sell-btn, .tf-alloc-half-btn { flex: 1 1 100px; }
  .tf-side-note { display: none; }
  .tf-results-grid { grid-template-columns: 1fr; }
  .tf-results-header { flex-direction: column; text-align: center; }
  .tf-results-badges { justify-content: center; }
  .tf-picker-header { flex-direction: column; }
  .tf-history-row { grid-template-columns: 1fr 30px 60px 70px; }
  .tf-history-row span:nth-child(5) { display: none; }
  .tf-gear-grid { grid-template-columns: 1fr; }
}
