/* ===== CSS Variables / Theme — ccunpacked.dev inspired ====== */
:root {
    --bg-primary: #0d0d0d;
    --bg-secondary: #141414;
    --bg-tertiary: #1a1a1a;
    --bg-card: #161616;
    --bg-hover: #1f1f1f;
    --text-primary: #e8e4df;
    --text-secondary: #b0a99f;
    --text-muted: #8a8580;
    --accent: #d4a853;
    --accent-hover: #e0ba6e;
    --accent-dim: rgba(212, 168, 83, 0.10);
    --accent-secondary: #c17b5e;
    --success: #6ba368;
    --success-dim: rgba(107, 163, 104, 0.12);
    --warning: #d4a853;
    --warning-dim: rgba(212, 168, 83, 0.10);
    --danger: #c17b5e;
    --danger-dim: rgba(193, 123, 94, 0.12);
    --code-color: #7b9eb8;
    --border: #2a2520;
    --border-light: #332e28;
    --sidebar-width: 300px;
    --topbar-height: 56px;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.2);
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    --font-heading: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-body: 'Source Serif 4', Georgia, 'Times New Roman', serif;
    --transition: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

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

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

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

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}

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

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
}

/* ===== Top Bar ===== */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 20px;
    z-index: 1000;
    gap: 16px;
}

.sidebar-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.sidebar-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-muted);
    border-radius: 1px;
    transition: var(--transition);
}

.logo {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent);
    white-space: nowrap;
    letter-spacing: -0.025em;
}

.top-bar-actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    white-space: nowrap;
    font-family: var(--font-heading);
    letter-spacing: 0.01em;
}

.btn-primary {
    background: var(--accent);
    color: #0d0d0d;
}

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

.btn-outline {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-light);
}

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

.btn-success {
    background: var(--success);
    color: #0d0d0d;
}

.btn-success:hover {
    background: #7bb878;
}

.btn-success.completed {
    background: var(--success-dim);
    color: var(--success);
    cursor: default;
}

.btn-lg {
    padding: 12px 32px;
    font-size: 1rem;
}

/* ===== Sidebar ===== */
.sidebar {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    z-index: 900;
    transition: transform 0.3s ease;
}

.sidebar-nav {
    padding: 12px 0;
}

.nav-section {
    margin-bottom: 4px;
}

.nav-section-header {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
    user-select: none;
    transition: var(--transition);
}

.nav-section-header:hover {
    color: var(--accent);
}

.nav-section-header .chevron {
    margin-left: auto;
    transition: transform 0.2s ease;
    font-size: 0.65rem;
}

.nav-section-header.expanded .chevron {
    transform: rotate(90deg);
}

.nav-section-items {
    display: none;
    padding-bottom: 4px;
}

.nav-section-items.visible {
    display: block;
}

.nav-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px 6px;
    margin-top: 4px;
}

.nav-divider::before,
.nav-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-light);
}

.nav-divider span {
    font-family: var(--font-heading);
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    white-space: nowrap;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 8px 16px 8px 28px;
    font-family: var(--font-heading);
    font-size: 0.82rem;
    font-weight: 400;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    gap: 8px;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-dim);
    color: var(--accent);
    border-left-color: var(--accent);
}

.nav-item .check-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    border-radius: 50%;
    border: 1.5px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.55rem;
}

.nav-item.completed .check-icon {
    background: var(--success);
    border-color: var(--success);
    color: #0d0d0d;
}

.nav-item .nav-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 899;
}

/* ===== Main Content ===== */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    padding: 32px;
    min-height: calc(100vh - var(--topbar-height));
}

/* ===== Welcome Page ===== */
.welcome-hero {
    text-align: center;
    padding: 48px 0 32px;
}

.welcome-hero h2 {
    font-family: var(--font-heading);
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--accent);
    letter-spacing: -0.025em;
}

.welcome-subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 640px;
    margin: 0 auto 32px;
    line-height: 1.7;
}

.welcome-stats {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 28px;
    text-align: center;
    min-width: 120px;
}

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

.stat-label {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ===== Progress Overview ===== */
.progress-overview {
    margin: 40px 0;
}

.progress-overview h3 {
    font-size: 1.2rem;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.progress-chart {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.progress-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-row-label {
    font-family: var(--font-heading);
    font-size: 0.78rem;
    color: var(--text-muted);
    width: 200px;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.progress-bar-container {
    flex: 1;
    height: 22px;
    background: var(--bg-tertiary);
    border-radius: 11px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border);
}

.progress-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 11px;
    transition: width 0.5s ease;
    min-width: 0;
}

.progress-bar-text {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--font-heading);
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* ===== Section Cards ===== */
.section-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 32px;
}

.section-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.section-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent);
    opacity: 0;
    transition: var(--transition);
}

