/* ═══════════════════════════════════════════════════════════
   eBook STEAM — Minimalista Científico
   ═══════════════════════════════════════════════════════════ */

/* ── Variables ──────────────────────────────────────────── */
:root {
    --primary:      #5B4CF5;
    --primary-dim:  #ece9fe;
    --teal:         #00E5C3;
    --teal-dim:     #e0faf6;
    --bg:           #f8fafc;
    --bg-2:         #f1f5f9;
    --surface:      #ffffff;
    --border:       #e2e8f0;
    --text:         #1a202c;
    --text-2:       #64748b;
    --text-3:       #94a3b8;
    --success:      #10b981;
    --warning:      #f59e0b;
    --danger:       #ef4444;
    --footer-bg:    #ffffff;
    --footer-text:  #1a202c;
    --footer-muted: #64748b;
    --footer-link:  #475569;
    --footer-border: rgba(15, 23, 42, 0.12);
    --footer-hover-bg: rgba(91, 76, 245, 0.1);

    /* Legacy aliases used by JS */
    --primary-color:    var(--primary);
    --secondary-color:  var(--teal);
    --accent-color:     var(--teal);
    --dark-color:       #1a202c;
    --light-color:      var(--bg-2);
    --success-color:    var(--success);
    --warning-color:    var(--warning);
    --danger-color:     var(--danger);
    --background-color: var(--bg);
    --text-color:       var(--text);
    --card-background:  var(--surface);
    --border-color:     var(--border);
    --shadow-color:     rgba(0, 0, 0, 0.06);
}

/* ── Dark Theme ─────────────────────────────────────────── */
body.dark-theme {
    --primary:      #7c6cf8;
    --primary-dim:  #1e1a3e;
    --teal:         #00d4b4;
    --teal-dim:     #0d2e29;
    --bg:           #0f172a;
    --bg-2:         #1e293b;
    --surface:      #1e293b;
    --border:       #334155;
    --text:         #f1f5f9;
    --text-2:       #94a3b8;
    --text-3:       #64748b;
    --footer-bg:    #0f172a;
    --footer-text:  #e2e8f0;
    --footer-muted: #94a3b8;
    --footer-link:  #94a3b8;
    --footer-border: rgba(255, 255, 255, 0.12);
    --footer-hover-bg: rgba(255, 255, 255, 0.08);

    --primary-color:    var(--primary);
    --secondary-color:  var(--teal);
    --accent-color:     var(--teal);
    --dark-color:       #0f172a;
    --light-color:      var(--bg-2);
    --success-color:    #34d399;
    --warning-color:    #fbbf24;
    --danger-color:     #f87171;
    --background-color: var(--bg);
    --text-color:       var(--text);
    --card-background:  var(--surface);
    --border-color:     var(--border);
    --shadow-color:     rgba(0, 0, 0, 0.3);
}

/* ── High Contrast ──────────────────────────────────────── */
body.high-contrast {
    --primary:          #0000ff;
    --primary-dim:      #e0e0ff;
    --teal:             #008080;
    --bg:               #ffffff;
    --bg-2:             #f0f0f0;
    --surface:          #ffffff;
    --border:           #000000;
    --text:             #000000;
    --text-2:           #333333;
    --footer-bg:        #ffffff;
    --footer-text:      #000000;
    --footer-muted:     #111111;
    --footer-link:      #000000;
    --footer-border:    rgba(0, 0, 0, 0.6);
    --footer-hover-bg:  rgba(0, 0, 0, 0.1);
    --success-color:    #006600;
    --warning-color:    #cc6600;
    --danger-color:     #cc0000;
    --background-color: #ffffff;
    --text-color:       #000000;
    --card-background:  #ffffff;
    --border-color:     #000000;
    --shadow-color:     rgba(0,0,0,0.4);
}

body.dark-theme.high-contrast {
    --bg:               #000000;
    --surface:          #000000;
    --text:             #ffffff;
    --border:           #ffffff;
    --footer-bg:        #000000;
    --footer-text:      #ffffff;
    --footer-muted:     #f5f5f5;
    --footer-link:      #ffffff;
    --footer-border:    rgba(255, 255, 255, 0.75);
    --footer-hover-bg:  rgba(255, 255, 255, 0.15);
    --background-color: #000000;
    --text-color:       #ffffff;
    --card-background:  #000000;
    --border-color:     #ffffff;
}

/* ── Reduced Motion ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce), body.reduce-motion {
    *, ::before, ::after {
        animation-duration: 0.001s !important;
        transition-duration: 0.001s !important;
    }
}

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

html { scroll-behavior: smooth; }

/* ── Base ───────────────────────────────────────────────── */
body {
    font-family: 'Syne', 'Segoe UI', system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.7;
    color: var(--text);
    background-color: var(--bg);
    overflow-x: hidden;
}

/* ── Layout ─────────────────────────────────────────────── */
.container {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
    background-color: var(--surface);
    border-right: 1px solid var(--border);
    padding: 1.5rem 1rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    transition: all 0.3s;
}

