:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #e0e7ff;
    --primary-subtle: #eef2ff;
    --secondary: #1e293b;
    --bg: #f8fafc;
    --surface: #ffffff;
    --surface-hover: #f1f5f9;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --text: #0f172a;
    --text-secondary: #475569;
    --text-light: #64748b;
    --text-muted: #94a3b8;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --card-bg: #ffffff;
    --sidebar-width: 270px;
    --header-height: 60px;
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

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

html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    display: flex;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: var(--primary); color: white; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.sidebar {
    width: var(--sidebar-width);
    background: var(--secondary);
    color: #fff;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: transform var(--transition);
    box-shadow: 2px 0 12px rgba(0,0,0,0.08);
}

.sidebar-header {
    padding: 28px 24px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    gap: 14px;
}

.sidebar-logo svg { display: block; border-radius: 10px; }

.sidebar-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.3;
}

.sidebar-header p {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.4);
    letter-spacing: 0.03em;
    text-transform: uppercase;
    font-weight: 500;
    margin-top: 2px;
}

.sidebar nav { flex: 1; padding: 20px 0; }

.sidebar-search {
    padding: 16px 20px;
    position: relative;
}

#search-input {
    width: 100%;
    padding: 10px 14px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    color: white;
    font-size: 0.875rem;
    font-family: inherit;
    outline: none;
    transition: all 0.2s ease;
}

#search-input::placeholder {
    color: rgba(255,255,255,0.4);
}

#search-input:focus {
    background: rgba(255,255,255,0.12);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.search-results {
    position: absolute;
    top: 100%;
    left: 20px;
    right: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.search-results.active {
    display: block;
}

.search-result-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-light);
    transition: background 0.15s ease;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: var(--surface-hover);
}

.search-result-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.search-result-subject {
    font-size: 0.75rem;
    color: var(--text-light);
}

.search-result-type {
    display: inline-block;
    padding: 2px 8px;
    background: var(--primary-subtle);
    color: var(--primary);
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 8px;
    text-transform: uppercase;
}

.search-no-results {
    padding: 20px;
    text-align: center;
    color: var(--text-light);
    font-size: 0.875rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    color: rgba(255,255,255,0.55);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    border-left: 3px solid transparent;
    text-decoration: none !important;
    letter-spacing: -0.01em;
    margin: 2px 0;
}

.nav-item:hover {
    background: rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.9);
}

.nav-item.active {
    background: rgba(99,102,241,0.15);
    color: #fff;
    border-left-color: var(--primary);
    font-weight: 600;
}

.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 0.6;
}

.nav-item.active .nav-icon { opacity: 1; }
.nav-item:hover .nav-icon { opacity: 0.85; }

.sidebar-footer {
    padding: 20px 24px;
    border-top: 1px solid rgba(255,255,255,0.06);
    font-size: 0.72rem;
    color: rgba(255,255,255,0.25);
    text-align: center;
    letter-spacing: 0.04em;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.reset-progress-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    color: rgba(255,255,255,0.5);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.reset-progress-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: rgba(239, 68, 68, 0.8);
}

.reset-progress-btn svg {
    flex-shrink: 0;
}

.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--secondary);
    color: #fff;
    z-index: 99;
    align-items: center;
    padding: 0 16px;
    gap: 12px;
}

.mobile-header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mobile-header-logo h2 {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.menu-toggle {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-toggle:hover { background: rgba(255,255,255,0.08); }

.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    z-index: 99;
}

.content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    padding: 48px;
    max-width: 1120px;
    width: 100%;
}

.hero {
    text-align: center;
    padding: 80px 20px 60px;
    margin-bottom: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: var(--radius-lg);
    color: white;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><defs><pattern id="grid" width="40" height="40" patternUnits="userSpaceOnUse"><path d="M 40 0 L 0 0 0 40" fill="none" stroke="rgba(255,255,255,0.05)" stroke-width="1"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.3;
}

.hero > * {
    position: relative;
    z-index: 1;
}

.hero-badge {
    display: inline-block;
    padding: 8px 20px;
    background: rgba(255,255,255,0.2);
    color: white;
    border-radius: 24px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 24px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    backdrop-filter: blur(10px);
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    color: white;
    margin-bottom: 16px;
    line-height: 1.1;
    text-shadow: 0 2px 20px rgba(0,0,0,0.1);
}

