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

:root {
    --font-display: 'Fredoka', 'Nunito', sans-serif;
    --font-body: 'Nunito', 'Source Sans 3', sans-serif;
    --ink: #1f2937;
    --ink-soft: #475569;
    --sky: #38bdf8;
    --teal: #2dd4bf;
    --sun: #fcd34d;
    --sun-deep: #f59e0b;
    --coral: #fb7185;
    --mint: #34d399;
    --cream: #fff7ed;
    --paper: #ffffff;
    --border: #fde68a;
    --bg: radial-gradient(circle at top left, #fef9c3 0%, transparent 50%),
          radial-gradient(circle at top right, #bae6fd 0%, transparent 45%),
          radial-gradient(circle at bottom left, #fecdd3 0%, transparent 50%),
          linear-gradient(135deg, #fff7ed 0%, #f0f9ff 100%);
    --orb-1: linear-gradient(135deg, #38bdf8, #2dd4bf);
    --orb-2: linear-gradient(135deg, #fcd34d, #fb7185);
    --header-bg: rgba(255, 255, 255, 0.94);
    --nav-bg: rgba(255, 255, 255, 0.9);
    --section-bg: rgba(255, 255, 255, 0.96);
    --section-border: rgba(252, 211, 77, 0.4);
    --section-shadow: 0 15px 35px rgba(30, 41, 59, 0.15);
    --panel-bg: #fffaf0;
    --panel-border: var(--sun);
    --formula-bg: #fefce8;
    --card-bg: linear-gradient(135deg, #ffffff 0%, #fef3c7 100%);
    --card-border: rgba(252, 211, 77, 0.55);
    --card-shadow: 0 10px 20px rgba(30, 41, 59, 0.08);
    --chip-bg: #fef3c7;
    --chip-text: #92400e;
    --nav-link-bg: rgba(255, 255, 255, 0.8);
    --nav-link-hover-bg: var(--sun);
    --nav-link-hover-border: var(--sun-deep);
    --canvas-bg: #f8fafc;
    --canvas-border: var(--sky);
    --button-bg: linear-gradient(135deg, #38bdf8, #2dd4bf);
    --button-bg-hover: linear-gradient(135deg, #22d3ee, #34d399);
    --button-shadow: 0 10px 18px rgba(56, 189, 248, 0.25);
    --button-shadow-hover: 0 14px 22px rgba(45, 212, 191, 0.3);
    --helper-bg: #ecfeff;
    --helper-text: #0f766e;
    --grid: #e2e8f0;
    --axis: #94a3b8;
    --accent-1: var(--sky);
    --accent-2: var(--coral);
    --accent-3: var(--mint);
    --accent-4: var(--sun-deep);
    --accent-danger: #ef4444;
}

body {
    font-family: var(--font-body);
    line-height: 1.7;
    color: var(--ink);
    background: var(--bg);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

body::before,
body::after {
    content: "";
    position: fixed;
    width: 240px;
    height: 240px;
    border-radius: 50%;
    opacity: 0.18;
    z-index: -1;
    filter: blur(0px);
}

body::before {
    background: var(--orb-1);
    top: -80px;
    left: -60px;
}

body::after {
    background: var(--orb-2);
    bottom: -90px;
    right: -70px;
}

header {
    background: var(--header-bg);
    padding: 2.5rem 1.5rem;
    text-align: center;
    box-shadow: 0 10px 30px rgba(30, 41, 59, 0.12);
    border-bottom: 4px solid var(--sun);
}

header h1 {
    font-family: var(--font-display);
    color: var(--ink);
    font-size: clamp(2.1rem, 3vw, 3rem);
    margin-bottom: 0.6rem;
}

header p {
    color: var(--ink-soft);
    font-size: 1.1rem;
}

.mode-switcher {
    margin-top: 1.2rem;
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.9rem;
    border-radius: 999px;
    background: var(--panel-bg);
    border: 2px solid var(--section-border);
}

.mode-label {
    font-weight: 700;
    color: var(--ink-soft);
}

.mode-btn {
    border: 2px solid transparent;
    border-radius: 999px;
    padding: 0.35rem 0.9rem;
    background: var(--nav-link-bg);
    color: var(--ink);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.mode-btn.is-active {
    background: var(--accent-1);
    color: white;
    border-color: var(--accent-1);
    box-shadow: 0 6px 12px rgba(56, 189, 248, 0.3);
}

.chapter-switcher {
    display: flex;
    justify-content: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    padding: 0.9rem 1rem 0.6rem;
}

.chapter-btn {
    border: 2px solid transparent;
    border-radius: 999px;
    padding: 0.45rem 1.1rem;
    background: var(--nav-link-bg);
    color: var(--ink);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.chapter-btn.is-active {
    background: var(--accent-1);
    color: white;
    border-color: var(--accent-1);
    box-shadow: 0 6px 12px rgba(56, 189, 248, 0.3);
}

nav {
    background: var(--nav-bg);
    padding: 0.8rem 1rem;
    display: flex;
    justify-content: center;
    gap: 0.8rem;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 6px 18px rgba(30, 41, 59, 0.12);
    border-bottom: 2px solid var(--section-border);
}

.chapter {
    display: block;
}

body[data-chapter-mode="on"] .chapter {
    display: none;
}

body[data-chapter-mode="on"] .chapter.is-active {
    display: block;
}

nav a {
    color: var(--ink);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    transition: all 0.25s ease;
    font-weight: 700;
    background: var(--nav-link-bg);
    border: 2px solid transparent;
}

nav a:hover {
    background: var(--nav-link-hover-bg);
    color: var(--ink);
    border-color: var(--nav-link-hover-border);
    transform: translateY(-2px);
}

main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.example-section {
    background: var(--section-bg);
    margin: 2rem 0;
    padding: 2rem;
    border-radius: 24px;
    box-shadow: var(--section-shadow);
    border: 3px solid var(--section-border);
    scroll-margin-top: 80px;
}

.example-section h2 {
    font-family: var(--font-display);
    color: var(--ink);
    margin-bottom: 1.5rem;
    font-size: 2rem;
    border-bottom: 3px dashed var(--sun);
    padding-bottom: 0.5rem;
}

.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

.fundamentals-grid {
    grid-template-columns: 1.15fr 0.85fr;
}

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

@media (max-width: 900px) {
    .transformer-advanced-grid {
        grid-template-columns: 1fr;
    }

    .transformer-advanced-grid .visualization {
        order: 1;
    }

    .transformer-advanced-grid .explanation {
        order: 2;
    }

    .depth-tier {
        grid-template-columns: 1fr;
        padding: 1rem;
    }

    .depth-map {
        padding: 0.8rem;
    }

    .depth-marker {
        padding: 0.8rem 0.9rem;
    }

    .depth-visual {
        padding: 0.85rem 0.9rem;
    }

    .depth-card-body {
        grid-template-columns: 1fr;
    }
}

.explanation h3 {
    font-family: var(--font-display);
    color: var(--ink);
    margin-bottom: 1rem;
}

.explanation h4 {
    color: var(--ink);
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.explanation p {
    margin-bottom: 1rem;
}

.explanation ul, .explanation ol {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

.explanation li {
    margin-bottom: 0.5rem;
}

.section-intro {
    color: var(--ink-soft);
    margin-bottom: 1.5rem;
    font-weight: 600;
}


.rl-card {
    background: var(--card-bg);
    border-radius: 18px;
    padding: 1rem 1.1rem;
    border: 2px solid var(--card-border);
    box-shadow: var(--card-shadow);
    margin-bottom: 1rem;
}

.rl-definition {
    background: var(--panel-bg);
    border-radius: 16px;
    padding: 0.9rem 1.1rem;
    border: 2px solid var(--panel-border);
    box-shadow: var(--card-shadow);
    margin: 1rem 0 1.5rem;
}

.rl-interface-explain p {
    margin-bottom: 0.6rem;
    color: var(--ink-soft);
}

.rl-walkthrough {
    margin-top: 2rem;
}

.rl-control-panel {
    margin-top: 1rem;
    background: var(--panel-bg);
    border-radius: 16px;
    padding: 1rem;
    border: 2px solid var(--panel-border);
    box-shadow: var(--card-shadow);
}

.rl-algo-steps {
    display: grid;
    gap: 1rem;
    margin: 1.2rem 0;
}

.rl-control-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 0.6rem;
    align-items: center;
    margin-bottom: 0.6rem;
}

.rl-control-row label {
    font-weight: 700;
    color: var(--ink-soft);
}

.rl-control-row input[type="range"] {
    width: 160px;
}

.rl-toggle-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 0.8rem 0 0.4rem;
    font-weight: 600;
    color: var(--ink-soft);
}

.rl-reward-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: 0.6rem;
    margin: 0.8rem 0;
}

.rl-reward-list label {
    display: grid;
    gap: 0.3rem;
    font-weight: 600;
    color: var(--ink-soft);
}

.rl-return-output {
    font-weight: 700;
    color: var(--ink);
    margin-top: 0.6rem;
}

.rl-table {
    margin-top: 0.8rem;
    background: var(--panel-bg);
    border-radius: 12px;
    border: 1px solid var(--section-border);
    padding: 0.6rem 0.8rem;
}

.rl-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.rl-table th,
.rl-table td {
    padding: 0.35rem 0.4rem;
    text-align: left;
}

.rl-table th {
    color: var(--ink-soft);
}

.rl-inspect {
    margin-top: 1rem;
    background: var(--panel-bg);
    border-radius: 16px;
    padding: 0.9rem 1rem;
    border: 2px solid var(--panel-border);
    box-shadow: var(--card-shadow);
}

.code-block {
    margin: 1rem 0;
    background: var(--formula-bg);
    border-radius: 12px;
    padding: 0.8rem 1rem;
    border: 2px dashed var(--section-border);
}

.code-block h4 {
    margin-bottom: 0.4rem;
    color: var(--ink);
}

.code-block pre {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: var(--ink);
    white-space: pre-wrap;
}

.rl-fundamentals-grid,
.rl-bandits-grid,
.rl-gridworld-grid,
.rl-mc-grid,
.rl-td-grid,
.rl-control-grid,
.rl-deep-grid {
    gap: 2rem;
}

.rl-fundamentals-visuals,
.rl-bandits-visuals,
.rl-gridworld-visuals,
.rl-mc-visuals,
.rl-td-visuals,
.rl-control-visuals {
    display: grid;
    gap: 1rem;
}

.rl-bandits-visuals canvas,
.rl-gridworld-visuals canvas,
.rl-mc-visuals canvas,
.rl-td-visuals canvas,
.rl-control-visuals canvas,
.rl-fundamentals-visuals canvas {
    background: var(--canvas-bg);
    border: 2px solid var(--canvas-border);
    border-radius: 16px;
    box-shadow: var(--card-shadow);
}

.viz-meta {
    margin-top: 0.4rem;
    padding: 0.55rem 0.75rem;
    border-radius: 12px;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    color: var(--ink-soft);
    font-size: 0.82rem;
    line-height: 1.4;
}

.viz-meta-label {
    color: var(--ink);
    font-weight: 700;
    margin-right: 0.25rem;
}

@media (max-width: 900px) {
    .rl-control-row {
        grid-template-columns: 1fr;
        justify-items: start;
    }

    .rl-control-row input[type="range"] {
        width: 100%;
    }
}

.ai-intro {
    position: relative;
    overflow: hidden;
}

.ai-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: 2rem;
    align-items: center;
}

.ai-definition {
    background: var(--panel-bg);
    border-radius: 16px;
    padding: 0.9rem 1.1rem;
    border: 2px dashed var(--section-border);
    font-weight: 600;
    box-shadow: var(--card-shadow);
}

.ai-intuition {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.ai-intuition-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 0.9rem 1rem;
    border: 2px solid var(--card-border);
    box-shadow: var(--card-shadow);
}

.ai-intuition-card h3 {
    font-family: var(--font-display);
    margin-bottom: 0.4rem;
    font-size: 1.05rem;
}

.ai-hero-visual {
    background: linear-gradient(140deg, #fff7ed 0%, #e0f2fe 100%);
    border-radius: 24px;
    border: 2px solid var(--section-border);
    padding: 1.5rem;
    min-height: 260px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    box-shadow: var(--section-shadow);
}

.ai-hero-visual::before,
.ai-hero-visual::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    opacity: 0.22;
    z-index: 0;
}

.ai-hero-visual::before {
    width: 160px;
    height: 160px;
    background: var(--orb-1);
    top: -50px;
    right: -40px;
}

.ai-hero-visual::after {
    width: 190px;
    height: 190px;
    background: var(--orb-2);
    bottom: -70px;
    left: -60px;
}

.ai-loop,
.ai-goal,
.ai-signal-grid {
    position: relative;
    z-index: 1;
}

.ai-loop {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.ai-loop-step {
    background: var(--paper);
    border: 2px solid var(--accent-1);
    color: var(--ink);
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    font-weight: 700;
    box-shadow: 0 6px 12px rgba(56, 189, 248, 0.2);
}

.ai-loop-arrow {
    font-weight: 700;
    color: var(--ink-soft);
}

.ai-goal {
    background: var(--chip-bg);
    color: var(--chip-text);
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-weight: 700;
}

.ai-signal-grid {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    justify-content: center;
}

.ai-signal {
    background: var(--nav-link-bg);
    border: 1px solid var(--section-border);
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    font-weight: 700;
    color: var(--ink-soft);
}

.ai-math-flow {
    width: 100%;
    text-align: center;
}

.ai-math-flow .MathJax {
    font-size: 0.95rem;
}

.ai-categories {
    margin-top: 2rem;
}

.ai-category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.ai-category-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 0.9rem 1rem;
    border: 2px solid var(--card-border);
    box-shadow: var(--card-shadow);
}

.ai-category-card h4 {
    font-family: var(--font-display);
    margin-bottom: 0.4rem;
}

.ai-category-card p {
    color: var(--ink-soft);
}

.ai-category-note {
    margin-top: 1rem;
    color: var(--ink-soft);
    font-weight: 600;
}

@media (max-width: 900px) {
    .ai-hero {
        grid-template-columns: 1fr;
    }

    .ai-hero-visual {
        order: -1;
    }
}

.learning-path {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0 2rem;
}

.vector-toolkit {
    margin-top: 2rem;
}

.vector-toolkit h3 {
    font-family: var(--font-display);
    color: var(--ink);
    margin-bottom: 0.5rem;
}

.vector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.vector-card {
    background: var(--card-bg);
    border-radius: 18px;
    padding: 1rem 1.1rem;
    border: 2px solid var(--card-border);
    box-shadow: var(--card-shadow);
}

.vector-card h4 {
    font-family: var(--font-display);
    margin-bottom: 0.5rem;
    color: var(--ink);
}

.vector-card ul {
    margin-left: 1.25rem;
    color: var(--ink-soft);
}

.vector-card li {
    margin-bottom: 0.45rem;
}

.vector-mode-switcher {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin: 1rem 0 1.5rem;
}

.vector-mode-panel {
    display: none;
}

.vector-mode-panel.is-active {
    display: block;
}

.matrix-mode-switcher {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin: 1rem 0 1.5rem;
}

.matrix-mode-panel {
    display: none;
}

.matrix-mode-panel.is-active {
    display: block;
}

.probability-controls {
    margin-top: 0.8rem;
}

.probability-venn-controls {
    margin-top: 0.8rem;
}

.probability-review-grid {
    margin-bottom: 2rem;
    scroll-margin-top: 120px;
}

.probability-spam-grid {
    margin: 2rem 0;
    scroll-margin-top: 120px;
}

.probability-nll-grid {
    margin: 2rem 0;
    scroll-margin-top: 120px;
}

.probability-sample-grid {
    margin: 2rem 0;
    scroll-margin-top: 120px;
}

.probability-filter-grid {
    margin: 2rem 0;
    scroll-margin-top: 120px;
}

.probability-filter-visuals .guide-card {
    display: grid;
    gap: 0.7rem;
    justify-items: center;
}

.probability-filter-visuals .guide-card h4 {
    text-align: center;
}

.spam-controls {
    display: grid;
    gap: 0.8rem;
    margin: 1rem 0 0.6rem;
}

.sample-controls {
    display: grid;
    gap: 0.8rem;
    margin: 1rem 0 0.6rem;
}

.word-chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.probability-readout {
    margin-top: 0.8rem;
}

.probability-mode-switcher {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin: 1rem 0 1.5rem;
}

.probability-mode-panel {
    display: none;
}

.probability-mode-panel.is-active {
    display: block;
}

.probability-canvas-panel {
    background-color: var(--section-bg);
    background-image: linear-gradient(rgba(148, 163, 184, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, 0.08) 1px, transparent 1px);
    background-size: 28px 28px;
    border: 2px solid var(--section-border);
    border-radius: 20px;
    padding: 1.4rem;
    box-shadow: var(--card-shadow);
    position: relative;
    overflow: hidden;
}

@media (max-width: 768px) {
    .probability-canvas-panel {
        padding: 1rem;
    }
}

.probability-deep-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
    background: var(--panel-bg);
    border: 2px solid var(--section-border);
    border-radius: 16px;
    padding: 0.7rem 0.9rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--card-shadow);
}

.probability-deep-label {
    font-weight: 700;
    color: var(--ink-soft);
}

.probability-deep-link {
    background: var(--nav-link-bg);
    border: 2px solid transparent;
    border-radius: 999px;
    padding: 0.35rem 0.85rem;
    font-weight: 700;
    color: var(--ink);
    text-decoration: none;
    transition: all 0.2s ease;
}

.probability-deep-link:hover {
    border-color: var(--accent-1);
    transform: translateY(-1px);
}

.probability-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    width: 100%;
}

.probability-playground-grid {
    margin: 2rem 0;
    scroll-margin-top: 120px;
}

.playground-card {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.18), rgba(251, 113, 133, 0.12));
    border: 2px solid var(--panel-border);
    border-radius: 20px;
    padding: 1rem 1.1rem;
    box-shadow: var(--section-shadow);
    display: grid;
    gap: 0.9rem;
    width: 100%;
}

.playground-header {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    flex-wrap: wrap;
}

.playground-card h4 {
    font-family: var(--font-display);
    color: var(--ink);
    margin: 0;
}

.playground-badge {
    background: var(--button-bg);
    color: white;
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.85rem;
}

.playground-subtitle {
    color: var(--ink-soft);
    font-weight: 600;
}

.ll-step-track {
    margin: 0.9rem 0;
}

.controls.ll-step-controls {
    flex-direction: row;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.visualization.likelihood-visual {
    align-items: stretch;
    width: 100%;
}

.ll-token-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.6rem 0.75rem;
    background: var(--panel-bg);
    border: 1px dashed var(--section-border);
    border-radius: 12px;
    min-height: 44px;
}

.ll-token {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
    color: white;
}

.ll-token.is-success {
    background: var(--accent-1);
    box-shadow: 0 6px 10px rgba(56, 189, 248, 0.35);
}

.ll-token.is-failure {
    background: var(--accent-2);
    box-shadow: 0 6px 10px rgba(251, 113, 133, 0.3);
}

.ll-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    align-items: center;
    font-size: 0.85rem;
    color: var(--ink-soft);
}

.ll-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 600;
}

.ll-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.ll-dot--curve {
    background: var(--accent-1);
}

.ll-dot--mle {
    background: var(--accent-4);
}

.ll-dot--guess {
    background: var(--accent-3);
}

.likelihood-readout {
    margin-top: 0.2rem;
}

.visualization.nll-visual {
    align-items: stretch;
    width: 100%;
}

.nll-flow {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 0.6rem;
    align-items: center;
    width: 100%;
}

.nll-card {
    background: var(--panel-bg);
    border: 2px solid var(--panel-border);
    border-radius: 16px;
    padding: 0.85rem;
    box-shadow: var(--card-shadow);
    display: grid;
    gap: 0.5rem;
}

.nll-card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nll-card h4 {
    font-family: var(--font-display);
    margin: 0;
    color: var(--ink);
    font-size: 1rem;
}

.nll-step {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-1);
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
}

.nll-prob-row,
.nll-loss-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.45rem;
    align-items: end;
    height: 80px;
    padding: 0.5rem;
    background: var(--canvas-bg);
    border-radius: 12px;
    border: 1px dashed var(--section-border);
}

.nll-bar-group {
    display: grid;
    grid-template-rows: 1fr auto;
    align-items: end;
    justify-items: center;
    height: 100%;
    gap: 0.2rem;
}

.nll-prob-bar,
.nll-loss-bar {
    width: 100%;
    min-height: 6px;
    border-radius: 8px 8px 6px 6px;
    background: var(--accent-1);
    box-shadow: inset 0 -6px 10px rgba(15, 23, 42, 0.12);
}

.nll-bar-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--ink-soft);
}

