
/* ─── Design Tokens ──────────────────────────────────────────────── */
:root {
    --sidebar-w:        260px;
    --sidebar-w-col:    72px;
    --topbar-h:         64px;
    --transition:       all 0.28s cubic-bezier(0.4, 0, 0.2, 1);

    /* Dark chrome (sidebar + topbar) */
    --chrome-bg:        #0d1117;
    --chrome-border:    rgba(255 255 255 / 0.07);
    --chrome-text:      #94a3b8;
    --chrome-text-act:  #f8fafc;
    --accent:           #38bdf8;
    --accent-glow:      rgba(56, 189, 248, 0.18);
    --danger:           #f87171;

    /* Content area (light) */
    --body-bg:          #f1f5f9;
    --surface:          #ffffff;
    --surface-2:        #f8fafc;
    --border:           #e2e8f0;
    --text:             #1e293b;
    --text-muted:       #64748b;

    /* Status */
    --online:           #22c55e;
    --ink:        #1a1410;
  --ink-soft:   #4a3f35;
  --paper:      #faf7f2;
  --paper-2:    #f2ede4;
  --paper-3:    #e8e0d4;
  --gold:       #c9923a;
  --gold-light: #f0d9b5;
  --gold-dim:   rgba(201,146,58,.12);
  --green:      #3d7a5c;
  --red:        #b84444;
  --shadow-sm:  0 2px 8px rgba(26,20,16,.08);
  --shadow-md:  0 6px 24px rgba(26,20,16,.12);
  --r:          10px;
  --ff-head:    'Playfair Display', Georgia, serif;
  --ff-body:    'Mulish', sans-serif;
}

/* ─── Reset & Base ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: 'DM Sans', system-ui, sans-serif;
    background: var(--body-bg);
    color: var(--text);
    margin: 0;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, .font-display {
    font-family: 'Syne', sans-serif;
}

/* ─── Sidebar Toggle (Pure CSS) ──────────────────────────────────── */
#nav-toggler        { display: none; }

/* Collapsed state */
#nav-toggler:checked ~ #sidebar                { width: var(--sidebar-w-col); }
#nav-toggler:checked ~ #sidebar .nav-label     { opacity: 0; width: 0; overflow: hidden; }
#nav-toggler:checked ~ #sidebar .nav-section   { opacity: 0; height: 0; overflow: hidden; margin: 0; }
#nav-toggler:checked ~ #sidebar .brand-name    { opacity: 0; width: 0; overflow: hidden; }
#nav-toggler:checked ~ #sidebar .footer-detail { opacity: 0; width: 0; overflow: hidden; }
#nav-toggler:checked ~ .main-wrapper           { margin-left: var(--sidebar-w-col); }
#nav-toggler:checked ~ #sidebar .sidebar-footer { justify-content: center; }

/* Mobile overlay toggle */
#mob-toggler        { display: none; }
#mob-toggler:checked ~ #sidebar { transform: translateX(0) !important; }
#mob-toggler:checked ~ #mob-overlay { display: block !important; }

/* ─── Sidebar ────────────────────────────────────────────────────── */
#sidebar {
    width: var(--sidebar-w);
    height: 100dvh;
    background: var(--chrome-bg);
    position: fixed;
    left: 0; top: 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--chrome-border);
    transition: var(--transition);
    overflow: hidden;
}

/* ── Sidebar Header ── */
.sidebar-header {
    height: var(--topbar-h);
    min-height: var(--topbar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.1rem 0 1.35rem;
    border-bottom: 1px solid var(--chrome-border);
    flex-shrink: 0;
}

.brand-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    overflow: hidden;
}

.brand-icon {
    width: 34px; height: 34px;
    background: var(--accent);
    border-radius: 9px;
    display: grid; place-items: center;
    flex-shrink: 0;
}

.brand-icon i { color: #0d1117; font-size: 1rem; }

.brand-name {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--chrome-text-act);
    letter-spacing: 0.08em;
    white-space: nowrap;
    transition: var(--transition);
}

.toggle-btn {
    background: none;
    border: none;
    color: var(--chrome-text);
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    display: grid; place-items: center;
    flex-shrink: 0;
    transition: 0.2s;
    line-height: 1;
}

.toggle-btn:hover { background: rgba(255 255 255 / 0.06); color: var(--chrome-text-act); }
.toggle-btn i { font-size: 1.25rem; pointer-events: none; }

/* ── Nav ── */
.nav-menu {
    flex: 1;
    padding: 12px 10px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
}

.nav-menu::-webkit-scrollbar { display: none; }

.nav-section {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: #475569;
    text-transform: uppercase;
    padding: 0 10px;
    margin: 14px 0 6px;
    white-space: nowrap;
    transition: var(--transition);
}

.nav-link {
    color: var(--chrome-text);
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: 10px;
    margin-bottom: 2px;
    transition: 0.18s;
    text-decoration: none;
    white-space: nowrap;
    position: relative;
}

.nav-link:hover {
    background: rgba(255 255 255 / 0.05);
    color: var(--chrome-text-act);
}

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

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0; top: 20%; bottom: 20%;
    width: 3px;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
}

.nav-link i {
    font-size: 1.15rem;
    flex-shrink: 0;
    width: 22px;
    text-align: center;
}

.nav-label {
    white-space: nowrap;
    transition: var(--transition);
    font-size: 0.9rem;
    font-weight: 400;
}

.nav-badge {
    margin-left: auto;
    font-size: 0.65rem;
    font-weight: 600;
    background: var(--accent);
    color: #0d1117;
    padding: 1px 7px;
    border-radius: 20px;
    flex-shrink: 0;
}

/* ── Sidebar Footer ── */
.sidebar-footer {
    padding: 12px 14px;
    border-top: 1px solid var(--chrome-border);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    overflow: hidden;
    transition: var(--transition);
}

.avatar-sm {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #38bdf8, #818cf8);
    display: grid; place-items: center;
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 0.75rem;
    color: #fff;
    flex-shrink: 0;
}

.footer-detail {
    overflow: hidden;
    transition: var(--transition);
    white-space: nowrap;
}

.footer-detail .role-badge {
    font-size: 0.58rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
}

.footer-detail .username {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--chrome-text-act);
    display: block;
}

.status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--online);
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25);
    flex-shrink: 0;
}

/* ─── Mobile Overlay ─────────────────────────────────────────────── */
#mob-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 1039;
    backdrop-filter: blur(2px);
}

