
:root {
    --bg-deep: #050a18;
    --bg-card: rgba(15, 23, 52, 0.85);
    --bg-card-hover: rgba(20, 30, 65, 0.92);
    --border-card: rgba(100, 140, 255, 0.15);
    --border-glow: rgba(100, 140, 255, 0.3);
    --text-primary: #e8ecf4;
    --text-secondary: #9aa5bd;
    --text-muted: #6b7a96;
    --accent-cyan: #38bdf8;
    --accent-purple: #a78bfa;
    --accent-orange: #fb923c;
    --accent-green: #34d399;
    --accent-pink: #f472b6;
    --accent-red: #f87171;
    --accent-yellow: #fbbf24;
    --gradient-hero: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
    --gradient-accent: linear-gradient(135deg, #38bdf8, #a78bfa);
    --gradient-warm: linear-gradient(135deg, #fb923c, #f472b6);
    --gradient-green: linear-gradient(135deg, #34d399, #38bdf8);
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;
    --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(100, 140, 255, 0.08);
    --shadow-glow: 0 0 30px rgba(56, 189, 248, 0.15);
    --font-mono: 'JetBrains Mono', monospace;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-deep);
    color: var(--text-primary);
    line-height: 1.7;
    overflow-x: hidden;
}

/* ═══ STARFIELD BACKGROUND ═══ */
#starfield {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 0; pointer-events: none;
}

/* ═══ NAVIGATION ═══ */
.nav {
    position: sticky; top: 64px; left: 0; right: 0; z-index: 10;
    background: rgba(5, 10, 24, 0.88);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-card);
    padding: 0 2rem;
    transition: all 0.3s ease;
}
.nav-inner {
    max-width: 1200px; margin: 0 auto;
    display: flex; align-items: center; justify-content: space-between;
    height: 60px;
}
.nav-logo {
    font-weight: 700; font-size: 1.1rem;
    background: var(--gradient-accent);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
.nav-links { display: flex; gap: 0.25rem; flex-wrap: wrap; }
.nav-links a {
    color: var(--text-secondary); text-decoration: none;
    font-size: 0.8rem; font-weight: 500;
    padding: 0.4rem 0.75rem; border-radius: var(--radius-xs);
    transition: all 0.2s ease;
}
.nav-links a:hover, .nav-links a.active {
    color: var(--accent-cyan);
    background: rgba(56, 189, 248, 0.1);
}

/* ═══ MAIN CONTENT ═══ */
.container {
    max-width: 1100px; margin: 0 auto;
    padding: 80px 1.5rem 3rem;
    position: relative; z-index: 1;
}

/* ═══ HERO ═══ */
.hero {
    text-align: center; padding: 4rem 1rem 3rem;
    position: relative;
}
.hero-badge {
    display: inline-block;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.25);
    color: var(--accent-cyan);
    font-size: 0.8rem; font-weight: 600;
    padding: 0.35rem 1rem; border-radius: 20px;
    margin-bottom: 1.5rem; letter-spacing: 0.5px;
}
.hero h1 {
    font-size: clamp(2.2rem, 5vw, 3.5rem);
    font-weight: 800; line-height: 1.15;
    background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text; margin-bottom: 1rem;
}
.hero p {
    font-size: 1.15rem; color: var(--text-secondary);
    max-width: 600px; margin: 0 auto;
}

/* ═══ SECTION ═══ */
.section { margin-bottom: 3rem; }
.section-anchor { scroll-margin-top: 80px; }

/* ═══ CARD ═══ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(10px);
    transition: all 0.4s ease;
    opacity: 0; transform: translateY(30px);
}
.card.visible { opacity: 1; transform: translateY(0); }
.card:hover {
    border-color: var(--border-glow);
    box-shadow: var(--shadow-card), var(--shadow-glow);
}

/* ═══ SECTION HEADER ═══ */
.section-header {
    display: flex; align-items: center; gap: 1rem;
    margin-bottom: 1.5rem;
}
.section-icon {
    width: 48px; height: 48px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; flex-shrink: 0;
}
.section-icon.blue { background: rgba(56, 189, 248, 0.15); }
.section-icon.purple { background: rgba(167, 139, 250, 0.15); }
.section-icon.orange { background: rgba(251, 146, 60, 0.15); }
.section-icon.green { background: rgba(52, 211, 153, 0.15); }
.section-icon.pink { background: rgba(244, 114, 182, 0.15); }
.section-title {
    font-size: 1.5rem; font-weight: 700;
    color: var(--text-primary);
}

/* ═══ KLO BOX ═══ */
.klo-box {
    background: rgba(56, 189, 248, 0.06);
    border: 1px solid rgba(56, 189, 248, 0.15);
    border-radius: var(--radius-sm);
    padding: 1.25rem 1.5rem; margin-bottom: 1.5rem;
}
.klo-box h4 {
    font-size: 0.85rem; font-weight: 600;
    color: var(--accent-cyan);
    text-transform: uppercase; letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
}
.klo-box ul { padding-left: 1.5rem; }
.klo-box li { color: var(--text-secondary); margin-bottom: 0.4rem; font-size: 0.95rem; }
.klo-box li ul { margin-top: 0.4rem; }

