/* ==========================================================================
   CAS RL · Lecture 01 — Introduction to Reinforcement Learning
   Student-First Visual Textbook Theme (Light Default + Readable Dark Toggle)
   ========================================================================== */

html { scroll-padding-top: 72px; font-size: 108%; }
main { padding-top: 3.6rem; }
.section { scroll-margin-top: 66px; padding-block: clamp(3.4rem, 7vh, 5.2rem); }
.scroll-progress { top: 3.25rem; }
.rail { padding-top: 4.6rem; }
.skip-link:not(:focus) { top: -200px; opacity: 0; pointer-events: none; }
[data-reveal] { opacity: 1 !important; transform: none !important; }

/* ------------------------------------------------- Top Navigation Bar */
.topnav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 130;
  display: flex; align-items: center; gap: 0.65rem;
  padding: 0.5rem clamp(0.85rem, 2vw, 1.5rem);
  background: rgba(5, 8, 14, 0.9); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topnav-brand { display: flex; align-items: center; gap: 0.55rem; text-decoration: none; color: var(--text); flex: none; }
.topnav-brand:hover { text-decoration: none; }
.topnav-brand img { width: 2rem; height: 2rem; border-radius: 7px; object-fit: contain; }
.topnav-brand .tb-txt { display: flex; flex-direction: column; line-height: 1.1; }
.topnav-brand .tb-txt strong { font-family: var(--font-display); font-size: 0.85rem; letter-spacing: 0.04em; }
.topnav-brand .tb-txt small { font-family: var(--font-mono); font-size: 0.56rem; letter-spacing: 0.13em; color: var(--text-3); text-transform: uppercase; }