.nll-bar--a {
    background: var(--accent-1);
}

.nll-bar--b {
    background: var(--accent-3);
}

.nll-bar--c {
    background: var(--accent-2);
}

.nll-log-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.4rem 0.5rem;
    background: var(--canvas-bg);
    border-radius: 12px;
    border: 1px dashed var(--section-border);
}

.nll-eq-block {
    background: var(--canvas-bg);
    border-radius: 12px;
    border: 1px dashed var(--section-border);
    padding: 0.6rem 0.7rem;
    display: grid;
    gap: 0.4rem;
}

.nll-eq-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.nll-eq-subrow {
    font-size: 0.82rem;
    color: var(--ink-soft);
}

.nll-eq-label {
    text-align: center;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--ink-soft);
}

.nll-chip {
    background: var(--chip-bg);
    color: var(--chip-text);
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.84rem;
}

.nll-chip .MathJax {
    font-size: 0.84rem;
}

.nll-chip--p {
    background: var(--accent-1);
    color: white;
}

.nll-chip--result {
    background: var(--accent-4);
    color: white;
}

.nll-mini-chip {
    background: var(--nav-link-bg);
    color: var(--ink-soft);
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.78rem;
}

.nll-operator {
    font-weight: 800;
    color: var(--ink-soft);
}