/* ═══ CONTENT ═══ */
.content p { color: var(--text-secondary); margin-bottom: 1rem; font-size: 0.95rem; }
.content ul { padding-left: 1.5rem; margin-bottom: 1rem; }
.content li { color: var(--text-secondary); margin-bottom: 0.5rem; font-size: 0.95rem; }
.content strong { color: var(--text-primary); }

/* ═══ FORMULA ═══ */
.formula-box {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.12), rgba(167, 139, 250, 0.12));
    border: 1px solid rgba(56, 189, 248, 0.2);
    border-radius: var(--radius-sm);
    padding: 1.5rem; margin: 1.5rem 0;
    text-align: center;
}
.formula-box .formula-main {
    font-family: var(--font-mono);
    font-size: 1.3rem; font-weight: 600;
    color: var(--accent-cyan);
    margin-bottom: 0.3rem;
}
.formula-box .formula-expanded {
    font-family: var(--font-mono);
    font-size: 1.1rem; color: var(--accent-purple);
}

/* ═══ EXAMPLE ═══ */
.example-box {
    background: rgba(251, 146, 60, 0.08);
    border: 1px solid rgba(251, 146, 60, 0.2);
    border-left: 4px solid var(--accent-orange);
    border-radius: var(--radius-sm);
    padding: 1.25rem 1.5rem; margin: 1.5rem 0;
}
.example-box .example-label {
    font-size: 0.8rem; font-weight: 700;
    color: var(--accent-orange);
    text-transform: uppercase; letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
}
.example-box p { color: var(--text-secondary); margin-bottom: 0.5rem; font-size: 0.9rem; }
.example-box code {
    font-family: var(--font-mono);
    background: rgba(0,0,0,0.3); padding: 0.1rem 0.4rem;
    border-radius: 4px; font-size: 0.85rem; color: var(--accent-cyan);
}

/* ═══ DATA TABLE ═══ */
.data-table {
    width: 100%; border-collapse: collapse;
    margin: 1.5rem 0; border-radius: var(--radius-sm);
    overflow: hidden;
}
.data-table th {
    background: rgba(56, 189, 248, 0.12);
    color: var(--accent-cyan); padding: 0.9rem 1rem;
    text-align: left; font-size: 0.85rem; font-weight: 600;
    border-bottom: 1px solid var(--border-card);
}
.data-table td {
    padding: 0.8rem 1rem; font-size: 0.9rem;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(100, 140, 255, 0.06);
}
.data-table tr:hover td {
    background: rgba(56, 189, 248, 0.04);
}

/* ═══ SIMULATION CONTAINER ═══ */
.sim-container {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-sm);
    padding: 1.5rem; margin: 1.5rem 0;
    overflow: hidden;
}
.sim-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 1rem; flex-wrap: wrap; gap: 0.75rem;
}
.sim-title {
    font-size: 1rem; font-weight: 600;
    color: var(--accent-cyan);
}
.sim-controls {
    display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
}
.sim-canvas-wrap {
    position: relative; width: 100%;
    border-radius: var(--radius-xs); overflow: hidden;
    background: #030812;
}
.sim-canvas-wrap canvas {
    display: block; width: 100%; height: auto;
    cursor: default;
}

/* ═══ CONTROLS ═══ */
.btn {
    background: var(--gradient-accent);
    color: #fff; border: none;
    padding: 0.6rem 1.5rem; border-radius: var(--radius-xs);
    font-size: 0.85rem; font-weight: 600;
    cursor: pointer; transition: all 0.2s ease;
    font-family: inherit;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 15px rgba(56, 189, 248, 0.3); }
.btn:active { transform: translateY(0); }
.btn-sm { padding: 0.4rem 1rem; font-size: 0.8rem; }
.btn-outline {
    background: transparent;
    border: 1px solid var(--border-glow);
    color: var(--text-primary);
}
.btn-outline:hover { background: rgba(56, 189, 248, 0.1); }
.btn-orange { background: var(--gradient-warm); }
.btn-green { background: var(--gradient-green); }

.slider-group {
    display: flex; flex-direction: column; gap: 0.25rem;
}
.slider-label {
    font-size: 0.75rem; color: var(--text-muted); font-weight: 500;
}
input[type="range"] {
    -webkit-appearance: none; appearance: none;
    width: 120px; height: 6px;
    background: rgba(100, 140, 255, 0.15);
    border-radius: 3px; outline: none;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 16px; height: 16px;
    background: var(--accent-cyan);
    border-radius: 50%; cursor: pointer;
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.5);
}
input[type="range"]::-moz-range-thumb {
    width: 16px; height: 16px;
    background: var(--accent-cyan);
    border-radius: 50%; cursor: pointer; border: none;
}

