:root {
    --bg-primary: #111111;
    --bg-secondary: #1a1a1a;
    --bg-card: #1e1e1e;
    --bg-card-hover: #252525;
    --border-color: #2a2a2a;
    --border-subtle: #222222;
    --accent: #ff6b00;
    --accent-hover: #ff8c38;
    --accent-dim: rgba(255, 107, 0, 0.15);
    --text-primary: #f0f0f0;
    --text-secondary: #a0a0a0;
    --text-muted: #8a8a8a;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --easy: #00b8a3;
    --medium: #ffc01e;
    --hard: #ff375f;
    --sidebar-width: 64px;
    --topbar-height: 56px;
    --transition: all 0.2s ease;
    --radius: 10px;
    --radius-lg: 16px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

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

html {
    background-color: var(--bg-primary);
    color-scheme: dark;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-primary) !important;
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

.card,
.card-dark,
.stat-card {
    color: var(--text-primary);
}

.stat-num,
.big-num,
.metric-value,
.rating-num,
.rank-num,
.donut-inner {
    color: var(--text-primary);
}

.stat-lbl,
.metric-label,
.sub-label,
.rating-sub {
    color: var(--text-secondary);
}

/* ─── Left Sidebar ─── */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 0;
    z-index: 1000;
    transition: var(--transition);
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    background: var(--accent);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 1.1rem;
    color: white;
    text-decoration: none;
    margin-bottom: 20px;
    flex-shrink: 0;
    letter-spacing: -1px;
}

.sidebar-logo:hover {
    background: var(--accent-hover);
    color: white;
    text-decoration: none;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 1;
    width: 100%;
}

.sidebar-link {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 1.25rem;
    transition: var(--transition);
    position: relative;
}

.sidebar-link:hover,
.sidebar-link.active {
    background: var(--accent-dim);
    color: var(--accent);
    text-decoration: none;
}

.sidebar-link .tooltip-label {
    position: absolute;
    left: calc(100% + 12px);
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transform: translateX(-5px);
    transition: var(--transition);
    border: 1px solid var(--border-color);
    z-index: 999;
}

.sidebar-link:hover .tooltip-label {
    opacity: 1;
    transform: translateX(0);
}

.sidebar-bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding-bottom: 8px;
}

/* ─── Top Bar ─── */
.topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--topbar-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 900;
    gap: 12px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-brand {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
    text-decoration: none;
}

.topbar-brand:hover {
    color: var(--accent);
    text-decoration: none;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pill-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.pill-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    text-decoration: none;
}

.pill-btn.accent {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.pill-btn.accent:hover {
    background: var(--accent-hover);
    color: white;
}

.icon-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-size: 1rem;
}

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

.user-avatar-sm {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #ff375f);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: white;
    cursor: pointer;
    border: 2px solid var(--border-color);
    transition: var(--transition);
    text-decoration: none;
    flex-shrink: 0;
}

.user-avatar-sm:hover {
    border-color: var(--accent);
    color: white;
    text-decoration: none;
}

/* ─── Main Content ─── */
.main-wrapper {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    min-height: calc(100vh - var(--topbar-height) - 13px);
    background-color: var(--bg-primary);
}

/* ── Index Page ── */
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 1.6rem; font-weight: 800; color: var(--text-primary); }
.page-header p { color: var(--text-secondary); font-size: 0.9rem; margin-top: 4px; }

.overall-progress-bar-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 18px 22px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.progress-info { flex: 1; min-width: 180px; }
.progress-info .label { font-size: 0.82rem; color: var(--text-secondary); font-weight: 600; margin-bottom: 4px; }
.progress-info .numbers { font-size: 1.3rem; font-weight: 800; color: var(--text-primary); }
.progress-info .pct { color: var(--accent); font-size: 0.88rem; font-weight: 600; margin-top: 2px; }

.progress-track {
    flex: 2;
    min-width: 200px;
    height: 10px;
    background: var(--bg-secondary);
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #ff375f);
    border-radius: 999px;
    transition: width 0.6s ease;
}

/* Topic grid */
.topics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.topic-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 20px;
    transition: all 0.2s;
    text-decoration: none;
    display: block;
    color: var(--text-primary);
}