.nll-log-chip {
    background: var(--chip-bg);
    color: var(--chip-text);
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.84rem;
}

.nll-log-plus {
    color: var(--ink-soft);
    font-weight: 800;
}

.nll-caption {
    font-size: 0.86rem;
    color: var(--ink-soft);
    font-weight: 600;
}

.nll-connector {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--accent-1);
    text-align: center;
}

@media (max-width: 900px) {
    .nll-flow {
        grid-template-columns: 1fr;
    }

    .nll-connector {
        transform: rotate(90deg);
    }
}

.probability-card {
    background: var(--card-bg);
    border-radius: 18px;
    padding: 1rem 1.1rem;
    border: 2px solid var(--card-border);
    box-shadow: var(--card-shadow);
}

.probability-card h4 {
    font-family: var(--font-display);
    margin-bottom: 0.4rem;
    color: var(--ink);
}

.ml-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    width: 100%;
}

.ml-card {
    background: var(--card-bg);
    border-radius: 18px;
    padding: 1rem 1.1rem;
    border: 2px solid var(--card-border);
    box-shadow: var(--card-shadow);
}

.ml-card h4 {
    font-family: var(--font-display);
    margin-bottom: 0.4rem;
    color: var(--ink);
}

.ml-phase-toggle {
    margin: 0.8rem 0 1rem;
}

.ml-algo-toggle {
    margin: 0.8rem 0 1rem;
}

.ml-step-list {
    margin: 0.6rem 0 1rem;
    padding-left: 1.2rem;
}

.ml-step-list li {
    margin-bottom: 0.45rem;
    cursor: pointer;
    color: var(--ink-soft);
    border-radius: 8px;
    padding: 0.2rem 0.4rem;
    transition: color 0.2s ease, background 0.2s ease;
}

.ml-step-list li.is-active {
    color: var(--ink);
    background: var(--panel-bg);
    font-weight: 700;
}

.ml-step-list li:focus-visible {
    outline: 2px solid var(--accent-1);
    outline-offset: 2px;
}

.ml-derivations {
    margin-top: 2rem;
}

.ml-derivation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.ml-mini-vis {
    background: var(--panel-bg);
    border: 1px dashed var(--panel-border);
    border-radius: 12px;
    padding: 0.5rem;
    margin: 0.6rem 0;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ml-mini-vis:focus-visible {
    outline: 2px solid var(--accent-1);
    outline-offset: 2px;
}

.ml-mini-vis:hover {
    border-color: var(--accent-1);
    box-shadow: 0 8px 14px rgba(30, 64, 175, 0.18);
}

.ml-mini-vis svg {
    display: block;
    width: 100%;
    height: 80px;
}

.ml-state {
    opacity: 1;
    transition: opacity 0.3s ease;
}

.ml-state--b {
    opacity: 0;
}

.ml-mini-vis.is-alt .ml-state--a {
    opacity: 0;
}

.ml-mini-vis.is-alt .ml-state--b {
    opacity: 1;
}

.ml-line {
    transition: opacity 0.2s ease, stroke 0.2s ease;
}

.ml-mini-vis:hover .ml-line,
.ml-mini-vis.is-hover .ml-line {
    stroke-dasharray: 6 6;
    animation: ml-dash 1.1s linear infinite;
}

.ml-point {
    transform-box: fill-box;
    transform-origin: center;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.ml-mini-vis:hover .ml-point,
.ml-mini-vis.is-hover .ml-point {
    transform: scale(1.15);
}

@keyframes ml-dash {
    to {
        stroke-dashoffset: -12;
    }
}

.ml-caption {
    margin: 0.35rem 0 0;
    font-size: 0.86rem;
    color: var(--ink-soft);
}

.math-formula.math-mini {
    padding: 0.6rem 0.75rem;
    margin: 0.6rem 0 0;
    border-left-width: 3px;
    font-size: 0.92rem;
}

.vector-db-tabs {
    margin: 0.6rem 0 1rem;
}

.vector-db-panels {
    display: grid;
    gap: 0.8rem;
}

.vector-db-panel {
    display: none;
    background: var(--panel-bg);
    border: 2px solid var(--panel-border);
    border-radius: 16px;
    padding: 0.9rem 1rem;
    box-shadow: var(--card-shadow);
}

.vector-db-panel.is-active {
    display: block;
}

.vector-db-panel h4 {
    font-family: var(--font-display);
    margin-bottom: 0.4rem;
    color: var(--ink);
}

.toggle-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.toggle-btn {
    background: var(--chip-bg);
    border: 2px solid var(--panel-border);
    border-radius: 999px;
    padding: 0.35rem 0.9rem;
    cursor: pointer;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--chip-text);
    transition: all 0.2s ease;
}

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

.toggle-btn.is-active {
    background: var(--accent-1);
    border-color: var(--accent-1);
    color: white;
    box-shadow: 0 6px 12px rgba(56, 189, 248, 0.3);
}

.controls .toggle-btn {
    background: var(--chip-bg);
    color: var(--chip-text);
    border: 2px solid var(--panel-border);
    box-shadow: none;
    padding: 0.35rem 0.9rem;
}

.controls .toggle-btn.is-active {
    background: var(--accent-1);
    border-color: var(--accent-1);
    color: white;
    box-shadow: 0 6px 12px rgba(56, 189, 248, 0.3);
}

.controls .toggle-btn:hover {
    background: var(--chip-bg);
    color: var(--ink);
    border-color: var(--accent-1);
}

.vector-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.7rem;
    margin-top: 1rem;
}

