/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Oxanium', sans-serif;
    background: linear-gradient(135deg, #0a0e27 0%, #1a1a3e 50%, #0d1b2a 100%);
    color: #e0f7ff;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ── Starfield background ── */
#stars-canvas {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

/* ── Header ── */
.header {
    font-family: 'Jersey 15', sans-serif;
    background: rgba(0, 255, 136, 0.08);
    border-bottom: 2px solid #00ff88;
    padding: 0.55rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.2rem;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.3);
    position: relative;
    z-index: 10;
}
.header h1 {
    font-size: 2rem;
    text-shadow: 0 0 10px #00ff88, 0 0 20px #ff006e;
    letter-spacing: 3px;
    color: #00ffff;
    text-decoration: none;
}
.header a { color: inherit; text-decoration: none; }
.header-badge {
    font-family: 'DotGothic16', monospace;
    font-size: 0.8rem;
    color: rgba(0, 255, 136, 0.6);
    letter-spacing: 2px;
    border: 1px solid rgba(0, 255, 136, 0.25);
    padding: 3px 10px;
    border-radius: 4px;
    background: rgba(0, 255, 136, 0.05);
}
.header-back {
    margin-left: auto;
    font-family: 'Oxanium', monospace;
    font-size: 0.75rem;
    color: rgba(0, 255, 136, 0.5);
    text-decoration: none;
    padding: 4px 12px;
    border: 1px solid rgba(0, 255, 136, 0.2);
    border-radius: 4px;
    transition: all 0.2s;
}
.header-back:hover {
    color: #00ff88;
    border-color: #00ff88;
    background: rgba(0, 255, 136, 0.08);
}

/* ── Progress dots ── */
.progress-bar {
    position: relative;
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 14px 0 8px;
}
.prog-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(0, 255, 136, 0.15);
    border: 2px solid rgba(0, 255, 136, 0.3);
    transition: all 0.4s;
    cursor: pointer;
}
.prog-dot.active {
    background: #00ff88;
    border-color: #00ff88;
    box-shadow: 0 0 10px #00ff88;
    transform: scale(1.3);
}
.prog-dot.done {
    background: rgba(0, 255, 136, 0.5);
    border-color: rgba(0, 255, 136, 0.6);
}
.prog-connector {
    width: 30px;
    height: 2px;
    background: rgba(0, 255, 136, 0.2);
    transition: background 0.4s;
}
.prog-connector.done { background: rgba(0, 255, 136, 0.5); }