.section-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

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

.section-card-number {
    font-family: var(--font-heading);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 8px;
}

.section-card h4 {
    font-size: 1.05rem;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.section-card p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.section-card-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-heading);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.section-card-progress .mini-bar {
    flex: 1;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
}

.section-card-progress .mini-bar-fill {
    height: 100%;
    background: var(--success);
    border-radius: 2px;
    transition: width 0.5s ease;
}

/* ===== Lesson Page ===== */
.lesson-breadcrumb {
    font-family: var(--font-heading);
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.lesson-breadcrumb span {
    color: var(--accent);
    cursor: pointer;
}

.lesson-breadcrumb span:hover {
    text-decoration: underline;
}

.lesson-content {
    max-width: 860px;
}

.lesson-content h2 {
    font-family: var(--font-heading);
    font-size: 1.9rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
    letter-spacing: -0.025em;
}

.lesson-content .lesson-section-tag {
    display: inline-block;
    font-family: var(--font-heading);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-dim);
    padding: 3px 10px;
    border-radius: 4px;
    margin-bottom: 20px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.lesson-content h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 600;
    margin: 36px 0 12px;
    color: var(--text-primary);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.lesson-content h4 {
    font-family: var(--font-heading);
    font-size: 1.02rem;
    font-weight: 600;
    margin: 24px 0 8px;
    color: var(--text-primary);
}

.lesson-content p {
    margin-bottom: 16px;
    color: var(--text-secondary);
    line-height: 1.8;
}

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

.lesson-content ul, .lesson-content ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

.lesson-content li {
    margin-bottom: 8px;
    color: var(--text-secondary);
    line-height: 1.7;
}

.lesson-content code {
    font-family: var(--font-mono);
    background: var(--bg-tertiary);
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 0.88em;
    color: var(--code-color);
    border: 1px solid var(--border);
}

.lesson-content pre {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    overflow-x: auto;
    margin-bottom: 20px;
    line-height: 1.55;
}

.lesson-content pre code {
    background: none;
    padding: 0;
    font-size: 0.84rem;
    color: var(--text-primary);
    border: none;
}

/* ===== Highlight.js Syntax Color Overrides ===== */
.lesson-content pre code.hljs {
    background: var(--bg-tertiary);
    padding: 0;
}

.hljs-keyword,
.hljs-built_in,
.hljs-type,
.hljs-literal,
.hljs-selector-tag {
    color: #c17b5e;
}

.hljs-string,
.hljs-doctag,
.hljs-regexp {
    color: #6ba368;
}

.hljs-comment,
.hljs-quote {
    color: var(--text-muted);
    font-style: italic;
}

.hljs-title,
.hljs-title.function_,
.hljs-section {
    color: #d4a853;
}

.hljs-number,
.hljs-selector-class {
    color: #b48ead;
}

.hljs-variable,
.hljs-template-variable,
.hljs-attr {
    color: #7b9eb8;
}

.hljs-params {
    color: var(--text-primary);
}

.hljs-meta,
.hljs-meta .hljs-keyword {
    color: var(--text-muted);
}

.hljs-symbol,
.hljs-bullet {
    color: #d4a853;
}

.hljs-name,
.hljs-tag {
    color: #c17b5e;
}

.hljs-attribute {
    color: #7b9eb8;
}

.hljs-operator,
.hljs-punctuation {
    color: var(--text-secondary);
}

.info-box {
    background: var(--accent-dim);
    border-left: 4px solid var(--accent);
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: 16px 20px;
    margin-bottom: 20px;
}

.info-box p {
    color: var(--text-primary);
    margin-bottom: 0;
}

.info-box .info-title {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 4px;
    display: block;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.warning-box {
    background: var(--danger-dim);
    border-left: 4px solid var(--accent-secondary);
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: 16px 20px;
    margin-bottom: 20px;
}

.warning-box p {
    color: var(--text-primary);
    margin-bottom: 0;
}

.warning-box .warning-title {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--accent-secondary);
    margin-bottom: 4px;
    display: block;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.practice-problems {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    margin: 24px 0;
}

.practice-problems h4 {
    font-family: var(--font-heading);
    margin: 0 0 12px;
    color: var(--accent);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.practice-problems ul {
    list-style: none;
    padding: 0;
}

.practice-problems li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-family: var(--font-heading);
    font-size: 0.88rem;
}

.practice-problems li:last-child {
    border-bottom: none;
}

.practice-problems a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.practice-problems a:hover {
    text-decoration: underline;
    color: var(--accent-hover);
}

.difficulty-easy {
    display: inline-block;
    font-family: var(--font-heading);
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--success);
    background: var(--success-dim);
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 8px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.difficulty-medium {
    display: inline-block;
    font-family: var(--font-heading);
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-dim);
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 8px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.difficulty-hard {
    display: inline-block;
    font-family: var(--font-heading);
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--accent-secondary);
    background: var(--danger-dim);
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 8px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.practice-problems li {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pp-check {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-light);
    border-radius: 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
    font-size: 0.55rem;
    color: transparent;
}

.pp-check:hover {
    border-color: var(--success);
}

.practice-problems li.completed .pp-check {
    background: var(--success);
    border-color: var(--success);
    color: #0d0d0d;
}

.practice-problems li.completed a {
    color: var(--text-muted);
}

.pp-progress {
    font-family: var(--font-heading);
    font-size: 0.7rem;
    font-weight: 400;
    color: var(--text-muted);
    text-transform: none;
    letter-spacing: 0;
}

.progress-pp-line {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-family: var(--font-heading);
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.progress-pp-line .pp-icon {
    color: var(--success);
    font-size: 0.7rem;
}

.lesson-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    gap: 12px;
}

/* ===== Flashcard Modal ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 24px;
}

.modal-overlay.visible {
    display: flex;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    box-shadow: var(--shadow);
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.flashcard-modal {
    max-width: 640px;
}

.progress-modal {
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text-primary);
}

.flashcard-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    gap: 12px;
}

.select-input {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    flex: 1;
    font-family: var(--font-heading);
}

.flashcard-counter {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
}

.flashcard-container {
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.flashcard {
    width: 100%;
    max-width: 540px;
    height: 260px;
    perspective: 1000px;
    cursor: pointer;
}

.flashcard-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.5s ease;
    transform-style: preserve-3d;
}

.flashcard.flipped .flashcard-inner {
    transform: rotateY(180deg);
}

.flashcard-front, .flashcard-back {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    border-radius: var(--radius-lg);
    text-align: center;
    font-size: 1rem;
    line-height: 1.6;
}

.flashcard-front {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-family: var(--font-body);
}

.flashcard-back {
    background: var(--accent-dim);
    border: 1px solid var(--accent);
    color: var(--text-primary);
    transform: rotateY(180deg);
    font-family: var(--font-body);
}

.flashcard-hint {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.flashcard-nav {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 16px 24px 24px;
}

/* ===== SRS Rating Buttons ===== */
.srs-rating {
    gap: 8px;
}

.btn-srs {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 18px 8px;
    border-radius: var(--radius);
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    min-width: 72px;
}

.btn-srs .srs-interval {
    font-size: 0.65rem;
    font-weight: 400;
    opacity: 0.8;
    margin-top: 2px;
}

.btn-srs-again {
    background: var(--danger-dim);
    color: var(--accent-secondary);
    border: 1px solid rgba(193, 123, 94, 0.3);
}

.btn-srs-again:hover {
    background: rgba(193, 123, 94, 0.25);
}

.btn-srs-hard {
    background: var(--warning-dim);
    color: var(--accent);
    border: 1px solid rgba(212, 168, 83, 0.3);
}

.btn-srs-hard:hover {
    background: rgba(212, 168, 83, 0.2);
}

.btn-srs-good {
    background: var(--success-dim);
    color: var(--success);
    border: 1px solid rgba(107, 163, 104, 0.3);
}

.btn-srs-good:hover {
    background: rgba(107, 163, 104, 0.25);
}

.btn-srs-easy {
    background: rgba(123, 158, 184, 0.12);
    color: var(--code-color);
    border: 1px solid rgba(123, 158, 184, 0.3);
}

.btn-srs-easy:hover {
    background: rgba(123, 158, 184, 0.2);
}

.srs-due-badge {
    display: inline-block;
    background: var(--accent-secondary);
    color: #0d0d0d;
    font-family: var(--font-heading);
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 8px;
    margin-left: 6px;
    vertical-align: middle;
}

/* ===== Progress Dashboard ===== */
.progress-dashboard {
    padding: 24px;
}

.progress-section-group {
    margin-bottom: 24px;
}

.progress-section-title {
    font-family: var(--font-heading);
    font-size: 0.92rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.progress-subsection-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 8px;
}

.progress-subsection-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    font-family: var(--font-heading);
    font-size: 0.82rem;
    color: var(--text-muted);
}

.progress-subsection-item.completed {
    color: var(--success);
}

.progress-subsection-item .check {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1.5px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    flex-shrink: 0;
}

.progress-subsection-item.completed .check {
    background: var(--success);
    border-color: var(--success);
    color: #0d0d0d;
}

.progress-overall {
    margin-bottom: 32px;
    text-align: center;
}

.progress-overall-ring {
    width: 140px;
    height: 140px;
    margin: 0 auto 16px;
    position: relative;
}

.progress-overall-ring svg {
    transform: rotate(-90deg);
}

.progress-overall-ring .ring-bg {
    fill: none;
    stroke: var(--bg-tertiary);
    stroke-width: 10;
}

.progress-overall-ring .ring-fill {
    fill: none;
    stroke: var(--accent);
    stroke-width: 10;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.8s ease;
}

.progress-overall-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent);
}