.metric {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 0.55rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    opacity: 0.55;
    transition: opacity 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.metric.is-active {
    opacity: 1;
    border-color: var(--accent-1);
    transform: translateY(-1px);
}

.metric-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--ink-soft);
}

.metric-value {
    font-weight: 800;
    color: var(--ink);
}

.matrix-controls {
    gap: 0.8rem;
}

.matrix-transform-controls {
    display: grid;
    gap: 0.6rem;
}

.vector-scenes {
    margin-top: 2.5rem;
}

.scene-panel {
    background: var(--panel-bg);
    border: 2px solid var(--panel-border);
    border-radius: 16px;
    padding: 1rem 1.1rem;
}

.scene-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.scene-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.7rem;
    border-radius: 999px;
    background: var(--chip-bg);
    color: var(--chip-text);
    font-weight: 700;
    font-size: 0.85rem;
}

.scene-block h5 {
    font-family: var(--font-display);
    font-size: 0.95rem;
    color: var(--ink);
    margin-bottom: 0.3rem;
}

.scene-block p {
    color: var(--ink-soft);
}

.scene-block + .scene-block {
    margin-top: 0.8rem;
}

.scene-controls {
    flex-direction: row;
    justify-content: center;
    flex-wrap: wrap;
}

.architecture-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.architecture-card {
    background: var(--panel-bg);
    border: 2px solid var(--panel-border);
    border-radius: 16px;
    padding: 1rem;
    box-shadow: var(--card-shadow);
}

.architecture-card h4 {
    font-family: var(--font-display);
    margin-bottom: 0.4rem;
    color: var(--ink);
}

.arch-diagram {
    width: 100%;
    height: 120px;
    margin-bottom: 0.5rem;
}

.arch-stroke {
    stroke: var(--arch-accent, var(--accent-1));
    stroke-width: 2;
    fill: none;
}

.arch-node {
    fill: var(--arch-accent, var(--accent-1));
    stroke: var(--ink);
    stroke-width: 1;
}

.arch-box {
    fill: var(--panel-bg);
    stroke: var(--arch-accent, var(--accent-1));
    stroke-width: 2;
}

.guide-stack {
    display: grid;
    gap: 0.9rem;
    margin: 1rem 0 1.5rem;
}

.matrix-derivations {
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.guide-card {
    background: var(--panel-bg);
    border: 2px solid var(--panel-border);
    border-radius: 16px;
    padding: 0.9rem 1rem;
}

.guide-card h4 {
    font-family: var(--font-display);
    margin-bottom: 0.5rem;
    color: var(--ink);
}

.guide-card ul,
.guide-card ol {
    margin-left: 1.2rem;
    margin-top: 0.6rem;
}

.guide-card li {
    margin-bottom: 0.4rem;
}

.reading-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.reading-card {
    background: var(--card-bg);
    border: 2px solid var(--card-border);
    border-radius: 18px;
    padding: 1rem 1.1rem;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.reading-meta {
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    color: var(--ink-soft);
    font-size: 0.85rem;
}

.reading-card h3 {
    font-family: var(--font-display);
    margin: 0.2rem 0 0.1rem;
}

.reading-card a {
    color: var(--ink);
    text-decoration: none;
}

.reading-card a:hover {
    text-decoration: underline;
}

.reading-title {
    font-family: var(--font-display);
    color: var(--ink);
    margin: 0.2rem 0 0.1rem;
}

.reading-summary {
    color: var(--ink-soft);
}

.reading-link-note {
    font-size: 0.85rem;
    color: var(--ink-soft);
}

.reading-bullets {
    margin-left: 1.1rem;
}

.depth-map {
    position: relative;
    display: grid;
    gap: 2rem;
    margin-top: 1.4rem;
    padding: 1.1rem;
    border-radius: 28px;
    border: 2px solid rgba(252, 211, 77, 0.3);
    background: linear-gradient(135deg, rgba(255, 247, 237, 0.92), rgba(236, 254, 255, 0.9));
    box-shadow: 0 16px 32px rgba(30, 41, 59, 0.12);
}

.depth-map::before {
    content: none;
}

.depth-tier {
    display: grid;
    grid-template-columns: minmax(200px, 240px) 1fr;
    gap: 1.2rem;
    align-items: stretch;
    position: relative;
    padding: 1.2rem;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.92);
    border: 2px solid rgba(252, 211, 77, 0.3);
    box-shadow: 0 14px 26px rgba(30, 41, 59, 0.1);
    overflow: hidden;
}

.depth-tier::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 8px;
    height: 100%;
    background: var(--depth-accent, var(--accent-1));
    z-index: 0;
    pointer-events: none;
}

.depth-tier::after {
    content: '';
    position: absolute;
    right: -40px;
    top: -40px;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: var(--depth-accent, var(--accent-1));
    opacity: 0.12;
    z-index: 0;
    pointer-events: none;
}

.depth-marker {
    position: relative;
    padding: 0.9rem 1rem;
    border-radius: 18px;
    background: var(--panel-bg);
    border: 2px solid rgba(148, 163, 184, 0.3);
    box-shadow: 0 10px 20px rgba(30, 41, 59, 0.08);
    z-index: 1;
}

.depth-marker::before {
    content: none;
}

.depth-badge {
    display: inline-block;
    background: var(--depth-accent, var(--accent-1));
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 0.22rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: white;
    box-shadow: 0 8px 14px rgba(15, 23, 42, 0.12);
}

.depth-marker h3 {
    font-family: var(--font-display);
    margin: 0.6rem 0 0.35rem;
    color: var(--ink);
    font-size: 1.25rem;
}

.depth-marker p {
    margin: 0;
    color: var(--ink-soft);
    font-weight: 600;
    font-size: 0.98rem;
}

.depth-content {
    display: grid;
    gap: 1.2rem;
    z-index: 1;
}

.depth-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.depth-card {
    position: relative;
    background: linear-gradient(135deg, rgba(255, 250, 240, 0.96), rgba(255, 244, 214, 0.92));
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 18px;
    padding: 1rem 1.1rem 1rem 1.4rem;
    box-shadow: 0 12px 24px rgba(30, 41, 59, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
}

.depth-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 28px rgba(30, 41, 59, 0.12);
}

.depth-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 6px;
    height: 100%;
    border-radius: 18px 0 0 18px;
    background: var(--depth-accent, var(--accent-1));
}

.depth-card h4 {
    font-family: var(--font-display);
    margin-bottom: 0.6rem;
    color: var(--ink);
    font-size: 1.05rem;
}

.depth-card-body {
    display: grid;
    grid-template-columns: minmax(140px, 180px) 1fr;
    gap: 0.9rem;
    align-items: start;
}

.depth-mini {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(240, 253, 250, 0.9));
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-left: 4px solid var(--depth-accent, var(--accent-1));
    border-radius: 14px;
    padding: 0.45rem;
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.08);
}

.depth-mini svg {
    width: 100%;
    height: auto;
    display: block;
}

.depth-mini text {
    font-family: var(--font-display);
    font-size: 9.5px;
    font-weight: 700;
    fill: var(--ink);
}

.depth-copy p {
    margin: 0 0 0.5rem;
    color: var(--ink-soft);
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.6;
}

.depth-copy p:last-child {
    margin-bottom: 0;
}

.depth-line {
    margin-bottom: 0.45rem;
    color: var(--ink-soft);
    font-weight: 600;
    font-size: 0.92rem;
}

.depth-line span {
    display: inline-block;
    margin-right: 0.35rem;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink);
}