/* ─── Top Navbar ─────────────────────────────────────────────────── */
.main-wrapper {
    margin-left: var(--sidebar-w);
    transition: var(--transition);
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.top-navbar {
    height: var(--topbar-h);
    min-height: var(--topbar-h);
    background: var(--chrome-bg);
    border-bottom: 1px solid var(--chrome-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1030;
    gap: 12px;
}

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

/* Breadcrumb in topbar */
.topbar-breadcrumb {
    font-size: 0.82rem;
    color: var(--chrome-text);
}

.topbar-breadcrumb .current {
    color: var(--chrome-text-act);
    font-weight: 500;
}

/* Search bar */
.topbar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255 255 255 / 0.04);
    border: 1px solid var(--chrome-border);
    border-radius: 10px;
    padding: 6px 14px;
    transition: 0.2s;
}

.topbar-search:focus-within {
    border-color: var(--accent);
    background: rgba(56, 189, 248, 0.06);
}

.topbar-search i { color: var(--chrome-text); font-size: 0.9rem; flex-shrink: 0; }

.topbar-search input {
    background: none;
    border: none;
    outline: none;
    color: var(--chrome-text-act);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    width: 160px;
}

.topbar-search input::placeholder { color: #475569; }

/* Search result cards */
.search-result-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: var(--chrome-bg2);
    border: 1px solid var(--chrome-border);
    border-radius: 10px;
    color: var(--chrome-text-act);
    transition: border-color 0.15s, background 0.15s;
}
.search-result-card:hover {
    border-color: var(--accent);
    background: rgba(56, 189, 248, 0.06);
    color: var(--chrome-text-act);
}
.search-result-icon {
    width: 36px; height: 36px;
    border-radius: 8px;
    background: rgba(56, 189, 248, 0.1);
    color: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}
.search-result-body { flex: 1; min-width: 0; }
.search-result-title {
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.search-result-meta {
    font-size: 0.78rem;
    color: var(--chrome-text);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.search-result-arrow {
    color: var(--chrome-text);
    font-size: 0.75rem;
    flex-shrink: 0;
}

/* Icon buttons in topbar */
.icon-btn {
    width: 38px; height: 38px;
    background: rgba(255 255 255 / 0.04);
    border: 1px solid var(--chrome-border);
    border-radius: 10px;
    display: grid; place-items: center;
    color: var(--chrome-text);
    cursor: pointer;
    transition: 0.18s;
    text-decoration: none;
    position: relative;
    flex-shrink: 0;
}

.icon-btn:hover { background: rgba(255 255 255 / 0.08); color: var(--chrome-text-act); }
.icon-btn i { font-size: 1.05rem; pointer-events: none; }

.icon-btn .notif-dot {
    position: absolute;
    top: 7px; right: 7px;
    width: 7px; height: 7px;
    background: var(--accent);
    border-radius: 50%;
    border: 1.5px solid var(--chrome-bg);
}

/* User dropdown trigger */
.user-trigger {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 5px 10px 5px 5px;
    background: rgba(255 255 255 / 0.04);
    border: 1px solid var(--chrome-border);
    border-radius: 40px;
    cursor: pointer;
    transition: 0.18s;
    text-decoration: none;
    color: var(--chrome-text-act);
}

.user-trigger:hover { background: rgba(255 255 255 / 0.08); border-color: rgba(255 255 255 / 0.12); }

.user-trigger .avatar-sm { width: 28px; height: 28px; font-size: 0.65rem; }

.user-trigger .uname {
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
}

/* ── Dropdown Menu ── */
.dropdown-menu {
    background: #161d2b;
    border: 1px solid var(--chrome-border);
    border-radius: 14px;
    padding: 8px;
    box-shadow: 0 16px 40px rgba(0,0,0,0.45);
    min-width: 200px;
}

.dropdown-header {
    padding: 8px 12px 10px;
    color: var(--chrome-text);
    font-size: 0.72rem;
    letter-spacing: 0.05em;
}

.dropdown-item {
    color: #94a3b8;
    border-radius: 9px;
    padding: 9px 12px;
    font-size: 0.87rem;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: 0.15s;
}

.dropdown-item:hover { background: rgba(255 255 255 / 0.06); color: var(--chrome-text-act); }
.dropdown-item i { font-size: 1rem; opacity: 0.75; }
.dropdown-item.text-danger { color: var(--danger) !important; }
.dropdown-item.text-danger:hover { background: rgba(248, 113, 113, 0.1); }
.dropdown-divider { border-color: var(--chrome-border); margin: 4px 0; }

/* Auth buttons (not logged in) */
.btn-auth-outline {
    padding: 7px 18px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid var(--chrome-border);
    color: var(--chrome-text-act);
    background: transparent;
    transition: 0.18s;
    text-decoration: none;
    white-space: nowrap;
}

.btn-auth-outline:hover { background: rgba(255 255 255 / 0.07); color: #fff; }

.btn-auth-primary {
    padding: 7px 18px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    border: none;
    background: var(--accent);
    color: #0d1117;
    transition: 0.18s;
    text-decoration: none;
    white-space: nowrap;
}

.btn-auth-primary:hover { background: #7dd3fc; color: #0d1117; }

/* ─── Content Area ───────────────────────────────────────────────── */
.content-area {
    flex: 1;
    padding: 2rem;
    background: var(--body-bg);
}

/* ─── Page Header ────────────────────────────────────────────────── */
.page-header {
    margin-bottom: 1.75rem;
}

.page-title {
    font-family: 'Syne', sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 4px;
}

.page-subtitle {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin: 0;
}

/* ─── Card overrides (light content area) ────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.card-header {
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    border-radius: 16px 16px 0 0 !important;
    padding: 1rem 1.25rem;
    font-family: 'Syne', sans-serif;
    font-weight: 600;
}

/* ─── Messages / Alerts ──────────────────────────────────────────── */
.messages-container {
    padding: 0 2rem;
    margin-top: 1rem;
}


/* ─── Scrollbar ──────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 10px; }

/* ─── Responsive ─────────────────────────────────────────────────── */

/* Desktop (≥992px): explicit overrides to guarantee proper layout */
@media (min-width: 992px) {
    #sidebar {
        transform: none !important;
        width: var(--sidebar-w);
    }
    #nav-toggler:checked ~ #sidebar {
        width: var(--sidebar-w-col);
        transform: none !important;
    }
    .main-wrapper {
        margin-left: var(--sidebar-w);
    }
    #nav-toggler:checked ~ .main-wrapper {
        margin-left: var(--sidebar-w-col);
    }
    .mob-bottom-nav {
        display: none !important;
    }
}

@media (max-width: 991.98px) {
    #sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-w) !important; /* always full on mobile */
    }

    /* Restore text in sidebar on mobile */
    #nav-toggler:checked ~ #sidebar .nav-label,
    #nav-toggler:checked ~ #sidebar .nav-section,
    #nav-toggler:checked ~ #sidebar .brand-name,
    #nav-toggler:checked ~ #sidebar .footer-detail {
        opacity: 1; width: auto; height: auto; overflow: visible;
    }

    .main-wrapper { margin-left: 0 !important; }

    #nav-toggler { display: none !important; } /* disable desktop toggle on mobile */

    .topbar-search { display: none; }

    .content-area { padding: 1.25rem; padding-bottom: calc(1.25rem + 68px); }
}

