/* ===== CSS Variables - Dark Theme (Default) ===== */
:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --accent-primary: #58a6ff;
    --accent-secondary: #3fb950;
    --accent-warning: #d29922;
    --accent-error: #f85149;
    --border-color: #30363d;
    --code-bg: #0d1117;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    --transition-fast: 0.15s ease;
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Syntax Highlighting Colors - VS Code Dark+ Theme */
    --syntax-keyword: #c586c0;
    --syntax-string: #ce9178;
    --syntax-comment: #6a9955;
    --syntax-number: #b5cea8;
    --syntax-function: #dcdcaa;
    --syntax-variable: #9cdcfe;
    --syntax-operator: #d4d4d4;
    --syntax-bracket: #ffd700;
    --syntax-tag: #569cd6;
    --syntax-attribute: #9cdcfe;
    --syntax-property: #9cdcfe;
    --syntax-selector: #d7ba7d;
    --syntax-decorator: #dcdcaa;
    --syntax-at-rule: #c586c0;
    --syntax-color: #ce9178;
    --syntax-doctype: #569cd6;
}

/* ===== Light Theme ===== */
[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f6f8fa;
    --bg-tertiary: #eaeef2;
    --text-primary: #1f2328;
    --text-secondary: #656d76;
    --text-muted: #8b949e;
    --accent-primary: #0969da;
    --accent-secondary: #1a7f37;
    --accent-warning: #9a6700;
    --accent-error: #cf222e;
    --border-color: #d0d7de;
    --code-bg: #f6f8fa;
    --shadow: 0 8px 24px rgba(140, 149, 159, 0.2);

    /* Syntax Highlighting Colors - VS Code Light+ Theme */
    --syntax-keyword: #af00db;
    --syntax-string: #a31515;
    --syntax-comment: #008000;
    --syntax-number: #098658;
    --syntax-function: #795e26;
    --syntax-variable: #001080;
    --syntax-operator: #000000;
    --syntax-bracket: #0431fa;
    --syntax-tag: #800000;
    --syntax-attribute: #e50000;
    --syntax-property: #001080;
    --syntax-selector: #800000;
    --syntax-decorator: #795e26;
    --syntax-at-rule: #af00db;
    --syntax-color: #a31515;
    --syntax-doctype: #800000;
}

/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== Page Transition Animations ===== */
body {
    animation: pageEnter 0.4s ease-out;
}

body.page-exit {
    animation: pageExit 0.3s ease-in forwards;
}

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

@keyframes pageExit {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* Stagger animation for content elements */
.container > * {
    animation: contentFadeIn 0.5s ease-out backwards;
}

.header {
    animation-delay: 0.1s;
}

.hero, .practice-section, .lessons-section, .docs-section, .about-section {
    animation-delay: 0.2s;
}

.footer {
    animation-delay: 0.3s;
}

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

/* Disable animations on page exit */
body.page-exit .container > * {
    animation: none;
}

/* ===== Loading Spinner ===== */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.page-loader.active {
    opacity: 1;
    pointer-events: all;
}

.spinner {
    width: 60px;
    height: 60px;
    position: relative;
    margin-bottom: 20px;
}

/* Code icon in center of spinner */
.spinner::before {
    content: '</>';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 700;
    color: var(--accent-primary);
    animation: codeIconPulse 1.5s ease-in-out infinite;
}

@keyframes codeIconPulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.6;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }
}

.spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 4px solid transparent;
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spinnerRotate 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
}

.spinner-ring:nth-child(2) {
    border-top-color: var(--accent-secondary);
    animation-delay: 0.1s;
    width: 85%;
    height: 85%;
    top: 7.5%;
    left: 7.5%;
}

.spinner-ring:nth-child(3) {
    border-top-color: var(--accent-warning);
    animation-delay: 0.2s;
    width: 70%;
    height: 70%;
    top: 15%;
    left: 15%;
}

@keyframes spinnerRotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.spinner-text {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-secondary);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.5;
    }
    50% {
        opacity: 1;
    }
}