.depth-visual {
    position: relative;
    background: linear-gradient(135deg, rgba(255, 250, 240, 0.96), rgba(236, 254, 255, 0.92));
    border: 2px solid rgba(148, 163, 184, 0.3);
    border-radius: 22px;
    padding: 1rem 1.1rem;
    margin-bottom: 0.5rem;
    box-shadow: 0 14px 22px rgba(30, 41, 59, 0.1);
    overflow: hidden;
}

.depth-visual::after {
    content: '';
    position: absolute;
    right: 18px;
    top: 16px;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: var(--depth-accent, var(--accent-1));
    opacity: 0.12;
    z-index: 0;
    pointer-events: none;
}

.depth-diagram {
    width: 100%;
    height: auto;
    display: block;
    position: relative;
    z-index: 1;
}

.depth-diagram text {
    font-family: var(--font-display);
    font-size: 11.5px;
    font-weight: 700;
    fill: var(--ink);
}

.depth-box {
    fill: var(--panel-bg);
    stroke: var(--depth-accent, var(--accent-1));
    stroke-width: 2;
}

.depth-box-muted {
    fill: var(--formula-bg);
}

.depth-token {
    fill: var(--depth-accent, var(--accent-1));
    opacity: 0.85;
}

.depth-chip {
    fill: var(--formula-bg);
    stroke: var(--panel-border);
    stroke-width: 1.4;
}

.depth-node {
    fill: var(--panel-bg);
    stroke: var(--depth-accent, var(--accent-1));
    stroke-width: 2;
}

.depth-arrow {
    stroke: var(--ink-soft);
    stroke-width: 2;
    fill: none;
}

.depth-arrowhead {
    fill: var(--ink-soft);
}

.depth-soft {
    stroke: var(--panel-border);
    stroke-width: 1.5;
}

.depth-skip {
    stroke: var(--panel-border);
    stroke-width: 1.5;
    stroke-dasharray: 4 3;
}

.depth-cell {
    fill: var(--panel-bg);
    stroke: var(--panel-border);
    stroke-width: 1;
}

.depth-cell--masked {
    fill: var(--formula-bg);
}

.depth-wave {
    stroke: var(--depth-accent, var(--accent-1));
    stroke-width: 2;
    fill: none;
}

.depth-check {
    stroke: var(--depth-accent, var(--accent-1));
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.depth-visual-note {
    margin: 0.4rem 0 0;
    color: var(--ink-soft);
    font-weight: 600;
    font-size: 0.95rem;
    position: relative;
    z-index: 1;
}

.figure-note {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--ink-soft);
    margin-top: 0.5rem;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.7rem;
    margin-top: 0.8rem;
}

.info-card {
    background: var(--formula-bg);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 0.6rem 0.7rem;
}

.info-card h5 {
    font-family: var(--font-display);
    font-size: 0.95rem;
    margin-bottom: 0.2rem;
    color: var(--ink);
}

.transformer-advanced-steps {
    overflow-x: auto;
    padding-bottom: 0.4rem;
}

.transformer-advanced-steps .toggle-btn {
    white-space: nowrap;
}

.transformer-advanced-grid {
    align-items: start;
}

.transformer-advanced-visuals {
    align-items: stretch;
}

.transformer-advanced-canvas-grid {
    display: grid;
    gap: 0.8rem;
    width: 100%;
}

.step-points {
    margin: 0.6rem 0 0.4rem 1.2rem;
    color: var(--ink-soft);
}

.step-points li {
    margin-bottom: 0.35rem;
}

.reference-drawer {
    margin-top: 1rem;
    border: 2px dashed var(--panel-border);
    border-radius: 14px;
    padding: 0.6rem 0.9rem 0.9rem;
    background: var(--panel-bg);
}

.reference-drawer summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--ink);
}

.reference-drawer[open] .guide-stack {
    margin-top: 0.8rem;
    max-height: 360px;
    overflow-y: auto;
    padding-right: 0.4rem;
}

.neural-module {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 2px dashed var(--section-border);
    scroll-margin-top: 90px;
}

.neural-module:first-of-type {
    margin-top: 1.5rem;
    padding-top: 0;
    border-top: none;
}

.step-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin: 1rem 0 1.2rem;
}

.vector-step-grid .math-formula,
.nll-step-grid .math-formula {
    margin: 0.6rem 0 0;
}

.step-card {
    background: var(--panel-bg);
    border: 2px solid var(--panel-border);
    border-radius: 16px;
    padding: 0.9rem 1rem;
}

.step-card h4 {
    font-family: var(--font-display);
    margin-bottom: 0.5rem;
    color: var(--ink);
}

.step-card ol {
    margin-left: 1.2rem;
    color: var(--ink-soft);
}

.neural-readout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin: 1rem 0;
}

.readout-card {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    padding: 0.6rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.readout-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--ink-soft);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.readout-value {
    font-weight: 800;
    color: var(--ink);
    font-size: 0.95rem;
}

.example-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.6rem 0 0.8rem;
}

.example-note {
    color: var(--ink-soft);
    font-weight: 600;
    margin-bottom: 0.8rem;
}

.step-panel {
    margin-top: 1rem;
}

.controls .toggle-group,
.controls .example-chips {
    justify-content: center;
}

.path-card {
    background: var(--card-bg);
    border-radius: 18px;
    padding: 1rem 1.1rem;
    border: 2px solid var(--card-border);
    box-shadow: var(--card-shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.path-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 24px rgba(30, 41, 59, 0.15);
}

.path-step {
    display: inline-block;
    background: var(--accent-1);
    color: white;
    font-weight: 700;
    padding: 0.2rem 0.7rem;
    border-radius: 999px;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.path-card h4 {
    font-family: var(--font-display);
    margin-bottom: 0.35rem;
    color: var(--ink);
}

.path-card p {
    color: var(--ink-soft);
    margin-bottom: 0.5rem;
}

.path-goal {
    display: inline-block;
    font-weight: 700;
    color: var(--chip-text);
    background: var(--chip-bg);
    border-radius: 12px;
    padding: 0.3rem 0.6rem;
    font-size: 0.85rem;
}

.foundation-lead {
    font-weight: 700;
    color: var(--ink-soft);
}

.concept-bullets {
    list-style: disc;
}

.concept-steps {
    list-style: decimal;
    margin-left: 1.2rem;
    color: var(--ink);
}

.concept-steps li {
    margin-bottom: 0.35rem;
}

.mini-mission {
    background: var(--helper-bg);
    border-left: 4px solid var(--teal);
    padding: 0.7rem 0.9rem;
    border-radius: 12px;
    font-weight: 700;
    color: var(--helper-text);
}

.concept-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1rem 0;
}

.concept-tab {
    background: var(--chip-bg);
    border: 2px solid var(--border);
    border-radius: 999px;
    padding: 0.4rem 0.9rem;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--chip-text);
    transition: all 0.2s ease;
}

.concept-tab:hover {
    border-color: var(--accent-1);
    color: var(--ink);
    transform: translateY(-1px);
}

.concept-tab.is-active {
    background: var(--accent-1);
    border-color: var(--accent-1);
    color: white;
    box-shadow: 0 6px 12px rgba(56, 189, 248, 0.3);
}

.concept-panels {
    margin-top: 0.5rem;
}

.concept-panel {
    display: none;
    padding: 1rem;
    border-radius: 8px;
    background: var(--panel-bg);
    border-left: 4px solid var(--panel-border);
}

.concept-panel.is-active {
    display: block;
}

.concept-panel h3 {
    color: var(--ink);
    margin-bottom: 0.75rem;
}

.math-formula {
    background: var(--formula-bg);
    padding: 1rem;
    border-left: 4px solid var(--panel-border);
    margin: 1rem 0;
    overflow-x: auto;
}

.math-formula code {
    font-size: 1.1rem;
    color: var(--ink);
}

.matrix-example {
    background: var(--formula-bg);
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 5px;
}

.matrix-example pre {
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    color: var(--ink);
}

.prompt-template {
    background: var(--panel-bg);
    border: 2px solid var(--panel-border);
    border-radius: 16px;
    padding: 1rem;
    box-shadow: var(--card-shadow);
}

.prompt-template h4 {
    font-family: var(--font-display);
    margin-bottom: 0.6rem;
    color: var(--ink);
}

.prompt-template pre {
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    color: var(--ink);
    background: var(--formula-bg);
    border-radius: 12px;
    padding: 0.75rem;
    white-space: pre-wrap;
    line-height: 1.5;
}

.prompt-template ol,
.prompt-template ul {
    margin-left: 1.2rem;
    margin-top: 0.6rem;
}

.prompt-template li {
    margin-bottom: 0.4rem;
}