@media (max-width: 575.98px) {
    .top-navbar { padding: 0 0.875rem; gap: 8px; }
    .content-area { padding: 1rem; padding-bottom: calc(1rem + 68px); }
    .user-trigger .uname { display: none; }

    /* Tighter cards on small phones */
    .card { border-radius: 12px; }
    .ms-grid { grid-template-columns: 1fr; }
    .mdt-practice-grid { grid-template-columns: 1fr; }
    .mdt-students { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
    .an-kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .an-my-kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .mdt-stats { grid-template-columns: repeat(2, 1fr); }

    /* ── Compact action buttons ── */
    .btn-core-primary,
    .btn-core-outline {
        padding: 7px 13px;
        font-size: 0.82rem;
    }
    .btn-auth-primary,
    .btn-auth-outline {
        padding: 6px 13px;
        font-size: 0.82rem;
    }
    .btn-submit { font-size: 0.9rem; }
    .btn-back, .btn-next, .btn-finish {
        padding: 9px 16px;
        font-size: 0.83rem;
    }

    /* ── Language switcher: hide on very small ── */
    .lang-switcher { display: none !important; }

    /* ── Page header tighter ── */
    .page-title { font-size: 1.35rem; }
    .messages-container { padding: 0 1rem; }
}

/* ─── Mobile Bottom Navigation (PWA) ────────────────────────── */
.mob-bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 64px;
    background: var(--chrome-bg);
    border-top: 1px solid var(--chrome-border);
    display: flex;
    align-items: stretch;
    z-index: 1050;
    /* Safe area for phones with home bar */
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.mob-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--chrome-text);
    text-decoration: none;
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    transition: color 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.mob-nav-item i { font-size: 1.25rem; line-height: 1; }

.mob-nav-item:hover,
.mob-nav-item.active {
    color: var(--accent);
}

.mob-nav-item.active i {
    filter: drop-shadow(0 0 4px var(--accent));
}

/* Hide bottom nav during quiz so the quiz footer is fully visible */
.quiz-active .mob-bottom-nav { display: none !important; }
.quiz-active .content-area   { padding-bottom: 0 !important; }

/* ─── Utility ────────────────────────────────────────────────────── */
.text-accent { color: var(--accent); }
.bg-chrome  { background: var(--chrome-bg); }

/* ─── Form Core (shared inputs/textareas) ────────────────────── */
.form-core {
    width: 100%;
    max-width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.5rem 1rem;
    border-radius: 10px;
    font-size: 0.875rem;
    transition: var(--transition);
    box-sizing: border-box;
    display: block;
}
.form-core:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ─── Practice Specifics ─────────────────────────────────────── */
.transition-hover {
    transition: transform 0.2s ease, border-color 0.2s ease;
}
.transition-hover:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
}

.practice-title {
    font-family: 'Syne', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}

.practice-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.practice-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.badge-core {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}
.badge-easy { background: rgba(34, 197, 94, 0.1); color: var(--online); }
.badge-hard { background: rgba(248, 113, 113, 0.1); color: var(--danger); }


/* --- Info Stats Grid --- */
.info-card-stat {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    height: 100%;
}
.info-card-stat .min-width-0 { min-width: 0; }
.stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.stat-value {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
}

/* --- Score Ring Animation --- */
.score-ring-container {
    display: flex;
    justify-content: center;
}
.score-ring {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--surface);
    border: 4px solid var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px var(--accent-glow);
}
.score-val {
    font-family: 'Syne', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text);
}

/* --- Responsive fixes --- */
@media (max-width: 991px) {
    .sticky-top { position: static !important; }
}
/* --- Quiz Immersive Layout --- */
.quiz-wrapper {
    height: calc(100vh - var(--topbar-h));
    background: var(--body-bg);
}

