/* ==========================================================================
   AURA BLACKJACK MATH DASHBOARD - DESIGN SYSTEM & STYLES
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. VARIABLES & CORE STYLES
   -------------------------------------------------------------------------- */
:root {
  --bg-primary: #07090e;
  --bg-secondary: #0c0f17;
  --bg-card: rgba(18, 24, 41, 0.75);
  --bg-card-hover: rgba(26, 34, 56, 0.85);
  --border-color: rgba(255, 255, 255, 0.05);
  --border-glow: rgba(6, 182, 212, 0.15);
  
  /* Modern Harmonies Palettes (HSL) */
  --accent-cyan: hsl(188, 95%, 43%);
  --accent-teal: hsl(172, 95%, 43%);
  --accent-gold: hsl(45, 93%, 47%);
  --accent-purple: hsl(271, 91%, 65%);
  --accent-blue: hsl(217, 91%, 60%);
  --accent-red: hsl(349, 89%, 60%);
  --accent-green: hsl(152, 76%, 45%);
  --accent-orange: hsl(25, 95%, 53%);

  --text-primary: #f8fafc; /* Slate-50: Crisp primary white/slate for high readability */
  --text-secondary: #cbd5e1; /* Slate-300: High-contrast secondary slate grey (WCAG AAA compliant) */
  --text-muted: #94a3b8; /* Slate-400: Clean, legible muted label color (WCAG AA compliant) */
  
  /* Card Action Colors */
  --act-stand: #10b981;
  --act-hit: #ef4444;
  --act-double: #3b82f6;
  --act-split: #a855f7;
  --act-surrender: #f97316;

  --font-header: 'Space Grotesk', sans-serif;
  --font-body: 'Outfit', sans-serif;

  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-premium: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
  --glass-blur: blur(12px);

  /* ==========================================================================
     GOLDEN RATIO TYPOGRAPHY (GRT) VARIABLES (grtcalculator.com/math/)
     ========================================================================== */
  --phi: 1.6180339887;
  
  --font-size-base: 16px; /* Base body font size */
  --font-size-tiny: calc(var(--font-size-base) / var(--phi)); /* ~9.8px - for micro-labels */
  --font-size-small: calc(var(--font-size-base) / 1.25); /* ~12.8px - for comfortable sub-copy */
  --font-size-medium: var(--font-size-base); /* 16px - for standard readable paragraph copy */
  --font-size-h3: calc(var(--font-size-base) * var(--phi)); /* ~25.8px - for card titles */
  --font-size-h2: calc(var(--font-size-h3) * var(--phi)); /* ~41.8px - for secondary sections */
  --font-size-h1: calc(var(--font-size-h2) * var(--phi)); /* ~67.7px - for massive header text */

  --line-height-body: var(--phi); /* The Golden Line Height (1.618033) */
  --line-height-heading: 1.25; /* Tighter leading for larger heading wraps */
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(at 10% 20%, rgba(6, 182, 212, 0.03) 0px, transparent 50%),
    radial-gradient(at 90% 80%, rgba(168, 85, 247, 0.03) 0px, transparent 50%);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: var(--line-height-body);
  font-size: var(--font-size-medium);
  min-height: 100vh;
  overflow-x: hidden;
  padding: 1.5rem;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-cyan);
}

/* --------------------------------------------------------------------------
   2. DASHBOARD LAYOUT & WRAPPER
   -------------------------------------------------------------------------- */
.dashboard-wrapper {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-premium);
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-icon {
  font-size: 2.2rem;
  color: var(--accent-cyan);
  text-shadow: 0 0 15px rgba(6, 182, 212, 0.5);
  animation: float-logo 4s ease-in-out infinite;
}

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

.logo-text h1 {
  font-family: var(--font-header);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 2px;
  line-height: 1;
}

.logo-text h1 span {
  color: var(--accent-cyan);
  margin-left: 4px;
}

.logo-text p {
  font-size: 0.65rem;
  letter-spacing: 3px;
  color: var(--text-muted);
  margin-top: 2px;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  letter-spacing: 1px;
  font-weight: 500;
  color: var(--text-secondary);
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  position: relative;
}

.status-indicator.online {
  background-color: var(--accent-cyan);
  box-shadow: 0 0 10px var(--accent-cyan);
}

