@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Fira+Code:wght@400;500;600&display=swap');

:root {
    --red: #dc1414;
    --red-dark: #b01010;
    --blue: #1e64a0;
    --blue-dark: #154a78;
    --yellow: #fac832;
    --dark: #0f172a;
    --dark-light: #1e293b;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-600: #475569;
    --gray-800: #1e293b;
    --white: #ffffff;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-50);
    color: var(--dark);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navbar */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--gray-200);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.85rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand { display: flex; align-items: center; gap: 0.75rem; text-decoration: none; color: var(--dark); }
.nav-logo { height: 40px; }
.brand-text { display: flex; flex-direction: column; }
.brand-name { font-weight: 800; font-size: 1.15rem; }
.brand-version { font-size: 0.75rem; color: var(--gray-400); font-weight: 600; }

.nav-links { display: flex; align-items: center; gap: 1.5rem; }
.nav-links a { text-decoration: none; color: var(--gray-600); font-weight: 500; font-size: 0.95rem; }
.nav-links a:hover, .nav-links a.active { color: var(--red); }
.github-link { display: flex; align-items: center; gap: 0.35rem; }
.mobile-toggle { display: none; background: none; border: none; font-size: 1.5rem; cursor: pointer; }
@media (max-width: 768px) {
    .mobile-toggle { display: block; }
    .nav-links { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--white); flex-direction: column; padding: 1rem; gap: 1rem; border-bottom: 1px solid var(--gray-200); }
    .nav-links.active { display: flex; }
}

/* Header */
.tutorial-main {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 7rem 1.5rem 3rem;
}

.tutorial-header {
    text-align: center;
    margin-bottom: 2rem;
}

.tutorial-header h1 {
    font-size: 2.25rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.tutorial-header p {
    color: var(--gray-600);
    max-width: 640px;
    margin: 0 auto;
}

.section-tag {
    display: inline-block;
    background: rgba(220, 20, 20, 0.1);
    color: var(--red);
    padding: 0.35rem 0.9rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

/* Progress */
.tutorial-progress {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.step-dot {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--gray-200);
    background: var(--white);
    color: var(--gray-600);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.step-dot.active, .step-dot:hover {
    background: var(--red);
    border-color: var(--red);
    color: white;
}

/* Steps */
.tutorial-step {
    display: none;
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-lg);
    padding: 1.75rem;
    margin-bottom: 1.5rem;
}

.tutorial-step.active { display: block; }

.tutorial-step h2 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

.tutorial-step > p {
    color: var(--gray-600);
    margin-bottom: 1.25rem;
    max-width: 760px;
}

.tutorial-step code {
    background: var(--gray-100);
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
    font-family: 'Fira Code', monospace;
    color: var(--red);
}

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

.compare.single { grid-template-columns: 1fr; max-width: 600px; }

.code-box {
    background: #2d2d2d;
    border-radius: var(--radius-sm);
    padding: 1rem;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.lang-tag {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-400);
    background: rgba(255,255,255,0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.lang-tag.python2 { color: #fca5a5; }

.code-box pre {
    background: transparent;
    padding: 0;
    margin: 0;
    overflow-x: auto;
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
}

.code-box pre code {
    background: transparent;
    padding: 0;
    font-size: inherit;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.85rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary { background: var(--red); color: white; }
.btn-primary:hover { background: var(--red-dark); }
.btn-ghost { background: transparent; color: var(--gray-600); border: 1px solid var(--gray-200); }
.btn-ghost:hover { background: var(--gray-100); }

.try-btn { align-self: flex-start; }

.tutorial-nav {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
}

/* Output */
.try-output {
    background: #1e1e1e;
    border-radius: var(--radius);
    border: 1px solid #334155;
    overflow: hidden;
}

.try-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #252525;
    color: #e2e8f0;
    font-weight: 600;
    font-size: 0.9rem;
}

#try-content {
    padding: 1rem;
    color: #e2e8f0;
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    min-height: 120px;
    max-height: 300px;
    overflow: auto;
    white-space: pre-wrap;
    margin: 0;
}

#try-content.error { color: #ff8585; }
#try-content.empty { color: #64748b; font-style: italic; }

.final-msg {
    margin-top: 1.25rem;
    padding: 1rem;
    background: #eff6ff;
    border-left: 4px solid var(--blue);
    border-radius: var(--radius-sm);
    color: var(--blue-dark);
}

.final-msg a { color: var(--red); font-weight: 700; }

/* Footer */
.footer {
    background: var(--white);
    border-top: 1px solid var(--gray-200);
    padding: 1.5rem;
    margin-top: auto;
}

.footer-bottom {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
    color: var(--gray-600);
    font-size: 0.9rem;
}

.footer-bottom a { color: var(--red); text-decoration: none; }

@media (max-width: 768px) {
    .compare { grid-template-columns: 1fr; }
    .tutorial-header h1 { font-size: 1.75rem; }
}
