:root {
  --navy-950: #070b14;
  --navy-900: #0b1220;
  --navy-800: #101a2c;
  --cyan: #38f2e0;
  --cyan-dim: #1e8f88;
  --amber: #ffb547;
  --amber-dim: #b3791f;
  --ember: #ff6a4d;
  --ember-dim: #c23f26;
  --line-dark: #1f2d44;

  /* Speed Drill hero — warm dark base */
  --drill-950: #170f08;
  --drill-line: #35291a;

  --bg-light: #f4f6f9;
  --card: #ffffff;
  --border: #e3e8ef;
  --text-dark: #1a2233;
  --text-mid: #5b6b82;
  --text-low: #8a97a8;
  --mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  --sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg-light);
  color: var(--text-dark);
  -webkit-font-smoothing: antialiased;
}

/* ===== TOPNAV (Dark Chrome) ===== */
.topnav {
  background: var(--navy-950);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 32px;
  border-bottom: 1px solid var(--line-dark);
  position: relative;
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand .logo {
  width: 36px;
  height: 36px;
  background: var(--cyan);
  color: var(--navy-950);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.5px;
}

.brand .name {
  color: #ffffff;
  font-weight: 700;
  font-size: 15px;
  line-height: 1.2;
}

.brand .sub {
  color: var(--text-low);
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.navlinks {
  display: flex;
  align-items: center;
  gap: 24px;
}

.navlinks a {
  color: var(--text-low);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.15s ease;
}

.navlinks a:hover,
.navlinks a.active {
  color: var(--cyan);
  font-weight: 600;
}

/* --- Dropdown in Nav --- */
.navlinks .dropdown {
  position: relative;
}

.navlinks .dropdown-toggle {
  color: var(--text-low);
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  user-select: none;
  transition: color 0.15s ease;
}

.navlinks .dropdown:hover .dropdown-toggle,
.navlinks .dropdown.open .dropdown-toggle,
.navlinks .dropdown-toggle.active {
  color: var(--cyan);
  font-weight: 600;
}

.navlinks .dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  margin-top: 6px;
  left: 0;
  background: var(--navy-800);
  border: 1px solid var(--line-dark);
  border-radius: 8px;
  min-width: 210px;
  overflow: visible;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  z-index: 100;
}

.navlinks .dropdown-menu::before {
  content: "";
  position: absolute;
  top: -12px;
  left: 0;
  right: 0;
  height: 12px;
}

.navlinks .dropdown-menu a {
  display: block;
  padding: 11px 16px;
  font-size: 13px;
  color: #cfd8e3;
  text-decoration: none;
  transition: all 0.15s ease;
}

.navlinks .dropdown-menu a:hover {
  background: rgba(56, 242, 224, 0.12);
  color: var(--cyan);
}

.navlinks .dropdown:hover .dropdown-menu,
.navlinks .dropdown.open .dropdown-menu {
  display: block !important;
}

.back-btn {
  background: var(--navy-800);
  color: #cfd8e3;
  border: 1px solid var(--line-dark);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: all 0.15s ease;
}

.back-btn:hover {
  background: var(--line-dark);
  color: #ffffff;
}

/* ===== HERO (Graph-Paper Blueprint Pattern) ===== */
.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 6% -20%, rgba(56, 242, 224, 0.16), transparent 42%),
    radial-gradient(circle at 100% 120%, rgba(255, 181, 71, 0.08), transparent 45%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.028) 0 1px, transparent 1px 34px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.028) 0 1px, transparent 1px 34px),
    var(--navy-950);
  padding: 24px 32px 28px;
}

/* Speed Drill Variant Hero */
.hero.hero-speed {
  background:
    radial-gradient(circle at 6% -20%, rgba(255, 181, 71, 0.18), transparent 42%),
    radial-gradient(circle at 100% 120%, rgba(255, 106, 77, 0.14), transparent 45%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.028) 0 1px, transparent 1px 34px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.028) 0 1px, transparent 1px 34px),
    var(--drill-950);
}

.breadcrumb {
  color: var(--cyan-dim);
  font-size: 13px;
  margin-bottom: 8px;
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--cyan-dim, #0d9488);
  text-decoration: none;
  transition: color 0.15s ease;
}