.status-indicator.online::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border: 1px solid var(--accent-cyan);
  border-radius: 50%;
  animation: pulse-ring 2s cubic-bezier(0.215, 0.610, 0.355, 1) infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.5); opacity: 1; }
  100% { transform: scale(1.8); opacity: 0; }
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.5rem;
}

/* --------------------------------------------------------------------------
   3. PREMIUM COMPONENTS (CARDS)
   -------------------------------------------------------------------------- */
.dashboard-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-premium);
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  content-visibility: auto; /* Guide Recommendation */
  contain-intrinsic-size: auto 300px auto 600px;
}

.dashboard-card:hover {
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.6), 0 0 20px 0 var(--border-glow);
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.card-header h2 {
  font-family: var(--font-header);
  font-size: calc(var(--font-size-base) * 1.25); /* ~20px - golden proportion for card headings */
  font-weight: 700;
  letter-spacing: 0.5px;
  flex-grow: 1;
  line-height: var(--line-height-heading);
}

.card-number {
  font-family: var(--font-header);
  font-size: var(--font-size-small);
  font-weight: 700;
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
}

.card-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  flex-grow: 1;
}

.section-desc {
  font-size: var(--font-size-small);
  color: var(--text-secondary);
  line-height: var(--line-height-body);
  max-width: 42rem; /* Constrain reading width for optimal scanning */
}

/* Individual Grid Assignments */
.intro-card {
  grid-column: span 4;
}

.sandbox-card {
  grid-column: span 8;
}

.strategy-card {
  grid-column: span 7;
}

.math-card {
  grid-column: span 5;
}

.simulator-card {
  grid-column: span 12;
}

@media (max-width: 1200px) {
  .intro-card, .sandbox-card, .strategy-card, .math-card {
    grid-column: span 12;
  }
}

/* --------------------------------------------------------------------------
   4. INTRO SECTION METRICS
   -------------------------------------------------------------------------- */
.hi-lo-explanation h3 {
  font-size: 0.95rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.hi-lo-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.hi-lo-group {
  display: grid;
  grid-template-columns: 50px 1fr;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 0.75rem;
  gap: 1rem;
}

.hi-lo-group.high { border-left: 3px solid var(--accent-red); }
.hi-lo-group.neutral { border-left: 3px solid var(--text-muted); }
.hi-lo-group.low { border-left: 3px solid var(--accent-green); }

.hi-lo-group .badge {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 32px;
  width: 32px;
  border-radius: 8px;
  font-weight: 700;
  font-family: var(--font-header);
}

.hi-lo-group.high .badge { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); }
.hi-lo-group.neutral .badge { background: rgba(100, 116, 139, 0.15); color: var(--text-secondary); }
.hi-lo-group.low .badge { background: rgba(16, 185, 129, 0.15); color: var(--accent-green); }

.hi-lo-group .cards-lbl {
  font-family: var(--font-header);
  font-weight: 600;
  font-size: 0.95rem;
  grid-column: 2;
  line-height: 1;
}

.hi-lo-group .desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  grid-column: 2;
  margin-top: 2px;
}

/* --------------------------------------------------------------------------
   5. SANDBOX & DEAL FEAT
   -------------------------------------------------------------------------- */
.deck-selector-row {
  display: flex;
  gap: 1rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: 1rem;
  border-radius: 14px;
}

.deal-selector h3, .felt-area h4 {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.card-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.card-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  font-family: var(--font-header);
  font-size: 1rem;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.card-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.card-btn.count-plus:hover {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--accent-green);
  color: var(--accent-green);
}

.card-btn.count-zero:hover {
  background: rgba(100, 116, 139, 0.15);
  border-color: var(--text-secondary);
}

.card-btn.count-minus:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--accent-red);
  color: var(--accent-red);
}

.felt-area {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.felt-cards-container {
  min-height: 85px;
  background: radial-gradient(100% 100% at 50% 0%, #153326 0%, #0d1e16 100%);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 14px;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  overflow-x: auto;
  position: relative;
  box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.8);
}

.felt-cards-container::-webkit-scrollbar {
  height: 4px;
}

.empty-felt-placeholder {
  font-size: 0.85rem;
  color: rgba(16, 185, 129, 0.4);
  width: 100%;
  text-align: center;
}

/* Dealt Card Visual Representation */
.dealt-card {
  width: 45px;
  height: 65px;
  background: #ffffff;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 4px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  animation: dealt-slide-in 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  flex-shrink: 0;
  position: relative;
}

@keyframes dealt-slide-in {
  from { transform: translateY(-30px) rotate(15deg); opacity: 0; }
  to { transform: translateY(0) rotate(0deg); opacity: 1; }
}

.dealt-card .card-rank {
  font-family: var(--font-header);
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
  color: #111827;
}

.dealt-card .card-suit {
  align-self: flex-end;
  font-size: 1.1rem;
  line-height: 1;
  color: #ef4444;
}

.dealt-card.black-suit .card-suit {
  color: #111827;
}

.dealt-card .card-mini-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.65rem;
  font-weight: 800;
  opacity: 0.45;
  color: #111827;
}