.hero h2 {
    font-size: 1.4rem;
    color: rgba(255,255,255,0.95);
    font-weight: 500;
    margin-bottom: 20px;
    letter-spacing: -0.01em;
}

.hero p {
    color: rgba(255,255,255,0.85);
    font-size: 1rem;
    max-width: 650px;
    margin: 0 auto 10px;
    line-height: 1.7;
}

.hero .subtitle {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.7);
    font-style: italic;
}

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

.sem-tab {
    padding: 14px 28px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
}

.sem-tab:hover {
    border-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

.sem-tab.active {
    background: linear-gradient(135deg, var(--primary), #a855f7);
    color: white;
    border-color: transparent;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
    transform: translateY(-2px);
}

.coming-soon {
    text-align: center;
    padding: 100px 20px;
}

.coming-soon-content {
    max-width: 420px;
    margin: 0 auto;
}

.coming-soon-content svg {
    color: var(--text-muted);
    margin-bottom: 24px;
}

.coming-soon-content h3 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--secondary);
    letter-spacing: -0.02em;
}

.coming-soon-content p {
    color: var(--text-light);
    line-height: 1.7;
    font-size: 0.95rem;
}

.subjects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 24px;
    padding-bottom: 60px;
}

.subject-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 32px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border-light);
    position: relative;
    overflow: hidden;
}

.subject-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), #a855f7);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.subject-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px -12px rgba(99, 102, 241, 0.25);
    border-color: var(--primary-light);
}

.subject-card:hover::before { opacity: 1; }

.subject-card .card-icon {
    width: 52px;
    height: 52px;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary-subtle), var(--primary-light));
    border-radius: 14px;
    color: var(--primary);
    margin-bottom: 20px;
    display: block;
    transition: all 0.3s ease;
}

.subject-card:hover .card-icon {
    transform: scale(1.05);
    background: linear-gradient(135deg, var(--primary-light), #ddd6fe);
}

.subject-card h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--secondary);
    letter-spacing: -0.02em;
}

.subject-card .card-desc {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 20px;
    line-height: 1.7;
}

.subject-card .card-meta {
    display: flex;
    gap: 16px;
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 16px;
}

.card-progress {
    margin-top: auto;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

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

.progress-text {
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 500;
}

/* Progress tracker states */
.lesson-item.completed {
    opacity: 0.7;
}

.lesson-item.completed .lesson-info h4 {
    text-decoration: line-through;
    color: var(--text-light);
}

.lesson-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary);
    flex-shrink: 0;
}

.lesson-content-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.subject-card .card-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.meta-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    display: inline-block;
}

.subject-header { margin-bottom: 28px; }

.subject-header h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
    line-height: 1.2;
}

.subject-header p {
    color: var(--text-light);
    font-size: 0.92rem;
    line-height: 1.5;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 16px;
    transition: all var(--transition);
    font-family: inherit;
}

.back-btn:hover {
    background: var(--surface-hover);
    border-color: var(--text-muted);
    color: var(--text);
}

.back-btn svg { flex-shrink: 0; }

.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
}

.tab {
    padding: 10px 20px;
    background: none;
    border: none;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-light);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all var(--transition);
    font-family: inherit;
    letter-spacing: -0.01em;
}

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

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

.lessons-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 48px;
}

.lesson-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
}

.lesson-item:hover {
    border-color: var(--primary-light);
    background: var(--primary-subtle);
    box-shadow: var(--shadow-sm);
    transform: translateX(4px);
}