.topnav-links { display: flex; gap: 0.12rem; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.topnav-links::-webkit-scrollbar { display: none; }
.topnav-links a {
  font-size: 0.72rem; font-weight: 500; color: var(--text-2); text-decoration: none;
  padding: 0.32rem 0.38rem; border-radius: 7px; white-space: nowrap; transition: color 0.15s, background 0.15s;
}
.topnav-links a:hover { color: var(--text); background: var(--panel-2); text-decoration: none; }
.topnav-links a.active { color: var(--teal); font-weight: 700; background: rgba(13, 148, 136, 0.09); }

.topnav-back {
  flex: none; font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase;
  border: 1px solid var(--line-2); border-radius: 8px; padding: 0.38rem 0.72rem; color: var(--text);
  background: transparent; text-decoration: none; transition: border-color 0.2s, color 0.2s, background 0.2s;
  white-space: nowrap; cursor: pointer;
}
.topnav-back:hover { border-color: var(--teal); color: var(--teal); text-decoration: none; }
.nav-rail-btn { display: none; }
@media (min-width: 1100px) { .nav-rail-btn { display: inline-flex; align-items: center; gap: 0.35rem; } }
@media (max-width: 1099px) { .topnav-links { display: none; } .topnav-brand { margin-right: auto; } }
@media (max-width: 460px) {
  .topnav { gap: 0.42rem; padding: 0.45rem 0.7rem; }
  .topnav-brand img { width: 1.7rem; height: 1.7rem; }
  .topnav-brand .tb-txt strong { font-size: 0.78rem; }
  .topnav-brand .tb-txt small { display: none; }
  .topnav-back { padding: 0.34rem 0.55rem; font-size: 0.62rem; }
}
.sym-keep { text-transform: none !important; }

/* ------------------------------------------------- Theme Palettes (Light Textbook Default & High-Readability Dark) */
body {
  background-color: #070d19;
  color: #e2e8f0;
  background-image:
    radial-gradient(900px 500px at 14% 4%, rgba(45, 212, 191, 0.1), transparent 65%),
    radial-gradient(950px 550px at 88% 10%, rgba(56, 189, 248, 0.1), transparent 65%);
}

html:not(.light-theme) {
  --bg0: #070d19;
  --bg1: #0e172a;
  --panel: #101b30;
  --panel-2: #16233b;
  --panel-solid: #101b30;
  --line: rgba(148, 163, 184, 0.2);
  --line-2: rgba(148, 163, 184, 0.34);
  --text: #f1f5f9;
  --text-2: #cbd5e1;
  --text-3: #94a3b8;
  --teal: #5eead4;
  --sky: #38bdf8;
  --indigo: #818cf8;
  --violet: #c4b5fd;
  --amber: #fbbf24;
  --rose: #fb7185;
  --green: #34d399;
}

html.light-theme {
  --bg0: #f8fafc;
  --bg1: #f1f5f9;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --panel-solid: #ffffff;
  --line: rgba(15, 23, 42, 0.11);
  --line-2: rgba(15, 23, 42, 0.2);
  --text: #0f172a;
  --text-2: #334155;
  --text-3: #64748b;
  --teal: #0d9488;
  --sky: #0284c7;
  --indigo: #4f46e5;
  --violet: #7c3aed;
  --amber: #d97706;
  --rose: #e11d48;
  --green: #059669;
}
html.light-theme body {
  background-color: #f8fafc;
  color: #0f172a;
  background-image:
    radial-gradient(900px 500px at 15% 4%, rgba(13, 148, 136, 0.065), transparent 65%),
    radial-gradient(950px 550px at 88% 10%, rgba(2, 132, 199, 0.065), transparent 65%);
}
html.light-theme .topnav { background: rgba(255, 255, 255, 0.94); border-bottom-color: rgba(15, 23, 42, 0.1); }
html.light-theme .rail { background: rgba(255, 255, 255, 0.98); border-right-color: rgba(15, 23, 42, 0.12); }
html.light-theme .toc-panel { background: #ffffff; color: #0f172a; }
html.light-theme .btn { background: #ffffff; border-color: rgba(15, 23, 42, 0.22); color: #0f172a; }
html.light-theme .btn:hover { background: #f0fdfa; border-color: #0d9488; color: #0f766e; }
html.light-theme .btn.btn-teal { background: rgba(13, 148, 136, 0.12); border-color: #0d9488; color: #0f766e; font-weight: 700; }
html.light-theme .btn.btn-teal:hover { background: #0d9488; color: #ffffff; }
html.light-theme .fact { background: #f8fafc; border-color: rgba(15, 23, 42, 0.14); color: #1e293b; }

/* Section headers & clean paper contrast */
.sec-head { margin-bottom: 1.8rem; max-width: 82ch; }
.sec-head .kicker { gap: 0.4rem; letter-spacing: 0.18em; font-size: 0.74rem; color: var(--teal); margin-bottom: 0.65rem; }
.sec-head .kicker .knum { display: inline; border: 0; background: none; padding: 0; min-width: 0; height: auto; border-radius: 0; }
.sec-head .kicker .knum::before { content: "— SECTION "; }
.sec-head .kicker .knum::after { content: " ·"; }
.sec-head h2 { font-size: clamp(1.9rem, 3.6vw, 2.85rem); font-weight: 700; line-height: 1.18; }
.sec-head .lede { color: var(--text-2); font-size: 1.07rem; max-width: 68ch; line-height: 1.7; }

.tok-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  padding: clamp(1.2rem, 2.8vw, 1.85rem); box-shadow: 0 10px 28px rgba(15, 23, 42, 0.05);
}
html:not(.light-theme) .tok-card { box-shadow: 0 14px 36px rgba(0, 0, 0, 0.35); }

/* ------------------------------------------------- Hero & Intuition Showcase */
.sec-hero { text-align: center; padding-top: clamp(2.4rem, 6vh, 4.2rem); }
.hero-badge {
  display: inline-flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; justify-content: center;
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.07em; color: var(--teal);
  border: 1px solid rgba(13, 148, 136, 0.35); border-radius: 999px; padding: 0.38rem 0.95rem;
  background: rgba(13, 148, 136, 0.08); margin-bottom: 1.25rem;
}
.sec-hero .hero-title { margin-inline: auto; max-width: 24ch; font-size: clamp(2.2rem, 5vw, 3.7rem); }
.hero-question {
  max-width: 66ch; margin: 0.9rem auto 0.65rem; padding: 0.85rem 1.2rem;
  border-radius: 14px; border: 1px solid rgba(13, 148, 136, 0.28);
  background: rgba(13, 148, 136, 0.06); font-size: 1.12rem; font-weight: 600; color: var(--teal);
  line-height: 1.5;
}
.sec-hero .hero-sub { margin: 0.75rem auto 0; text-align: center; max-width: 68ch; font-size: 1.06rem; color: var(--text-2); line-height: 1.7; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.65rem; justify-content: center; margin: 1.45rem auto 2rem; }
.hero-actions .btn { padding: 0.56rem 1.02rem; font-size: 0.78rem; }

.hl-showcase {
  text-align: left; margin: 0 auto; padding: 1.45rem 1.55rem;
  border-radius: 18px; border: 1px solid var(--line-2); background: var(--panel);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.05);
}
.hl-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 0.75rem; margin-bottom: 1.1rem; }
.hl-theme { font-family: var(--font-mono); font-size: 0.65rem; font-weight: 700; letter-spacing: 0.12em; color: var(--teal); text-transform: uppercase; }
.hl-title { margin: 0.2rem 0 0; font-family: var(--font-display); font-size: clamp(1.25rem, 2.1vw, 1.6rem); color: var(--text); }
.hl-title em { font-style: normal; color: var(--teal); }
.hl-bento-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.9rem; }
@media (max-width: 960px) { .hl-bento-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .hl-bento-grid { grid-template-columns: 1fr; } }

.hl-card {
  display: flex; flex-direction: column; gap: 0.5rem; padding: 1.05rem 1.15rem; text-align: left;
  border-radius: 13px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  cursor: pointer; transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s; position: relative; overflow: hidden;
  text-decoration: none;
}
.hl-card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--teal); }
.hl-card.acc-sky::before { background: var(--sky); }
.hl-card.acc-amber::before { background: var(--amber); }
.hl-card.acc-indigo::before { background: var(--indigo); }
.hl-card.acc-rose::before { background: var(--rose); }
.hl-card.acc-green::before { background: var(--green); }
.hl-card:hover { transform: translateY(-3px); border-color: var(--teal); box-shadow: 0 10px 22px rgba(13, 148, 136, 0.1); text-decoration: none; }
.hl-card h3 { margin: 0; font-size: 1rem; color: var(--text); line-height: 1.3; }
.hl-card p { margin: 0; font-size: 0.86rem; color: var(--text-2); line-height: 1.55; }
.hl-go { font-family: var(--font-mono); font-size: 0.68rem; font-weight: 700; color: var(--teal); margin-top: auto; padding-top: 0.25rem; }

/* ------------------------------------------------- One-Look Visual Reminder Banner */
.one-look {
  display: grid; grid-template-columns: auto 1fr; gap: 0.85rem 1.1rem; align-items: center;
  padding: 0.95rem 1.2rem; border-radius: 14px;
  border: 1px solid rgba(13, 148, 136, 0.32);
  background: linear-gradient(125deg, rgba(13, 148, 136, 0.08), rgba(2, 132, 199, 0.05));
  margin-bottom: 1.25rem;
}
@media (max-width: 600px) { .one-look { grid-template-columns: 1fr; gap: 0.65rem; } }
.ol-badge {
  width: 3rem; height: 3rem; border-radius: 12px; display: grid; place-items: center;
  background: rgba(13, 148, 136, 0.14); border: 1px solid rgba(13, 148, 136, 0.35);
  color: var(--teal); font-family: var(--font-mono); font-size: 1.25rem; font-weight: 700;
}
.ol-kicker { font-family: var(--font-mono); font-size: 0.64rem; font-weight: 700; letter-spacing: 0.12em; color: var(--teal); text-transform: uppercase; margin: 0 0 0.2rem; }
.ol-text { margin: 0; font-size: 0.98rem; color: var(--text); font-weight: 600; line-height: 1.48; }
.ol-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.48rem; }
.ol-chip {
  font-family: var(--font-mono); font-size: 0.66rem; font-weight: 600; color: var(--text-2);
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 999px; padding: 0.18rem 0.62rem;
}