.breadcrumb a:hover {
  color: var(--cyan, #06b6d4);
  text-decoration: underline;
}

.breadcrumb .sep {
  opacity: 0.6;
}

.breadcrumb b, .breadcrumb span.current {
  color: var(--cyan);
  font-weight: 600;
}

.hero.hero-speed .breadcrumb {
  color: var(--amber-dim);
}

.hero.hero-speed .breadcrumb a {
  color: var(--amber-dim);
}

.hero.hero-speed .breadcrumb a:hover {
  color: var(--amber);
}

.hero.hero-speed .breadcrumb b, .hero.hero-speed .breadcrumb span.current {
  color: var(--amber);
}

.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  position: relative;
  z-index: 2;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 1.5px;
  color: var(--cyan);
  text-transform: uppercase;
  margin-bottom: 10px;
  position: relative;
  z-index: 2;
}

.eyebrow::before {
  content: "</> ";
}

.eyebrow.eyebrow-amber {
  color: var(--amber);
}

.eyebrow.eyebrow-ember {
  color: var(--ember);
}

h1.hero-title {
  color: #ffffff;
  font-size: 30px;
  font-weight: 800;
  margin: 0 0 10px;
  position: relative;
  z-index: 2;
  letter-spacing: -0.5px;
}

.hero p.sub {
  color: var(--text-low);
  font-size: 14.5px;
  max-width: 680px;
  line-height: 1.6;
  margin: 0 0 20px;
  position: relative;
  z-index: 2;
}

/* Hero HUD Timer */
.drill-timer {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--drill-line);
  border-radius: 10px;
  padding: 14px 22px;
  text-align: center;
  min-width: 155px;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

.drill-timer .tlabel {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-low);
  margin-bottom: 6px;
}

.drill-timer .tval {
  font-family: var(--mono);
  font-size: 32px;
  font-weight: 800;
  color: var(--cyan);
  letter-spacing: 1px;
  transition: color 0.2s ease;
}

.drill-timer.warn .tval {
  color: var(--amber);
}

.drill-timer.danger .tval {
  color: var(--ember);
  animation: pulseDanger 1s infinite;
}

@keyframes pulseDanger {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.drill-timer .tcap {
  font-size: 10.5px;
  color: var(--text-low);
  margin-top: 4px;
}

/* Subnav Navigation */
.subnav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  position: relative;
  z-index: 2;
  margin-top: 6px;
}

.subnav a {
  font-size: 13.5px;
  color: #cfd8e3;
  background: var(--navy-800);
  border: 1px solid var(--line-dark);
  padding: 9px 16px;
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.15s ease;
}

.subnav a:hover {
  border-color: var(--cyan-dim);
  color: #ffffff;
}

.subnav a.active {
  color: var(--cyan);
  background: rgba(56, 242, 224, 0.08);
  border-color: var(--cyan-dim);
  font-weight: 600;
}

.hero.hero-speed .subnav a {
  background: rgba(0, 0, 0, 0.25);
  border-color: var(--drill-line);
}

.hero.hero-speed .subnav a.active {
  color: var(--ember);
  background: rgba(255, 106, 77, 0.1);
  border-color: var(--ember-dim);
}

/* ===== LAYOUTS ===== */
.layout-2col {
  display: grid;
  grid-template-columns: 1fr 310px;
  gap: 24px;
  padding: 28px 32px 60px;
  align-items: start;
}

.layout-3col {
  display: grid;
  grid-template-columns: 260px 1fr 310px;
  gap: 24px;
  padding: 28px 32px 60px;
  align-items: start;
}

/* ===== CARDS & CONTAINERS ===== */
.cluster {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 14px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(20, 30, 50, 0.04);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.cluster.open {
  border-color: #bfe9e4;
  box-shadow: 0 4px 18px rgba(30, 143, 136, 0.08);
}

.cluster-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  cursor: pointer;
  user-select: none;
}

.badge-num {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  background: var(--navy-950);
  color: var(--cyan);
  min-width: 32px;
  height: 32px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cluster.open .badge-num {
  background: var(--cyan);
  color: var(--navy-950);
}

.cluster-titles {
  flex: 1;
  min-width: 0;
}

.cluster-titles h3 {
  margin: 0 0 3px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-dark);
}

.cluster-titles .tag {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-low);
}

.cluster-titles .tag::before {
  content: "// ";
  color: var(--cyan-dim);
}

.cluster-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.count-pill {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-mid);
  background: #eef1f6;
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

.chevron {
  width: 18px;
  height: 18px;
  color: var(--text-low);
  transition: transform 0.2s ease;
}

.cluster.open .chevron {
  transform: rotate(180deg);
  color: var(--cyan-dim);
}