.lesson-number {
    width: 32px;
    height: 32px;
    background: var(--primary-subtle);
    color: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.lesson-item:hover .lesson-number { background: var(--primary); color: white; }

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

.lesson-info h4 {
    font-size: 0.92rem;
    font-weight: 600;
    margin-bottom: 2px;
    color: var(--text);
}

.lesson-info p {
    font-size: 0.8rem;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lesson-arrow {
    color: var(--text-muted);
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    transition: transform var(--transition);
}

.lesson-item:hover .lesson-arrow {
    color: var(--primary);
    transform: translateX(2px);
}

.lesson-content {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    padding: 48px;
    box-shadow: var(--shadow);
    max-width: 100%;
    overflow-wrap: break-word;
}

.lesson-content h1 { font-size: 2rem; font-weight: 800; margin-bottom: 8px; letter-spacing: -0.02em; line-height: 1.2; }
.lesson-content h2 { font-size: 1.45rem; font-weight: 700; margin: 36px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); letter-spacing: -0.02em; line-height: 1.3; }
.lesson-content h3 { font-size: 1.2rem; font-weight: 600; margin: 28px 0 8px; line-height: 1.4; }
.lesson-content h4 { font-size: 1.05rem; font-weight: 600; margin: 24px 0 6px; line-height: 1.4; }
.lesson-content p { margin-bottom: 14px; color: var(--text-secondary); line-height: 1.7; }
.lesson-content ul, .lesson-content ol { margin: 8px 0 14px 24px; }
.lesson-content li { margin-bottom: 4px; color: var(--text-secondary); line-height: 1.6; }
.lesson-content blockquote {
    border-left: 4px solid var(--primary);
    padding: 16px 24px;
    margin: 20px 0;
    background: linear-gradient(135deg, var(--primary-subtle), #faf5ff);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--primary-dark);
}
.lesson-content blockquote p:last-child { margin-bottom: 0; }
.lesson-content blockquote p { color: var(--primary-dark); }

.lesson-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 0.88rem;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.lesson-content th {
    background: var(--secondary);
    color: #fff;
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 0.82rem;
    letter-spacing: 0.02em;
}

.lesson-content td {
    padding: 10px 14px;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.lesson-content tr:nth-child(even) { background: var(--bg); }
.lesson-content tr:hover { background: var(--primary-subtle); }

.lesson-content pre {
    background: #0f172a;
    color: #e2e8f0;
    padding: 24px;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 20px 0;
    font-size: 0.85rem;
    line-height: 1.7;
    font-family: var(--font-mono);
}

.lesson-content code {
    background: var(--primary-subtle);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.88em;
    color: #dc2626;
    font-family: var(--font-mono);
}

.lesson-content pre code {
    background: none;
    padding: 0;
    color: inherit;
    font-size: inherit;
}

.lesson-content hr { border: none; border-top: 1px solid var(--border); margin: 28px 0; }
.lesson-content strong { color: var(--secondary); font-weight: 700; }
.lesson-content img, .lesson-content svg { max-width: 100%; margin: 20px 0; border-radius: var(--radius-sm); }

.loading {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 0 auto 16px;
}

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

.error-state {
    text-align: center;
    padding: 60px 20px;
}

.error-icon {
    width: 48px;
    height: 48px;
    color: var(--danger);
    margin: 0 auto 16px;
    display: block;
}

.error-state p { color: var(--text-light); margin-bottom: 4px; }
.error-state small { color: var(--text-muted); font-size: 0.8rem; }

.nav-divider {
    height: 1px;
    background: rgba(255,255,255,0.08);
    margin: 8px 16px;
}

.playground-header { margin-bottom: 24px; }

.playground-header h1 {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}

.playground-header p {
    color: var(--text-light);
    font-size: 0.9rem;
}

.playground-layout {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.playground-editor-panel,
.playground-output-panel {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.playground-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.playground-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-light);
    letter-spacing: 0.02em;
}

.playground-toolbar-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.playground-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition);
    font-family: inherit;
}

.playground-btn:hover {
    background: var(--surface-hover);
    border-color: var(--text-muted);
}

.playground-btn-primary {
    background: linear-gradient(135deg, var(--primary), #a855f7);
    color: white;
    border-color: transparent;
}

.playground-btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), #9333ea);
    border-color: transparent;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.playground-editor {
    flex: 1;
    width: 100%;
    padding: 16px;
    border: none;
    outline: none;
    resize: vertical;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.6;
    background: #1e293b;
    color: #e2e8f0;
    tab-size: 4;
    min-height: 300px;
    max-height: 600px;
}

.playground-editor::placeholder { color: #64748b; }

.playground-output {
    flex: 1;
    padding: 16px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.6;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text);
    min-height: 200px;
    max-height: 600px;
}

.playground-output-placeholder {
    color: var(--text-muted);
    font-style: italic;
    font-family: var(--font-sans);
}

.playground-output .output-stdout { color: var(--text); }
.playground-output .output-stderr { color: var(--danger); }
.playground-output .output-success { color: var(--success); }

.sql-result-table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 0.85rem;
}