/* Loading dots animation */
.spinner-text::after {
    content: '';
    animation: loadingDots 1.5s steps(4, end) infinite;
}

@keyframes loadingDots {
    0% { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
    100% { content: ''; }
}

/* ===== Container ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== Header ===== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--bg-primary);
    z-index: 100;
    backdrop-filter: blur(10px);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 700;
}

.logo-icon {
    color: var(--accent-primary);
    font-family: var(--font-mono);
}

.nav {
    display: flex;
    gap: 30px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-fast);
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-primary);
}

/* ===== Hamburger Menu Button ===== */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
    cursor: pointer;
    padding: 8px;
    gap: 5px;
    transition: all var(--transition-fast);
    z-index: 1001;
}

.hamburger:hover {
    border-color: var(--accent-primary);
    background: var(--bg-tertiary);
}

.hamburger-line {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-secondary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger:hover .hamburger-line {
    background: var(--accent-primary);
}

/* Hamburger Animation - Active State */
.hamburger.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active .hamburger-line:nth-child(2) {
    opacity: 0;
    transform: translateX(-10px);
}

.hamburger.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Menu Overlay */
.menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.menu-overlay.active {
    display: block;
    opacity: 1;
}

/* ===== Theme Toggle Button ===== */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.theme-toggle:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: var(--bg-tertiary);
}

.theme-toggle .icon-sun {
    display: none;
}

.theme-toggle .icon-moon {
    display: block;
}

[data-theme="light"] .theme-toggle .icon-sun {
    display: block;
}

[data-theme="light"] .theme-toggle .icon-moon {
    display: none;
}

/* ===== Sound Toggle Button ===== */
.sound-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.sound-toggle:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: var(--bg-tertiary);
}

.sound-toggle .icon-sound-on {
    display: block;
}

.sound-toggle .icon-sound-off {
    display: none;
}

.sound-toggle.muted .icon-sound-on {
    display: none;
}

.sound-toggle.muted .icon-sound-off {
    display: block;
    color: var(--accent-error);
}

.sound-toggle.muted:hover .icon-sound-off {
    color: var(--accent-error);
}

/* Shake animation for error sound feedback */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

.sound-toggle.error {
    animation: shake 0.2s ease;
}

/* Light theme specific adjustments */
[data-theme="light"] .header {
    background: rgba(255, 255, 255, 0.9);
}

