/* Apex Karting Academy - css/style.css
   Frosted liquid-glass motorsport telemetry UI, Paddock Hub, Coaching HUD, and iPad touch controls. */

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0b1120;
  color: #f8fafc;
  font-family: 'Baloo 2', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

#game-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  z-index: 1;
}

#ui-root {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

.screen, .hud {
  width: 100%;
  height: 100%;
}

[hidden] {
  display: none !important;
}

.glass {
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.42);
}

.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.icon svg {
  width: 22px;
  height: 22px;
}

.eyebrow {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #38bdf8;
  text-transform: uppercase;
}

/* ==================== HOME / PADDOCK SCREEN ==================== */
.screen-home {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  padding: 18px 24px;
  background: radial-gradient(circle at 50% 20%, rgba(15, 23, 42, 0.35), rgba(2, 6, 23, 0.72));
  overflow-y: auto;
}

.home-shell {
  max-width: 1320px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
}

.home-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  border-radius: 20px;
  gap: 16px;
  flex-wrap: wrap;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  background: linear-gradient(135deg, #ef233c, #f97316);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(239, 35, 60, 0.45);
}

.brand-logo .icon svg {
  width: 30px;
  height: 30px;
}

.brand-title {
  font-family: 'Lilita One', 'Baloo 2', sans-serif;
  font-size: 1.75rem;
  letter-spacing: 0.03em;
  line-height: 1.05;
  color: #ffffff;
}

.driver-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.driver-pill, .license-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(30, 41, 59, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 6px 14px;
  border-radius: 14px;
}

.driver-num, .license-badge {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0f172a;
}

.driver-name, .license-title {
  font-weight: 800;
  font-size: 0.95rem;
  line-height: 1.1;
}

.driver-class, .license-xp {
  font-size: 0.78rem;
  color: #94a3b8;
}

.home-tabs {
  display: flex;
  gap: 10px;
  padding: 8px;
  border-radius: 16px;
  flex-wrap: wrap;
}

.tab-btn {
  flex: 1;
  min-width: 180px;
  min-height: 48px;
  border: 1px solid transparent;
  background: rgba(30, 41, 59, 0.55);
  color: #cbd5e1;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.96rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 8px 16px;
  cursor: pointer;
  transition: all 0.16s ease;
}

.tab-btn:hover {
  background: rgba(51, 65, 85, 0.78);
  color: #ffffff;
}

.tab-btn.active {
  background: linear-gradient(135deg, #2563eb, #0284c7);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow: 0 6px 18px rgba(2, 132, 199, 0.38);
}

.tab-btn.highlight-tab {
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.25), rgba(249, 115, 22, 0.25));
  border-color: rgba(250, 204, 21, 0.45);
  color: #fde047;
}

.home-content {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 16px;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 16px;
}

.mode-card {
  border-radius: 18px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.16s ease, border-color 0.16s ease;
}

.mode-card:hover {
  transform: translateY(-2px);
  border-color: rgba(56, 189, 248, 0.48);
}

.mode-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.pill-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.18);
  color: #38bdf8;
  margin-bottom: 4px;
}

.mode-card h3 {
  font-size: 1.25rem;
  line-height: 1.15;
  color: #ffffff;
}

.mode-sub {
  font-size: 0.85rem;
  color: #94a3b8;
}

.grade-medal {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  border: 2px solid #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Lilita One', sans-serif;
  font-size: 1.35rem;
  background: rgba(15, 23, 42, 0.65);
  flex-shrink: 0;
}

.mode-desc {
  font-size: 0.88rem;
  line-height: 1.4;
  color: #cbd5e1;
}

.drill-steps {
  list-style: none;
  background: rgba(2, 6, 23, 0.46);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
  color: #e2e8f0;
}

.corner-badges-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.corner-mini-badge {
  font-size: 0.76rem;
  padding: 3px 8px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid #475569;
}