/* ------------------------------------------------- Buttons, Presets, Grids, Typography Utils */
.pn-presets { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.pn-preset {
  font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-2);
  border: 1px solid var(--line-2); border-radius: 999px; padding: 0.38rem 0.85rem;
  background: var(--panel-2); cursor: pointer; transition: all 0.15s;
}
.pn-preset:hover { color: var(--teal); border-color: var(--teal); }
.pn-preset.on { color: #ffffff; background: var(--teal); border-color: var(--teal); font-weight: 700; }
html:not(.light-theme) .pn-preset.on { color: #042220; }

.svg-wrap { width: 100%; overflow-x: auto; margin-top: 0.6rem; }
.rl-svg {
  width: 100%; height: auto; display: block; border-radius: 14px;
  background: var(--panel-2); border: 1px solid var(--line);
}
.svg-ink { fill: var(--text); font-family: var(--font-display); }
.svg-sub { fill: var(--text-2); font-family: var(--font-body); }
.svg-dim { fill: var(--text-3); font-family: var(--font-mono); }
.svg-teal { fill: var(--teal); }
.svg-sky { fill: var(--sky); }
.svg-amber { fill: var(--amber); }
.svg-rose { fill: var(--rose); }
.svg-green { fill: var(--green); }
.svg-indigo { fill: var(--indigo); }

.teal-txt { color: var(--teal); }
.sky-txt { color: var(--sky); }
.amber-txt { color: var(--amber); }
.rose-txt { color: var(--rose); }
.green-txt { color: var(--green); }
.indigo-txt { color: var(--indigo); }

.stat-big { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; display: block; margin: 0.15rem 0; }
.tok-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 0.8rem; margin-top: 0.9rem; }
.sub-card { border-radius: 14px; border: 1px solid var(--line); background: var(--panel-2); padding: 1.05rem 1.15rem; }

/* ------------------------------------------------- §01 Trial & Error */
.trio-stories { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.9rem; margin-bottom: 1.15rem; }
@media (max-width: 840px) { .trio-stories { grid-template-columns: 1fr; } }
.story-card {
  display: flex; flex-direction: column; gap: 0.55rem; text-align: left; cursor: pointer;
  padding: 0.95rem 1.05rem; border-radius: 14px; border: 1px solid var(--line); background: var(--panel-2);
  transition: border-color 0.16s, transform 0.16s, box-shadow 0.16s; color: var(--text);
}
.story-card:hover, .story-card.active { border-color: var(--teal); transform: translateY(-2px); box-shadow: 0 8px 20px rgba(13, 148, 136, 0.09); }
.story-card.active { background: rgba(13, 148, 136, 0.06); }
.story-steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.55rem; margin: 0.9rem 0; }
@media (max-width: 780px) { .story-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.step-chip { padding: 0.65rem 0.72rem; border-radius: 11px; border: 1px solid var(--line); background: var(--panel-2); }
.step-chip strong { display: block; font-size: 0.86rem; color: var(--text); }
.step-chip small { display: block; font-size: 0.76rem; color: var(--text-2); line-height: 1.45; margin-top: 0.2rem; }

.trial-layout { display: grid; grid-template-columns: 1.15fr 1fr; gap: 1.15rem; align-items: start; margin-top: 1rem; }
@media (max-width: 900px) { .trial-layout { grid-template-columns: 1fr; } }
.trial-bars { display: flex; flex-direction: column; gap: 0.55rem; margin-top: 0.7rem; }
.tbar-row { display: grid; grid-template-columns: 8.5rem 1fr 3.6rem; gap: 0.65rem; align-items: center; font-family: var(--font-mono); font-size: 0.74rem; }
.tbar-track { height: 12px; border-radius: 999px; background: rgba(148, 163, 184, 0.22); overflow: hidden; }
.tbar-track i { display: block; height: 100%; border-radius: 999px; transition: width 0.28s ease; }

/* ------------------------------------------------- §02 ML Paradigms */
.paradigm-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
@media (max-width: 900px) { .paradigm-grid { grid-template-columns: 1fr; } }
.p-card {
  display: flex; flex-direction: column; gap: 0.6rem; padding: 1.1rem; border-radius: 15px;
  border: 1px solid var(--line); background: var(--panel-2); border-top: 4px solid var(--sky);
}
.p-card.p-unsub { border-top-color: var(--amber); }
.p-card.p-rl { border-top-color: var(--teal); background: rgba(13, 148, 136, 0.045); }
.p-card h3 { margin: 0; font-size: 1.1rem; }
.p-svg-box { width: 100%; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--panel); }