[data-theme="light"] .code-window {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .editor-container {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .lesson-card:hover {
    box-shadow: 0 8px 30px rgba(9, 105, 218, 0.15);
}

[data-theme="light"] .btn-primary {
    background: linear-gradient(135deg, #0969da, #0550ae);
    box-shadow: 0 4px 15px rgba(9, 105, 218, 0.3);
}

[data-theme="light"] .btn-primary:hover {
    box-shadow: 0 6px 20px rgba(9, 105, 218, 0.4);
}

[data-theme="light"] .char.correct {
    color: #1a7f37 !important;
    text-shadow: none;
}

[data-theme="light"] .char.incorrect {
    color: #cf222e;
    background: rgba(207, 34, 46, 0.1);
}

[data-theme="light"] .char.current {
    background: rgba(9, 105, 218, 0.2);
}

[data-theme="light"] .progress-bar {
    background: linear-gradient(90deg, #0969da, #1a7f37);
}

/* Light theme correct syntax colors */
[data-theme="light"] .char.correct.syntax-keyword { color: #7b30a0 !important; }
[data-theme="light"] .char.correct.syntax-string { color: #6e1010 !important; }
[data-theme="light"] .char.correct.syntax-comment { color: #006600 !important; }
[data-theme="light"] .char.correct.syntax-number { color: #076040 !important; }
[data-theme="light"] .char.correct.syntax-function { color: #5a4520 !important; }
[data-theme="light"] .char.correct.syntax-tag { color: #600000 !important; }
[data-theme="light"] .char.correct.syntax-bracket { color: #0320c0 !important;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent-primary);
    border-radius: 1px;
}

/* ===== Hero Section ===== */
.hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
    padding: 80px 0;
    min-height: 80vh;
}

.hero-content {
    animation: fadeInUp 0.8s ease;
}

.hero-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 20px;
    min-height: 4rem;
}

.typing-text {
    color: var(--accent-primary);
}

.cursor {
    color: var(--accent-primary);
    animation: blink 1s infinite;
    font-weight: 300;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), #1f6feb);
    color: white;
    border: none;
    padding: 14px 32px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-smooth);
    box-shadow: 0 4px 15px rgba(88, 166, 255, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(88, 166, 255, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

/* ===== Code Window ===== */
.hero-visual {
    animation: fadeInRight 0.8s ease 0.3s both;
}

.code-window {
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.window-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dot.red { background: #ff5f57; }
.dot.yellow { background: #febc2e; }
.dot.green { background: #28c840; }

.window-title {
    margin-left: 10px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-family: var(--font-mono);
}

.code-content {
    padding: 20px;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.8;
    min-height: 300px;
    overflow: hidden;
}

.code-content pre {
    margin: 0;
}

.code-content code {
    color: var(--text-primary);
}

/* ===== Practice Section ===== */
.practice-section {
    padding: 80px 0;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 10px;
}

.section-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

/* ===== Language Selector ===== */
.language-selector {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.lang-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 10px 24px;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.lang-btn:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.lang-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

/* ===== Editor Container ===== */
.editor-container {
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 10px;
}

.editor-title {
    font-weight: 500;
    color: var(--text-secondary);
}

.editor-stats {
    display: flex;
    gap: 20px;
}

.stat {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.stat span {
    color: var(--accent-secondary);
    font-weight: 600;
}

/* ===== Code Display ===== */
.code-display {
    display: flex;
    padding: 20px;
    background: var(--code-bg);
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
}

.line-numbers {
    display: flex;
    flex-direction: column;
    padding-right: 20px;
    border-right: 1px solid var(--border-color);
    margin-right: 20px;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.8;
    color: var(--text-muted);
    user-select: none;
    text-align: right;
    min-width: 30px;
}

.code-text {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.8;
    white-space: pre-wrap;
    word-break: break-all;
    flex: 1;
}

/* ===== Syntax Highlighting (VS Code Dark+ Theme) ===== */

/* Base syntax colors for pending characters */
.char.pending.syntax-keyword,
.char.syntax-keyword {
    color: var(--syntax-keyword);
}

.char.pending.syntax-string,
.char.syntax-string {
    color: var(--syntax-string);
}

.char.pending.syntax-comment,
.char.syntax-comment {
    color: var(--syntax-comment);
    font-style: italic;
}

.char.pending.syntax-number,
.char.syntax-number {
    color: var(--syntax-number);
}

.char.pending.syntax-function,
.char.syntax-function {
    color: var(--syntax-function);
}

.char.pending.syntax-variable,
.char.syntax-variable {
    color: var(--syntax-variable);
}

.char.pending.syntax-operator,
.char.syntax-operator {
    color: var(--syntax-operator);
}

.char.pending.syntax-bracket,
.char.syntax-bracket {
    color: var(--syntax-bracket);
}

.char.pending.syntax-tag,
.char.syntax-tag {
    color: var(--syntax-tag);
}

.char.pending.syntax-attribute,
.char.syntax-attribute {
    color: var(--syntax-attribute);
}

.char.pending.syntax-property,
.char.syntax-property {
    color: var(--syntax-property);
}

.char.pending.syntax-selector,
.char.syntax-selector {
    color: var(--syntax-selector);
}

.char.pending.syntax-decorator,
.char.syntax-decorator {
    color: var(--syntax-decorator);
}

.char.pending.syntax-at-rule,
.char.syntax-at-rule {
    color: var(--syntax-at-rule);
}

.char.pending.syntax-color,
.char.syntax-color {
    color: var(--syntax-color);
}

.char.pending.syntax-doctype,
.char.syntax-doctype {
    color: var(--syntax-doctype);
}

/* Correct characters - bright green with slight glow */
.char.correct {
    color: #4ade80 !important;
    text-shadow: 0 0 2px rgba(74, 222, 128, 0.3);
}

/* Keep syntax color but add green tint for correct */
.char.correct.syntax-keyword { color: #a8e6a3 !important; }
.char.correct.syntax-string { color: #b8d4a8 !important; }
.char.correct.syntax-comment { color: #8bc68b !important; }
.char.correct.syntax-number { color: #c5e8b5 !important; }
.char.correct.syntax-function { color: #d4e8b5 !important; }
.char.correct.syntax-tag { color: #8bc6c6 !important; }
.char.correct.syntax-bracket { color: #e8e8a8 !important; }

/* Legacy classes for hero demo code */
.code-text .keyword {
    color: var(--syntax-keyword);
}

.code-text .string {
    color: var(--syntax-string);
}

.code-text .function {
    color: var(--syntax-function);
}

.code-text .comment {
    color: var(--syntax-comment);
    font-style: italic;
}

.code-text .number {
    color: var(--syntax-number);
}

.code-text .operator {
    color: var(--syntax-operator);
}

.code-text .variable {
    color: var(--syntax-variable);
}

.code-text .tag {
    color: var(--syntax-tag);
}

.code-text .attribute {
    color: var(--syntax-attribute);
}

/* ===== Character States ===== */
.char {
    position: relative;
    transition: all 0.05s ease;
}

.char.correct {
    color: var(--accent-secondary);
}

.char.incorrect {
    color: var(--accent-error);
    background: rgba(248, 81, 73, 0.2);
    border-radius: 2px;
}

.char.current {
    background: rgba(88, 166, 255, 0.3);
    border-radius: 2px;
    animation: pulse 0.5s ease infinite alternate;
}

@keyframes pulse {
    from { background: rgba(88, 166, 255, 0.2); }
    to { background: rgba(88, 166, 255, 0.4); }
}

.char.pending {
    color: var(--text-muted);
}

/* ===== Input Container ===== */
.input-container {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.input-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.btn-reset {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 16px;
    font-size: 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-reset:hover {
    border-color: var(--accent-error);
    color: var(--accent-error);
}

.code-input {
    width: 100%;
    min-height: 150px;
    background: var(--code-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.8;
    color: var(--text-primary);
    resize: vertical;
    transition: border-color var(--transition-fast);
}

.code-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1);
}

.code-input::placeholder {
    color: var(--text-muted);
}

/* ===== Typing Effect Styles ===== */
.code-input.typing {
    caret-color: var(--accent-primary);
}

/* Smooth character appearance */
@keyframes charAppear {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.char-typed {
    animation: charAppear 0.1s ease forwards;
}

/* ===== Progress Bar ===== */
.progress-container {
    height: 4px;
    background: var(--bg-tertiary);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    width: 0%;
    transition: width var(--transition-smooth);
    border-radius: 0 2px 2px 0;
}

/* ===== Results ===== */
.results {
    padding: 30px;
    text-align: center;
    animation: fadeInUp 0.5s ease;
}

.results h3 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--accent-secondary);
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.result-item {
    background: var(--bg-tertiary);
    padding: 20px;
    border-radius: 8px;
}

.result-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-primary);
    font-family: var(--font-mono);
}

.result-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ===== Lessons Section ===== */
.lessons-section {
    padding: 80px 0;
}

.lessons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.lesson-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    cursor: pointer;
    transition: all var(--transition-smooth);
}

.lesson-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-primary);
    box-shadow: 0 8px 30px rgba(88, 166, 255, 0.15);
}

.lesson-icon {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.lesson-card h3 {
    font-size: 1.25rem;
    margin-bottom: 8px;
}

.lesson-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.lesson-level {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.lesson-level.beginner {
    background: rgba(63, 185, 80, 0.15);
    color: var(--accent-secondary);
}

.lesson-level.intermediate {
    background: rgba(210, 153, 34, 0.15);
    color: var(--accent-warning);
}

.lesson-level.advanced {
    background: rgba(248, 81, 73, 0.15);
    color: var(--accent-error);
}

/* ===== Docs Section ===== */
.docs-section {
    padding: 80px 0;
    background: var(--bg-secondary);
}

.docs-tabs {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.docs-tab {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 10px 24px;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.docs-tab:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.docs-tab.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.docs-content-container {
    max-width: 900px;
    margin: 0 auto;
}

.docs-content {
    display: none;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 40px;
    animation: fadeInUp 0.4s ease;
}

.docs-content.active {
    display: block;
}

.docs-content h3 {
    font-size: 2rem;
    margin-bottom: 30px;
    color: var(--accent-primary);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 15px;
}

.docs-content h4 {
    font-size: 1.25rem;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.docs-block {
    margin-bottom: 35px;
}

.docs-block p {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 15px;
}

.docs-block ul,
.docs-block ol {
    margin-left: 25px;
    color: var(--text-secondary);
    line-height: 1.8;
}

.docs-block li {
    margin-bottom: 8px;
}

.docs-block strong {
    color: var(--text-primary);
    font-weight: 600;
}

.docs-block pre {
    background: var(--code-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    overflow-x: auto;
    margin: 15px 0;
}

.docs-block code {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-primary);
}

.docs-block p code,
.docs-block li code,
.docs-block td code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--accent-primary);
    border: 1px solid var(--border-color);
}

.docs-table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
}

.docs-table thead {
    background: var(--bg-tertiary);
}

.docs-table th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.docs-table td {
    padding: 12px 15px;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.docs-table tr:hover {
    background: var(--bg-tertiary);
}

.docs-table code {
    font-size: 0.85rem;
}

/* ===== About Section ===== */
.about-section {
    padding: 80px 0;
}

.about-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 50px;
}

.about-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 32px;
    text-align: center;
    transition: all var(--transition-smooth);
}

.about-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow);
}

.about-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--accent-primary), #1f6feb);
    border-radius: 20px;
    color: white;
    margin-bottom: 20px;
}

[data-theme="light"] .about-icon {
    background: linear-gradient(135deg, #0969da, #0550ae);
}

.about-card h3 {
    font-size: 1.25rem;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.about-card p {
    color: var(--text-secondary);
    line-height: 1.7;
}

.about-card strong {
    color: var(--accent-primary);
}

.about-stats {
    display: flex;
    justify-content: center;
    gap: 60px;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 3rem;
    font-weight: 700;
    color: var(--accent-primary);
    font-family: var(--font-mono);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* ===== Footer ===== */
.footer {
    text-align: center;
    padding: 40px 0;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.footer-brand .logo-icon {
    color: var(--accent-primary);
    font-family: var(--font-mono);
}

.footer p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.footer strong {
    color: var(--accent-primary);
    font-weight: 600;
}

.footer-copyright {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 8px;
}

/* ===== Animations ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ===== Responsive ===== */

/* Tablet - 1024px */
@media (max-width: 1024px) {
    .container {
        padding: 0 16px;
    }

    .hero {
        gap: 40px;
    }

    .about-stats {
        gap: 40px;
    }
}

/* Tablet Portrait - 900px */
@media (max-width: 900px) {
    .hero {
        grid-template-columns: 1fr;
        text-align: center;
        padding: 40px 0;
        gap: 30px;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-visual {
        order: -1;
        max-width: 500px;
        margin: 0 auto;
    }

    .results-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Show Hamburger, Hide Desktop Nav */
    .hamburger {
        display: flex;
    }

    .nav {
        position: fixed;
        top: 0;
        right: -280px;
        width: 280px;
        height: 100vh;
        background: var(--bg-secondary);
        flex-direction: column;
        padding: 80px 30px 30px;
        gap: 0;
        z-index: 1000;
        box-shadow: -5px 0 30px rgba(0, 0, 0, 0.3);
        transition: right 0.3s ease;
        overflow-y: auto;
    }

    .nav.active {
        right: 0;
    }

    .nav-link {
        padding: 16px 0;
        font-size: 1.1rem;
        border-bottom: 1px solid var(--border-color);
        display: block;
    }

    .nav-link:last-child {
        border-bottom: none;
    }

    .nav-link.active::after {
        display: none;
    }

    .nav-link.active {
        color: var(--accent-primary);
    }

    /* Mobile Nav Header */
    .nav::before {
        content: 'Menu';
        position: absolute;
        top: 20px;
        left: 30px;
        font-size: 1.25rem;
        font-weight: 700;
        color: var(--text-primary);
    }

    .header {
        padding: 15px 0;
    }

    .about-content {
        grid-template-columns: 1fr;
    }

    .about-stats {
        gap: 30px;
    }

    .stat-number {
        font-size: 2.5rem;
    }

    .lessons-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile Large - 768px */
@media (max-width: 768px) {
    .section-title {
        font-size: 2rem;
    }

    .editor-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .editor-stats {
        width: 100%;
        justify-content: space-between;
    }

    .code-display {
        padding: 15px;
    }

    .line-numbers {
        padding-right: 12px;
        margin-right: 12px;
        font-size: 0.8rem;
    }

    .code-text {
        font-size: 0.85rem;
    }

    .code-input {
        font-size: 0.85rem;
        min-height: 120px;
    }

    .language-selector {
        gap: 8px;
    }

    .lang-btn {
        padding: 8px 16px;
        font-size: 0.85rem;
    }

    .lessons-grid {
        grid-template-columns: 1fr;
    }

    .lesson-card {
        padding: 20px;
    }

    .docs-section {
        padding: 50px 0;
    }

    .docs-content {
        padding: 30px 20px;
    }

    .docs-content h3 {
        font-size: 1.5rem;
    }

    .docs-table {
        font-size: 0.85rem;
    }

    .docs-table th,
    .docs-table td {
        padding: 10px;
    }

    .docs-block pre {
        padding: 15px;
        font-size: 0.8rem;
    }
}

/* Mobile - 600px */
@media (max-width: 600px) {
    .container {
        padding: 0 12px;
    }

    .header {
        padding: 12px 0;
    }

    .logo {
        font-size: 1.25rem;
    }

    .theme-toggle {
        width: 36px;
        height: 36px;
    }

    .theme-toggle svg {
        width: 18px;
        height: 18px;
    }

    .hero {
        padding: 30px 0;
        min-height: auto;
    }

    .hero-title {
        font-size: 1.5rem;
        min-height: 3rem;
    }

    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 20px;
    }

    .btn-primary {
        padding: 12px 24px;
        font-size: 0.9rem;
        width: 100%;
    }

    .code-window {
        border-radius: 8px;
    }

    .window-header {
        padding: 10px 12px;
    }

    .dot {
        width: 10px;
        height: 10px;
    }

    .code-content {
        padding: 15px;
        font-size: 0.8rem;
        min-height: 200px;
    }

    .section-title {
        font-size: 1.5rem;
        margin-bottom: 8px;
    }

    .section-subtitle {
        font-size: 0.9rem;
        margin-bottom: 25px;
    }

    .practice-section,
    .lessons-section,
    .about-section {
        padding: 50px 0;
    }

    .editor-container {
        border-radius: 8px;
    }

    .editor-header {
        padding: 12px 15px;
    }

    .editor-title {
        font-size: 0.8rem;
    }

    .editor-stats {
        flex-wrap: wrap;
        gap: 8px;
    }

    .stat {
        font-size: 0.75rem;
    }

    .code-display {
        padding: 12px;
    }

    .line-numbers {
        padding-right: 10px;
        margin-right: 10px;
        font-size: 0.75rem;
        min-width: 24px;
    }

    .code-text {
        font-size: 0.8rem;
        line-height: 1.6;
    }

    .input-container {
        padding: 15px;
    }

    .input-header {
        font-size: 0.8rem;
    }

    .btn-reset {
        padding: 5px 12px;
        font-size: 0.75rem;
    }

    .code-input {
        font-size: 0.8rem;
        padding: 12px;
        min-height: 100px;
        line-height: 1.6;
    }

    .results {
        padding: 20px 15px;
    }

    .results h3 {
        font-size: 1.25rem;
    }

    .results-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .result-item {
        padding: 15px;
    }

    .result-value {
        font-size: 1.5rem;
    }

    .result-label {
        font-size: 0.75rem;
    }

    .language-selector {
        gap: 6px;
        margin-bottom: 20px;
    }

    .lang-btn {
        padding: 8px 14px;
        font-size: 0.8rem;
        border-radius: 6px;
    }

    .about-card {
        padding: 24px 20px;
        border-radius: 12px;
    }

    .about-icon {
        width: 64px;
        height: 64px;
        border-radius: 16px;
    }

    .about-icon svg {
        width: 32px;
        height: 32px;
    }

    .about-card h3 {
        font-size: 1.1rem;
    }

    .about-card p {
        font-size: 0.9rem;
    }

    .about-stats {
        gap: 24px;
        margin-top: 30px;
    }

    .stat-number {
        font-size: 2rem;
    }

    .stat-label {
        font-size: 0.85rem;
    }

    .footer {
        padding: 30px 0;
    }

    .footer-brand {
        font-size: 1.1rem;
    }

    .footer p {
        font-size: 0.85rem;
    }

    .footer-copyright {
        font-size: 0.75rem;
    }

    .docs-tabs {
        gap: 6px;
    }

    .docs-tab {
        padding: 8px 16px;
        font-size: 0.85rem;
    }

    .docs-content {
        padding: 20px 15px;
    }

    .docs-content h3 {
        font-size: 1.35rem;
        margin-bottom: 20px;
    }

    .docs-content h4 {
        font-size: 1.1rem;
    }

    .docs-block {
        margin-bottom: 25px;
    }

    .docs-block ul,
    .docs-block ol {
        margin-left: 20px;
    }

    .docs-block pre {
        padding: 12px;
        font-size: 0.75rem;
    }

    .docs-table {
        font-size: 0.8rem;
    }

    .docs-table th,
    .docs-table td {
        padding: 8px;
    }
}

/* Mobile Small - 400px */
@media (max-width: 400px) {
    .container {
        padding: 0 10px;
    }

    .hero-title {
        font-size: 1.3rem;
    }

    .hero-subtitle {
        font-size: 0.9rem;
    }

    .section-title {
        font-size: 1.35rem;
    }

    .language-selector {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }

    .lang-btn {
        padding: 10px 12px;
    }

    .editor-stats {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        text-align: center;
    }

    .results-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .result-value {
        font-size: 1.3rem;
    }

    .about-stats {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }

    .stat-number {
        font-size: 1.75rem;
    }

    .stat-label {
        font-size: 0.8rem;
    }

    .docs-tabs {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .docs-tab {
        padding: 10px 12px;
        font-size: 0.8rem;
    }

    .docs-content {
        padding: 20px 12px;
    }

    .docs-content h3 {
        font-size: 1.25rem;
    }

    .docs-content h4 {
        font-size: 1rem;
    }

    .docs-block pre {
        padding: 10px;
        font-size: 0.7rem;
    }

    .docs-table {
        font-size: 0.75rem;
    }

    .docs-table th,
    .docs-table td {
        padding: 6px;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .btn-primary:hover,
    .lang-btn:hover,
    .lesson-card:hover,
    .about-card:hover,
    .theme-toggle:hover {
        transform: none;
    }

    .lesson-card:active,
    .about-card:active {
        transform: scale(0.98);
    }

    .btn-primary:active,
    .lang-btn:active,
    .theme-toggle:active {
        transform: scale(0.95);
    }

    /* Larger touch targets */
    .lang-btn {
        min-height: 44px;
    }

    .btn-primary {
        min-height: 48px;
    }

    .theme-toggle {
        min-width: 44px;
        min-height: 44px;
    }

    .nav-link {
        padding: 10px 0;
    }
}

/* Landscape Mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: 20px 0;
    }

    .hero-title {
        font-size: 1.5rem;
        min-height: auto;
    }

    .code-window {
        max-height: 250px;
        overflow: hidden;
    }

    .code-content {
        min-height: 150px;
    }
}

/* Print Styles */
@media print {
    .header,
    .theme-toggle,
    .btn-primary,
    .btn-reset,
    .language-selector,
    .input-container,
    .progress-container,
    .results {
        display: none !important;
    }

    .code-display {
        border: 1px solid #ccc;
    }

    body {
        background: white;
        color: black;
    }
}

/* ===== Special Effects ===== */
.glow {
    text-shadow: 0 0 10px rgba(88, 166, 255, 0.5),
                 0 0 20px rgba(88, 166, 255, 0.3),
                 0 0 30px rgba(88, 166, 255, 0.2);
}

/* Smooth text rendering */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Selection styling */
::selection {
    background: rgba(88, 166, 255, 0.3);
    color: var(--text-primary);
}

/* ===== Run Code Button & Output Panel ===== */
.input-header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn-run {
    display: flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, var(--accent-secondary), #2ea043);
    border: none;
    color: white;
    padding: 6px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 8px rgba(63, 185, 80, 0.2);
}

.btn-run:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(63, 185, 80, 0.3);
}

.btn-run:active {
    transform: translateY(0);
}

.btn-run svg {
    width: 16px;
    height: 16px;
}

.btn-run:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Output Container */
.output-container {
    border-top: 1px solid var(--border-color);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        max-height: 500px;
        transform: translateY(0);
    }
}

.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.btn-clear-output {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 4px;
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-clear-output:hover {
    border-color: var(--accent-error);
    color: var(--accent-error);
    background: rgba(248, 81, 73, 0.1);
}

.output-content {
    padding: 16px 20px;
    background: var(--code-bg);
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.8;
    color: var(--text-primary);
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.output-content:empty::before {
    content: 'Chưa có output...';
    color: var(--text-muted);
    font-style: italic;
}

/* Output message types */
.output-line {
    padding: 2px 0;
    border-left: 3px solid transparent;
    padding-left: 8px;
    margin-left: -8px;
}

.output-line.log {
    color: var(--text-primary);
}

.output-line.info {
    color: var(--accent-primary);
    border-left-color: var(--accent-primary);
}

.output-line.warn {
    color: var(--accent-warning);
    border-left-color: var(--accent-warning);
    background: rgba(210, 153, 34, 0.05);
}

.output-line.error {
    color: var(--accent-error);
    border-left-color: var(--accent-error);
    background: rgba(248, 81, 73, 0.1);
    font-weight: 500;
}

.output-line.success {
    color: var(--accent-secondary);
    border-left-color: var(--accent-secondary);
}

/* Preview Frame for HTML/CSS */
.preview-frame {
    width: 100%;
    min-height: 300px;
    max-height: 500px;
    border: none;
    background: white;
    display: block;
}

/* Loading state for run button */
.btn-run.loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn-run.loading::after {
    content: '';
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-left: 6px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive styles for output panel */
@media (max-width: 768px) {
    .input-header-actions {
        flex-direction: row;
        width: auto;
    }

    .btn-run {
        font-size: 0.8rem;
        padding: 6px 12px;
    }

    .output-header {
        padding: 10px 15px;
    }

    .output-content {
        padding: 12px 15px;
        font-size: 0.8rem;
        max-height: 250px;
    }

    .preview-frame {
        min-height: 250px;
        max-height: 400px;
    }
}

@media (max-width: 600px) {
    .btn-run svg {
        display: none;
    }

    .btn-run {
        padding: 6px 12px;
        font-size: 0.75rem;
    }

    .btn-reset {
        padding: 6px 12px;
        font-size: 0.75rem;
    }
}