.mode-card-foot {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mode-stats {
  display: flex;
  flex-direction: column;
  font-size: 0.8rem;
  color: #94a3b8;
}

.mode-stats strong {
  color: #f8fafc;
}

.primary-btn, .secondary-btn {
  min-height: 48px;
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.primary-btn {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.35);
}

.secondary-btn {
  background: rgba(30, 41, 59, 0.85);
  color: #f8fafc;
}

.primary-btn:hover, .secondary-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

/* ==================== GARAGE PANEL ==================== */
.garage-panel {
  border-radius: 18px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.garage-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.field-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 700;
  color: #cbd5e1;
  flex: 1;
  min-width: 200px;
}

.text-inp {
  height: 46px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(2, 6, 23, 0.65);
  color: #ffffff;
  padding: 0 14px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
}

.section-sub {
  font-size: 1.05rem;
  color: #38bdf8;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.choice-card {
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(30, 41, 59, 0.65);
  border: 2px solid rgba(255, 255, 255, 0.12);
  color: #f8fafc;
  text-align: left;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
}

.choice-card.active {
  border-color: #facc15;
  background: rgba(250, 204, 21, 0.14);
}

.choice-meta {
  font-size: 0.78rem;
  color: #94a3b8;
}

.livery-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.livery-swatch {
  min-height: 48px;
  padding: 8px 16px;
  border-radius: 12px;
  background: rgba(30, 41, 59, 0.65);
  border: 2px solid rgba(255, 255, 255, 0.12);
  color: #f8fafc;
  font-family: inherit;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.livery-swatch.active {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.18);
}

.swatch-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 3px solid #ffffff;
}

/* ==================== IN-GAME COACHING HUD ==================== */
.hud {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px 16px;
  pointer-events: none;
}

.hud-top {
  display: grid;
  grid-template-columns: 270px 1fr auto;
  gap: 12px;
  align-items: start;
}

.hud-card {
  border-radius: 16px;
  padding: 10px 14px;
  pointer-events: auto;
}

.hud-session-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  margin-bottom: 6px;
}

.badge {
  background: #ef233c;
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 6px;
}

.hud-timers {
  display: flex;
  gap: 18px;
  margin-bottom: 6px;
}

.timer-col {
  display: flex;
  flex-direction: column;
}

.timer-label {
  font-size: 0.66rem;
  color: #94a3b8;
  font-weight: 700;
}

.timer-val {
  font-family: monospace;
  font-size: 1.15rem;
  font-weight: 800;
  color: #f8fafc;
}

.hud-corner-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.c-pill {
  font-size: 0.68rem;
  padding: 1px 6px;
  border-radius: 6px;
  border: 1px solid #475569;
  background: rgba(2, 6, 23, 0.55);
}

.c-pill.current {
  background: rgba(250, 204, 21, 0.24);
}

/* Center Coaching Banner */
.hud-coach-banner {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 620px;
  width: 100%;
  justify-self: center;
}

.coach-corner-title {
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #94a3b8;
}

.coach-action-prompt {
  font-family: 'Lilita One', 'Baloo 2', sans-serif;
  font-size: 1.28rem;
  letter-spacing: 0.02em;
  color: #10b981;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.line-guide-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.line-side-label {
  font-size: 0.64rem;
  font-weight: 800;
  color: #94a3b8;
}

.line-guide-bar {
  flex: 1;
  height: 12px;
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.16);
  position: relative;
  overflow: hidden;
}

.line-target-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 20px;
  transform: translateX(-50%);
  background: rgba(16, 185, 129, 0.45);
  border-left: 2px solid #10b981;
  border-right: 2px solid #10b981;
  transition: left 0.06s linear;
}

.line-player-marker {
  position: absolute;
  top: 1px;
  width: 10px;
  height: 8px;
  border-radius: 999px;
  transform: translateX(-50%);
  background: #facc15;
  box-shadow: 0 0 8px #facc15;
  transition: left 0.04s linear;
}

.line-player-marker.on-target {
  background: #10b981;
  box-shadow: 0 0 10px #10b981;
}

/* Toolbar */
.hud-toolbar {
  display: flex;
  gap: 6px;
  align-items: center;
}

.tool-btn {
  min-width: 46px;
  height: 46px;
  padding: 0 10px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(30, 41, 59, 0.7);
  color: #cbd5e1;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
}