.sidebar-header {
    margin-bottom: 1.25rem;
    text-align: center;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-header img {
    width: 72px !important;
    height: 72px !important;
    border-radius: 12px;
    object-fit: cover;
    margin: 0 auto 0.75rem !important;
    display: block !important;
}

.sidebar-header h1 {
    font-family: 'Syne', sans-serif;
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
    margin-bottom: 0.2rem;
    line-height: 1.3;
}

.sidebar-header p {
    font-size: 0.78rem;
    color: var(--text-2);
    line-height: 1.4;
    margin-bottom: 0.15rem;
}

/* ── Lang Toggle ────────────────────────────────────────── */
#lang-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.28rem 0.75rem;
    background: var(--primary-dim) !important;
    border: 1px solid var(--primary) !important;
    border-radius: 20px;
    color: var(--primary) !important;
    font-family: 'Syne', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: background 0.2s, color 0.15s, transform 0.15s;
    white-space: nowrap;
    margin-top: 0.6rem;
    position: static !important;
    top: auto !important;
    right: auto !important;
    z-index: auto !important;
}

#lang-toggle:hover {
    background: var(--primary) !important;
    color: #fff !important;
    transform: translateY(-1px);
}

#lang-toggle:active { transform: translateY(0); }

body.dark-theme #lang-toggle {
    background: rgba(91, 76, 245, 0.22) !important;
    border-color: rgba(139, 156, 247, 0.5) !important;
    color: #e6ecff !important;
}

/* ── Nav Links ──────────────────────────────────────────── */
.nav-links {
    list-style: none;
    flex: 1;
}

.nav-links li {
    margin-bottom: 0.1rem;
}

.nav-links a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.42rem 0.75rem;
    border-radius: 8px;
    font-size: 0.83rem;
    font-weight: 500;
    color: var(--text-2);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    position: relative;
    overflow: hidden;
}

.nav-links a i {
    width: 16px;
    text-align: center;
    font-size: 0.78rem;
    flex-shrink: 0;
    color: var(--text-3);
    margin-right: 0;
    transition: color 0.15s;
}

.nav-links a:hover {
    background: var(--bg-2);
    color: var(--text);
}

.nav-links a:hover i {
    color: var(--primary);
}

.nav-links a.active {
    background: var(--primary-dim);
    color: var(--primary);
    font-weight: 700;
}

.nav-links a.active i {
    color: var(--primary);
}

.nav-links a.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    height: 60%;
    width: 3px;
    background: var(--primary);
    border-radius: 0 2px 2px 0;
    animation: slideIn 0.25s ease-out;
}

@keyframes slideIn {
    from { transform: scaleY(0) translateX(-3px); opacity: 0; }
    to   { transform: scaleY(1) translateX(0);    opacity: 1; }
}

/* ── Main Content ────────────────────────────────────────── */
.main-content {
    padding: 2.5rem 2rem;
    background-color: var(--bg);
    overflow-y: auto;
    min-width: 0;
    box-shadow: none;
}

/* ── Progress Bar (top) ──────────────────────────────────── */
.progress-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    z-index: 9999;
    background: var(--border);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--teal) 100%);
    width: 0%;
    transition: width 0.3s ease;
}

/* ── Sections ────────────────────────────────────────────── */
.section {
    margin-bottom: 4rem;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.section.visible {
    opacity: 1;
    transform: translateY(0);
}

.section-header {
    margin-bottom: 1.5rem;
    padding-left: 1rem;
    border-left: 3px solid var(--primary);
    position: relative;
}

.section-header::after { display: none; }

.section-header h2 {
    font-family: 'Syne', sans-serif;
    font-size: 1.65rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text);
    line-height: 1.2;
}

.section-content {
    font-size: 1rem;
    color: var(--text);
}

/* ── Hero ────────────────────────────────────────────────── */
.hero {
    background: linear-gradient(135deg, rgba(91,76,245,0.04) 0%, rgba(0,229,195,0.04) 100%);
    border: 1px solid var(--border);
    border-top: 3px solid var(--primary);
    color: var(--text);
    padding: 3rem 2.5rem;
    border-radius: 16px;
    margin-bottom: 3rem;
    position: relative;
    overflow: hidden;
    background-image: none !important;
    background-size: auto;
    background-position: center;
    background-blend-mode: normal;
    width: 100%;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(91,76,245,0.07) 0%, transparent 70%);
    z-index: 0;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 700px;
    width: 100%;
}

.hero h1, .hero p, .hero a {
    position: relative;
    z-index: 1;
}

.hero h1 {
    font-family: 'Syne', sans-serif;
    font-size: 1.9rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text);
    margin-bottom: 1rem;
    line-height: 1.15;
    width: 100%;
}

.hero p {
    font-size: 0.975rem;
    color: var(--text-2);
    margin-bottom: 0.6rem;
}

.hero p strong {
    color: var(--text);
}

/* ── Hero Features ───────────────────────────────────────── */
.hero-features {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1.5rem 0;
}

.feature-badge {
    background: var(--primary-dim);
    color: var(--primary);
    padding: 0.3rem 0.8rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    border: 1px solid rgba(91,76,245,0.2);
    backdrop-filter: none;
    box-shadow: none;
}