.topic-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255,107,0,0.1);
    text-decoration: none;
    color: var(--text-primary);
}

.topic-card-name {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.topic-card-sub {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 14px;
}

.topic-progress-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.topic-track {
    flex: 1;
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 999px;
    overflow: hidden;
}

.topic-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.5s ease;
}

.topic-fill.done   { background: var(--success); }
.topic-fill.partial { background: var(--accent); }
.topic-fill.empty  { background: var(--border-color); }

.topic-pct {
    font-size: 0.78rem;
    color: var(--text-secondary);
    min-width: 36px;
    text-align: right;
}

.topic-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.topic-action-btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.topic-action-btn.completed { border-color: var(--success); color: var(--success); }
.topic-action-btn.started { border-color: var(--accent); color: var(--accent); }

/* Moved from templates/base.html */
:root {
            --bg-primary: #111111;
            --bg-secondary: #1a1a1a;
            --bg-card: #1e1e1e;
            --bg-card-hover: #252525;
            --border-color: #2a2a2a;
            --border-subtle: #222222;
            --accent: #ff6b00;
            --accent-hover: #ff8c38;
            --accent-dim: rgba(255, 107, 0, 0.15);
            --text-primary: #f0f0f0;
            --text-secondary: #a0a0a0;
            --text-muted: #8a8a8a;
            --success: #22c55e;
            --warning: #f59e0b;
            --danger: #ef4444;
            --info: #3b82f6;
            --easy: #00b8a3;
            --medium: #ffc01e;
            --hard: #ff375f;
            --sidebar-width: 64px;
            --topbar-height: 56px;
            --transition: all 0.2s ease;
            --radius: 10px;
            --radius-lg: 16px;
            --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
        }

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

        html {
            background-color: var(--bg-primary);
            color-scheme: dark;
        }

        body {
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
            background-color: var(--bg-primary) !important;
            color: var(--text-primary);
            min-height: 100vh;
            overflow-x: hidden;
        }

        .page-load-target {
            transition: opacity 0.18s ease;
        }

        .page-load-skeleton {
            display: none;
            gap: 14px;
            margin-bottom: 20px;
        }

        .page-loading .page-load-target {
            opacity: 0;
        }

        .page-loading .page-load-skeleton {
            display: grid;
        }

        .skeleton-block,
        .skeleton-line,
        .skeleton-chip {
            position: relative;
            overflow: hidden;
            background: rgba(255, 255, 255, 0.06);
        }

        .skeleton-block::after,
        .skeleton-line::after,
        .skeleton-chip::after {
            content: "";
            position: absolute;
            inset: 0;
            transform: translateX(-100%);
            background: linear-gradient(
                90deg,
                transparent,
                rgba(255, 255, 255, 0.12),
                transparent
            );
            animation: skeleton-shimmer 1.15s linear infinite;
        }

        .skeleton-block {
            border-radius: var(--radius-lg);
            min-height: 120px;
        }

        .skeleton-line {
            border-radius: 999px;
            height: 12px;
        }

        .skeleton-chip {
            border-radius: 8px;
            height: 32px;
        }

        @keyframes skeleton-shimmer {
            100% {
                transform: translateX(100%);
            }
        }

        /* ========== ACCESSIBILITY IMPROVEMENTS ========== */

        /* Skip to main content link - for keyboard users */
        .skip-link {
            position: absolute;
            top: -40px;
            left: 0;
            background: var(--accent);
            color: white;
            padding: 8px 16px;
            z-index: 10000;
            text-decoration: none;
            font-weight: 600;
            border-radius: 0 0 8px 0;
            transition: top 0.2s ease;
        }

        .skip-link:focus {
            top: 0;
            outline: 2px solid white;
            outline-offset: 2px;
        }

        /* Focus indicators for keyboard navigation */
        :focus {
            outline: 2px solid var(--accent);
            outline-offset: 2px;
        }

        /* Remove outline for mouse users but keep for keyboard */
        :focus:not(:focus-visible) {
            outline: none;
        }

        :focus-visible {
            outline: 2px solid var(--accent);
            outline-offset: 2px;
            border-radius: 4px;
        }

        /* Better focus for interactive elements */
        button:focus-visible,
        a:focus-visible,
        input:focus-visible,
        textarea:focus-visible,
        select:focus-visible,
        [tabindex]:focus-visible {
            outline: 2px solid var(--accent);
            outline-offset: 2px;
        }

        /* High contrast mode support */
        @media (prefers-contrast: high) {
            :focus-visible {
                outline: 3px solid var(--accent);
                outline-offset: 3px;
            }
        }

        /* ─── Left Sidebar ─── */
        .sidebar {
            position: fixed;
            left: 0;
            top: 0;
            bottom: 0;
            width: var(--sidebar-width);
            background-color: var(--bg-secondary);
            border-right: 1px solid var(--border-color);
            display: flex;
            flex-direction: column;
            align-items: center;
            padding: 12px 0;
            z-index: 1000;
            transition: var(--transition);
        }

        .sidebar-logo {
            width: 40px;
            height: 40px;
            background: var(--accent);
            border-radius: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 900;
            font-size: 1.1rem;
            color: white;
            text-decoration: none;
            margin-bottom: 20px;
            flex-shrink: 0;
            letter-spacing: -1px;
        }

        .sidebar-logo:hover {
            background: var(--accent-hover);
            color: white;
            text-decoration: none;
        }

        .sidebar-nav {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 4px;
            flex: 1;
            width: 100%;
        }

        .sidebar-link {
            width: 44px;
            height: 44px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 10px;
            color: var(--text-muted);
            text-decoration: none;
            font-size: 1.25rem;
            transition: var(--transition);
            position: relative;
        }

        .sidebar-link:hover,
        .sidebar-link.active {
            background: var(--accent-dim);
            color: var(--accent);
            text-decoration: none;
        }

        .sidebar-link .tooltip-label {
            position: absolute;
            left: calc(100% + 12px);
            background: var(--bg-card);
            color: var(--text-primary);
            padding: 4px 10px;
            border-radius: 6px;
            font-size: 0.75rem;
            white-space: nowrap;
            pointer-events: none;
            opacity: 0;
            transform: translateX(-5px);
            transition: var(--transition);
            border: 1px solid var(--border-color);
            z-index: 999;
        }

        .sidebar-link:hover .tooltip-label {
            opacity: 1;
            transform: translateX(0);
        }

        .sidebar-bottom {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 8px;
            padding-bottom: 8px;
        }

        .sidebar-logout-form {
            display: flex;
        }

        .sidebar-logout-form .sidebar-link {
            border: none;
            background: transparent;
            padding: 0;
            cursor: pointer;
            font: inherit;
        }

        /* ─── Top Bar ─── */
        .topbar {
            position: fixed;
            top: 0;
            left: var(--sidebar-width);
            right: 0;
            height: var(--topbar-height);
            background: var(--bg-secondary);
            border-bottom: 1px solid var(--border-color);
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0 20px;
            z-index: 900;
            gap: 12px;
        }

        .topbar-left {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .topbar-brand {
            font-weight: 700;
            font-size: 1rem;
            color: var(--text-primary);
            text-decoration: none;
        }

        .topbar-brand:hover {
            color: var(--accent);
            text-decoration: none;
        }

        .topbar-right {
            display: flex;
            align-items: center;
            gap: 10px;
        }
        .app-modal {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.7);
            z-index: 9999;
            align-items: center;
            justify-content: center;
        }

        .app-modal.open {
            display: flex;
        }

        .app-modal__dialog {
            background: var(--bg-card);
            border: 1px solid var(--border-color);
            border-radius: 16px;
            padding: 28px;
            width: 90%;
            max-width: 480px;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
        }

        .app-modal__title {
            font-size: 1.05rem;
            font-weight: 700;
            margin-bottom: 16px;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .app-modal__textarea {
            width: 100%;
            padding: 12px;
            background: var(--bg-secondary);
            border: 1px solid var(--border-color);
            border-radius: 10px;
            color: var(--text-primary);
            font-size: 0.88rem;
            font-family: inherit;
            resize: vertical;
            min-height: 120px;
            outline: none;
        }

        .app-modal__textarea:focus {
            border-color: var(--accent);
        }

        .app-modal__actions {
            display: flex;
            justify-content: flex-end;
            gap: 10px;
            margin-top: 16px;
        }

        .ui-btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            padding: 8px 16px;
            border-radius: 9px;
            border: 1px solid var(--border-color);
            background: var(--bg-card);
            color: var(--text-secondary);
            cursor: pointer;
            transition: var(--transition);
            text-decoration: none;
            font-family: inherit;
            font-size: 0.82rem;
            font-weight: 700;
            line-height: 1.2;
            white-space: nowrap;
        }

        .ui-btn:hover {
            text-decoration: none;
            border-color: var(--accent);
            color: var(--accent);
        }

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

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

        .ui-btn-secondary {
            background: var(--bg-secondary);
            border-color: var(--border-color);
            color: var(--text-secondary);
        }

        .ui-btn-secondary:hover {
            color: var(--accent);
        }

        .ui-btn-success {
            background: var(--success);
            border-color: var(--success);
            color: white;
        }

        .ui-btn-success:hover {
            background: #2dd46a;
            border-color: #2dd46a;
            color: white;
        }

        .ui-btn-danger {
            background: transparent;
            border-color: var(--danger);
            color: var(--danger);
        }

        .ui-btn-danger:hover {
            background: rgba(239, 68, 68, 0.1);
            border-color: var(--danger);
            color: var(--danger);
        }

        .ui-btn-icon {
            width: 36px;
            height: 36px;
            padding: 0;
            border-radius: 50%;
            flex-shrink: 0;
        }

        .ui-btn-pill {
            border-radius: 999px;
            padding: 6px 14px;
            font-size: 0.8rem;
            font-weight: 600;
        }

        .ui-btn-block {
            display: flex;
            width: 100%;
        }

        .pill-btn {
            display: flex;
            align-items: center;
            gap: 6px;
            padding: 6px 14px;
            border-radius: 50px;
            font-size: 0.8rem;
            font-weight: 600;
            border: 1px solid var(--border-color);
            background: var(--bg-card);
            color: var(--text-secondary);
            cursor: pointer;
            transition: var(--transition);
            text-decoration: none;
            white-space: nowrap;
        }

        .pill-btn:hover {
            border-color: var(--accent);
            color: var(--accent);
            text-decoration: none;
        }

        .pill-btn.accent {
            background: var(--accent);
            border-color: var(--accent);
            color: white;
        }

        .pill-btn.accent:hover {
            background: var(--accent-hover);
            color: white;
        }

        .icon-btn {
            width: 36px;
            height: 36px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            background: var(--bg-card);
            border: 1px solid var(--border-color);
            color: var(--text-secondary);
            cursor: pointer;
            transition: var(--transition);
            font-size: 1rem;
        }

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

        .user-avatar-sm {
            width: 34px;
            height: 34px;
            border-radius: 50%;
            background: linear-gradient(135deg, var(--accent), #ff375f);
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 700;
            font-size: 0.8rem;
            color: white;
            cursor: pointer;
            border: 2px solid var(--border-color);
            transition: var(--transition);
            text-decoration: none;
            flex-shrink: 0;
        }

        .user-avatar-sm:hover {
            border-color: var(--accent);
            color: white;
            text-decoration: none;
        }

        /* ─── Main Content ─── */
        .main-wrapper {
            margin-left: var(--sidebar-width);
            margin-top: var(--topbar-height);
            min-height: calc(100vh - var(--topbar-height) - 130px);
            padding: 24px;
            background-color: var(--bg-primary);
        }

        /* ─── Cards ─── */
        .card-dark {
            background: var(--bg-card);
            border: 1px solid var(--border-color);
            border-radius: var(--radius-lg);
            padding: 18px;
            color: var(--text-primary);
            transition: var(--transition);
        }

        .card-dark:hover {
            border-color: #333;
        }

        .card,
        .stat-card {
            color: var(--text-primary);
        }

        .stat-num,
        .big-num,
        .metric-value,
        .rating-num,
        .rank-num,
        .donut-inner {
            color: var(--text-primary);
        }

        .stat-lbl,
        .metric-label,
        .sub-label,
        .rating-sub {
            color: var(--text-secondary);
        }

        /* ─── Toast Notifications - TOP RIGHT ─── */
        .toast-container {
            position: fixed;
            top: calc(var(--topbar-height) + 12px);
            right: 20px;
            z-index: 10000;
            display: flex;
            flex-direction: column;
            gap: 12px;
            max-width: 380px;
        }

        .toast-notification {
            background: var(--bg-card);
            border-radius: 12px;
            padding: 14px 16px;
            display: flex;
            align-items: flex-start;
            gap: 12px;
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
            border-left: 4px solid;
            animation: toastSlideIn 0.3s ease;
            cursor: pointer;
            transition: all 0.2s;
            position: relative;
        }

        .toast-notification:hover {
            transform: translateX(-4px);
        }

        .toast-notification.success {
            border-left-color: var(--success);
            background: linear-gradient(135deg, var(--bg-card), rgba(34, 197, 94, 0.05));
        }
        .toast-notification.success .toast-icon { color: var(--success); }

        .toast-notification.error {
            border-left-color: var(--danger);
            background: linear-gradient(135deg, var(--bg-card), rgba(239, 68, 68, 0.05));
        }
        .toast-notification.error .toast-icon { color: var(--danger); }

        .toast-notification.info {
            border-left-color: var(--info);
            background: linear-gradient(135deg, var(--bg-card), rgba(59, 130, 246, 0.05));
        }
        .toast-notification.info .toast-icon { color: var(--info); }

        .toast-notification.warning {
            border-left-color: var(--warning);
            background: linear-gradient(135deg, var(--bg-card), rgba(245, 158, 11, 0.05));
        }
        .toast-notification.warning .toast-icon { color: var(--warning); }

        .toast-icon {
            font-size: 1.2rem;
            flex-shrink: 0;
        }

        .toast-content {
            flex: 1;
        }

        .toast-title {
            font-weight: 700;
            font-size: 0.85rem;
            margin-bottom: 2px;
        }

        .toast-message {
            font-size: 0.8rem;
            color: var(--text-secondary);
            line-height: 1.4;
        }

        .toast-close {
            background: none;
            border: none;
            color: var(--text-muted);
            cursor: pointer;
            font-size: 0.9rem;
            padding: 2px;
            transition: var(--transition);
            flex-shrink: 0;
        }

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

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

        .btn-spinner {
            display: inline-block;
            width: 13px;
            height: 13px;
            border: 2px solid rgba(255,255,255,.35);
            border-top-color: #fff;
            border-radius: 50%;
            animation: btnSpin .7s linear infinite;
            flex-shrink: 0;
        }

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

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

        /* Flash messages (legacy, kept for backward compatibility) */
        .flash-messages {
            position: fixed;
            top: calc(var(--topbar-height) + 12px);
            right: 20px;
            z-index: 9999;
            display: flex;
            flex-direction: column;
            gap: 8px;
            max-width: 360px;
        }

        .flash-alert {
            padding: 12px 16px;
            border-radius: var(--radius);
            font-size: 0.85rem;
            font-weight: 500;
            display: flex;
            align-items: center;
            gap: 10px;
            animation: slideIn 0.3s ease;
            cursor: pointer;
        }

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

        /* ─── Footer ─── */
        .site-footer {
            background: var(--bg-secondary);
            border-top: 1px solid var(--border-color);
            padding: 24px 20px;
            margin-left: var(--sidebar-width);
            text-align: center;
        }

        .footer-links {
            display: flex;
            justify-content: center;
            flex-wrap: wrap;
            gap: 12px 24px;
            margin-bottom: 16px;
        }

        .footer-links a {
            color: var(--text-secondary);
            text-decoration: none;
            font-size: 0.82rem;
            transition: color 0.2s;
        }

        .footer-links a:hover {
            color: var(--accent);
        }

        .footer-socials {
            display: flex;
            justify-content: center;
            gap: 14px;
            margin-bottom: 12px;
        }

        .footer-socials a {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            border: 1px solid var(--border-color);
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--text-secondary);
            text-decoration: none;
            font-size: 1rem;
            transition: var(--transition);
        }

        .footer-socials a:hover {
            border-color: var(--accent);
            color: var(--accent);
        }

        .footer-copy {
            color: var(--text-muted);
            font-size: 0.78rem;
        }

        /* ─── Scrollbars ─── */
        ::-webkit-scrollbar {
            width: 6px;
            height: 6px;
        }

        ::-webkit-scrollbar-track {
            background: transparent;
        }

        ::-webkit-scrollbar-thumb {
            background: #333;
            border-radius: 3px;
        }

        ::-webkit-scrollbar-thumb:hover {
            background: #444;
        }

        /* ─── Mobile Responsive ─── */
        @media (max-width: 768px) {
            .sidebar {
                bottom: 0;
                top: auto;
                width: 100%;
                height: 56px;
                flex-direction: row;
                justify-content: space-around;
                padding: 0 10px;
                border-right: none;
                border-top: 1px solid var(--border-color);
            }

            .sidebar-logo {
                display: none;
            }

            .sidebar-nav {
                flex-direction: row;
                flex: 1;
                justify-content: space-around;
            }

            .sidebar-bottom {
                flex-direction: row;
                padding-bottom: 0;
            }

            .sidebar-link .tooltip-label {
                display: none;
            }

            .topbar {
                left: 0;
            }

            .main-wrapper {
                margin-left: 0;
                margin-top: var(--topbar-height);
                padding: 14px;
                padding-bottom: 72px;
            }

            .site-footer {
                margin-left: 0;
                padding-bottom: 72px;
            }

            .pill-btn span {
                display: none;
            }
        }

        @media (max-width: 480px) {
            .topbar {
                padding: 0 12px;
            }

            .pill-btn {
                padding: 5px 10px;
            }
        }