.cluster-body {
  display: none;
  padding: 0 20px 22px;
  border-top: 1px solid var(--border);
}

.cluster.open .cluster-body {
  display: block;
}

.overview {
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--text-mid);
  background: #f7f9fc;
  border: 1px solid var(--border);
  border-left: 3px solid var(--cyan-dim);
  padding: 14px 18px;
  margin: 18px 0;
  border-radius: 6px;
}

.guiding-q {
  font-size: 14px;
  color: var(--amber-dim);
  font-style: italic;
  margin: 0 0 18px;
  padding-left: 14px;
  border-left: 2px solid var(--amber);
}

.micro {
  background: #fbfcfe;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 12px;
  padding: 16px 18px;
}

.micro-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.micro-num {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--cyan-dim);
  flex-shrink: 0;
  margin-top: 2px;
  font-weight: 700;
}

.micro-head h4 {
  margin: 0 0 4px;
  font-size: 14.5px;
  color: var(--text-dark);
}

.micro-head p {
  margin: 0;
  font-size: 13px;
  color: var(--text-mid);
  line-height: 1.6;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.info-box {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
}

.info-box .k {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-low);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.info-box .v {
  font-size: 12.5px;
  color: var(--text-dark);
  line-height: 1.55;
}

.info-box.key {
  border-color: #bfe9e4;
  background: #f0fbfa;
}

.info-box.key .k {
  color: var(--cyan-dim);
}

.info-box.trap {
  border-color: #f6ddb0;
  background: #fff9ef;
}

.info-box.trap .k {
  color: var(--amber-dim);
}

/* ===== DERIVATION TRACE (Dark Inset) ===== */
.derivation {
  margin-top: 14px;
  background: var(--navy-950);
  border: 1px solid var(--line-dark);
  border-radius: 8px;
  padding: 16px 18px;
}

.dv-label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 1.5px;
  color: var(--cyan);
  text-transform: uppercase;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.dv-label::before {
  content: "⚡";
}

.trace-steps {
  position: relative;
  padding-left: 22px;
}

.trace-steps::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 4px;
  bottom: 4px;
  width: 1px;
  background: repeating-linear-gradient(180deg, var(--cyan-dim) 0 4px, transparent 4px 8px);
}

.trace-step {
  position: relative;
  margin-bottom: 10px;
  font-size: 12.5px;
  color: var(--text-low);
  line-height: 1.5;
}

.trace-step:last-child {
  margin-bottom: 0;
  color: var(--cyan);
}

.trace-step::before {
  content: "";
  position: absolute;
  left: -22px;
  top: 5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--navy-950);
  border: 1.5px solid var(--cyan-dim);
}

.trace-step:last-child::before {
  border-color: var(--cyan);
  background: var(--cyan);
}

.trace-step .eq {
  font-family: var(--mono);
  color: #e8f3f2;
}

/* Expand Strip Buttons */
.expand-strip {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.strip-btn {
  flex: 1;
  font-family: var(--mono);
  font-size: 11.5px;
  text-align: left;
  background: #ffffff;
  border: 1px solid var(--border);
  color: var(--text-mid);
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: all 0.15s ease;
}

.strip-btn:hover {
  border-color: var(--text-mid);
}

.strip-btn.sim-btn {
  color: var(--cyan-dim);
  border-color: #bfe9e4;
  background: #f0fbfa;
}

.strip-btn.sim-btn:hover {
  background: #e1f7f5;
}

.strip-btn.trap-btn {
  color: var(--amber-dim);
  border-color: #f6ddb0;
  background: #fffaf0;
}

/* ===== SIDEBAR & COCKPIT CONTROLS ===== */
.side-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  position: sticky;
  top: 24px;
  box-shadow: 0 1px 3px rgba(20, 30, 50, 0.04);
}

.side-card h4 {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--cyan-dim);
  margin: 0 0 6px;
}

.side-card h3 {
  margin: 0 0 16px;
  font-size: 18px;
  color: var(--text-dark);
}

.node-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}

.node {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-mid);
  background: #fbfcfe;
  cursor: pointer;
  transition: all 0.15s ease;
}

.node:hover {
  border-color: var(--cyan-dim);
}

.node.current {
  border-color: var(--amber);
  color: var(--amber-dim);
  background: #fff9ef;
  font-weight: 800;
}

.node.done, .node.correct {
  background: #f0fbfa;
  border-color: #bfe9e4;
  color: var(--cyan-dim);
}