.tool-btn.active {
  border-color: #38bdf8;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.16);
}

.tool-btn.danger:hover {
  border-color: #f43f5e;
  color: #f43f5e;
}

/* Corner Report Card Popup */
.hud-corner-report {
  position: fixed;
  right: 16px;
  top: 96px;
  width: 310px;
  border-radius: 16px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: auto;
  animation: popIn 0.22s ease-out;
}

@keyframes popIn {
  from { opacity: 0; transform: translateX(20px) scale(0.95); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

.rep-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.rep-eyebrow {
  font-size: 0.66rem;
  font-weight: 800;
  color: #38bdf8;
}

.rep-title {
  font-size: 0.98rem;
  color: #ffffff;
}

.rep-grade {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  color: #0f172a;
  font-family: 'Lilita One', sans-serif;
  font-size: 1.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rep-bars {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rep-bar-row {
  display: grid;
  grid-template-columns: 88px 1fr 30px;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
}

.rep-bar {
  height: 7px;
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.65);
  overflow: hidden;
}

.rep-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #10b981);
  border-radius: 999px;
}

.rep-speed-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #cbd5e1;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.rep-advice {
  font-size: 0.78rem;
  line-height: 1.3;
  color: #fef08a;
  background: rgba(250, 204, 21, 0.1);
  padding: 6px 8px;
  border-radius: 8px;
}

/* ==================== BOTTOM TELEMETRY & DASH ==================== */
.hud-bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.hud-left-cluster {
  display: flex;
  gap: 10px;
}

.minimap-card, .grip-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 10px;
}

.widget-title {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #94a3b8;
  margin-bottom: 2px;
}

.grip-status {
  font-size: 0.68rem;
  font-weight: 800;
  margin-top: 2px;
}

/* Center MyChron Pro Dash */
.hud-dash {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 16px;
  min-width: 355px;
}

.rpm-bar {
  display: grid;
  grid-template-columns: repeat(16, 1fr);
  gap: 4px;
}

.rpm-led {
  height: 7px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
}