.sql-result-table th {
    background: var(--primary-subtle);
    color: var(--primary);
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--primary-light);
}

.sql-result-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text);
}

.sql-result-table tr:hover {
    background: var(--surface-hover);
}

.sql-result-table em {
    color: var(--text-muted);
    font-style: italic;
}

.sql-result-info {
    margin-top: 8px;
    padding: 8px 12px;
    background: var(--primary-subtle);
    color: var(--primary);
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    display: inline-block;
}

.playground-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 8px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--text-light);
    flex-shrink: 0;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    flex-shrink: 0;
}

.status-dot.loading { background: var(--warning); animation: pulse 1s infinite; }
.status-dot.error { background: var(--danger); }

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

/* ====== Quiz & Flashcards ====== */
.quiz-subjects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; margin-top: 24px; }

.quiz-modes { display: flex; gap: 24px; margin-top: 24px; flex-wrap: wrap; }
.quiz-mode-btn {
    flex: 1; min-width: 220px; background: var(--card-bg); border: 2px solid var(--border); border-radius: 16px; padding: 32px 24px;
    text-align: center; cursor: pointer; transition: all 0.25s ease;
}
.quiz-mode-btn:hover { border-color: var(--primary); transform: translateY(-4px); box-shadow: var(--shadow); }
.quiz-mode-btn svg { color: var(--primary); margin-bottom: 12px; }
.quiz-mode-btn h3 { font-size: 1.2rem; font-weight: 700; margin-bottom: 8px; }
.quiz-mode-btn p { font-size: 0.9rem; color: var(--text-secondary); margin: 0; }

.flashcard-wrapper { max-width: 600px; margin: 24px auto; }
.flashcard { perspective: 1000px; cursor: pointer; height: 320px; margin-bottom: 20px; }
.flashcard-inner { position: relative; width: 100%; height: 100%; transition: transform 0.6s; transform-style: preserve-3d; }
.flashcard.flipped .flashcard-inner { transform: rotateY(180deg); }
.flashcard-front, .flashcard-back {
    position: absolute; width: 100%; height: 100%; backface-visibility: hidden;
    border-radius: 16px; padding: 32px; display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow); border: 1px solid var(--border);
}
.flashcard-front { background: var(--card-bg); }
.flashcard-back { background: var(--primary); color: white; transform: rotateY(180deg); }
.flashcard-front p, .flashcard-back p { font-size: 1.1rem; line-height: 1.7; text-align: center; margin: 0; }
.flashcard-back p { color: white; }
.flashcard-controls { display: flex; justify-content: center; gap: 16px; align-items: center; }
.flashcard-controls span { font-weight: 600; color: var(--text-secondary); min-width: 80px; text-align: center; }