.node.wrong {
  background: #fdecec;
  border-color: #f3bcbc;
  color: #c23b3b;
}

/* Question Workspace */
.qcard {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px 28px;
  box-shadow: 0 1px 3px rgba(20, 30, 50, 0.04);
}

.qindex {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text-low);
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
}

.qtext {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.55;
  margin: 0 0 20px;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 22px;
}

.option {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 13px 16px;
  cursor: pointer;
  font-size: 14.5px;
  color: var(--text-dark);
  transition: background 0.15s, border-color 0.15s;
}

.option:hover {
  border-color: var(--cyan-dim);
  background: #f7fdfc;
}

.option.selected {
  border-color: var(--cyan);
  background: #f0fbfa;
  font-weight: 600;
}

.option.correct {
  border-color: #7fd6cc;
  background: #f0fbfa;
  color: #1c6b64;
  font-weight: 600;
}

.option.wrong {
  border-color: #f3bcbc;
  background: #fdecec;
  color: #a53030;
  font-weight: 600;
}

.option .letter {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: #eef1f6;
  color: var(--text-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

/* Numerical Value Input Box (JEE Section B) */
.numerical-box {
  background: #fbfcfe;
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 22px;
}

.numerical-box .nv-label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-mid);
  letter-spacing: 1px;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.numerical-input-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.numerical-input {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 700;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: 6px;
  width: 180px;
  outline: none;
  transition: border-color 0.15s;
}

.numerical-input:focus {
  border-color: var(--cyan-dim);
}

/* Right Rail: 5-Step Nudge Panel */
.nudge-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  position: sticky;
  top: 24px;
  box-shadow: 0 1px 3px rgba(20, 30, 50, 0.04);
}

.nudge-card h4 {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--amber-dim);
  margin: 0 0 6px;
}

.nudge-card h3 {
  margin: 0 0 10px;
  font-size: 17px;
  color: var(--text-dark);
}

.nudge-card .desc {
  font-size: 12.5px;
  color: var(--text-mid);
  line-height: 1.6;
  margin-bottom: 18px;
}

.nudge-dots {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}

.ndot {
  flex: 1;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-low);
  background: #fbfcfe;
}

.ndot.active {
  border-color: var(--amber);
  color: var(--amber-dim);
  background: #fff9ef;
}

.ndot.done {
  border-color: #bfe9e4;
  color: var(--cyan-dim);
  background: #f0fbfa;
}

.nudge-slot {
  background: #fbfcfe;
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text-mid);
  line-height: 1.6;
  min-height: 90px;
  margin-bottom: 16px;
}

.nudge-slot.filled {
  border-style: solid;
  border-color: #bfe9e4;
  background: #f0fbfa;
  color: var(--text-dark);
}

.nudge-slot .step-label {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--cyan-dim);
  margin-bottom: 6px;
}

.nudge-btn {
  display: block;
  width: 100%;
  padding: 12px;
  border-radius: 7px;
  border: none;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  background: var(--navy-950);
  color: var(--amber);
  transition: opacity 0.15s;
}

.nudge-btn:hover {
  opacity: 0.9;
}

.nudge-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.nudge-hint {
  font-size: 11.5px;
  color: var(--text-low);
  text-align: center;
  margin-top: 8px;
}

/* Speed Stats Card */
.stats-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  position: sticky;
  top: 24px;
  box-shadow: 0 1px 3px rgba(20, 30, 50, 0.04);
}

.stats-card h4 {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--ember-dim);
  margin: 0 0 6px;
}

.stats-card h3 {
  margin: 0 0 10px;
  font-size: 16.5px;
  color: var(--text-dark);
}

.stats-card .desc {
  font-size: 12.5px;
  color: var(--text-mid);
  line-height: 1.6;
  margin-bottom: 18px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.stat-row:last-of-type {
  border-bottom: none;
}

.stat-row .slabel {
  font-size: 13px;
  color: var(--text-mid);
}

.stat-row .sval {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-dark);
}

.stat-row .sval.up {
  color: var(--cyan-dim);
}

.stat-row .sval.down {
  color: #c23b3b;
}

.streak-bar {
  display: flex;
  gap: 4px;
  margin-top: 16px;
}

.streak-pip {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
}

.streak-pip.hit {
  background: var(--ember);
}

.streak-caption {
  font-size: 11.5px;
  color: var(--text-low);
  margin-top: 8px;
  text-align: center;
}

/* Actions in Question Footer */
.qfooter {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
}