/* Custom Progress Bar */
.progress-track-custom { height: 6px; background: var(--border); overflow: hidden; }
.progress-fill-custom { 
    height: 100%; 
    background: var(--accent); 
    box-shadow: 0 0 10px var(--accent-glow);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Sidebar Navigator */
.quiz-nav-sidebar {
    background: var(--chrome-bg);
    border-right: 1px solid var(--chrome-border);
    overflow-y: auto;
}
.q-nav-dot {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 8px;
    background: rgba(255,255,255,0.05);
    color: var(--chrome-text);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 600;
    transition: var(--transition);
}
.q-nav-dot.active { background: var(--accent); color: var(--chrome-bg); }
.q-nav-dot.answered { border: 1px solid var(--accent); color: var(--accent); }

/* Choice Cards */
.choice-card {
    display: flex; align-items: center;
    padding: 1.25rem;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
}
.choice-card:hover { border-color: var(--accent); background: var(--surface-2); }
.choice-card.selected { 
    border-color: var(--accent); 
    background: var(--accent-glow); 
}

.choice-check {
    width: 22px; height: 22px;
    border: 2px solid var(--border);
    border-radius: 6px;
    margin-right: 15px;
    position: relative;
}
.choice-card.selected .choice-check { background: var(--accent); border-color: var(--accent); }
.choice-card.selected .choice-check::after {
    content: '\F26E'; font-family: "bootstrap-icons";
    color: white; font-size: 12px;
    position: absolute; left: 3px; top: -1px;
}

.q-hint-card {
    background: #fff9db; /* Light warning yellow */
    border-left: 4px solid #fcc419;
    padding: 1rem;
    border-radius: 0 12px 12px 0;
    font-size: 0.9rem;
    color: #856404;
}
/* --- Result Specifics --- */
.score-ring-lg {
    width: 160px; height: 160px;
    border-radius: 50%;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    background: var(--surface);
    border: 6px solid var(--border);
    transition: var(--transition);
}
.score-ring-lg.passed { border-color: var(--online); box-shadow: 0 0 30px rgba(34, 197, 94, 0.2); }
.score-ring-lg.failed { border-color: var(--danger); box-shadow: 0 0 30px rgba(248, 113, 113, 0.2); }

.score-number { font-family: 'Syne', sans-serif; font-size: 3rem; font-weight: 800; color: var(--text); line-height: 1; }
.score-label { font-size: 0.7rem; letter-spacing: 2px; color: var(--text-muted); }

/* Review Colors */
.bg-success-light { background: rgba(34, 197, 94, 0.08); }
.bg-danger-light { background: rgba(248, 113, 113, 0.08); }
.bg-chrome-glow { background: var(--accent-glow); border: 1px solid var(--chrome-border); }

.result-verdict { font-family: 'Syne', sans-serif; font-weight: 800; }

/* --- Table Refinement --- */
.table thead th {
    font-size: 0.65rem;
    letter-spacing: 1px;
    padding: 1.25rem 1rem;
    text-transform: uppercase;
}

.table tbody td {
    padding: 1.1rem 1rem;
    font-size: 0.88rem;
    border-bottom: 1px solid var(--border);
}

.extra-small { font-size: 0.75rem; }

/* Status Indicators */
.status-indicator {
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.status-indicator::before {
    content: '';
    width: 8px; height: 8px;
    border-radius: 50%;
}
.status-indicator.online::before { background: var(--online); box-shadow: 0 0 8px var(--online); }
.status-indicator.draft::before { background: #94a3b8; }

/* Dashboard Card */
.border-dashed {
    border: 2px dashed var(--border) !important;
}


/** --- Panda & Master --- */
/* Card Hover Effects for both lists */
.transition-hover {
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.28s ease;
}
.transition-hover:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.1) !important;
}

/* Line clamping for descriptions */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Category Badge Variation */
.bg-accent-glow {
    background: var(--accent-glow);
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.extra-small {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}


/* Practice Attempt Page */



.quiz-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ── TOP HEADER ──────────────────────────── */
.quiz-header {
  background: var(--ink);
  padding: 0 28px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-shrink: 0;
}

.quiz-title {
  font-family: var(--ff-head);
  font-size: .95rem;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 340px;
}

.quiz-counter {
  margin-left: auto;
  font-size: .78rem;
  color: rgba(255,255,255,.5);
  letter-spacing: .5px;
  flex-shrink: 0;
}

/* ── PROGRESS BAR ────────────────────────── */
.quiz-progress {
  height: 5px;
  background: var(--paper-3);
  flex-shrink: 0;
  position: relative;
}
.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold) 0%, #e8b96a 100%);
  transition: width .5s cubic-bezier(.4,0,.2,1);
  border-radius: 0 3px 3px 0;
  position: relative;
}
.quiz-progress-fill::after {
  content: '';
  position: absolute;
  right: -1px; top: -2px;
  width: 9px; height: 9px;
  background: var(--gold);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(201,146,58,.25);
}

/* ── BODY: NAV + CONTENT ─────────────────── */
.quiz-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── SIDEBAR NAVIGATOR ───────────────────── */
.q-nav {
  width: 72px;
  background: var(--paper-2);
  border-right: 1px solid var(--paper-3);
  padding: 20px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  overflow-y: auto;
  flex-shrink: 0;
}
.q-nav::-webkit-scrollbar { width: 3px; }
.q-nav::-webkit-scrollbar-thumb { background: var(--paper-3); }

.q-dot {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .78rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1.5px solid var(--paper-3);
  transition: all .15s;
  position: relative;
}
.q-dot:hover          { border-color: var(--gold); color: var(--gold); }
.q-dot.active         { background: var(--ink); color: #fff; border-color: var(--ink); }
.q-dot.answered::after {
  content: '';
  position: absolute;
  top: 5px; right: 5px;
  width: 7px; height: 7px;
  background: var(--green);
  border-radius: 50%;
  border: 1.5px solid var(--paper-2);
}
.q-dot.active.answered::after { border-color: var(--ink); }

/* ── MAIN QUESTION PANEL ─────────────────── */
.q-main {
  flex: 1;
  overflow-y: auto;
  padding: 40px 48px 120px;   /* bottom pad for footer */
}
.q-main::-webkit-scrollbar { width: 4px; }
.q-main::-webkit-scrollbar-thumb { background: var(--paper-3); border-radius: 2px; }

.q-eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.q-badge {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--gold);
  background: var(--gold-dim);
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid rgba(201,146,58,.2);
}
.q-pts {
  font-size: .78rem;
  color: var(--ink-soft);
}

.q-text {
  font-family: var(--ff-head);
  font-size: 1.35rem;
  line-height: 1.65;
  color: var(--ink);
  margin: 0 0 28px;
  max-width: 700px;
}

/* Hint box */
.q-hint {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--gold-dim);
  border: 1px solid rgba(201,146,58,.2);
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--r) var(--r) 0;
  padding: 12px 16px;
  margin-bottom: 28px;
  font-size: .86rem;
  color: var(--ink-soft);
  max-width: 640px;
}
.q-hint-icon { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }

/* Question image */
.q-img { max-width: 480px; border-radius: var(--r); border: 1px solid var(--paper-3); margin-bottom: 28px; }

/* ── CHOICES ─────────────────────────────── */
.choices { display: flex; flex-direction: column; gap: 10px; max-width: 680px; }

.choice {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 18px;
  background: #fff;
  border: 1.5px solid var(--paper-3);
  border-radius: var(--r);
  cursor: pointer;
  transition: all .18s;
  box-shadow: var(--shadow-sm);
  user-select: none;
}
.choice:hover {
  border-color: var(--gold);
  background: #fffdf9;
  box-shadow: 0 3px 14px rgba(201,146,58,.12);
}
.choice:has(input:checked) {
  border-color: var(--gold);
  background: linear-gradient(135deg, #fffaf2 0%, #fef6e7 100%);
  box-shadow: 0 3px 16px rgba(201,146,58,.18);
}
.choice input { display: none; }

.choice-box {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--paper-3);
  flex-shrink: 0;
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .18s;
  font-size: .7rem;
  color: transparent;
}
.choice:has(input:checked) .choice-box {
  background: var(--gold);
  border-color: var(--gold);
  color: #fff;
}

.choice-label {
  font-size: .92rem;
  line-height: 1.5;
  color: var(--ink);
}
.choice:has(input:checked) .choice-label { font-weight: 500; }

/* ── STICKY FOOTER ───────────────────────── */
.q-footer {
  position: fixed;
  bottom: 0;
  /* offset by the sidebar */
  left: 72px;
  right: 0;
  background: rgba(250,247,242,.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--paper-3);
  padding: 14px 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 30;
}