.feature-badge i {
    font-size: 0.78rem;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.62rem 1.35rem;
    background: var(--primary);
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-family: 'Syne', sans-serif;
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
    border: none;
    cursor: pointer;
    line-height: 1;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(91,76,245,0.3);
    background: #4a3be0;
}

.btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.btn-secondary {
    background: var(--bg-2);
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: none;
}

.btn-secondary:hover {
    background: var(--border);
    box-shadow: none;
    transform: translateY(-1px);
}

.btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ── Cards ───────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border-radius: 12px;
    border: 1px solid var(--border);
    border-top: 3px solid var(--primary);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

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

.card-icon {
    width: 36px;
    height: 36px;
    background: var(--primary-dim);
    color: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.875rem;
}

.card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
}

/* ── Concept Visuals (Factores + Simulación) ───────────── */
.visual-duo-panel {
    margin-top: 1.5rem;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.concept-visual-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: linear-gradient(170deg, var(--surface), var(--bg-2));
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.concept-visual-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.concept-visual-head h4 {
    font-size: 0.98rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text);
}

.concept-visual-head span {
    font-size: 0.75rem;
    color: var(--text-2);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-weight: 700;
}

.factors-chart {
    position: relative;
    height: 190px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background:
        linear-gradient(180deg, rgba(91,76,245,0.08), rgba(91,76,245,0.02));
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: end;
    gap: 0.55rem;
    padding: 0.7rem 0.55rem 0.6rem;
    overflow: hidden;
}

.chart-grid-line {
    position: absolute;
    left: 0.55rem;
    right: 0.55rem;
    top: calc(100% - (var(--line) * 20%));
    border-top: 1px dashed rgba(100,116,139,0.3);
    pointer-events: none;
}

.factor-bar {
    position: relative;
    height: calc(var(--value) * 1%);
    border-radius: 9px 9px 7px 7px;
    border: 1px solid rgba(255,255,255,0.85);
    background: linear-gradient(180deg, rgba(255,255,255,0.65), var(--bar-color));
    box-shadow: 0 8px 14px rgba(0,0,0,0.08);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    min-height: 12px;
    transition: height 0.35s ease;
}

.factor-value {
    margin-top: 0.22rem;
    font-size: 0.71rem;
    font-family: 'DM Mono', monospace;
    color: rgba(15, 23, 42, 0.86);
    font-weight: 700;
}

.factor-labels {
    margin-top: 0.45rem;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.55rem;
}

.factor-labels span {
    text-align: center;
    font-size: 0.68rem;
    color: var(--text-2);
    font-weight: 700;
    line-height: 1.15;
}

.concept-note {
    margin-top: 0.75rem;
    color: var(--text-2);
    font-size: 0.84rem;
    line-height: 1.5;
}

.petri-card canvas {
    width: 100%;
    max-width: 100%;
    display: block;
    border-radius: 12px;
    border: 1px solid rgba(91,76,245,0.18);
    background: radial-gradient(circle at 50% 50%, #f8fffe 0%, #e9f2ff 55%, #dbe6f8 100%);
}

.petri-metrics {
    margin-top: 0.75rem;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
}

.metric-chip {
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface);
    padding: 0.45rem 0.55rem;
}

.metric-chip span {
    display: block;
    font-size: 0.72rem;
    color: var(--text-2);
    margin-bottom: 0.18rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    font-weight: 700;
}

.metric-chip strong {
    font-size: 0.92rem;
    color: var(--text);
    letter-spacing: -0.01em;
}

.petri-controls {
    margin-top: 0.75rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.58rem;
}

.petri-controls label {
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface);
    padding: 0.45rem 0.55rem;
    font-size: 0.78rem;
    color: var(--text-2);
    font-weight: 600;
    display: grid;
    gap: 0.28rem;
}

.petri-controls input[type="range"] {
    width: 100%;
    accent-color: var(--primary);
}

.petri-control-value {
    display: inline-block;
    font-family: 'DM Mono', monospace;
    color: var(--primary);
    font-weight: 700;
    font-size: 0.8rem;
}