.progress-overall h4 {
    font-size: 1rem;
    color: var(--text-muted);
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.visible {
        display: block;
    }

    .sidebar-toggle {
        display: flex;
    }

    .main-content {
        margin-left: 0;
        padding: 24px 16px;
    }

    .welcome-hero h2 {
        font-size: 1.8rem;
    }

    .welcome-stats {
        gap: 12px;
    }

    .stat-card {
        padding: 14px 18px;
        min-width: 80px;
    }

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

    .section-cards {
        grid-template-columns: 1fr;
    }

    .lesson-footer {
        flex-wrap: wrap;
    }

    .lesson-content h2 {
        font-size: 1.4rem;
    }

    .top-bar-actions {
        gap: 4px;
    }

    .top-bar-actions .btn {
        padding: 8px 10px;
        font-size: 0.78rem;
    }

    .progress-row-label {
        width: 120px;
        font-size: 0.68rem;
    }
}

@media (max-width: 480px) {
    .flashcard {
        height: 220px;
    }

    .flashcard-front, .flashcard-back {
        padding: 20px;
        font-size: 0.9rem;
    }

    .progress-subsection-list {
        grid-template-columns: 1fr;
    }
}

/* ===== Auth UI ===== */
.auth-container {
    display: flex;
    align-items: center;
    position: relative;
    gap: 8px;
}