/* metrics-row */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.metric-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: 1rem;
  border-radius: 14px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.metric-card.highlight {
  border-color: rgba(6, 182, 212, 0.3);
  background: linear-gradient(180deg, rgba(6, 182, 212, 0.05) 0%, transparent 100%);
}

.metric-val {
  font-family: var(--font-header);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.5px;
}

.metric-card.highlight .metric-val {
  color: var(--accent-cyan);
  text-shadow: 0 0 15px rgba(6, 182, 212, 0.3);
}

.metric-lbl {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  margin-top: 6px;
}

/* --------------------------------------------------------------------------
   6. STRATEGY TABLE & DYNAMIC DEVIATIONS
   -------------------------------------------------------------------------- */
.true-count-control-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: 1rem;
  border-radius: 14px;
}

.tc-slider-wrapper {
  flex-grow: 1;
  min-width: 250px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.tc-slider-wrapper label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tc-display-badge {
  font-family: var(--font-header);
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.85rem;
  display: inline-block;
}

.tc-display-badge.positive {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
}

.tc-display-badge.negative {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
}

.slider-ticks-container {
  position: relative;
  padding-bottom: 20px;
}

.slider-ticks {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 0 4px;
}

.slider-ticks span {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-family: var(--font-header);
  transform: translateX(-50%);
  position: relative;
}

.slider-ticks span.tick-zero {
  color: var(--accent-cyan);
  font-weight: 700;
}

/* Strategy Legend */
.strategy-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.legend-box {
  width: 20px;
  height: 20px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  border-radius: 4px;
  font-family: var(--font-header);
  font-weight: 700;
  font-size: 0.65rem;
  color: #fff;
  line-height: 1;
}

.legend-box.act-s { background-color: var(--act-stand); }
.legend-box.act-h { background-color: var(--act-hit); }
.legend-box.act-d { background-color: var(--act-double); }
.legend-box.act-p { background-color: var(--act-split); }
.legend-box.act-su { background-color: var(--act-surrender); }

.active-deviation-legend {
  background: rgba(234, 179, 8, 0.15);
  border: 1px solid var(--accent-gold);
  color: var(--accent-gold);
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  font-size: 0.65rem;
}

/* Tabs */
.strategy-tabs-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.tab-buttons {
  display: flex;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: 4px;
  border-radius: 12px;
}

.tab-btn {
  flex-grow: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-header);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.2);
  color: var(--accent-cyan);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.table-scroll-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: 14px;
}

/* Strategy Grid Styling */
.strategy-table {
  width: 100%;
  border-collapse: collapse;
  text-align: center;
}

.strategy-table th, .strategy-table td {
  padding: 0.6rem 0.5rem;
  font-size: 0.75rem;
  border: 1px solid var(--border-color);
}

.strategy-table th {
  background: rgba(255, 255, 255, 0.02);
  font-family: var(--font-header);
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.8rem;
}

.strategy-table td.player-label {
  background: rgba(255, 255, 255, 0.02);
  font-family: var(--font-header);
  font-weight: 700;
  text-align: left;
  padding-left: 1rem;
  color: var(--text-primary);
  font-size: 0.8rem;
}

.strategy-cell {
  font-family: var(--font-header);
  font-weight: 800;
  font-size: 0.75rem;
  color: #ffffff;
  border-radius: 4px;
  position: relative;
  transition: var(--transition-smooth);
}

/* Cell State Colors */
.strategy-cell.cell-S { background-color: rgba(16, 185, 129, 0.8); }
.strategy-cell.cell-H { background-color: rgba(239, 68, 68, 0.8); }
.strategy-cell.cell-D { background-color: rgba(59, 130, 246, 0.8); }
.strategy-cell.cell-P { background-color: rgba(168, 85, 247, 0.8); }
.strategy-cell.cell-SU { background-color: rgba(249, 115, 22, 0.8); }