.petri-actions {
    margin-top: 0.75rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

body.dark-theme .concept-visual-card {
    background: linear-gradient(170deg, #1e293b, #162031);
}

body.dark-theme .factors-chart {
    border-color: rgba(148,163,184,0.28);
    background: linear-gradient(180deg, rgba(91,76,245,0.22), rgba(91,76,245,0.08));
}

body.dark-theme .chart-grid-line {
    border-top-color: rgba(148,163,184,0.26);
}

body.dark-theme .factor-value {
    color: rgba(241,245,249,0.9);
}

body.dark-theme .petri-card canvas {
    border-color: rgba(148,163,184,0.35);
    background: radial-gradient(circle at 50% 50%, #1b2a3f 0%, #121c2e 55%, #0d1524 100%);
}

@media (max-width: 980px) {
    .visual-duo-panel {
        grid-template-columns: 1fr;
    }
}

/* ── Grid ────────────────────────────────────────────────── */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.steam-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

/* ── STEAM Cards ─────────────────────────────────────────── */
.steam-card {
    background: var(--surface);
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 1.4rem;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.steam-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}

.steam-icon {
    width: 52px;
    height: 52px;
    background: var(--bg-2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.75rem;
    font-size: 1.25rem;
}

.steam-card h3 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.4rem;
}

.steam-card p {
    font-size: 0.82rem;
    color: var(--text-2);
}

.science    { color: var(--danger); }
.technology { color: var(--teal); }
.engineering { color: var(--warning); }
.arts       { color: var(--success); }
.math       { color: var(--primary); }

/* ── Table ───────────────────────────────────────────────── */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.table th,
.table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    background: var(--bg-2);
    font-weight: 700;
    color: var(--text);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.table tr:last-child td { border-bottom: none; }

/* ── Simulation ──────────────────────────────────────────── */
.simulation-container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

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

.control-group { margin-bottom: 0.6rem; }

.control-group label {
    display: block;
    margin-bottom: 0.3rem;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text);
}

.control-group input {
    width: 100%;
    padding: 0.48rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    font-family: 'Syne', sans-serif;
    font-size: 0.875rem;
    transition: border-color 0.15s;
}

.control-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.chart-container {
    height: 400px;
    margin-bottom: 1.5rem;
}

/* ── Timeline ────────────────────────────────────────────── */
.timeline {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
}

.timeline::after {
    content: '';
    position: absolute;
    width: 2px;
    background: var(--border);
    top: 0;
    bottom: 0;
    left: 50%;
    margin-left: -1px;
}

.timeline-item {
    padding: 10px 40px;
    position: relative;
    background-color: inherit;
    width: 50%;
}

.timeline-item::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    right: -7px;
    background: var(--primary);
    border: 3px solid var(--surface);
    top: 20px;
    border-radius: 50%;
    z-index: 1;
    box-shadow: 0 0 0 2px var(--primary);
}

.left { left: 0; }
.right { left: 50%; }
.right::after { left: -7px; }

.timeline-content {
    padding: 1rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

/* ── Reflection: Real Uses Diagram ─────────────────────── */
.real-uses-diagram {
    margin-bottom: 1.5rem;
    padding: 1.1rem;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: linear-gradient(170deg, var(--surface), var(--bg-2));
}

.real-uses-head {
    margin-bottom: 0.9rem;
}

.real-uses-heading {
    font-size: 1.02rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 0.2rem;
}

.real-uses-subtitle {
    font-size: 0.84rem;
    color: var(--text-2);
}

.real-uses-layout {
    display: grid;
    grid-template-columns: minmax(280px, 1.05fr) minmax(260px, 1fr);
    gap: 1rem;
    align-items: start;
}

.uses-map {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(3, minmax(72px, auto));
    gap: 0.55rem;
}

.use-node {
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 12px;
    padding: 0.65rem 0.6rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 0.2rem;
    cursor: pointer;
    text-align: left;
    transition: transform 0.18s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
    color: var(--text);
}

.use-node i {
    font-size: 1rem;
    color: var(--primary);
}

.use-node-label {
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.25;
}

.use-node-tag {
    font-size: 0.68rem;
    color: var(--text-2);
    letter-spacing: 0.02em;
}

.use-node:hover {
    transform: translateY(-2px);
    border-color: rgba(91, 76, 245, 0.4);
    box-shadow: 0 8px 18px rgba(2, 6, 23, 0.08);
}

.use-node.active {
    background: rgba(91, 76, 245, 0.12);
    border-color: rgba(91, 76, 245, 0.55);
    box-shadow: 0 0 0 1px rgba(91, 76, 245, 0.2) inset;
}

.node-industry { grid-column: 1; grid-row: 1; }
.node-lab      { grid-column: 3; grid-row: 1; }
.node-pharma   { grid-column: 1; grid-row: 3; }
.node-vaccine  { grid-column: 3; grid-row: 3; }

.uses-hub {
    grid-column: 2;
    grid-row: 2;
    border-radius: 999px;
    border: 1px solid rgba(91, 76, 245, 0.35);
    background: radial-gradient(circle at 30% 20%, rgba(0, 229, 195, 0.2), rgba(91, 76, 245, 0.12));
    padding: 0.75rem 0.4rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 24px rgba(91, 76, 245, 0.16);
}

.uses-hub span {
    font-size: 0.68rem;
    color: var(--text-2);
    font-weight: 600;
    line-height: 1.2;
}

.uses-hub strong {
    font-size: 0.76rem;
    color: var(--text);
    font-weight: 800;
    margin-top: 0.2rem;
    line-height: 1.25;
}

.use-details {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.9rem;
}

.use-details h4 {
    font-size: 0.96rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 0.45rem;
}

.use-details p {
    font-size: 0.84rem;
    color: var(--text-2);
    line-height: 1.55;
    margin-bottom: 0.6rem;
}

.use-details ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.35rem;
    margin-bottom: 0.75rem;
}

.use-details li {
    font-size: 0.8rem;
    color: var(--text);
    padding-left: 1rem;
    position: relative;
    line-height: 1.45;
}

.use-details li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.52rem;
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 50%;
    background: var(--teal);
}