/* Shared question table UI */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 20px;
    padding: 7px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s;
}

.back-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    text-decoration: none;
}

.questions-table-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    overflow-x: auto;
}

.q-table {
    width: 100%;
    border-collapse: collapse;
}

.q-table thead th {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.q-table tbody tr {
    border-bottom: 1px solid var(--border-subtle);
    transition: background 0.15s;
}

.q-table tbody tr:last-child {
    border-bottom: none;
}

.q-table tbody tr:hover {
    background: var(--bg-secondary);
}

.q-table tbody td {
    padding: 12px 16px;
    font-size: 0.88rem;
    vertical-align: middle;
}

.q-num {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8rem;
}

.q-checkbox {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

.q-checkbox:disabled,
.action-icon:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.q-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.q-links {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.difficulty-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.difficulty-easy {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.difficulty-medium {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.difficulty-hard {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.q-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 0.73rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s;
}

.q-badge:hover {
    opacity: 0.85;
    text-decoration: none;
}

.badge-lc {
    background: rgba(255, 184, 0, 0.15);
    color: #ffb800;
    border: 1px solid rgba(255, 184, 0, 0.25);
}

.badge-gfg {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.25);
}

.badge-hr {
    background: rgba(0, 189, 108, 0.15);
    color: #00bd6c;
    border: 1px solid rgba(0, 189, 108, 0.25);
}

.badge-cn {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.badge-yt {
    background: rgba(255, 0, 0, 0.15);
    color: #ff0000;
    border: 1px solid rgba(255, 0, 0, 0.25);
}

.badge-link {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.25);
}

.action-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    font-size: 1.1rem;
    color: var(--text-muted);
    transition: all 0.2s;
}

.action-icon:hover {
    background: var(--bg-secondary);
    color: var(--accent);
}

.action-icon.bookmarked {
    color: var(--warning);
}

.action-icon.skipped,
.skip-btn.skipped {
    color: var(--danger);
}

.notes-btn-sm {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 0.77rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

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

.notes-btn-sm.has-notes {
    border-color: var(--info);
    color: var(--info);
}

@media (prefers-contrast: high) {
    .difficulty-easy {
        background: #10b981;
        color: black;
        border: 2px solid black;
    }

    .difficulty-medium {
        background: #f59e0b;
        color: black;
        border: 2px solid black;
    }

    .difficulty-hard {
        background: #ef4444;
        color: white;
        border: 2px solid white;
    }
}

/* Progressive hints styling */
.hints-container {
    margin-top: 10px;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.show-hint-btn {
    margin-bottom: 6px;
}

.hints-list {
    margin: 6px 0 0 0;
    padding-left: 18px;
    list-style-type: decimal;
}

.hint-item {
    margin-top: 4px;
    color: var(--text-secondary);
    line-height: 1.4;
    font-size: 0.8rem;
}

.hidden {
    display: none !important;
}