/* Highlight Deviations */
.strategy-cell.deviation-active {
  box-shadow: 0 0 0 2px var(--accent-gold);
  z-index: 2;
  animation: cell-glow 1.5s infinite alternate;
}

.strategy-cell.deviation-active::after {
  content: '⚡';
  position: absolute;
  top: 1px;
  right: 1px;
  font-size: 0.5rem;
  color: var(--accent-gold);
}

@keyframes cell-glow {
  0% { box-shadow: 0 0 0 1px var(--accent-gold); }
  100% { box-shadow: 0 0 8px 2px var(--accent-gold); }
}

/* Logs and active lists */
.deviation-logs-container {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 14px;
  padding: 1rem;
}

.deviation-logs-container h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.deviation-logs-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 120px;
  overflow-y: auto;
}

.no-deviations-msg {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.deviation-log-item {
  font-size: 0.78rem;
  padding: 6px 10px;
  background: rgba(234, 179, 8, 0.05);
  border: 1px dashed rgba(234, 179, 8, 0.2);
  border-radius: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.deviation-log-item .lbl {
  font-weight: 500;
  color: var(--text-primary);
}

.deviation-log-item .val {
  font-family: var(--font-header);
  font-weight: 600;
  color: var(--accent-gold);
}

/* --------------------------------------------------------------------------
   7. RISK PARAMETERS & BANKROLL MATH
   -------------------------------------------------------------------------- */
.risk-inputs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

@media (max-width: 580px) {
  .risk-inputs-grid {
    grid-template-columns: 1fr;
  }
}

.ev-card-container {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.08) 0%, rgba(168, 85, 247, 0.04) 100%);
  border: 1px solid rgba(6, 182, 212, 0.15);
  border-radius: 16px;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sub-metric {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  padding-bottom: 4px;
}

.sub-metric:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.sub-metric .lbl {
  color: var(--text-secondary);
}

.sub-metric .val {
  font-family: var(--font-header);
  font-weight: 600;
  color: var(--text-primary);
}

.sub-metric #adv-percentage {
  color: var(--accent-gold);
  font-size: 0.95rem;
  font-weight: 700;
}

/* Ruin Gauge Chart */
.ruin-chart-wrapper {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: 1rem;
  border-radius: 16px;
}

@media (max-width: 480px) {
  .ruin-chart-wrapper {
    flex-direction: column;
  }
}

.ruin-gauge-box {
  width: 130px;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
}

.gauge-svg {
  width: 100%;
}

.gauge-text {
  position: absolute;
  bottom: 0px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.gauge-val {
  font-family: var(--font-header);
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1;
}

.gauge-lbl {
  font-size: 0.6rem;
  letter-spacing: 1px;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-top: 2px;
}

.math-explainer {
  flex-grow: 1;
}

.math-explainer h4 {
  font-size: var(--font-size-small);
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  margin-bottom: 0.4rem;
}

.formula-block {
  font-family: var(--font-header);
  font-size: var(--font-size-medium);
  font-weight: 600;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px 10px;
  border-radius: 8px;
  display: inline-block;
  color: var(--accent-cyan);
  margin-bottom: 0.5rem;
}

.math-explainer p {
  font-size: var(--font-size-small);
  color: var(--text-secondary);
  line-height: var(--line-height-body);
  max-width: 38rem; /* Constrain explanation copy for highly scanning speed */
}

/* Canvas wrapping */
.chart-container {
  position: relative;
  width: 100%;
  height: 140px;
}

/* --------------------------------------------------------------------------
   8. MONTE CARLO SIMULATOR CARD
   -------------------------------------------------------------------------- */
.sim-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.input-group-row {
  display: flex;
  gap: 0.75rem;
}

.sim-actions {
  display: flex;
  gap: 0.5rem;
}

@media (max-width: 768px) {
  .sim-controls {
    flex-direction: column;
    align-items: stretch;
  }
}

.simulation-progress-bar-container {
  height: 24px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-cyan) 0%, var(--accent-purple) 100%);
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.4);
  transition: width 0.1s linear;
}