.use-impact {
    display: grid;
    gap: 0.38rem;
}

.use-impact-row {
    display: grid;
    grid-template-columns: 120px 1fr 40px;
    gap: 0.5rem;
    align-items: center;
}

.impact-label {
    font-size: 0.72rem;
    color: var(--text-2);
}

.impact-track {
    height: 8px;
    background: var(--bg-2);
    border-radius: 999px;
    overflow: hidden;
}

.impact-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--primary), var(--teal));
    border-radius: 999px;
    transition: width 0.3s ease;
}

.impact-value {
    font-size: 0.74rem;
    color: var(--text);
    text-align: right;
}

/* ── Footer ──────────────────────────────────────────────── */
.footer {
    background: var(--footer-bg);
    color: var(--footer-text);
    padding: 3rem 2rem 1.5rem;
    margin-top: 3rem;
    border-top: 1px solid var(--footer-border);
}

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

.footer-section h3 {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 1rem;
    position: relative;
    padding-bottom: 0.5rem;
    color: var(--footer-text);
}

.footer-section h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 24px;
    height: 2px;
    background: var(--teal);
    border-radius: 2px;
}

.footer-section p {
    font-size: 0.85rem;
    opacity: 1;
    color: var(--footer-muted);
    margin-bottom: 0.4rem;
}

.license {
    font-size: 0.76rem;
    opacity: 1;
    color: var(--footer-muted);
}

.footer-features, .footer-resources { list-style: none; }

.footer-features li,
.footer-resources li { margin-bottom: 0.4rem; }

.footer-features a,
.footer-resources a {
    color: var(--footer-link);
    text-decoration: none;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: color 0.15s;
    opacity: 1;
}

.footer-features a:hover,
.footer-resources a:hover { color: var(--teal); }

.footer-middle {
    padding: 1rem 0;
    border-top: 1px solid var(--footer-border);
    border-bottom: 1px solid var(--footer-border);
    text-align: center;
    margin-bottom: 1rem;
}

.footer-bottom {
    padding-top: 1.5rem;
    border-top: 1px solid var(--footer-border);
    text-align: center;
}

.footer-bottom p {
    font-size: 0.8rem;
    opacity: 1;
    color: var(--footer-muted);
    margin-bottom: 0.5rem;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.footer-links a {
    color: var(--footer-link);
    text-decoration: none;
    font-size: 0.8rem;
    padding: 0.3rem 0.75rem;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}

.footer-links a:hover {
    background: var(--footer-hover-bg);
    color: var(--footer-text);
}

/* ── Misc ────────────────────────────────────────────────── */
.formula {
    background: var(--bg-2);
    border: 1px solid var(--border);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    text-align: center;
    margin: 1rem 0;
    overflow-x: auto;
    font-family: 'DM Mono', monospace;
}

.tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.25rem;
}

.tab {
    padding: 0.55rem 1.2rem;
    cursor: pointer;
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--text-2);
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
    margin-bottom: -1px;
}

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

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 700;
}

.tab-content { display: none; }

.tab-content.active {
    display: block;
    animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Mobile Nav Toggle ──────────────────────────────────── */
.mobile-nav-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1001;
    background: var(--primary);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    font-size: 1.1rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(91,76,245,0.35);
}

/* ── Tooltip ─────────────────────────────────────────────── */
.tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
    text-decoration: underline dotted;
    text-underline-offset: 2px;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background: #1a202c;
    color: #f1f5f9;
    text-align: center;
    border-radius: 8px;
    padding: 0.55rem 0.75rem;
    position: absolute;
    z-index: 10;
    bottom: 130%;
    left: 50%;
    margin-left: -100px;
    font-size: 0.8rem;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* ── Resource Cards ──────────────────────────────────────── */
.resource-card {
    display: flex;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1.25rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.resource-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}

.resource-image {
    width: 100px;
    background: var(--bg-2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: var(--primary);
    flex-shrink: 0;
}

.resource-content {
    padding: 1rem;
    flex: 1;
    min-width: 0;
}

.resource-content h3 {
    margin-bottom: 0.35rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

.resource-content p {
    font-size: 0.875rem;
    color: var(--text-2);
    margin-bottom: 0.75rem;
}

.badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    background: var(--bg-2);
    border-radius: 50px;
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--text-2);
    margin-right: 0.3rem;
}

/* ── Back to Top ─────────────────────────────────────────── */
.back-to-top {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s, box-shadow 0.2s;
    transform: translateY(10px);
    box-shadow: 0 4px 12px rgba(91,76,245,0.35);
}

.back-to-top.visible {
    opacity: 1;
    transform: translateY(0);
}

.back-to-top:hover {
    box-shadow: 0 6px 20px rgba(91,76,245,0.45);
    transform: translateY(-2px);
    background-color: var(--primary);
}

/* ── Accessibility Panel ─────────────────────────────────── */
.accessibility-panel {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 1000;
}

.accessibility-toggle {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: background 0.15s, color 0.15s;
}