.visualization {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.card-column {
    align-items: stretch;
}

.card-column > * {
    width: 100%;
}

.text-link {
    color: var(--accent-1);
    font-weight: 700;
    text-decoration: underline;
}

.text-link:hover {
    color: var(--accent-4);
}

canvas {
    border: 3px solid var(--canvas-border);
    border-radius: 16px;
    background: var(--canvas-bg);
    box-shadow: 0 10px 18px rgba(30, 41, 59, 0.12);
    max-width: 100%;
    height: auto;
}

.card-canvas {
    border-width: 2px;
    border-radius: 12px;
    box-shadow: none;
    margin: 0.6rem 0 0.8rem;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

.vector-controls {
    gap: 0.8rem;
}

.slider-group {
    background: var(--panel-bg);
    border: 2px dashed var(--panel-border);
    padding: 0.75rem;
    border-radius: 12px;
    display: grid;
    gap: 0.4rem;
}

.slider-title {
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 0.2rem;
}

.slider-group label span {
    margin-left: auto;
    font-weight: 700;
    color: var(--accent-1);
}

.fundamentals-controls {
    align-items: stretch;
}

.helper-text {
    text-align: center;
    font-weight: 700;
    color: var(--helper-text);
    background: var(--helper-bg);
    padding: 0.5rem 0.75rem;
    border-radius: 999px;
}

.fundamentals-playground {
    margin-top: 2.5rem;
    scroll-margin-top: 120px;
}

.fundamentals-playground-card {
    align-items: start;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.18), rgba(52, 211, 153, 0.12));
}

.fundamentals-playground-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
}

.fundamentals-playground-note {
    color: var(--ink-soft);
    font-weight: 600;
}

.python-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 205;
}

.python-drawer-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.python-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: min(860px, 96vw);
    height: 100vh;
    background: var(--section-bg);
    border-left: 3px solid var(--section-border);
    box-shadow: -18px 0 35px rgba(15, 23, 42, 0.2);
    transform: translateX(100%);
    transition: transform 0.35s ease;
    z-index: 210;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem 1.6rem;
    overflow-y: auto;
}

.python-drawer.is-open {
    transform: translateX(0);
}

.python-drawer__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.2rem;
}

.python-drawer__title h3 {
    font-family: var(--font-display);
    color: var(--ink);
    margin: 0.35rem 0 0.2rem;
}

.python-drawer__subtitle {
    color: var(--ink-soft);
    margin: 0;
}

.python-drawer__header-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.6rem;
}

.python-status {
    font-weight: 700;
    color: var(--ink-soft);
    background: var(--panel-bg);
    border: 2px solid var(--panel-border);
    border-radius: 999px;
    padding: 0.2rem 0.7rem;
}

.python-drawer__close {
    border: 2px solid var(--section-border);
    background: var(--nav-link-bg);
    color: var(--ink);
    border-radius: 999px;
    padding: 0.35rem 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.python-drawer__close:hover {
    border-color: var(--nav-link-hover-border);
    transform: translateY(-1px);
}

.python-drawer__body {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: 1rem;
    min-height: 0;
}

.python-panel {
    background: var(--panel-bg);
    border: 2px solid var(--panel-border);
    border-radius: 18px;
    padding: 0.8rem 0.9rem 1rem;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.python-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.python-panel-title {
    font-weight: 700;
    color: var(--ink);
}

.python-panel-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.python-editor {
    flex: 1;
    min-height: 320px;
    margin-top: 0.7rem;
    resize: none;
    border-radius: 12px;
    border: 2px solid var(--section-border);
    padding: 0.8rem 0.9rem;
    font-family: 'Courier New', monospace;
    font-size: 0.92rem;
    background: #f8fafc;
}

.python-output {
    margin-top: 0.7rem;
    flex: 1;
    min-height: 300px;
    background: #f8fafc;
    border-radius: 12px;
    border: 2px dashed var(--section-border);
    padding: 0.8rem 0.9rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    white-space: normal;
    overflow: auto;
}

.python-output.has-error {
    border-color: var(--accent-danger);
    background: #fee2e2;
    color: #991b1b;
}

.python-drawer__footer {
    display: grid;
    gap: 0.6rem;
}

.python-snippets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.python-hint {
    color: var(--ink-soft);
    font-weight: 600;
}

@media (max-width: 960px) {
    .python-drawer {
        width: 100vw;
    }

    .python-drawer__body {
        grid-template-columns: 1fr;
        grid-template-rows: 1.1fr 0.9fr;
    }

    .python-editor {
        min-height: 260px;
    }

    .python-output {
        min-height: 220px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .python-drawer,
    .python-drawer-backdrop {
        transition: none;
    }
}

.wip-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
    padding: 1rem;
    border-radius: 18px;
    background: var(--panel-bg);
    border: 2px dashed var(--panel-border);
}

.wip-card img {
    width: 160px;
    height: auto;
    flex-shrink: 0;
}

.wip-card figcaption {
    color: var(--ink-soft);
    font-weight: 600;
}

.wip-label {
    display: inline-block;
    margin-bottom: 0.4rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background: var(--chip-bg);
    color: var(--chip-text);
    font-weight: 700;
}

@media (max-width: 768px) {
    .wip-card {
        flex-direction: column;
        text-align: center;
    }
}

.controls button {
    background: var(--button-bg);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 999px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    font-weight: 700;
    box-shadow: var(--button-shadow);
}

.controls button:hover {
    background: var(--button-bg-hover);
    transform: translateY(-2px);
    box-shadow: var(--button-shadow-hover);
}

.controls button:active {
    transform: translateY(0);
}

.controls label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    color: var(--ink-soft);
}

.controls input[type="range"] {
    flex: 1;
    cursor: pointer;
    accent-color: var(--accent-1);
}

.controls input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
}

footer {
    background: var(--header-bg);
    padding: 2rem;
    text-align: center;
    margin-top: 3rem;
    color: var(--ink-soft);
    border-top: 4px solid var(--sun);
}

footer p {
    margin: 0.5rem 0;
}