/* ── Slide container ── */
.slides-wrap {
    position: relative;
    z-index: 5;
    width: 100%;
    max-width: 820px;
    margin: 0 auto;
    padding: 0 1.2rem 2rem;
}
.slide {
    display: none;
    animation: slideIn 0.4s ease;
}
.slide.active { display: block; }
@keyframes slideIn {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Slide card ── */
.card {
    background: rgba(10, 14, 39, 0.82);
    border: 1px solid rgba(0, 255, 136, 0.25);
    border-radius: 14px;
    padding: 2rem 2.2rem;
    margin-top: 0.8rem;
    box-shadow: 0 0 40px rgba(0, 255, 136, 0.06), inset 0 0 30px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(6px);
}
.slide-num {
    font-family: 'Jersey 15', monospace;
    font-size: 0.78rem;
    letter-spacing: 3px;
    color: rgba(0, 255, 136, 0.35);
    text-transform: uppercase;
    margin-bottom: 0.35rem;
    display: block;
}
.slide-title {
    font-family: 'Jersey 15', sans-serif;
    font-size: 2.2rem;
    color: #00ffff;
    text-shadow: 0 0 12px rgba(0, 255, 255, 0.4);
    letter-spacing: 2px;
    line-height: 1.2;
    margin-bottom: 0.5rem;
}
.slide-emoji {
    font-size: 2.8rem;
    display: block;
    margin-bottom: 0.5rem;
}
.slide-desc {
    font-family: 'DotGothic16', sans-serif;
    font-size: 1.05rem;
    color: rgba(200, 240, 255, 0.85);
    line-height: 2;
    margin-bottom: 1.2rem;
}
.slide-desc strong { color: #f5a623; }
.slide-desc .hl-green { color: #00ff88; font-weight: 700; }
.slide-desc .hl-pink  { color: #ff006e; font-weight: 700; }
.slide-desc .hl-blue  { color: #4ea8d4; font-weight: 700; }

/* ── Analogy boxes ── */
.analogy-box {
    border-radius: 10px;
    padding: 1rem 1.2rem;
    margin: 1rem 0;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.analogy-box.green  { background: rgba(0, 255, 136, 0.07);  border: 1px solid rgba(0, 255, 136, 0.25); }
.analogy-box.orange { background: rgba(245, 166, 35, 0.07); border: 1px solid rgba(245, 166, 35, 0.25); }
.analogy-box.pink   { background: rgba(255, 0, 110, 0.07);  border: 1px solid rgba(255, 0, 110, 0.25); }
.analogy-box.blue   { background: rgba(78, 168, 212, 0.07); border: 1px solid rgba(78, 168, 212, 0.25); }
.analogy-icon {
    font-size: 2rem;
    flex-shrink: 0;
    line-height: 1;
    margin-top: 2px;
}
.analogy-text {
    font-family: 'DotGothic16', sans-serif;
    font-size: 0.95rem;
    color: rgba(200, 240, 255, 0.8);
    line-height: 1.9;
}
.analogy-text strong { color: #fff; }

/* ── Code demo block ── */
.code-demo {
    background: #08080f;
    border: 1px solid rgba(0, 255, 136, 0.22);
    border-radius: 8px;
    overflow: hidden;
    margin: 1.1rem 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}
.code-demo-bar {
    background: rgba(0, 255, 136, 0.07);
    border-bottom: 1px solid rgba(0, 255, 136, 0.15);
    padding: 6px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 10px;
    letter-spacing: 1px;
    color: rgba(0, 255, 136, 0.45);
    font-family: 'Oxanium', monospace;
}
.dot-r { width: 8px; height: 8px; border-radius: 50%; background: #ff5f57; }
.dot-y { width: 8px; height: 8px; border-radius: 50%; background: #ffbd2e; }
.dot-g { width: 8px; height: 8px; border-radius: 50%; background: #28ca41; }
.code-lines {
    padding: 1rem 1.2rem;
    font-family: 'Oxanium', monospace;
    font-size: 0.95rem;
    line-height: 2;
    counter-reset: ln;
}
.cl {
    display: flex;
    gap: 14px;
    counter-increment: ln;
}
.cl::before {
    content: counter(ln);
    color: rgba(0, 255, 136, 0.2);
    min-width: 18px;
    text-align: right;
    user-select: none;
    font-size: 0.8rem;
    margin-top: 2px;
}
.cl .comment { color: #5a7a5a; font-style: italic; }
.cl .fn      { color: #4ea8d4; }
.cl .paren   { color: rgba(200, 200, 200, 0.6); }
.cl .num     { color: #f5a623; }
.cl .str     { color: #e05050; }
.cl .kw      { color: #c792ea; }
.cl .var     { color: #00ff88; }
.cl .eq      { color: rgba(200, 200, 200, 0.5); }

/* ── Annotation labels ── */
.ann-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: 'DotGothic16', sans-serif;
    font-size: 0.82rem;
    padding: 4px 10px;
    border-radius: 20px;
    margin: 4px 4px 0 0;
    white-space: nowrap;
}
.ann-label.blue   { background: rgba(78, 168, 212, 0.15); color: #4ea8d4; border: 1px solid rgba(78, 168, 212, 0.3); }
.ann-label.orange { background: rgba(245, 166, 35, 0.15);  color: #f5a623; border: 1px solid rgba(245, 166, 35, 0.3); }
.ann-label.pink   { background: rgba(255, 0, 110, 0.15);   color: #ff6ea0; border: 1px solid rgba(255, 0, 110, 0.3); }
.ann-label.green  { background: rgba(0, 255, 136, 0.10);   color: #00ff88; border: 1px solid rgba(0, 255, 136, 0.3); }

/* ── Step-by-step run demo ── */
.run-demo {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 1.1rem 0;
}
.run-step {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    opacity: 0.35;
    transition: opacity 0.5s, transform 0.4s;
    transform: translateX(-8px);
}
.run-step.visible {
    opacity: 1;
    transform: translateX(0);
}
.run-step-num {
    font-family: 'Jersey 15', monospace;
    font-size: 1.4rem;
    color: #00ff88;
    min-width: 28px;
    text-align: center;
    text-shadow: 0 0 8px #00ff88;
}
.run-step-body {
    font-family: 'DotGothic16', sans-serif;
    font-size: 0.92rem;
    color: rgba(200, 240, 255, 0.8);
    line-height: 1.9;
    padding-top: 3px;
}
.run-step-body strong { color: #fff; }
.run-step-body .tag {
    display: inline-block;
    font-size: 0.75rem;
    padding: 1px 8px;
    border-radius: 3px;
    margin-left: 4px;
    vertical-align: middle;
}
.tag-green  { background: rgba(0, 255, 136, 0.15); color: #00ff88; border: 1px solid rgba(0, 255, 136, 0.3); }
.tag-orange { background: rgba(245, 166, 35, 0.15); color: #f5a623; border: 1px solid rgba(245, 166, 35, 0.3); }

/* ── Output log preview ── */
.output-preview {
    background: #050810;
    border: 1px solid rgba(0, 200, 255, 0.2);
    border-radius: 8px;
    padding: 10px 14px;
    font-family: 'Oxanium', monospace;
    font-size: 0.85rem;
    line-height: 2;
    margin: 0.6rem 0;
}
.op-info { color: #00c8ff; }
.op-ok   { color: #00ff88; }
.op-warn { color: #f5a623; }
.op-err  { color: #ff006e; }

/* ── Try / quiz panel ── */
.try-panel {
    background: rgba(0, 255, 136, 0.04);
    border: 1px dashed rgba(0, 255, 136, 0.3);
    border-radius: 10px;
    padding: 1.1rem 1.3rem;
    margin: 1.1rem 0;
}
.try-panel-title {
    font-family: 'Jersey 15', sans-serif;
    font-size: 1.1rem;
    color: #f5a623;
    margin-bottom: 0.5rem;
    letter-spacing: 1px;
}

/* ── Function chips ── */
.chip {
    font-family: 'Oxanium', monospace;
    font-size: 0.8rem;
    padding: 4px 12px;
    border-radius: 20px;
    background: rgba(78, 168, 212, 0.1);
    border: 1px solid rgba(78, 168, 212, 0.3);
    color: #4ea8d4;
    cursor: default;
    transition: all 0.15s;
    user-select: none;
    display: inline-block;
}
.chip:hover {
    background: rgba(78, 168, 212, 0.2);
    border-color: #4ea8d4;
    transform: translateY(-1px);
}

/* ── Quiz ── */
.quiz-wrap { margin: 1rem 0; }
.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.qopt {
    font-family: 'DotGothic16', sans-serif;
    font-size: 0.9rem;
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid rgba(0, 255, 136, 0.2);
    background: rgba(0, 0, 0, 0.3);
    color: rgba(200, 240, 255, 0.7);
    cursor: pointer;
    transition: all 0.18s;
    display: flex;
    align-items: center;
    gap: 10px;
}
.qopt:hover    { border-color: #00ff88; color: #fff; background: rgba(0, 255, 136, 0.06); }
.qopt.correct  { border-color: #00ff88; background: rgba(0, 255, 136, 0.12); color: #00ff88; }
.qopt.wrong    { border-color: #ff006e; background: rgba(255, 0, 110, 0.08); color: #ff6090; }
.qopt .opt-letter {
    font-family: 'Jersey 15', monospace;
    font-size: 1rem;
    min-width: 22px;
    text-align: center;
}
.quiz-feedback {
    font-family: 'DotGothic16', sans-serif;
    font-size: 0.95rem;
    margin-top: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    display: none;
    line-height: 1.8;
}
.quiz-feedback.show { display: block; animation: slideIn 0.3s; }
.quiz-feedback.ok   { background: rgba(0, 255, 136, 0.08); color: #00ff88; border: 1px solid rgba(0, 255, 136, 0.3); }
.quiz-feedback.bad  { background: rgba(255, 0, 110, 0.08); color: #ff6090; border: 1px solid rgba(255, 0, 110, 0.3); }

/* ── Navigation buttons ── */
.nav-row {
    position: relative;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 1.2rem 2rem;
    max-width: 820px;
    margin: 0 auto;
}
.nav-btn {
    font-family: 'Jersey 15', sans-serif;
    font-size: 1.1rem;
    letter-spacing: 1px;
    border: none;
    border-radius: 8px;
    padding: 10px 26px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 8px;
}
.nav-btn.prev {
    background: transparent;
    color: rgba(0, 255, 136, 0.6);
    border: 1px solid rgba(0, 255, 136, 0.3);
}
.nav-btn.prev:hover { color: #00ff88; border-color: #00ff88; }
.nav-btn.next {
    background: #00ff88;
    color: #040e12;
    box-shadow: 0 0 16px rgba(0, 255, 136, 0.4);
}
.nav-btn.next:hover {
    background: #33ffaa;
    box-shadow: 0 0 28px rgba(0, 255, 136, 0.65);
    transform: translateY(-1px);
}
.nav-btn.finish {
    background: linear-gradient(135deg, #ff006e, #ff4090);
    color: #fff;
    box-shadow: 0 0 16px rgba(255, 0, 110, 0.4);
    font-size: 1.2rem;
    padding: 12px 32px;
}
.nav-btn.finish:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 32px rgba(255, 0, 110, 0.65);
}
.nav-btn:disabled { opacity: 0.3; pointer-events: none; }

/* ── Mascot / speech bubble ── */
.mascot-row {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin: 0.8rem 0 1.2rem;
}
.mascot-bubble {
    background: rgba(0, 255, 136, 0.07);
    border: 1px solid rgba(0, 255, 136, 0.25);
    border-radius: 12px 12px 12px 2px;
    padding: 12px 16px;
    font-family: 'DotGothic16', sans-serif;
    font-size: 0.92rem;
    color: rgba(200, 240, 255, 0.85);
    line-height: 1.9;
    flex: 1;
    position: relative;
}
.mascot-bubble::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 14px;
    border: 6px solid transparent;
    border-right-color: rgba(0, 255, 136, 0.25);
}
.mascot-icon {
    font-size: 3rem;
    flex-shrink: 0;
    filter: drop-shadow(0 0 8px rgba(0, 255, 136, 0.4));
}

/* ── Flow diagram (slide 1) ── */
.flow-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 1.1rem 0;
    justify-content: center;
}
.flow-box {
    background: rgba(10, 14, 39, 0.8);
    border-radius: 10px;
    padding: 14px 18px;
    text-align: center;
    min-width: 110px;
    flex: 1;
}
.flow-box .fb-icon  { font-size: 2rem; display: block; margin-bottom: 5px; }
.flow-box .fb-label {
    font-family: 'DotGothic16', sans-serif;
    font-size: 0.78rem;
    color: rgba(200, 240, 255, 0.7);
    line-height: 1.7;
}
.flow-box.green  { border: 1px solid rgba(0, 255, 136, 0.35); }
.flow-box.orange { border: 1px solid rgba(245, 166, 35, 0.35); }
.flow-box.pink   { border: 1px solid rgba(255, 0, 110, 0.35); }
.flow-arrow { font-size: 1.5rem; color: rgba(200, 240, 255, 0.3); }

/* ── Typing / cursor animation ── */
.typed-line {
    display: inline-block;
    overflow: hidden;
    white-space: nowrap;
    border-right: 2px solid #00ff88;
    width: 0;
    animation: typing 1.2s steps(30) 0.3s forwards, blink 0.7s step-end infinite;
}
@keyframes typing {
    to { width: 100%; }
}
@keyframes blink {
    50% { border-color: transparent; }
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .card          { padding: 1.3rem 1.1rem; }
    .slide-title   { font-size: 1.7rem; }
    .flow-row      { flex-direction: column; }
    .flow-arrow    { transform: rotate(90deg); }
}