.accessibility-toggle:hover {
    background: var(--primary-dim);
    color: var(--primary);
}

.accessibility-options {
    position: absolute;
    right: 0;
    top: 50px;
    width: 260px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    display: none;
}

.accessibility-options.active {
    display: block;
    animation: fadeIn 0.2s ease-out;
}

.option-group {
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.option-group:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.option-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-2);
    margin-bottom: 0.5rem;
}

.theme-switcher,
.font-size-controls,
.contrast-controls { display: flex; gap: 0.5rem; }

.theme-switcher button,
.contrast-controls button {
    flex: 1;
    padding: 0.4rem 0.4rem;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-2);
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.theme-switcher button.active,
.contrast-controls button.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.font-size-controls {
    align-items: center;
    justify-content: space-between;
}

.font-size-controls button {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text);
    transition: background 0.15s;
}

.font-size-controls button:hover { background: var(--border); }

#currentFontSize {
    flex: 1;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}

.animation-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.86rem;
    color: var(--text);
}

.animation-toggle input { margin-right: 0; }

/* ── Toggle Switch ───────────────────────────────────────── */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

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

.toggle-switch label {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--border);
    border-radius: 24px;
    transition: background 0.3s;
}

.toggle-switch label:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.3s;
}

.toggle-switch input:checked + label { background: var(--primary); }
.toggle-switch input:checked + label:before { transform: translateX(20px); }

/* ── Case Studies ────────────────────────────────────────── */
.case-studies-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
    margin-top: 1.25rem;
}

.case-study-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.case-study-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

.case-study-header {
    background: var(--primary);
    color: #fff;
    padding: 1.2rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.case-study-header i { font-size: 1.4rem; }

.case-study-header h3 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
}

.case-study-content { padding: 1.25rem; }

.case-study-data {
    background: var(--bg-2);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin: 0.75rem 0;
    font-size: 0.875rem;
}

.case-study-btn { margin-top: 0.75rem; }

/* ── Quiz ────────────────────────────────────────────────── */
.quiz-intro {
    text-align: center;
    padding: 2rem;
}

.quiz-container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: none;
}

.quiz-progress { margin-bottom: 1.5rem; }

.quiz-progress-bar {
    height: 6px;
    background: var(--bg-2);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
    margin-bottom: 0.4rem;
}

.quiz-progress-bar::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--teal));
    width: 0%;
    transition: width 0.3s;
}

.quiz-progress-text {
    text-align: right;
    font-size: 0.78rem;
    color: var(--text-2);
}

.quiz-question { margin-bottom: 2rem; }

.quiz-question h3 {
    margin-bottom: 1rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
}

.quiz-options { display: grid; gap: 0.7rem; }

.quiz-option {
    padding: 0.82rem 1rem;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.15s, border-color 0.15s;
}

.quiz-option:hover {
    background: var(--primary-dim);
    border-color: rgba(91,76,245,0.3);
}

.quiz-option.selected {
    background: var(--primary-dim);
    border: 2px solid var(--primary);
}

.quiz-option.correct {
    background: rgba(16,185,129,0.1);
    border: 2px solid var(--success);
}

.quiz-option.incorrect {
    background: rgba(239,68,68,0.1);
    border: 2px solid var(--danger);
}

.quiz-feedback {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    display: none;
    font-size: 0.875rem;
}

.quiz-feedback.correct {
    background: rgba(16,185,129,0.1);
    border: 1px solid var(--success);
    color: #065f46;
}

.quiz-feedback.incorrect {
    background: rgba(239,68,68,0.1);
    border: 1px solid var(--danger);
    color: #7f1d1d;
}

body.dark-theme .quiz-feedback.correct { color: #6ee7b7; }
body.dark-theme .quiz-feedback.incorrect { color: #fca5a5; }

.quiz-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 1.5rem;
}

.quiz-results {
    text-align: center;
    padding: 2rem;
}

.results-score { margin-bottom: 1.5rem; }

.score-circle {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    background: var(--primary-dim);
    border: 6px solid var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    position: relative;
}

.score-circle::before { display: none; }

.results-feedback {
    max-width: 540px;
    margin: 0 auto 1.5rem;
    padding: 1.25rem;
    background: var(--bg-2);
    border-radius: 10px;
    font-size: 0.9rem;
}

/* ── Advanced Visualization ──────────────────────────────── */
.advanced-viz-container {
    padding: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.advanced-viz-intro { margin-bottom: 1.25rem; }

.model-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}

.model-tab {
    padding: 0.55rem 1.2rem;
    cursor: pointer;
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--text-2);
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
    margin-bottom: -1px;
}

.model-tab.active {
    border-bottom-color: var(--primary);
    color: var(--primary);
}

.model-settings-container {
    background: var(--bg-2);
    padding: 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.25rem;
    display: none;
}

.model-settings-container.active { display: block; }

.model-param-group { margin-bottom: 0.75rem; }

.model-param-group label {
    display: block;
    margin-bottom: 0.3rem;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text);
}

.model-param-group input[type="number"] {
    width: 100%;
    padding: 0.42rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    font-size: 0.875rem;
    margin-bottom: 0.4rem;
}