.progress-text {
  position: absolute;
  width: 100%;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

.simulator-layout-grid {
  display: grid;
  grid-template-columns: 7fr 5fr;
  gap: 1.5rem;
}

@media (max-width: 990px) {
  .simulator-layout-grid {
    grid-template-columns: 1fr;
  }
}

.sim-chart-container {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sim-chart-container h3, .sim-results-panel h3 {
  font-family: var(--font-header);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-primary);
}

.canvas-wrapper {
  position: relative;
  width: 100%;
  height: 280px;
}

.canvas-wrapper-sm {
  position: relative;
  width: 100%;
  height: 100px;
}

.sim-results-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sim-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.sim-stat-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
}

.sim-stat-box .lbl {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

.sim-stat-box .val {
  font-family: var(--font-header);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 4px;
  line-height: 1.1;
}

#sim-stat-observed-adv, #sim-stat-expected-ev {
  color: var(--accent-cyan);
}

#sim-stat-actual-result {
  color: var(--accent-green);
}

#sim-stat-observed-ror {
  color: var(--accent-red);
}

.sim-histogram-section {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 16px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sim-histogram-section h4 {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

/* --------------------------------------------------------------------------
   9. FORMS & BUTTONS DESIGN SYSTEM
   -------------------------------------------------------------------------- */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex-grow: 1;
}

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

.form-select, .form-input {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  padding: 8px 12px;
  outline: none;
  transition: var(--transition-smooth);
}

.form-select:focus, .form-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.25);
  background: rgba(255, 255, 255, 0.06);
}

.form-select option {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}

/* Custom Range Sliders */
.form-range {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  transition: var(--transition-smooth);
  cursor: pointer;
}

.form-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 8px var(--accent-cyan);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.form-range::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* Specialized True Count Slider */
.tc-slider::-webkit-slider-thumb {
  background: var(--accent-gold);
  box-shadow: 0 0 10px var(--accent-gold);
}

/* Buttons */
.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  font-family: var(--font-header);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition-smooth);
  outline: none;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-blue) 100%);
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(6, 182, 212, 0.5);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-cyan);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--accent-red);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.2);
}

.btn-sm {
  font-size: 0.72rem;
  padding: 4px 10px;
  border-radius: 6px;
}

.hidden {
  display: none !important;
}

/* Custom Toggle Switch */
.toggle-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toggle-lbl {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 22px;
}

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

.slider.round {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: .4s;
  border-radius: 24px;
}

.slider.round:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-secondary);
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: rgba(6, 182, 212, 0.25);
  border-color: var(--accent-cyan);
}

input:checked + .slider:before {
  transform: translateX(20px);
  background-color: var(--accent-cyan);
  box-shadow: 0 0 8px var(--accent-cyan);
}

/* Footer styling */
.app-footer {
  text-align: center;
  padding: 1.5rem;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  border-radius: 16px;
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

/* --------------------------------------------------------------------------
   10. SEMANTIC TOOLTIPS & INFO ICONS
   -------------------------------------------------------------------------- */
.tooltip-term {
  position: relative;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.25);
  cursor: help;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tooltip-term:hover {
  border-bottom-color: var(--accent-cyan);
}

.info-icon {
  font-size: 0.68rem;
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.2);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  transition: var(--transition-smooth);
}

.tooltip-term:hover .info-icon {
  background: var(--accent-cyan);
  color: var(--bg-primary);
  box-shadow: 0 0 6px var(--accent-cyan);
}

/* Glassmorphic CSS-Only Tooltip box */
.tooltip-term::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 130%;
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  width: 240px;
  background: rgba(12, 17, 28, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  color: var(--text-primary);
  text-align: left;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.4;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 999;
  text-transform: none; /* Reset uppercase labels */
  letter-spacing: normal;
}

/* Tooltip arrow */
.tooltip-term::after {
  content: "";
  position: absolute;
  bottom: 115%;
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  border-width: 6px;
  border-style: solid;
  border-color: rgba(12, 17, 28, 0.95) transparent transparent transparent;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 999;
}

/* Hover reveal */
.tooltip-term:hover::before,
.tooltip-term:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* --------------------------------------------------------------------------
   11. SIMPLE MODE LAYOUT OVERRIDES
   -------------------------------------------------------------------------- */
.simple-mode-active .advanced-panel {
  display: none !important;
}

@media (min-width: 1201px) {
  .simple-mode-active .intro-card {
    grid-column: span 4;
  }
  .simple-mode-active .sandbox-card {
    grid-column: span 8;
  }
  .simple-mode-active .strategy-card {
    grid-column: span 12; /* Expands to full screen width under simple mode */
  }
}