.auth-signin-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius);
    font-family: var(--font-heading);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border-light);
    background: transparent;
    color: var(--text-muted);
    transition: var(--transition);
    white-space: nowrap;
}

.auth-signin-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.auth-signin-btn svg {
    flex-shrink: 0;
}

.auth-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--border-light);
    cursor: pointer;
    transition: var(--transition);
    object-fit: cover;
}

.auth-avatar:hover {
    border-color: var(--accent);
}

.auth-avatar-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    color: var(--accent);
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 700;
    user-select: none;
}

.auth-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    min-width: 200px;
    z-index: 1100;
    overflow: hidden;
    animation: modalIn 0.15s ease;
}

.auth-dropdown.visible {
    display: block;
}

.auth-dropdown-info {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.auth-dropdown-name {
    font-family: var(--font-heading);
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.auth-dropdown-email {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    color: var(--text-muted);
    word-break: break-all;
}

.auth-dropdown-signout {
    display: block;
    width: 100%;
    padding: 10px 16px;
    background: none;
    border: none;
    font-family: var(--font-heading);
    font-size: 0.82rem;
    color: var(--text-muted);
    cursor: pointer;
    text-align: left;
    transition: var(--transition);
}

.auth-dropdown-signout:hover {
    background: var(--bg-hover);
    color: var(--accent-secondary);
}

.sync-status {
    font-family: var(--font-heading);
    font-size: 0.68rem;
    color: var(--text-muted);
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.sync-status.visible {
    opacity: 1;
}

@media (max-width: 900px) {
    .auth-signin-btn span {
        display: none;
    }

    .auth-signin-btn {
        padding: 6px 8px;
    }

    .auth-avatar {
        width: 28px;
        height: 28px;
    }

    .auth-dropdown {
        right: -8px;
    }

    .sync-status {
        display: none;
    }
}

/* ===== Utility ===== */
.hidden {
    display: none !important;
}

/* ===== Table Styles ===== */
.lesson-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.lesson-content th {
    font-family: var(--font-heading);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-weight: 600;
    text-align: left;
    padding: 10px 14px;
    border: 1px solid var(--border);
    font-size: 0.85rem;
}

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

.lesson-content tr:nth-child(even) td {
    background: rgba(26, 26, 26, 0.5);
}

/* ===== Graph Diagram Container ===== */
.graph-diagram {
    margin: 20px 0;
    text-align: center;
}

.graph-diagram svg {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
}

.graph-diagram .diagram-caption {
    font-family: var(--font-heading);
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 8px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