.model-param-group input[type="range"] {
    width: 100%;
    accent-color: var(--primary);
}

.model-color-picker { margin-bottom: 0.75rem; }

.color-options {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.4rem;
}

.color-option {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.15s;
}

.color-option:hover { transform: scale(1.15); }

.color-option.active {
    outline: 3px solid var(--text);
    outline-offset: 2px;
    border: none;
}

.model-active-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.875rem;
}

.advanced-viz-chart-container {
    height: 380px;
    margin-bottom: 1.25rem;
}

.advanced-viz-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

/* ── Lab ─────────────────────────────────────────────────── */
.lab-container {
    padding: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.lab-intro { margin-bottom: 1.25rem; }

.microscope-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.microscope-viewer {
    background: #0f172a;
    border-radius: 10px;
    padding: 1rem;
}

.microscope-stage {
    position: relative;
    aspect-ratio: 4/3;
    margin-bottom: 0.75rem;
    overflow: hidden;
    border-radius: 6px;
}

.microscope-stage img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.microscope-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.microscope-magnifier {
    position: absolute;
    width: 90px;
    height: 90px;
    border: 2px solid rgba(255,255,255,0.6);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 0 9999px rgba(0,0,0,0.5);
}

.microscope-crosshair {
    position: absolute;
    width: 50px;
    height: 50px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.microscope-crosshair::before,
.microscope-crosshair::after {
    content: '';
    position: absolute;
    background: rgba(255,255,255,0.5);
}

.microscope-crosshair::before {
    width: 1px;
    height: 100%;
    left: 50%;
}

.microscope-crosshair::after {
    width: 100%;
    height: 1px;
    top: 50%;
}

.microscope-controls {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
}

.zoom-controls,
.brightness-controls {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.zoom-controls button,
.brightness-controls button {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.15s;
}

.zoom-controls button:hover,
.brightness-controls button:hover { background: rgba(255,255,255,0.2); }

.microscope-samples {
    background: var(--bg-2);
    border-radius: 10px;
    padding: 1.25rem;
}

.sample-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.sample-option {
    display: flex;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.15s;
}

.sample-option:hover {
    transform: translateY(-2px);
    border-color: rgba(91,76,245,0.4);
    box-shadow: 0 5px 10px var(--shadow-color);
}

.sample-option.active { border: 2px solid var(--primary); }

.sample-thumbnail {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
}

.phase-thumb {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    background: radial-gradient(circle at 40% 35%, rgba(255,255,255,0.74), rgba(91,76,245,0.22));
}

.phase-thumb::before,
.phase-thumb::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.phase-thumb::before {
    background-image:
        radial-gradient(circle at 18% 28%, rgba(0, 229, 195, 0.82) 0 8%, transparent 9%),
        radial-gradient(circle at 72% 20%, rgba(91, 76, 245, 0.85) 0 9%, transparent 10%),
        radial-gradient(circle at 36% 64%, rgba(6, 182, 212, 0.78) 0 7%, transparent 8%),
        radial-gradient(circle at 68% 74%, rgba(167, 139, 250, 0.8) 0 10%, transparent 11%),
        radial-gradient(circle at 84% 58%, rgba(16, 185, 129, 0.78) 0 7%, transparent 8%);
    opacity: 0.85;
}

.phase-thumb::after {
    background: radial-gradient(circle at 50% 50%, rgba(255,255,255,0.15), rgba(15,23,42,0.1));
}

.phase-lag { filter: saturate(0.9) brightness(0.98); }
.phase-exponencial { filter: saturate(1.2) brightness(1.05); }
.phase-estacionaria { filter: saturate(0.78) brightness(0.92); }
.phase-muerte { filter: saturate(0.6) brightness(0.84) hue-rotate(18deg); }

body.dark-theme .phase-thumb {
    background: radial-gradient(circle at 42% 34%, rgba(148,163,184,0.28), rgba(30,41,59,0.82));
}

body.dark-theme .phase-thumb::after {
    background: radial-gradient(circle at 50% 50%, rgba(148,163,184,0.15), rgba(2,6,23,0.28));
}

.sample-info {
    padding: 0.5rem 0.6rem;
    min-width: 0;
}

.sample-info h4 {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text);
}

.sample-info p {
    margin: 0;
    font-size: 0.74rem;
    color: var(--text-2);
    opacity: 1;
}

.lab-data {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.lab-data-tabs {
    display: flex;
    background: var(--bg-2);
    border-bottom: 1px solid var(--border);
}

.lab-tab {
    padding: 0.72rem 1rem;
    flex: 1;
    text-align: center;
    cursor: pointer;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-2);
    transition: background 0.15s, color 0.15s;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.lab-tab.active {
    background: var(--surface);
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.lab-data-panel {
    padding: 1.25rem;
    display: none;
}

.lab-data-panel.active { display: block; }

.mini-chart-container {
    height: 190px;
    margin-bottom: 0.75rem;
}

/* ── Saved Simulations ───────────────────────────────────── */
.saved-simulation-item {
    background: var(--bg-2);
    border: 1px solid var(--border);
    padding: 0.85rem 1rem;
    margin-bottom: 0.5rem;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.saved-simulation-info {
    flex: 1;
    min-width: 0;
}

.saved-simulation-actions {
    display: flex;
    gap: 0.4rem;
    flex-shrink: 0;
}

.saved-simulation-actions button {
    padding: 0.25rem 0.6rem;
    font-size: 0.78rem;
}

/* ── Glossary ────────────────────────────────────────────── */
.glossary-search { margin-bottom: 1.25rem; }

.glossary-search-input {
    width: 100%;
    padding: 0.62rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    background: var(--bg);
    color: var(--text);
    transition: border-color 0.15s;
}

.glossary-search-input:focus {
    outline: none;
    border-color: var(--primary);
}

.glossary-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.glossary-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.glossary-item:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.06); }

.glossary-term {
    padding: 0.85rem 1rem;
    margin: 0;
    background: var(--bg-2);
    color: var(--primary);
    font-size: 0.975rem;
    font-weight: 700;
    cursor: pointer;
    position: relative;
    user-select: none;
}

.glossary-term::after {
    content: '\f078';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    right: 1rem;
    transition: transform 0.2s;
    color: var(--text-3);
}

.glossary-item.active .glossary-term::after { transform: rotate(180deg); }

.glossary-definition {
    padding: 0 1rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out, padding 0.3s;
    font-size: 0.9rem;
    color: var(--text-2);
}

.glossary-item.active .glossary-definition {
    padding: 1rem;
    max-height: 500px;
}

/* ── Progress Overview ───────────────────────────────────── */
.content-overview { margin-bottom: 2rem; }

.progress-overview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.progress-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.4rem 0.6rem;
    border-radius: 8px;
    transition: background 0.15s;
    cursor: pointer;
    min-width: 60px;
}

.progress-section:hover { background: var(--bg-2); }

.progress-section.active { background: var(--primary-dim); }

.progress-icon {
    width: 36px;
    height: 36px;
    background: var(--bg-2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.35rem;
    font-size: 0.95rem;
    color: var(--text-2);
    transition: background 0.15s, color 0.15s;
    box-shadow: none;
}

.progress-section.active .progress-icon {
    background: var(--primary);
    color: #fff;
}

.progress-section.completed .progress-icon {
    background: var(--success);
    color: #fff;
}

.progress-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-2);
    text-align: center;
    line-height: 1.2;
}

.progress-section.active .progress-label { color: var(--primary); }

.progress-divider {
    flex: 1;
    height: 1px;
    background: var(--border);
    max-width: 40px;
    min-width: 12px;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 992px) {
    .container {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
        height: 100vh;
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 260px;
        z-index: 1000;
        overflow-y: auto;
        box-shadow: 4px 0 20px rgba(0,0,0,0.15);
    }

    .sidebar.show {
        display: flex;
    }

    .mobile-nav-toggle {
        display: flex;
    }

    .accessibility-panel {
        top: 1rem;
        right: calc(1rem + 40px + 12px);
        z-index: 1002;
    }

    .accessibility-options {
        max-width: min(78vw, 260px);
    }

    .main-content {
        padding: 1.5rem 1rem;
    }

    .timeline::after { left: 31px; }

    .timeline-item {
        width: 100%;
        padding-left: 60px;
        padding-right: 20px;
    }

    .right { left: 0; }

    .timeline-item::after {
        left: 24px;
        right: auto;
    }

    .microscope-container {
        grid-template-columns: 1fr;
    }

    #lang-toggle {
        position: static !important;
    }
}