select, input[type="number"] {
    background: rgba(15, 23, 52, 0.9);
    border: 1px solid var(--border-card);
    color: var(--text-primary);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-xs);
    font-size: 0.9rem; font-family: inherit;
    transition: border-color 0.2s;
}
select:focus, input[type="number"]:focus {
    outline: none; border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.1);
}

.input-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem; margin-bottom: 1rem;
}
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group label {
    font-size: 0.8rem; font-weight: 600;
    color: var(--text-muted); text-transform: uppercase;
    letter-spacing: 0.3px;
}
.input-pair { display: flex; gap: 0.5rem; }
.input-pair input { flex: 1; min-width: 0; }
.input-pair select { width: 100px; }

/* ═══ RESULT ═══ */
.result-box {
    background: rgba(52, 211, 153, 0.06);
    border: 1px solid rgba(52, 211, 153, 0.2);
    border-radius: var(--radius-sm);
    padding: 1.25rem; margin-top: 1rem;
    font-family: var(--font-mono);
    font-size: 0.85rem; color: var(--text-secondary);
    white-space: pre-wrap;
    max-height: 0; overflow: hidden;
    opacity: 0; transition: all 0.5s ease;
}
.result-box.show {
    max-height: 500px; opacity: 1;
    padding: 1.25rem;
}

/* ═══ QUIZ ═══ */
.quiz-q {
    background: rgba(15, 23, 52, 0.6);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-sm);
    padding: 1.25rem; margin-bottom: 1rem;
    transition: all 0.3s ease;
}
.quiz-q.correct { border-color: var(--accent-green); background: rgba(52, 211, 153, 0.06); }
.quiz-q.incorrect { border-color: var(--accent-red); background: rgba(248, 113, 113, 0.06); }
.quiz-q p.q-text {
    font-weight: 600; color: var(--text-primary);
    margin-bottom: 0.75rem; font-size: 0.95rem;
}
.quiz-opt {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.5rem 0.75rem; margin-bottom: 0.3rem;
    border-radius: var(--radius-xs); cursor: pointer;
    transition: background 0.2s;
}
.quiz-opt:hover { background: rgba(56, 189, 248, 0.06); }
.quiz-opt input[type="radio"] {
    accent-color: var(--accent-cyan);
    width: 16px; height: 16px;
}
.quiz-opt label { cursor: pointer; color: var(--text-secondary); font-size: 0.9rem; flex: 1; }
.quiz-feedback {
    margin-top: 0.75rem; padding: 0.6rem 0.75rem;
    border-radius: var(--radius-xs);
    font-size: 0.85rem; display: none;
}
.quiz-feedback.show { display: block; }
.quiz-feedback.right {
    background: rgba(52, 211, 153, 0.1);
    border: 1px solid rgba(52, 211, 153, 0.2);
    color: var(--accent-green);
}
.quiz-feedback.wrong {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.2);
    color: var(--accent-red);
}
.score-display {
    text-align: center; padding: 1.5rem;
    border-radius: var(--radius-sm); margin-top: 1.5rem;
    font-size: 1.3rem; font-weight: 700;
    display: none;
}
.score-display.show { display: block; }
.score-display.great {
    background: rgba(52, 211, 153, 0.1);
    border: 1px solid rgba(52, 211, 153, 0.25);
    color: var(--accent-green);
}
.score-display.good {
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.25);
    color: var(--accent-yellow);
}
.score-display.needs-work {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.25);
    color: var(--accent-red);
}

/* ═══ PLANET INFO TOOLTIP ═══ */
.planet-info {
    position: absolute; pointer-events: none;
    background: rgba(5, 10, 24, 0.95);
    border: 1px solid var(--border-glow);
    border-radius: var(--radius-xs);
    padding: 0.6rem 0.8rem;
    font-size: 0.8rem; color: var(--text-primary);
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    opacity: 0; transition: opacity 0.2s;
    z-index: 10; white-space: nowrap;
}
.planet-info.show { opacity: 1; }

/* ═══ STAT BADGES ═══ */
.stat-row {
    display: flex; gap: 0.75rem; flex-wrap: wrap; margin: 1rem 0;
}
.stat-badge {
    background: rgba(56, 189, 248, 0.08);
    border: 1px solid rgba(56, 189, 248, 0.15);
    border-radius: var(--radius-xs);
    padding: 0.5rem 0.8rem;
    font-size: 0.8rem; font-family: var(--font-mono);
}
.stat-badge .stat-val { color: var(--accent-cyan); font-weight: 600; }
.stat-badge .stat-lbl { color: var(--text-muted); margin-left: 0.3rem; }

/* ═══ FOOTER ═══ */
.footer {
    text-align: center; padding: 2rem;
    color: var(--text-muted); font-size: 0.8rem;
    border-top: 1px solid var(--border-card);
    margin-top: 2rem;
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 768px) {
    .nav-links { display: none; }
    .container { padding: 70px 1rem 2rem; }
    .card { padding: 1.25rem; }
    .sim-controls { width: 100%; justify-content: center; }
    input[type="range"] { width: 90px; }
    .input-row { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