.footer-progress {
  font-size: .8rem;
  color: var(--ink-soft);
}
.footer-progress strong { color: var(--ink); }

.footer-actions { display: flex; gap: 10px; }

/* Buttons */
.btn-back, .btn-next, .btn-finish {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 8px;
  font-family: var(--ff-body);
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all .15s;
}
.btn-back {
  background: transparent;
  border: 1.5px solid var(--paper-3);
  color: var(--ink-soft);
}
.btn-back:hover { border-color: var(--ink-soft); color: var(--ink); }

.btn-next {
  background: var(--ink);
  color: #fff;
}
.btn-next:hover { background: #2e241c; }

.btn-finish {
  background: var(--green);
  color: #fff;
}
.btn-finish:hover { background: #2e6348; }

/* ── RESPONSIVE ──────────────────────────── */
@media (max-width: 640px) {
  .q-nav { display: none; }
  .q-main { padding: 24px 20px 110px; }
  .q-footer {
    left: 0;
    padding: 12px 20px;
    padding-bottom: max(12px, env(safe-area-inset-bottom, 12px));
  }
  .q-text { font-size: 1.1rem; }
}

/* ═══════════════════════════════════════════════════════════════
   AUTH & SHARED FORM STYLES
═══════════════════════════════════════════════════════════════ */

.auth-wrapper {
    min-height: calc(100dvh - var(--topbar-h));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
}

.auth-card { width: 100%; max-width: 440px; }
.auth-card-wide { max-width: 560px; }

.auth-card .card {
    border-radius: 20px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 24px rgba(0,0,0,0.07);
    overflow: hidden;
}

.auth-card .card::before {
    content: '';
    display: block;
    height: 4px;
    background: linear-gradient(90deg, var(--accent), #818cf8);
}

.auth-body { padding: 2.25rem 2rem; }
.auth-header { margin-bottom: 2rem; }

.auth-icon {
    width: 48px; height: 48px;
    background: linear-gradient(135deg, rgba(56,189,248,0.15), rgba(129,140,248,0.15));
    border: 1px solid rgba(56,189,248,0.25);
    border-radius: 14px;
    display: grid; place-items: center;
    margin-bottom: 1rem;
    font-size: 1.4rem;
    color: var(--accent);
}

.auth-title { font-family: 'Syne', sans-serif; font-size: 1.5rem; font-weight: 700; color: var(--text); margin: 0 0 4px; }
.auth-subtitle { font-size: 0.875rem; color: var(--text-muted); margin: 0; }

/* ── Form Fields ─────────────────────────────────────────────── */
.field-group { margin-bottom: 1rem; }

.field-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 6px;
}

.field-group input[type="text"],
.field-group input[type="email"],
.field-group input[type="password"],
.field-group input[type="date"],
.field-group input[type="url"],
.field-group input[type="file"],
.field-group select,
.field-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    transition: border-color 0.18s, box-shadow 0.18s;
    outline: none;
    -webkit-appearance: none;
}

.field-group input:focus,
.field-group select:focus,
.field-group textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.field-group input.is-invalid,
.field-group select.is-invalid,
.field-group textarea.is-invalid {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(248,113,113,0.12);
}

.field-group textarea { resize: vertical; line-height: 1.6; }

.field-group input[type="file"] {
    padding: 8px 12px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.field-group input[type="file"]::file-selector-button {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.78rem;
    font-weight: 500;
    padding: 4px 12px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--surface-2);
    color: var(--text);
    cursor: pointer;
    margin-right: 10px;
    transition: 0.15s;
}

.field-group input[type="file"]::file-selector-button:hover { background: var(--border); }

.field-help { font-size: 0.75rem; color: var(--text-muted); margin-top: 5px; line-height: 1.4; }

.field-error {
    font-size: 0.75rem;
    color: #ef4444;
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.field-error::before { content: '\F333'; font-family: 'bootstrap-icons'; font-size: 0.75rem; }

.field-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.field-row label { margin-bottom: 0; }

.forgot-link { font-size: 0.78rem; color: var(--accent); text-decoration: none; font-weight: 500; }
.forgot-link:hover { text-decoration: underline; }

.error-banner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
    color: #b91c1c;
}

.error-banner i { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }

.form-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-section-label::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.section-gap { margin-top: 1.75rem; }

.btn-submit {
    width: 100%;
    padding: 12px;
    margin-top: 1.75rem;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent), #818cf8);
    color: #fff;
    font-family: 'Syne', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: opacity 0.18s, transform 0.18s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-submit:hover  { opacity: 0.9; transform: translateY(-1px); }
.btn-submit:active { opacity: 1;   transform: translateY(0); }

.auth-footer { text-align: center; margin-top: 1.5rem; font-size: 0.875rem; color: var(--text-muted); }
.auth-footer a { color: var(--accent); font-weight: 500; text-decoration: none; }
.auth-footer a:hover { text-decoration: underline; }

/* Avatar preview in update form */
.avatar-preview-wrap { position: relative; display: inline-block; }
.avatar-preview {
    width: 80px; height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border);
    background: var(--surface-2);
}

/* Success card */
.success-icon {
    width: 64px; height: 64px;
    border-radius: 50%;
    background: rgba(34,197,94,0.1);
    border: 1px solid rgba(34,197,94,0.25);
    display: grid; place-items: center;
    margin: 0 auto 1.25rem;
    font-size: 1.8rem;
    color: var(--online);
}

@media (max-width: 575.98px) {
    .auth-body { padding: 1.5rem 1.25rem; }
    .auth-wrapper { padding: 1.5rem 0.75rem; align-items: flex-start; }
}

/* ═══════════════════════════════════════════════════════════════
   PROFILE PAGE
═══════════════════════════════════════════════════════════════ */

/* ── Banner ─────────────────────────────────────────────────── */
.profile-banner {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 1.75rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.profile-banner-bg {
    height: 130px;
    background: linear-gradient(135deg, #0d1117 0%, #0f2748 45%, #1e4a7a 75%, #38bdf8 100%);
    position: relative;
}

.profile-banner-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle at 20% 50%, rgba(56,189,248,0.15) 0%, transparent 60%),
                      radial-gradient(circle at 80% 30%, rgba(129,140,248,0.12) 0%, transparent 50%);
}

.profile-banner-body {
    display: flex;
    align-items: flex-end;
    gap: 1.5rem;
    padding: 0 2rem 1.5rem;
    flex-wrap: wrap;
}