.quiz-wrapper { max-width: 650px; margin: 24px auto 0; }
.quiz-progress { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.quiz-progress-bar { flex: 1; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.quiz-progress-fill { height: 100%; background: var(--primary); border-radius: 4px; transition: width 0.4s ease; }
.quiz-progress span { font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); white-space: nowrap; }
.quiz-question { margin-bottom: 24px; }
.quiz-question h3 { font-size: 1.2rem; line-height: 1.6; }
.quiz-options { display: flex; flex-direction: column; gap: 12px; }
.quiz-option {
    background: var(--card-bg); border: 2px solid var(--border); border-radius: 12px; padding: 14px 20px;
    text-align: left; font-size: 0.95rem; cursor: pointer; transition: all 0.2s ease; font-weight: 500;
}
.quiz-option:hover:not(:disabled) { border-color: var(--primary); background: var(--primary-light, rgba(99,102,241,0.05)); }
.quiz-option.correct { border-color: #10b981; background: rgba(16,185,129,0.1); color: #10b981; }
.quiz-option.wrong { border-color: #ef4444; background: rgba(239,68,68,0.1); color: #ef4444; }
.quiz-option:disabled { cursor: default; opacity: 0.8; }
.quiz-feedback { padding: 16px 20px; border-radius: 12px; font-weight: 600; margin-top: 16px; }
.quiz-feedback.correct { background: rgba(16,185,129,0.1); color: #10b981; border: 1px solid rgba(16,185,129,0.3); }
.quiz-feedback.wrong { background: rgba(239,68,68,0.1); color: #ef4444; border: 1px solid rgba(239,68,68,0.3); }

.quiz-results-card { max-width: 450px; margin: 40px auto 0; text-align: center; padding: 48px 32px; background: var(--card-bg); border-radius: 20px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.quiz-results-card h2 { font-size: 1.6rem; margin-bottom: 24px; }
.quiz-score-circle { width: 140px; height: 140px; border-radius: 50%; margin: 0 auto 20px; display: flex; align-items: center; justify-content: center; background: conic-gradient(var(--primary) 0%, #e5e7eb 0%); }
.quiz-score-circle span { font-size: 2rem; font-weight: 800; color: var(--text); }
.quiz-results-card p { font-size: 1.1rem; color: var(--text-secondary); margin-bottom: 24px; }
.quiz-results-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ====== Terminal Simulator ====== */
.terminal-container {
    background: #1a1b26;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    border: 1px solid #2a2b3e;
}

.terminal-toolbar {
    background: #2a2b3e;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.terminal-dot { width: 12px; height: 12px; border-radius: 50%; }
.terminal-dot.red { background: #ff5f56; }
.terminal-dot.yellow { background: #ffbd2e; }
.terminal-dot.green { background: #27c93f; }

.terminal-label {
    margin-left: 12px;
    color: #a9b1d6;
    font-size: 0.85rem;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

.terminal-output {
    padding: 20px;
    min-height: 360px;
    max-height: 500px;
    overflow-y: auto;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #c0caf5;
    background: #1a1b26;
}

.terminal-output::-webkit-scrollbar { width: 6px; }
.terminal-output::-webkit-scrollbar-track { background: #1a1b26; }
.terminal-output::-webkit-scrollbar-thumb { background: #3b3d54; border-radius: 3px; }

.terminal-line { white-space: pre-wrap; word-break: break-all; margin-bottom: 2px; }
.terminal-line.output { color: #c0caf5; }
.terminal-line.error { color: #f7768e; }
.terminal-line.success { color: #9ece6a; }
.terminal-line.info { color: #7dcfff; }
.terminal-line.warning { color: #e0af68; }
.terminal-line.prompt { color: #bb9af7; }
.terminal-line.command { color: #7aa2f7; }
.terminal-line.system { color: #565f89; font-style: italic; }

.terminal-input-line {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    background: #1a1b26;
    border-top: 1px solid #2a2b3e;
    gap: 8px;
}

.terminal-prompt {
    color: #9ece6a;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.9rem;
    font-weight: bold;
    flex-shrink: 0;
}

.terminal-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #c0caf5;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.9rem;
    caret-color: #c0caf5;
    padding: 0;
}

.terminal-input::placeholder { color: #3b3d54; }

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .overlay.show { display: block; }
    .mobile-header { display: flex; }

    .content {
        margin-left: 0;
        padding: 20px 16px;
        padding-top: calc(var(--header-height) + 16px);
    }

    .hero { padding: 32px 12px 24px; }
    .hero h1 { font-size: 1.75rem; }
    .hero h2 { font-size: 1rem; }

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

    .lesson-content { padding: 20px; }
    .lesson-content table { font-size: 0.76rem; display: block; overflow-x: auto; }
    .lesson-content pre { padding: 16px; font-size: 0.78rem; }
    .lesson-content h1 { font-size: 1.5rem; }
    .lesson-content h2 { font-size: 1.2rem; }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .content { padding: 32px 24px; }
    .subjects-grid { grid-template-columns: repeat(2, 1fr); }
}

@media print {
    .sidebar, .mobile-header, .overlay, .back-btn, .tabs { display: none !important; }
    .content { margin-left: 0; padding: 20px; }
    .lesson-content { box-shadow: none; border: 1px solid #ddd; padding: 24px; }
}