.btn-primary {
  background: var(--navy-950);
  color: var(--cyan);
  border: none;
  padding: 11px 20px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-primary:hover {
  opacity: 0.9;
}

.nav-btns {
  display: flex;
  gap: 10px;
}

.btn-ghost {
  background: #ffffff;
  border: 1px solid var(--border);
  color: var(--text-mid);
  padding: 11px 18px;
  border-radius: 7px;
  font-size: 13.5px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-ghost:hover {
  border-color: var(--text-dark);
  color: var(--text-dark);
}

.btn-next {
  background: var(--navy-950);
  color: #ffffff;
  border: none;
  padding: 11px 18px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

/* Responsive collapse */
@media (max-width: 1100px) {
  .layout-3col {
    grid-template-columns: 220px 1fr;
  }
  .layout-3col .nudge-card,
  .layout-3col .stats-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 768px) {
  .topnav {
    padding: 12px 18px;
  }
  .hero {
    padding: 20px 18px;
  }
  .layout-2col,
  .layout-3col {
    grid-template-columns: 1fr;
    padding: 18px;
  }
  .side-card {
    position: static;
  }
}

/* ===== UNIVERSAL BACK TO TOP FLOATING BUTTON ===== */
.back-to-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--navy-950);
  border: 1.5px solid var(--cyan-dim);
  color: var(--cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 999;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background: var(--navy-900);
  border-color: var(--cyan);
  color: #ffffff;
  transform: translateY(-4px);
  box-shadow: 0 10px 25px rgba(56, 242, 224, 0.35);
}

/* ===== DERIVATION & SOLUTION CONTRAST RULES ===== */
.derivation,
.derivation *,
.derivation .dv-eq,
.derivation .katex,
.derivation .katex-html {
  color: #e8f3f2 !important;
}

.derivation .dv-label,
.derivation .dv-label * {
  color: var(--cyan) !important;
}

/* ===== HIGH-CONTRAST VERIFIED SOLUTION BOX (CROSS-CONCEPT) ===== */
.derivation-verified,
.derivation-verified *,
.derivation-verified .katex,
.derivation-verified .katex-html,
.derivation-verified .katex * {
  color: #0f172a !important;
}

[data-theme="dark"] .derivation-verified {
  background: #0f172a !important;
  border-color: #334155 !important;
}
[data-theme="dark"] .derivation-verified,
[data-theme="dark"] .derivation-verified *,
[data-theme="dark"] .derivation-verified .katex,
[data-theme="dark"] .derivation-verified .katex-html,
[data-theme="dark"] .derivation-verified .katex * {
  color: #f8fafc !important;
}

/* Primary CTA styling */
.btn-solid {
  background: var(--cyan) !important;
  color: var(--navy-950) !important;
  font-weight: 800 !important;
  font-size: 14px !important;
  padding: 11px 24px !important;
  border-radius: 7px !important;
  border: none !important;
  cursor: pointer !important;
  box-shadow: 0 4px 14px rgba(56, 242, 224, 0.35) !important;
  transition: all 0.2s ease !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-solid:hover {
  background: #2dd4c3 !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(56, 242, 224, 0.5) !important;
}

/* ===== INTEGRAL CONCEPT VIRTUAL LAB BANNER ===== */
.concept-lab-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f0fbfa;
  border: 1px solid #bfe9e4;
  border-left: 3.5px solid var(--cyan-dim);
  border-radius: 8px;
  padding: 10px 14px;
  margin: 14px 0 10px;
  gap: 12px;
}

.lab-banner-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.lab-pill {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #0d7a6e;
  background: #dcf5f2;
  padding: 2px 7px;
  border-radius: 4px;
}

.lab-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dark);
}

.lab-launch-link {
  font-size: 12px;
  font-weight: 700;
  color: #ffffff !important;
  background: var(--navy-950);
  border: 1px solid var(--line-dark);
  padding: 6px 12px;
  border-radius: 6px;
  text-decoration: none;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.lab-launch-link:hover {
  background: var(--navy-900);
  border-color: var(--cyan-dim);
  color: var(--cyan) !important;
  transform: translateY(-1px);
}

.strip-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-mid);
  transition: all 0.15s ease;
}

.strip-btn.trap-btn {
  background: #fffaf0;
  border-color: #f6ddb0;
  color: var(--amber-dim);
}

.strip-btn:hover {
  border-color: var(--cyan-dim);
  color: var(--cyan-dim);
}