/* ── Avatar ─────────────────────────────────────────────────── */
.profile-avatar-wrap {
    position: relative;
    margin-top: -52px;
    flex-shrink: 0;
}

.profile-avatar {
    width: 104px;
    height: 104px;
    border-radius: 50%;
    border: 4px solid var(--surface);
    object-fit: cover;
    background: var(--surface-2);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    display: block;
}

.profile-role-dot {
    position: absolute;
    bottom: 6px;
    right: 6px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 3px solid var(--surface);
}

.profile-role-dot.master  { background: var(--accent); }
.profile-role-dot.student { background: var(--online); }

/* ── Identity ───────────────────────────────────────────────── */
.profile-identity { padding-bottom: 4px; flex: 1; min-width: 0; }

.profile-name {
    font-family: 'Syne', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 8px;
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
    line-height: 1.2;
}

.profile-username {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--text-muted);
    font-family: 'DM Sans', sans-serif;
}

.profile-roles { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── Role Chips ─────────────────────────────────────────────── */
.role-chip {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: 20px;
    white-space: nowrap;
}

.role-chip.master    { background: var(--accent-glow); color: var(--accent); border: 1px solid rgba(56,189,248,0.3); }
.role-chip.student   { background: rgba(34,197,94,0.1); color: var(--online); border: 1px solid rgba(34,197,94,0.25); }
.role-chip.admin     { background: rgba(248,113,113,0.1); color: var(--danger); border: 1px solid rgba(248,113,113,0.25); }
.role-chip.director  { background: rgba(139,92,246,0.1); color: #a78bfa; border: 1px solid rgba(139,92,246,0.25); }
.role-chip.cofounder { background: rgba(251,191,36,0.1); color: #fbbf24; border: 1px solid rgba(251,191,36,0.25); }
.role-chip.assistant { background: rgba(100,116,139,0.1); color: var(--text-muted); border: 1px solid var(--border); }

/* ── Profile Cards ──────────────────────────────────────────── */
.profile-card { border-radius: 16px !important; overflow: hidden; }

/* ── About / Bio ────────────────────────────────────────────── */
.profile-bio {
    font-size: 0.9rem;
    line-height: 1.75;
    color: var(--text);
    margin-bottom: 1.25rem;
}

.profile-info-list { display: flex; flex-direction: column; gap: 10px; }

.profile-info-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.profile-info-item i { color: var(--accent); font-size: 0.95rem; width: 16px; flex-shrink: 0; }
.profile-info-item a { color: var(--accent); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-info-item a:hover { text-decoration: underline; }

/* ── Quick Action Links ─────────────────────────────────────── */
.profile-action-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.85rem 1.25rem;
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
    font-size: 0.875rem;
    cursor: pointer;
}

.profile-action-link:last-child { border-bottom: none; }
.profile-action-link:hover { background: var(--surface-2); color: var(--text); }
.profile-action-link i:first-child { color: var(--accent); font-size: 1rem; width: 20px; flex-shrink: 0; }
.profile-action-danger { color: var(--danger) !important; }
.profile-action-danger i:first-child { color: var(--danger) !important; }
.profile-action-danger:hover { background: rgba(248,113,113,0.06) !important; }

/* ── Stat Cards ─────────────────────────────────────────────── */
.profile-stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.25rem 1rem;
    text-align: center;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.profile-stat-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 16px var(--accent-glow);
}

.profile-stat-icon { font-size: 1.4rem; color: var(--accent); margin-bottom: 8px; }
.profile-stat-value { font-family: 'Syne', sans-serif; font-size: 1.3rem; font-weight: 700; color: var(--text); line-height: 1.2; margin-bottom: 4px; }
.profile-stat-label { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); font-weight: 600; }

/* ── Master Profile Detail ──────────────────────────────────── */
.master-name { font-family: 'Syne', sans-serif; font-size: 1.1rem; font-weight: 700; color: var(--text); }

.master-subject {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.master-subject i { color: var(--accent); }

.master-desc { font-size: 0.88rem; color: var(--text); line-height: 1.75; margin: 0; }

/* ── Practice Row Links ─────────────────────────────────────── */
.practice-row-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1.25rem;
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

.practice-row-link:last-child { border-bottom: none; }
.practice-row-link:hover { background: var(--surface-2); }

.practice-row-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.practice-row-title { font-size: 0.875rem; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.practice-row-meta  { font-size: 0.75rem; color: var(--text-muted); }

.practice-row-badges { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.badge-sm {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 3px 8px;
    border-radius: 6px;
    white-space: nowrap;
}

.badge-sm.free { background: rgba(34,197,94,0.1); color: var(--online); }
.badge-sm.paid { background: rgba(248,113,113,0.1); color: var(--danger); }

/* ── Score Chip ─────────────────────────────────────────────── */
.score-chip {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    white-space: nowrap;
}

.score-chip.pass { background: rgba(34,197,94,0.1); color: var(--online); }
.score-chip.fail { background: rgba(248,113,113,0.1); color: var(--danger); }

/* ── Panda Rank ─────────────────────────────────────────────── */
.panda-rank-display { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }

.panda-rank-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 10px 18px;
    border-radius: 12px;
    flex-shrink: 0;
}

.panda-rank-badge.novice      { background: rgba(100,116,139,0.1); color: var(--text-muted); border: 1px solid var(--border); }
.panda-rank-badge.scholar     { background: var(--accent-glow); color: var(--accent); border: 1px solid rgba(56,189,248,0.25); }
.panda-rank-badge.expert      { background: rgba(251,191,36,0.1); color: #fbbf24; border: 1px solid rgba(251,191,36,0.25); }
.panda-rank-badge.grandmaster { background: rgba(139,92,246,0.1); color: #a78bfa; border: 1px solid rgba(139,92,246,0.25); }

.panda-rating-bar { flex: 1; min-width: 180px; }

.panda-master-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--accent);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
}

.panda-master-link:hover { text-decoration: underline; }

/* ── Utility Buttons ────────────────────────────────────────── */
.btn-text-link {
    font-size: 0.8rem;
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    white-space: nowrap;
}

.btn-text-link:hover { color: var(--chrome-text-act); }

.btn-core-outline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid var(--border);
    color: var(--text);
    background: var(--surface);
    transition: 0.18s;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

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

.btn-core-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    color: #0d1117;
    background: var(--accent);
    transition: 0.18s;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

.btn-core-primary:hover { background: #7dd3fc; color: #0d1117; }

/* ── Profile Responsive ─────────────────────────────────────── */
@media (max-width: 575.98px) {
    .profile-banner-body { padding: 0 1rem 1.25rem; gap: 1rem; }
    .profile-avatar { width: 84px; height: 84px; }
    .profile-avatar-wrap { margin-top: -42px; }
    .profile-name { font-size: 1.2rem; }
    .profile-hero-actions { width: 100%; }
}

/* ── Language Switcher ──────────────────────────────────────── */
.lang-switcher {
    display: flex;
    align-items: center;
    gap: 2px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2px;
    margin: 0;
}

.lang-btn {
    padding: 3px 10px;
    border: none;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    cursor: pointer;
    background: transparent;
    color: var(--chrome-text);
    transition: 0.15s;
    line-height: 1.6;
}

.lang-btn:hover { color: var(--text); background: var(--chrome); }

.lang-btn--active {
    background: var(--accent);
    color: #0d1117;
}

.lang-btn--active:hover { background: #7dd3fc; color: #0d1117; }

/* ═══════════════════════════════════════════════════════════════
   TUTORIALS
═══════════════════════════════════════════════════════════════ */

/* ── Category colour palette ─────────────────────────────────── */
:root {
    --cat-math:        #818cf8;
    --cat-science:     #34d399;
    --cat-programming: #38bdf8;
    --cat-language:    #fb923c;
    --cat-history:     #f59e0b;
    --cat-other:       #94a3b8;
}

/* ── Filter Pill Row ─────────────────────────────────────────── */
.tut-filter-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin: 0 -0.25rem;
    padding: 0 0.25rem;
}
.tut-filter-scroll::-webkit-scrollbar { display: none; }

.tut-filter-pills {
    display: flex;
    gap: 8px;
    white-space: nowrap;
    padding-bottom: 4px;
}

.tut-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    border-radius: 50px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 500;
    text-decoration: none;
    transition: 0.18s;
    cursor: pointer;
    flex-shrink: 0;
}
.tut-pill:hover { border-color: var(--accent); color: var(--accent); }
.tut-pill--active {
    background: var(--accent);
    border-color: var(--accent);
    color: #0d1117;
    font-weight: 600;
}
.tut-pill--active:hover { background: #7dd3fc; border-color: #7dd3fc; color: #0d1117; }

/* ── Tutorial Cards ──────────────────────────────────────────── */
.tut-card-link { display: block; }
.tut-card-link:hover .tut-card {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0,0,0,0.1);
    border-color: var(--accent);
}
.tut-card {
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

/* Thumbnail */
.tut-thumb {
    position: relative;
    width: 100%;
    height: 180px;
    overflow: hidden;
    flex-shrink: 0;
}
.tut-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}
.tut-card-link:hover .tut-thumb-img { transform: scale(1.04); }

/* Gradient fallback by category */
.tut-thumb-fb {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
}
.tut-thumb-fb--math        { background: linear-gradient(135deg, #312e81, #4338ca); color: var(--cat-math); }
.tut-thumb-fb--science     { background: linear-gradient(135deg, #064e3b, #047857); color: var(--cat-science); }
.tut-thumb-fb--programming { background: linear-gradient(135deg, #0c4a6e, #0369a1); color: var(--cat-programming); }
.tut-thumb-fb--language    { background: linear-gradient(135deg, #7c2d12, #c2410c); color: var(--cat-language); }
.tut-thumb-fb--history     { background: linear-gradient(135deg, #78350f, #b45309); color: var(--cat-history); }
.tut-thumb-fb--other       { background: linear-gradient(135deg, #1e293b, #334155); color: var(--cat-other); }

/* Category chip (on card + detail) */
.tut-cat-chip {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 20px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
}
/* Inside a thumbnail: float it as an overlay badge */
.tut-thumb .tut-cat-chip {
    position: absolute;
    top: 12px;
    left: 12px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.tut-cat-chip--math        { background: rgba(129,140,248,.22); color: var(--cat-math);        border: 1px solid rgba(129,140,248,.3); }
.tut-cat-chip--science     { background: rgba(52,211,153,.22);  color: var(--cat-science);     border: 1px solid rgba(52,211,153,.3); }
.tut-cat-chip--programming { background: rgba(56,189,248,.22);  color: var(--cat-programming); border: 1px solid rgba(56,189,248,.3); }
.tut-cat-chip--language    { background: rgba(251,146,60,.22);  color: var(--cat-language);    border: 1px solid rgba(251,146,60,.3); }
.tut-cat-chip--history     { background: rgba(245,158,11,.22);  color: var(--cat-history);     border: 1px solid rgba(245,158,11,.3); }
.tut-cat-chip--other       { background: rgba(148,163,184,.22); color: var(--cat-other);       border: 1px solid rgba(148,163,184,.3); }

/* Card text */
.tut-card-title {
    font-family: 'Syne', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.tut-card-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
}

/* Card footer */
.tut-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--border);
    gap: 8px;
}
.tut-card-author {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
}
.tut-mini-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, #38bdf8, #818cf8);
    display: grid;
    place-items: center;
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 0.6rem;
    color: #fff;
    flex-shrink: 0;
}
.tut-card-author-name {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tut-card-stats {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.72rem;
    color: var(--text-muted);
    flex-shrink: 0;
}
.tut-card-stats i { font-size: 0.75rem; }

/* ── Empty State ─────────────────────────────────────────────── */
.tut-empty-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--text-muted);
    margin: 0 auto;
}

/* ── Detail Page ─────────────────────────────────────────────── */

/* CSS scroll-driven reading progress bar */
.tut-read-progress {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    height: 3px;
    width: 100%;
    background: var(--accent);
    transform-origin: left;
    transform: scaleX(0);
    z-index: 1035;
    pointer-events: none;
}
@supports (animation-timeline: scroll()) {
    .tut-read-progress {
        animation: tut-prog-grow linear;
        animation-timeline: scroll(root);
    }
    @keyframes tut-prog-grow {
        from { transform: scaleX(0); }
        to   { transform: scaleX(1); }
    }
}

/* Hero card */
.tut-detail-hero {
    border-radius: 20px;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    position: relative;
}
.tut-detail-thumb {
    position: relative;
    width: 100%;
    height: clamp(200px, 32vw, 380px);
    overflow: hidden;
}
.tut-detail-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
}
.tut-detail-thumb-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(13,17,23,.6) 0%, transparent 60%);
}
.tut-detail-hero-body {
    padding: 1.75rem 2rem;
}
.tut-detail-hero-body--over {
    /* When there's a thumbnail, give a little less top padding */
    padding-top: 1.25rem;
}
.tut-detail-title {
    font-family: 'Syne', sans-serif;
    font-size: clamp(1.4rem, 3vw, 2rem);
    font-weight: 800;
    color: var(--text);
    line-height: 1.25;
    margin: 0 0 8px;
}
.tut-detail-subtitle {
    font-size: 1rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0 0 1.25rem;
    max-width: 640px;
}

/* Meta row */
.tut-detail-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.tut-detail-author {
    display: flex;
    align-items: center;
    gap: 12px;
}
.tut-detail-author-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}
.tut-detail-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 1px;
}
.tut-detail-meta-stats {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ── Prose (rich-text content display) ──────────────────────── */
.tut-prose {
    color: var(--text);
    font-size: 1rem;
    line-height: 1.8;
    max-width: 100%;
    word-break: break-word;
    overflow: hidden; /* hard-clip anything CKEditor injects wider than the column */
}

/* CKEditor wraps images in <figure class="image" style="width:Xpx"> —
   target both the figure AND the img so neither can escape the column. */
.tut-prose figure,
.tut-prose .image,
.tut-prose figure.image {
    max-width: 100% !important;
    width: auto !important;
    overflow: hidden;
    margin: 1rem auto;
}
.tut-prose h1,
.tut-prose h2,
.tut-prose h3,
.tut-prose h4 {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    color: var(--text);
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    line-height: 1.3;
}
.tut-prose h1 { font-size: 1.75rem; }
.tut-prose h2 { font-size: 1.4rem; border-bottom: 1px solid var(--border); padding-bottom: 0.4rem; }
.tut-prose h3 { font-size: 1.15rem; }
.tut-prose h4 { font-size: 1rem; }
.tut-prose p  { margin: 0 0 1.1rem; }
.tut-prose a  { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; }
.tut-prose a:hover { opacity: 0.8; }
.tut-prose ul,
.tut-prose ol {
    padding-left: 1.5rem;
    margin: 0 0 1.1rem;
}
.tut-prose li { margin-bottom: 0.35rem; }
.tut-prose blockquote {
    border-left: 4px solid var(--accent);
    background: rgba(56,189,248,.06);
    margin: 1.25rem 0;
    padding: 0.75rem 1.25rem;
    border-radius: 0 10px 10px 0;
    color: var(--text-muted);
    font-style: italic;
}
.tut-prose code {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.875em;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 2px 6px;
    color: var(--accent);
}
.tut-prose pre {
    background: #0d1117;
    border: 1px solid var(--chrome-border);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    overflow-x: auto;
    margin: 1.25rem 0;
    font-size: 0.875rem;
    line-height: 1.65;
}
.tut-prose pre code {
    background: none;
    border: none;
    padding: 0;
    color: #e2e8f0;
    font-size: inherit;
}
/* Force all prose images (including CKEditor inline w/h) to be responsive */
.tut-prose img,
.tut-prose figure img {
    max-width: 100% !important;
    width: auto !important;
    height: auto !important;
    max-height: 65vh;
    object-fit: contain;
    border-radius: 10px;
    border: 1px solid var(--border);
    margin: 1rem auto;
    display: block;
}
.tut-prose figure { margin: 1.5rem 0; }
.tut-prose figcaption {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 6px;
    font-style: italic;
}
.tut-prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.25rem 0;
    font-size: 0.9rem;
    border-radius: 10px;
    overflow: hidden;
}
.tut-prose th {
    background: var(--surface-2);
    font-weight: 600;
    padding: 10px 14px;
    text-align: left;
    border-bottom: 2px solid var(--border);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}
.tut-prose td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
}
.tut-prose tr:last-child td { border-bottom: none; }
.tut-prose tr:hover td { background: var(--surface-2); }
.tut-prose hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

/* MathJax display override */
.tut-prose .MJX-TEX { font-size: 1.05em; }
.tut-prose mjx-container[display="true"] {
    overflow-x: auto;
    padding: 0.5rem 0;
}

/* ── Related Tutorials Sidebar ───────────────────────────────── */
.tut-related-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--text);
    transition: background 0.15s;
}
.tut-related-item:hover { background: var(--surface-2); color: var(--text); }
.tut-related-thumb {
    width: 56px;
    height: 44px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--border);
}
.tut-related-thumb-fb {
    width: 56px;
    height: 44px;
    border-radius: 8px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}
.tut-related-body { min-width: 0; }
.tut-related-title {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    margin-bottom: 3px;
}
.tut-related-meta { font-size: 0.72rem; color: var(--text-muted); }

/* ── Like / Dislike Reaction Bar ─────────────────────────────── */
.tut-react-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 1.1rem 1.5rem;
    background: var(--surface-2);
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.tut-react-label {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    margin-right: 4px;
    flex-shrink: 0;
}

.tut-react-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 18px;
    border-radius: 50px;
    font-size: 0.88rem;
    font-weight: 600;
    border: 2px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.18s;
    text-decoration: none;
    line-height: 1;
    white-space: nowrap;
}
.tut-react-btn:hover { background: var(--surface); }
.tut-react-btn i { font-size: 1.1rem; line-height: 1; }

.tut-react-btn--like:hover {
    border-color: var(--online);
    color: var(--online);
    background: rgba(34,197,94,.06);
}
.tut-react-btn--like.tut-react-btn--on {
    border-color: var(--online);
    color: var(--online);
    background: rgba(34,197,94,.1);
}

.tut-react-btn--dislike:hover {
    border-color: var(--danger);
    color: var(--danger);
    background: rgba(248,113,113,.06);
}
.tut-react-btn--dislike.tut-react-btn--on {
    border-color: var(--danger);
    color: var(--danger);
    background: rgba(248,113,113,.1);
}

/* Hide form chrome — the button IS the form submit */
.tut-react-form { margin: 0; padding: 0; display: contents; }

/* Like count chip on list cards */
.tut-like-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    color: var(--online);
    font-weight: 600;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 575.98px) {
    .tut-detail-hero-body { padding: 1.1rem; }
    .tut-detail-title { font-size: 1.25rem; }
    .tut-prose { font-size: 0.93rem; }
    .tut-prose pre { padding: 0.85rem; font-size: 0.8rem; }
    .tut-prose h1 { font-size: 1.35rem; }
    .tut-prose h2 { font-size: 1.15rem; }
    .tut-detail-meta-stats { gap: 8px; font-size: 0.73rem; }
    .tut-react-bar { padding: 0.9rem 1rem; gap: 8px; }
    .tut-react-btn { padding: 7px 14px; font-size: 0.82rem; }
}