.choice-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; margin-top: 0.75rem; }
@media (max-width: 720px) { .choice-grid { grid-template-columns: 1fr; } }
.choice-btn {
  text-align: left; padding: 0.9rem 1rem; border-radius: 12px; border: 1.5px solid var(--line-2);
  background: var(--panel); color: var(--text); transition: all 0.16s;
}
.choice-btn:hover { border-color: var(--teal); transform: translateY(-2px); }
.choice-btn.picked-ok { border-color: var(--green); background: rgba(5, 150, 105, 0.11); }
.choice-btn.picked-no { border-color: var(--rose); background: rgba(225, 29, 72, 0.09); }

/* ------------------------------------------------- §03 Robot Maze & Components */
.maze-studio { display: grid; grid-template-columns: minmax(320px, 1.05fr) 1fr; gap: 1.35rem; align-items: start; }
@media (max-width: 920px) { .maze-studio { grid-template-columns: 1fr; } }
.dpad { display: grid; grid-template-columns: repeat(3, 54px); grid-template-rows: repeat(3, 46px); gap: 6px; justify-content: center; margin: 0.9rem auto 0.35rem; }
.dpad-btn {
  border: 1.5px solid var(--line-2); border-radius: 11px; background: var(--panel); color: var(--text);
  font-weight: 700; font-size: 1.08rem; display: grid; place-items: center; transition: all 0.14s;
}
.dpad-btn:hover:not(:disabled) { border-color: var(--teal); color: var(--teal); background: rgba(13, 148, 136, 0.08); }
.dpad-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.comp-btn {
  width: 100%; text-align: left; padding: 0.78rem 1rem; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--panel-2); color: var(--text);
  transition: all 0.15s; display: flex; align-items: center; justify-content: space-between; gap: 0.7rem;
}
.comp-btn:hover, .comp-btn.active { border-color: var(--teal); background: rgba(13, 148, 136, 0.09); }