@media (max-width: 768px) {
    .accessibility-panel {
        top: 1rem;
        right: calc(1rem + 40px + 12px);
        z-index: 1002;
    }

    .real-uses-layout {
        grid-template-columns: 1fr;
    }

    .uses-map {
        min-height: 260px;
    }

    .use-impact-row {
        grid-template-columns: 1fr 1fr auto;
    }

    .impact-label {
        font-size: 0.7rem;
    }

    .use-node-label {
        font-size: 0.74rem;
    }

    .progress-overview {
        overflow-x: auto;
        justify-content: flex-start;
        padding: 0.75rem;
    }

    .progress-section { min-width: 58px; }
    .progress-divider { min-width: 12px; }

    .hero { padding: 2rem 1.5rem; }
    .hero h1 { font-size: 1.45rem; }

    .section-header h2 { font-size: 1.35rem; }
}

/* ── Print ───────────────────────────────────────────────── */
@media print {
    .sidebar, .mobile-nav-toggle, .back-to-top, .accessibility-panel,
    .simulation-controls, .tabs, .quiz-container, .advanced-viz-controls,
    .lab-data-tabs, #lang-toggle {
        display: none !important;
    }

    .container { display: block !important; }

    .main-content {
        padding: 0 !important;
        box-shadow: none !important;
    }

    .section {
        page-break-inside: avoid;
        opacity: 1 !important;
        transform: none !important;
    }

    a {
        text-decoration: none !important;
        color: black !important;
    }
}