/* =========================================================
   GLOBAL TOAST & NOTIFICATION SYSTEM
   ========================================================= */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 10005;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
  max-width: 420px;
  width: calc(100vw - 48px);
}

.custom-toast {
  pointer-events: auto;
  position: relative;
  overflow: hidden;
  background: rgba(11, 18, 32, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.55), 0 0 1px rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: flex-start;
  padding: 14px 16px;
  gap: 12px;
  color: #fff;
  transform: translateX(110%);
  opacity: 0;
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.32s ease;
}

.custom-toast.show {
  transform: translateX(0);
  opacity: 1;
}

.custom-toast.hide {
  transform: translateX(110%);
  opacity: 0;
}

/* Toast variants */
.custom-toast.toast-success {
  border-left: 4px solid #10b981;
}
.custom-toast.toast-success .toast-icon {
  color: #10b981;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.custom-toast.toast-info {
  border-left: 4px solid var(--cyan);
}
.custom-toast.toast-info .toast-icon {
  color: var(--cyan);
  background: rgba(56, 242, 224, 0.15);
  border: 1px solid rgba(56, 242, 224, 0.25);
}

.custom-toast.toast-warning {
  border-left: 4px solid var(--amber);
}
.custom-toast.toast-warning .toast-icon {
  color: var(--amber);
  background: rgba(255, 181, 71, 0.15);
  border: 1px solid rgba(255, 181, 71, 0.25);
}

.custom-toast.toast-danger, .custom-toast.toast-error {
  border-left: 4px solid #ef4444;
}
.custom-toast.toast-danger .toast-icon, .custom-toast.toast-error .toast-icon {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.toast-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.toast-body {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: #f8fafc;
  margin-bottom: 3px;
  line-height: 1.3;
}

.toast-message {
  font-size: 12.5px;
  color: #94a3b8;
  line-height: 1.45;
  word-break: break-word;
}

.toast-close {
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
  margin-left: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.toast-close:hover {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.1);
}

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  width: 100%;
  transform-origin: left;
  animation: toast-timer linear forwards;
}

.toast-success .toast-progress { background: #10b981; }
.toast-info .toast-progress { background: var(--cyan); }
.toast-warning .toast-progress { background: var(--amber); }
.toast-danger .toast-progress, .toast-error .toast-progress { background: #ef4444; }

@keyframes toast-timer {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

/* =========================================================
   GLOBAL CONFIRMATION MODAL
   ========================================================= */
.app-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(7, 11, 20, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10010;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}

.app-modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.app-modal-card {
  background: #0b1220;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.75), 0 0 1px rgba(255, 255, 255, 0.25);
  transform: scale(0.94) translateY(12px);
  transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.app-modal-backdrop.active .app-modal-card {
  transform: scale(1) translateY(0);
}

.app-modal-header {
  padding: 22px 24px 14px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.app-modal-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.app-modal-icon.danger {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.app-modal-icon.info {
  background: rgba(56, 242, 224, 0.15);
  color: var(--cyan);
  border: 1px solid rgba(56, 242, 224, 0.3);
}

.app-modal-icon.warning {
  background: rgba(255, 181, 71, 0.15);
  color: var(--amber);
  border: 1px solid rgba(255, 181, 71, 0.3);
}

.app-modal-title {
  font-size: 16.5px;
  font-weight: 700;
  color: #f8fafc;
  margin: 0;
  letter-spacing: -0.3px;
}

.app-modal-body {
  padding: 0 24px 22px 24px;
  color: #94a3b8;
  font-size: 13.5px;
  line-height: 1.55;
}

.app-modal-actions {
  padding: 16px 24px;
  background: rgba(16, 26, 44, 0.65);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.app-modal-btn {
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  font-family: inherit;
}

.app-modal-btn.btn-cancel {
  background: rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
  border-color: rgba(255, 255, 255, 0.12);
}

.app-modal-btn.btn-cancel:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.app-modal-btn.btn-confirm-danger {
  background: #ef4444;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
}

.app-modal-btn.btn-confirm-danger:hover {
  background: #dc2626;
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
  transform: translateY(-1px);
}

.app-modal-btn.btn-confirm-primary {
  background: var(--cyan);
  color: var(--navy-950);
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(56, 242, 224, 0.3);
}

.app-modal-btn.btn-confirm-primary:hover {
  background: #5ef5e6;
  box-shadow: 0 6px 20px rgba(56, 242, 224, 0.45);
  transform: translateY(-1px);
}