/* ------------------------------------------------- §05 Timeline & §06 Discount */
.traj-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 0.48rem; margin: 0.9rem 0; }
.traj-node {
  padding: 0.48rem 0.76rem; border-radius: 10px; border: 1.5px solid var(--line);
  background: var(--panel-2); font-family: var(--font-mono); font-size: 0.74rem; color: var(--text);
  transition: all 0.15s;
}
.traj-node.active { border-color: var(--teal); background: rgba(13, 148, 136, 0.14); font-weight: 700; transform: translateY(-2px); }
.traj-node.terminal { border-color: var(--green); background: rgba(5, 150, 105, 0.14); color: var(--green); }

.cmp-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.cmp-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.cmp-table th, .cmp-table td { text-align: left; padding: 0.72rem 0.95rem; border-bottom: 1px solid var(--line); }
.cmp-table th { font-family: var(--font-mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); background: var(--panel-2); }

/* ------------------------------------------------- §07 Multi-Armed Bandit */
.bandit-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.95rem; margin: 1rem 0; }
@media (max-width: 780px) { .bandit-grid { grid-template-columns: 1fr; } }
.slot-card {
  border: 1.5px solid var(--line); border-radius: 16px; background: var(--panel-2);
  padding: 1.05rem; display: flex; flex-direction: column; gap: 0.55rem; align-items: center; text-align: center;
  transition: transform 0.16s, border-color 0.16s, box-shadow 0.16s;
}
.slot-card.winner { border-color: var(--teal); box-shadow: 0 10px 24px rgba(13, 148, 136, 0.13); }
.slot-reel {
  width: 100%; padding: 0.65rem 0.7rem; border-radius: 11px; border: 1px solid var(--line-2);
  background: var(--panel); font-family: var(--font-mono); font-weight: 700; font-size: 1.15rem;
}

/* ------------------------------------------------- §08 Policy, §09 Methods & §10 Apps */
.policy-grid { display: grid; grid-template-columns: 1fr 1.15fr; gap: 1.25rem; align-items: center; }
@media (max-width: 880px) { .policy-grid { grid-template-columns: 1fr; } }
.method-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.05rem; margin-bottom: 1.25rem; }
@media (max-width: 860px) { .method-grid { grid-template-columns: 1fr; } }
.method-card {
  display: flex; flex-direction: column; gap: 0.65rem; padding: 1.15rem; border-radius: 16px;
  border: 1.5px solid var(--line); background: var(--panel-2); border-top: 4px solid var(--amber);
}
.method-card.m-pol { border-top-color: var(--teal); background: rgba(13, 148, 136, 0.045); }
.method-card h3 { margin: 0; font-size: 1.15rem; }
.apps-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.9rem; margin-bottom: 1.15rem; }
@media (max-width: 920px) { .apps-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .apps-grid { grid-template-columns: 1fr; } }
.app-card {
  padding: 1rem 1.05rem; border-radius: 14px; border: 1px solid var(--line); background: var(--panel-2);
  display: flex; flex-direction: column; gap: 0.45rem;
}
.app-card h3 { margin: 0; font-size: 1rem; }
.app-card p { margin: 0; font-size: 0.88rem; color: var(--text-2); line-height: 1.55; }