body[data-theme="dark"] {
    color-scheme: dark;
    --ink: #e2e8f0;
    --ink-soft: #94a3b8;
    --sun: #fbbf24;
    --sun-deep: #f59e0b;
    --border: rgba(56, 189, 248, 0.4);
    --bg: radial-gradient(circle at top left, rgba(14, 116, 144, 0.35) 0%, transparent 50%),
          radial-gradient(circle at top right, rgba(30, 64, 175, 0.35) 0%, transparent 45%),
          radial-gradient(circle at bottom left, rgba(251, 113, 133, 0.25) 0%, transparent 50%),
          linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --orb-1: linear-gradient(135deg, rgba(56, 189, 248, 0.6), rgba(34, 211, 238, 0.4));
    --orb-2: linear-gradient(135deg, rgba(251, 191, 36, 0.5), rgba(244, 114, 182, 0.4));
    --header-bg: rgba(15, 23, 42, 0.85);
    --nav-bg: rgba(15, 23, 42, 0.9);
    --section-bg: rgba(15, 23, 42, 0.78);
    --section-border: rgba(56, 189, 248, 0.35);
    --section-shadow: 0 20px 40px rgba(2, 6, 23, 0.6);
    --panel-bg: rgba(30, 41, 59, 0.85);
    --panel-border: rgba(56, 189, 248, 0.5);
    --formula-bg: rgba(15, 23, 42, 0.9);
    --card-bg: rgba(15, 23, 42, 0.7);
    --card-border: rgba(148, 163, 184, 0.3);
    --card-shadow: 0 16px 28px rgba(2, 6, 23, 0.5);
    --chip-bg: rgba(30, 41, 59, 0.8);
    --chip-text: #e2e8f0;
    --nav-link-bg: rgba(15, 23, 42, 0.7);
    --nav-link-hover-bg: rgba(56, 189, 248, 0.2);
    --nav-link-hover-border: rgba(56, 189, 248, 0.6);
    --canvas-bg: #0f172a;
    --canvas-border: rgba(56, 189, 248, 0.6);
    --button-bg: linear-gradient(135deg, #38bdf8, #22d3ee);
    --button-bg-hover: linear-gradient(135deg, #60a5fa, #2dd4bf);
    --button-shadow: 0 16px 26px rgba(2, 6, 23, 0.6);
    --button-shadow-hover: 0 20px 32px rgba(2, 6, 23, 0.7);
    --helper-bg: rgba(14, 116, 144, 0.25);
    --helper-text: #7dd3fc;
    --grid: rgba(148, 163, 184, 0.25);
    --axis: rgba(226, 232, 240, 0.6);
    --accent-1: #38bdf8;
    --accent-2: #f472b6;
    --accent-3: #34d399;
    --accent-4: #fbbf24;
    --accent-danger: #fb7185;
}

body[data-theme="kid"] {
    color-scheme: light;
    --font-display: 'Bangers', 'Fredoka', sans-serif;
    --font-body: 'Comic Neue', 'Nunito', sans-serif;
    --ink: #111827;
    --ink-soft: #374151;
    --sun: #fcd34d;
    --sun-deep: #f59e0b;
    --border: #111827;
    --bg: radial-gradient(circle at top left, #fff7ed 0%, transparent 45%),
          radial-gradient(circle at top right, #dbeafe 0%, transparent 45%),
          radial-gradient(circle at bottom left, #fde68a 0%, transparent 55%),
          repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.03) 0, rgba(0, 0, 0, 0.03) 12px, transparent 12px, transparent 24px);
    --orb-1: linear-gradient(135deg, #fb7185, #fcd34d);
    --orb-2: linear-gradient(135deg, #38bdf8, #a855f7);
    --header-bg: #fff7ed;
    --nav-bg: #fff7ed;
    --section-bg: #ffffff;
    --section-border: #111827;
    --section-shadow: 6px 6px 0 #111827;
    --panel-bg: #fff7ed;
    --panel-border: #111827;
    --formula-bg: #fff7ed;
    --card-bg: #ffffff;
    --card-border: #111827;
    --card-shadow: 4px 4px 0 #111827;
    --chip-bg: #fde68a;
    --chip-text: #92400e;
    --nav-link-bg: #ffffff;
    --nav-link-hover-bg: #fde68a;
    --nav-link-hover-border: #111827;
    --canvas-bg: #ffffff;
    --canvas-border: #111827;
    --button-bg: linear-gradient(135deg, #fb7185, #fcd34d);
    --button-bg-hover: linear-gradient(135deg, #f59e0b, #fb7185);
    --button-shadow: 4px 4px 0 #111827;
    --button-shadow-hover: 6px 6px 0 #111827;
    --helper-bg: #a7f3d0;
    --helper-text: #064e3b;
    --grid: #e5e7eb;
    --axis: #111827;
    --accent-1: #2563eb;
    --accent-2: #f43f5e;
    --accent-3: #22c55e;
    --accent-4: #f59e0b;
    --accent-danger: #ef4444;
}

body[data-theme="holiday"] {
    color-scheme: light;
    --font-display: 'Bangers', 'Fredoka', sans-serif;
    --font-body: 'Comic Neue', 'Nunito', sans-serif;
    --ink: #0f172a;
    --ink-soft: #334155;
    --sun: #93c5fd;
    --sun-deep: #60a5fa;
    --border: #0f172a;
    --bg: radial-gradient(circle at 15% 15%, rgba(255, 255, 255, 0.9) 0%, transparent 55%),
          radial-gradient(circle at 85% 10%, rgba(191, 219, 254, 0.7) 0%, transparent 50%),
          radial-gradient(circle at 20% 85%, rgba(226, 232, 240, 0.7) 0%, transparent 55%),
          repeating-radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.5) 0 2px, transparent 2px 14px),
          linear-gradient(150deg, #e2e8f0 0%, #bfdbfe 55%, #e0f2fe 100%);
    --orb-1: linear-gradient(135deg, #7dd3fc, #38bdf8);
    --orb-2: linear-gradient(135deg, #93c5fd, #c4b5fd);
    --header-bg: rgba(248, 250, 252, 0.96);
    --nav-bg: rgba(248, 250, 252, 0.92);
    --section-bg: #f8fafc;
    --section-border: #0f172a;
    --section-shadow: 6px 6px 0 rgba(15, 23, 42, 0.85);
    --panel-bg: #f1f5f9;
    --panel-border: #0f172a;
    --formula-bg: #e2e8f0;
    --card-bg: #f8fafc;
    --card-border: #0f172a;
    --card-shadow: 4px 4px 0 rgba(15, 23, 42, 0.8);
    --chip-bg: #e0f2fe;
    --chip-text: #0c4a6e;
    --nav-link-bg: #f8fafc;
    --nav-link-hover-bg: #bae6fd;
    --nav-link-hover-border: #0f172a;
    --canvas-bg: #f8fafc;
    --canvas-border: #0f172a;
    --button-bg: linear-gradient(135deg, #60a5fa, #38bdf8);
    --button-bg-hover: linear-gradient(135deg, #38bdf8, #a5b4fc);
    --button-shadow: 4px 4px 0 rgba(15, 23, 42, 0.85);
    --button-shadow-hover: 6px 6px 0 rgba(15, 23, 42, 0.85);
    --helper-bg: #e0f2fe;
    --helper-text: #075985;
    --grid: #dbeafe;
    --axis: #0f172a;
    --accent-1: #2563eb;
    --accent-2: #0ea5e9;
    --accent-3: #38bdf8;
    --accent-4: #a5b4fc;
    --accent-danger: #ef4444;
}

body[data-theme="holiday"] .example-section,
body[data-theme="holiday"] .path-card,
body[data-theme="holiday"] .vector-card,
body[data-theme="holiday"] .probability-card,
body[data-theme="holiday"] .ml-card,
body[data-theme="holiday"] .readout-card,
body[data-theme="holiday"] .step-card,
body[data-theme="holiday"] .concept-panel,
body[data-theme="holiday"] .scene-panel,
body[data-theme="holiday"] .vector-db-panel,
body[data-theme="holiday"] .prompt-template,
body[data-theme="holiday"] .architecture-card {
    position: relative;
    overflow: hidden;
    background: rgba(248, 250, 252, 0.9);
    border-color: rgba(15, 23, 42, 0.85);
    box-shadow: 0 12px 28px rgba(59, 130, 246, 0.22), 0 0 0 2px rgba(226, 232, 240, 0.7) inset;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

body[data-theme="holiday"] .example-section::before,
body[data-theme="holiday"] .path-card::before,
body[data-theme="holiday"] .vector-card::before,
body[data-theme="holiday"] .probability-card::before,
body[data-theme="holiday"] .ml-card::before,
body[data-theme="holiday"] .readout-card::before,
body[data-theme="holiday"] .step-card::before,
body[data-theme="holiday"] .concept-panel::before,
body[data-theme="holiday"] .scene-panel::before,
body[data-theme="holiday"] .vector-db-panel::before,
body[data-theme="holiday"] .prompt-template::before,
body[data-theme="holiday"] .architecture-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.65), rgba(191, 219, 254, 0.18));
    opacity: 0.9;
    pointer-events: none;
    z-index: 0;
}

body[data-theme="holiday"] .example-section > *,
body[data-theme="holiday"] .path-card > *,
body[data-theme="holiday"] .vector-card > *,
body[data-theme="holiday"] .probability-card > *,
body[data-theme="holiday"] .ml-card > *,
body[data-theme="holiday"] .readout-card > *,
body[data-theme="holiday"] .step-card > *,
body[data-theme="holiday"] .concept-panel > *,
body[data-theme="holiday"] .scene-panel > *,
body[data-theme="holiday"] .vector-db-panel > *,
body[data-theme="holiday"] .prompt-template > *,
body[data-theme="holiday"] .architecture-card > * {
    position: relative;
    z-index: 1;
}

body[data-theme="adult"] {
    color-scheme: light;
    --font-display: 'Playfair Display', serif;
    --font-body: 'Source Sans 3', sans-serif;
    --ink: #0f172a;
    --ink-soft: #334155;
    --sun: #cbd5e1;
    --sun-deep: #94a3b8;
    --border: rgba(148, 163, 184, 0.6);
    --bg: radial-gradient(circle at top left, rgba(148, 163, 184, 0.2) 0%, transparent 50%),
          linear-gradient(120deg, #f8fafc 0%, #e2e8f0 100%);
    --orb-1: linear-gradient(135deg, rgba(71, 85, 105, 0.3), rgba(148, 163, 184, 0.2));
    --orb-2: linear-gradient(135deg, rgba(15, 118, 110, 0.2), rgba(71, 85, 105, 0.2));
    --header-bg: rgba(255, 255, 255, 0.95);
    --nav-bg: rgba(248, 250, 252, 0.95);
    --section-bg: rgba(255, 255, 255, 0.96);
    --section-border: rgba(148, 163, 184, 0.5);
    --section-shadow: 0 24px 50px rgba(15, 23, 42, 0.12);
    --panel-bg: #f8fafc;
    --panel-border: #94a3b8;
    --formula-bg: #f1f5f9;
    --card-bg: #ffffff;
    --card-border: #cbd5e1;
    --card-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
    --chip-bg: #e2e8f0;
    --chip-text: #0f172a;
    --nav-link-bg: rgba(255, 255, 255, 0.9);
    --nav-link-hover-bg: #cbd5e1;
    --nav-link-hover-border: #475569;
    --canvas-bg: #f8fafc;
    --canvas-border: #475569;
    --button-bg: linear-gradient(135deg, #334155, #0f172a);
    --button-bg-hover: linear-gradient(135deg, #475569, #111827);
    --button-shadow: 0 10px 20px rgba(15, 23, 42, 0.12);
    --button-shadow-hover: 0 14px 26px rgba(15, 23, 42, 0.18);
    --helper-bg: #e2e8f0;
    --helper-text: #1f2937;
    --grid: #d1d5db;
    --axis: #475569;
    --accent-1: #0f766e;
    --accent-2: #4b5563;
    --accent-3: #16a34a;
    --accent-4: #d97706;
    --accent-danger: #dc2626;
}

body[data-theme="kid"] .example-section,
body[data-theme="kid"] .path-card,
body[data-theme="kid"] .concept-panel,
body[data-theme="kid"] .controls button,
body[data-theme="holiday"] .example-section,
body[data-theme="holiday"] .path-card,
body[data-theme="holiday"] .concept-panel,
body[data-theme="holiday"] .controls button {
    border-style: solid;
    border-width: 3px;
}

body[data-theme="kid"] .example-section h2,
body[data-theme="holiday"] .example-section h2 {
    letter-spacing: 0.04em;
}

body[data-theme="kid"] .math-formula,
body[data-theme="kid"] .matrix-example,
body[data-theme="holiday"] .math-formula,
body[data-theme="holiday"] .matrix-example {
    border: 2px solid var(--border);
}

body[data-theme="kid"] header,
body[data-theme="holiday"] header {
    border-bottom-color: var(--border);
}

body[data-theme="kid"] .example-section h2,
body[data-theme="holiday"] .example-section h2 {
    border-bottom-color: var(--border);
}

body[data-theme="kid"] .mode-switcher,
body[data-theme="kid"] .mode-btn,
body[data-theme="holiday"] .mode-switcher,
body[data-theme="holiday"] .mode-btn {
    box-shadow: 3px 3px 0 var(--border);
}

body[data-theme="adult"] .mode-switcher {
    border-radius: 12px;
}

body[data-theme="adult"] nav a {
    border-radius: 10px;
    font-weight: 600;
}

body[data-theme="adult"] .example-section h2 {
    border-bottom-style: solid;
}

body[data-theme="adult"] .concept-tab.is-active {
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.15);
}

.holiday-parade {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 200;
    display: none;
}

.holiday-parade::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.5), transparent 55%),
                radial-gradient(circle at 80% 30%, rgba(226, 232, 240, 0.5), transparent 60%),
                radial-gradient(circle at 50% 70%, rgba(191, 219, 254, 0.35), transparent 65%);
    opacity: 0.25;
    animation: snow-haze 12s ease-in-out infinite;
    z-index: 0;
}

body[data-theme="holiday"] .holiday-parade {
    display: block;
}

.snow-layer {
    position: absolute;
    inset: 0;
    overflow: hidden;
    opacity: 0;
    z-index: 1;
}

body[data-theme="holiday"] .snow-layer {
    opacity: 1;
}

.snowflake {
    position: absolute;
    top: -12%;
    left: var(--x);
    font-size: var(--size);
    color: #e2e8f0;
    text-shadow: 0 4px 10px rgba(15, 23, 42, 0.25);
    animation: snow-fall var(--duration) linear var(--delay) infinite;
}

.santa-ride {
    position: absolute;
    top: 12%;
    left: -35%;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--font-display);
    font-size: 2.5rem;
    opacity: 0;
    filter: drop-shadow(0 6px 10px rgba(15, 23, 42, 0.35));
    z-index: 1;
}

.santa-ride.is-active {
    animation: santa-ride 6.2s ease-in-out;
}

@media (max-width: 700px) {
    .santa-ride {
        top: 10%;
        font-size: 2rem;
    }

    .snowflake {
        font-size: calc(var(--size) * 0.85);
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.example-section {
    animation: fadeIn 0.5s ease-out;
}

/* Pulse animation for interactive elements */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.pulsing {
    animation: pulse 1s ease-in-out infinite;
}

@keyframes snow-fall {
    0% {
        opacity: 0;
        transform: translate3d(0, -12vh, 0) rotate(0deg);
    }
    12% {
        opacity: 0.9;
    }
    100% {
        opacity: 0.6;
        transform: translate3d(0, 110vh, 0) rotate(360deg);
    }
}

@keyframes snow-haze {
    0% {
        opacity: 0.2;
        transform: translate3d(0, 0, 0);
    }
    50% {
        opacity: 0.35;
        transform: translate3d(0, 8px, 0);
    }
    100% {
        opacity: 0.2;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes santa-ride {
    0% {
        opacity: 0;
        transform: translate3d(-40vw, -8px, 0) scale(0.95) rotate(-2deg);
    }
    15% {
        opacity: 1;
    }
    60% {
        transform: translate3d(50vw, 6px, 0) scale(1) rotate(1deg);
    }
    100% {
        opacity: 0;
        transform: translate3d(140vw, 16px, 0) scale(1.06) rotate(2deg);
    }
}

.notebook-section {
    position: relative;
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    padding: 2.6rem clamp(1rem, 4vw, 3rem);
    border-radius: 0;
}

.notebook-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.2rem;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    flex-wrap: wrap;
}

.notebook-status {
    font-weight: 700;
    color: var(--ink-soft);
}

.toolbar-actions {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.notebook-workspace {
    display: grid;
    gap: 1.2rem;
}

.notebook-group {
    display: grid;
    gap: 1rem;
    background: var(--panel-bg);
    border-radius: 18px;
    border: 2px solid var(--panel-border);
    padding: 1.2rem;
    box-shadow: var(--card-shadow);
}

.notebook-chip {
    background: var(--chip-bg);
    color: var(--chip-text);
    padding: 0.2rem 0.75rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.8rem;
}

.notebook-cell {
    border: 2px solid var(--section-border);
    background: var(--section-bg);
    border-radius: 16px;
    padding: 0.9rem 1rem;
    box-shadow: var(--card-shadow);
    margin-top: 0;
}

.notebook-cell h4 {
    margin-bottom: 0.5rem;
}

.markdown-cell {
    background: linear-gradient(135deg, #ffffff 0%, #fef3c7 100%);
    margin-top: 0;
}

.code-cell {
    border-left: 5px solid var(--accent-1);
}

.cell-top {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    margin-bottom: 0.6rem;
}

.cell-label {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    color: var(--ink-soft);
    background: var(--helper-bg);
    padding: 0.1rem 0.6rem;
    border-radius: 10px;
}

.cell-title {
    font-weight: 700;
    color: var(--ink);
}

.cell-editor {
    width: 100%;
    min-height: 180px;
    resize: vertical;
    border-radius: 12px;
    border: 2px solid var(--section-border);
    padding: 0.9rem 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.92rem;
    background: #f8fafc;
}

.cell-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.6rem;
}

.cell-output {
    margin-top: 0.8rem;
    background: var(--panel-bg);
    border-radius: 12px;
    border: 2px dashed var(--section-border);
    padding: 0.7rem 0.9rem;
    font-family: 'Courier New', monospace;
    font-size: 0.88rem;
    white-space: normal;
    min-height: 80px;
}

.cell-output::before {
    content: "Out [ ]";
    display: block;
    font-weight: 700;
    color: var(--ink-soft);
    margin-bottom: 0.4rem;
}

.cell-output-text {
    margin: 0;
    white-space: pre-wrap;
}

.cell-output-figure {
    margin-top: 0.6rem;
    display: flex;
    justify-content: center;
}

.cell-output-figure svg {
    max-width: 100%;
    height: auto;
}

.cell-output.has-error {
    border-color: var(--accent-danger);
    background: #fee2e2;
    color: #991b1b;
}

.notebook-btn {
    border: none;
    border-radius: 999px;
    padding: 0.45rem 1.1rem;
    background: var(--button-bg);
    color: white;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--button-shadow);
}

.notebook-btn:hover {
    background: var(--button-bg-hover);
    transform: translateY(-1px);
    box-shadow: var(--button-shadow-hover);
}

.notebook-btn.secondary {
    background: var(--nav-link-bg);
    color: var(--ink);
    border: 2px solid var(--section-border);
    box-shadow: none;
}

.notebook-btn.secondary:hover {
    transform: translateY(-1px);
    border-color: var(--nav-link-hover-border);
}

.notebook-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    box-shadow: none;
}

.onnx-demo {
    display: grid;
    gap: 1rem;
}

.onnx-demo-controls {
    display: grid;
    gap: 0.7rem;
}

.onnx-demo-label {
    font-weight: 700;
    color: var(--ink);
}

.onnx-demo-input {
    width: 100%;
    border: 2px solid var(--section-border);
    border-radius: 12px;
    padding: 0.6rem 0.8rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    background: #f8fafc;
}

.onnx-demo-actions {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.onnx-demo-visuals {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 1rem;
    align-items: start;
}

.onnx-input-canvas {
    border: 2px solid var(--section-border);
    border-radius: 12px;
    background: #f8fafc;
    box-shadow: var(--card-shadow);
    width: 140px;
    height: 140px;
}

.onnx-demo-status {
    text-align: left;
}

@media (max-width: 900px) {
    .onnx-demo-visuals {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 980px) {
    .notebook-section {
        padding: 2.2rem 1.2rem;
    }

    .cell-editor {
        min-height: 150px;
    }
}