.rpm-led.on.green { background: #10b981; box-shadow: 0 0 6px #10b981; }
.rpm-led.on.yellow { background: #facc15; box-shadow: 0 0 6px #facc15; }
.rpm-led.on.red { background: #ef4444; box-shadow: 0 0 6px #ef4444; }

.dash-main-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.pedal-meters {
  display: flex;
  gap: 8px;
}

.pedal-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.64rem;
  font-weight: 800;
  color: #94a3b8;
}

.pedal-track {
  width: 12px;
  height: 54px;
  border-radius: 6px;
  background: rgba(2, 6, 23, 0.7);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.pedal-fill {
  width: 100%;
  height: 0%;
  transition: height 0.04s linear;
}

.pedal-fill.brake { background: #ef4444; }
.pedal-fill.throttle { background: #10b981; }

.speed-cluster {
  text-align: center;
}

.speed-num {
  font-family: 'Lilita One', sans-serif;
  font-size: 2.5rem;
  line-height: 0.95;
  color: #ffffff;
}

.speed-unit {
  font-size: 0.68rem;
  font-weight: 800;
  color: #94a3b8;
}

.target-speed-pill {
  margin-top: 3px;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.16);
  color: #38bdf8;
}

.physics-badges {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.phys-pill {
  font-size: 0.64rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: #64748b;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.phys-pill.active {
  background: rgba(16, 185, 129, 0.22);
  color: #34d399;
  border-color: #10b981;
}

.phys-pill.warn.active {
  background: rgba(239, 68, 68, 0.28);
  color: #fca5a5;
  border-color: #ef4444;
}

.telemetry-graph-wrap {
  background: rgba(2, 6, 23, 0.62);
  border-radius: 10px;
  padding: 4px 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.tele-legend {
  display: flex;
  justify-content: space-between;
  font-size: 0.64rem;
  font-weight: 700;
  padding: 0 4px;
}

.leg-gas { color: #10b981; }
.leg-brk { color: #ef4444; }
.leg-str { color: #38bdf8; }

/* Touch Controls */
.touch-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: auto;
}

.touch-steer-pad {
  width: 128px;
  height: 112px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.75);
  border: 2px solid rgba(56, 189, 248, 0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 0.64rem;
  font-weight: 800;
  color: #94a3b8;
  cursor: grab;
  touch-action: none;
}

.touch-wheel-graphic .icon svg {
  width: 54px;
  height: 54px;
  color: #38bdf8;
}

.touch-pedals {
  display: flex;
  gap: 8px;
}

.touch-pedal {
  width: 74px;
  height: 112px;
  border-radius: 14px;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 800;
  color: #ffffff;
  border: 2px solid rgba(255, 255, 255, 0.22);
  cursor: pointer;
  touch-action: none;
}

.brake-pedal {
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.78), rgba(185, 28, 28, 0.88));
}

.gas-pedal {
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.78), rgba(5, 150, 105, 0.88));
}

.touch-pedal.pressed {
  transform: scale(0.95);
  filter: brightness(1.2);
}

/* ==================== MODAL & INTERACTIVE LAB ==================== */
.screen-modal, .screen-lab {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(2, 6, 23, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  pointer-events: auto;
}

.modal-card {
  max-width: 620px;
  width: 100%;
  border-radius: 22px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-grade {
  width: 62px;
  height: 62px;
  border-radius: 16px;
  color: #0f172a;
  font-family: 'Lilita One', sans-serif;
  font-size: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.kpi-box {
  background: rgba(2, 6, 23, 0.55);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  font-size: 0.75rem;
  color: #94a3b8;
}

.kpi-box strong {
  font-size: 1.05rem;
  color: #ffffff;
}

.modal-bars .rep-bar-row {
  grid-template-columns: 220px 1fr 44px;
  font-size: 0.84rem;
}

.coach-tip-box {
  background: rgba(250, 204, 21, 0.14);
  border: 1px solid rgba(250, 204, 21, 0.4);
  color: #fef08a;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 0.9rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Lab Specific */
.lab-card {
  max-width: 1060px;
  width: 100%;
  border-radius: 22px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 94vh;
  overflow-y: auto;
}

.lab-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(30, 41, 59, 0.8);
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.lab-Presets-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.lab-preset-btn {
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(30, 41, 59, 0.72);
  border: 2px solid rgba(255, 255, 255, 0.12);
  color: #f8fafc;
  font-family: inherit;
  text-align: left;
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.lab-preset-btn.active {
  border-color: #facc15;
  background: rgba(250, 204, 21, 0.16);
}

.lab-preset-title {
  font-weight: 800;
  font-size: 0.92rem;
}

.lab-preset-badge {
  font-size: 0.74rem;
  color: #38bdf8;
  font-weight: 700;
}

.lab-body {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 16px;
}

.lab-canvas-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#lab-sim-canvas {
  width: 100%;
  height: auto;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.lab-explain-box {
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #e0f2fe;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.88rem;
}

.lab-controls {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.lab-metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.lab-metric {
  background: rgba(2, 6, 23, 0.58);
  padding: 10px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
}

.lab-metric-label {
  font-size: 0.72rem;
  color: #94a3b8;
}

.lab-metric-val {
  font-size: 1.28rem;
  color: #ffffff;
}

.lab-metric-val.highlight {
  color: #facc15;
}

.lab-metric-sub {
  font-size: 0.7rem;
  color: #64748b;
}

.lab-metric-sub.good { color: #10b981; font-weight: 800; }
.lab-metric-sub.bad { color: #f43f5e; font-weight: 800; }

.lab-sliders {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(2, 6, 23, 0.45);
  padding: 14px;
  border-radius: 14px;
}

.lab-slider-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.84rem;
  font-weight: 700;
}

.lab-slider-row input[type="range"] {
  width: 100%;
  accent-color: #facc15;
}

@media (max-width: 1024px) {
  .hud-top {
    grid-template-columns: 1fr;
  }
  .lab-body {
    grid-template-columns: 1fr;
  }
  .minimap-card {
    display: none;
  }
}