/* ------------------------------------------------- §10 Quiz 2x2 */
.quiz-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  padding: clamp(1.2rem, 2.8vw, 1.8rem); box-shadow: 0 12px 28px rgba(15, 23, 42, 0.05);
}
.quiz-score-banner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
.quiz-score-val { font-family: var(--font-display); font-size: 1.8rem; font-weight: 700; color: var(--teal); }
.quiz-q { background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; padding: 1.05rem 1.15rem; }
.quiz-q h4 { margin: 0.25rem 0 0.75rem; font-size: 1.04rem; line-height: 1.45; }
.quiz-opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.65rem; }
@media (max-width: 720px) { .quiz-opts { grid-template-columns: 1fr; } }
.quiz-opt {
  text-align: left; padding: 0.72rem 0.9rem; border-radius: 10px;
  border: 1.5px solid var(--line-2); background: var(--panel); color: var(--text);
  font-size: 0.92rem; line-height: 1.45; transition: all 0.15s;
}
.quiz-opt:hover:not(:disabled) { border-color: var(--teal); background: rgba(13, 148, 136, 0.06); }
.quiz-opt.correct { border-color: var(--green); background: rgba(5, 150, 105, 0.13); color: var(--text); font-weight: 600; }
.quiz-opt.wrong { border-color: var(--rose); background: rgba(225, 29, 72, 0.11); color: var(--text); }
.fact { border-radius: 11px; padding: 0.78rem 1rem; border: 1px solid var(--line); background: var(--panel-2); font-size: 0.92rem; color: var(--text-2); line-height: 1.58; }

/* ------------------------------------------------- MDP Specific Grids & Code */
.tuple-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.65rem; margin-bottom: 1rem; }
@media (max-width: 820px) { .tuple-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tuple-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.25rem;
  padding: 0.85rem 0.95rem; border-radius: 13px; border: 1.5px solid var(--line);
  background: var(--panel-2); color: var(--text); text-align: left; transition: all 0.16s;
}
.tuple-btn:hover, .tuple-btn.active { border-color: var(--teal); background: rgba(13, 148, 136, 0.08); transform: translateY(-2px); }
.tuple-sym { font-family: var(--font-display); font-size: 1.55rem; font-weight: 700; color: var(--teal); line-height: 1.1; }
.ice-studio { display: grid; grid-template-columns: minmax(290px, 0.95fr) 1.05fr; gap: 1.25rem; align-items: start; }
@media (max-width: 900px) { .ice-studio { grid-template-columns: 1fr; } }

.badge-ok { display: inline-block; padding: 0.18rem 0.58rem; border-radius: 999px; font-family: var(--font-mono); font-size: 0.64rem; font-weight: 700; background: rgba(5, 150, 105, 0.14); color: var(--green); border: 1px solid rgba(5, 150, 105, 0.4); }
.badge-no { display: inline-block; padding: 0.18rem 0.58rem; border-radius: 999px; font-family: var(--font-mono); font-size: 0.64rem; font-weight: 700; background: rgba(225, 29, 72, 0.12); color: var(--rose); border: 1px solid rgba(225, 29, 72, 0.4); }

.mdp-code-box { border: 1px solid var(--line-2); border-radius: 14px; overflow: hidden; background: var(--panel-2); }
.mdp-code-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.6rem; padding: 0.7rem 1rem; border-bottom: 1px solid var(--line); background: var(--panel); }
.mdp-pre { margin: 0; padding: 1.05rem 1.15rem; font-family: var(--font-mono); font-size: 0.78rem; line-height: 1.58; overflow-x: auto; color: var(--text); }

@media (prefers-reduced-motion: reduce) {
  .bridge .arw { animation: none; }
}
