
/* ─── 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;
    border-radius: 50%;
    overflow: hidden;
    display: grid; place-items: center;
    flex-shrink: 0;
}

.brand-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }

.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: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1.5px 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-info {
    padding: 7px 18px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1.5px solid var(--chrome-border);
    color: var(--chrome-text-act);
    background: transparent;
    transition: 0.18s;
    text-decoration: none;
    white-space: nowrap;
}
.btn-auth-primary {
    padding: 7px 18px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 700;
    border: none;
    background: var(--accent);
    color: #0d1117;
    transition: 0.18s;
    text-decoration: none;
    white-space: nowrap;
}

.btn-auth-primary:hover { background: #7dd3fc; color: #0d1117; }
.btn-auth-info:hover { background: #7dfc98; 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;
    }

    /* ── 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;
}
/* No-JS selected state: mirror .selected whenever the wrapped input is checked */
.choice-card:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-glow);
}
.choice-card:has(input:checked) .choice-check { background: var(--accent); border-color: var(--accent); }
.choice-card:has(input:checked) .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 20px;
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 600;
    border: 1.5px 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 20px;
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 700;
    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; }

.sidebar-lang {
    padding: 8px 14px;
    border-top: 1px solid var(--chrome-border);
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════
   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; }
}

/* ─── PWA Install Button + iOS Sheet ─────────────────────────────── */
.pwa-install-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    border-radius: 50px;
    font-size: 0.82rem;
    font-weight: 600;
    border: 1.5px solid var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
    cursor: pointer;
    transition: 0.18s;
    white-space: nowrap;
    flex-shrink: 0;
}

.pwa-install-btn:hover { background: var(--accent); color: #0d1117; }
.pwa-install-btn i { font-size: 0.95rem; }
.pwa-install-btn[hidden] { display: none; }

/* Tight screens: keep the icon, drop the word */
@media (max-width: 767.98px) {
    .pwa-install-btn { padding: 8px 10px; }
    .pwa-install-label { display: none; }
}

.pwa-sheet {
    position: fixed;
    inset: 0;
    z-index: 1080;
    background: rgba(0, 0, 0, 0.62);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 1rem;
}

.pwa-sheet[hidden] { display: none; }

@media (min-width: 576px) {
    .pwa-sheet { align-items: center; }
}

.pwa-sheet-card {
    position: relative;
    width: 100%;
    max-width: 430px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 1.5rem 1.4rem 1.2rem;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

.pwa-sheet-close {
    position: absolute;
    top: 12px; right: 12px;
    width: 32px; height: 32px;
    display: grid; place-items: center;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
}

.pwa-sheet-close:hover { background: var(--surface-2); color: var(--text); }

.pwa-sheet-head { display: flex; gap: 13px; align-items: flex-start; padding-right: 28px; }

.pwa-sheet-icon {
    width: 44px; height: 44px;
    flex-shrink: 0;
    display: grid; place-items: center;
    border-radius: 50%;
    overflow: hidden;
}

.pwa-sheet-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }

.pwa-sheet-head h2 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    margin: 2px 0 3px;
}

.pwa-sheet-head p { font-size: 0.83rem; color: var(--text-muted); margin: 0; }

.pwa-sheet-steps {
    list-style: none;
    margin: 1.25rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 11px;
}

.pwa-sheet-steps li {
    display: flex;
    gap: 11px;
    align-items: flex-start;
    font-size: 0.87rem;
    color: var(--text);
    line-height: 1.5;
}

.pwa-step-n {
    width: 23px; height: 23px;
    flex-shrink: 0;
    display: grid; place-items: center;
    border-radius: 50%;
    background: var(--accent-glow);
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 700;
    margin-top: 1px;
}

.pwa-step-icon { color: var(--accent); margin: 0 2px; }

.pwa-sheet-later {
    width: 100%;
    margin-top: 1.3rem;
    padding: 10px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.18s;
}

.pwa-sheet-later:hover { background: var(--surface-2); color: var(--text); }


/* ══════════════════════════════════════════════════════════════════
   PRIME ENGLISH — grammar-lesson component kit
   Used inside .tut-prose by the "Prime English" tutorials (PE-1 …).
   Pure CSS: every interaction is <details>/:hover, no JavaScript.
   Docs: tutorial/management/commands/STYLE_GUIDE_PRIME_ENGLISH.md
   ══════════════════════════════════════════════════════════════════ */

.tut-prose {
    --pe-s:    #2563eb;   /* subject      */
    --pe-v:    #16a34a;   /* main verb    */
    --pe-o:    #d97706;   /* object       */
    --pe-aux:  #8b5cf6;   /* auxiliary    */
    --pe-neg:  #e11d48;   /* negative     */
    --pe-adv:  #0891b2;   /* adverbial    */
    --pe-warn: #dc2626;
    --pe-ok:   #16a34a;
    --pe-tip:  #ca8a04;
}

/* ── Lesson goals card ─────────────────────────────────────────── */
.pe-goal {
    border: 1px solid var(--border);
    border-left: 5px solid var(--accent);
    background: linear-gradient(180deg, rgba(56,189,248,.07), transparent);
    border-radius: 0 14px 14px 0;
    padding: 1rem 1.2rem 0.6rem;
    margin: 1.2rem 0 1.6rem;
}
.pe-goal__title {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--accent);
    margin: 0 0 .5rem;
}
.pe-goal ul { margin: 0 0 .6rem; padding-left: 1.1rem; list-style: none; }
.pe-goal li { position: relative; padding-left: 1.4rem; margin-bottom: .3rem; }
.pe-goal li::before {
    content: '✓';
    position: absolute; left: 0; top: 0;
    color: var(--online); font-weight: 700;
}

/* ── Pattern strip: Subject + Verb + Object ────────────────────── */
.pe-formula {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    background: var(--surface-2);
    border: 1px dashed var(--border);
    border-radius: 14px;
    padding: 1rem .9rem;
    margin: 1.3rem 0;
    text-align: center;
}
.pe-formula__label {
    width: 100%;
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--text-muted);
    margin-bottom: .2rem;
}
.pe-chip {
    display: inline-block;
    padding: .35rem .8rem;
    border-radius: 9px;
    font-weight: 700;
    font-size: .88rem;
    line-height: 1.35;
    color: #fff;
    background: var(--text-muted);
    box-shadow: 0 2px 6px rgba(15,23,42,.12);
}
.pe-chip--s   { background: var(--pe-s); }
.pe-chip--v   { background: var(--pe-v); }
.pe-chip--o   { background: var(--pe-o); }
.pe-chip--aux { background: var(--pe-aux); }
.pe-chip--neg { background: var(--pe-neg); }
.pe-chip--adv { background: var(--pe-adv); }
.pe-chip--opt {
    background: transparent;
    color: var(--text-muted);
    border: 1px dashed var(--border);
    font-weight: 600;
}
.pe-op {
    font-weight: 700;
    color: var(--text-muted);
    font-size: 1rem;
    padding: 0 .1rem;
}

/* ── Example sentences with colour-coded parts ─────────────────── */
.pe-ex {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    padding: .9rem 1.1rem;
    margin: 1.1rem 0;
}
.pe-ex + .pe-ex { margin-top: -.4rem; }
.pe-ex__en { font-size: 1.02rem; margin: 0 0 .25rem; color: var(--text); }
.pe-ex__uz { font-size: .85rem; color: var(--text-muted); font-style: italic; margin: 0; }
.pe-ex__why {
    margin: .45rem 0 0;
    font-size: .82rem;
    color: var(--text-muted);
    border-top: 1px dashed var(--border);
    padding-top: .45rem;
}
.pe-hl { font-weight: 700; border-bottom: 2px solid currentColor; padding-bottom: 1px; }
.pe-hl--s   { color: var(--pe-s); }
.pe-hl--v   { color: var(--pe-v); }
.pe-hl--o   { color: var(--pe-o); }
.pe-hl--aux { color: var(--pe-aux); }
.pe-hl--neg { color: var(--pe-neg); }
.pe-hl--adv { color: var(--pe-adv); }

/* Colour legend */
.pe-legend {
    display: flex; flex-wrap: wrap; gap: .4rem .9rem;
    font-size: .74rem; color: var(--text-muted);
    margin: .6rem 0 1.2rem;
}
.pe-legend span { display: inline-flex; align-items: center; gap: .35rem; }
.pe-legend i {
    width: 10px; height: 10px; border-radius: 3px; display: inline-block;
    font-style: normal;
}

/* ── Callouts: Uzbek note, tip, warning ────────────────────────── */
.pe-call {
    position: relative;
    border-radius: 14px;
    padding: .85rem 1.1rem .85rem 3rem;
    margin: 1.2rem 0;
    font-size: .93rem;
    line-height: 1.7;
    border: 1px solid var(--border);
    background: var(--surface-2);
}
.pe-call::before {
    position: absolute;
    left: 1rem; top: .8rem;
    font-size: 1.1rem;
    line-height: 1.2;
}
.pe-call p:last-child { margin-bottom: 0; }
.pe-call__t {
    display: block;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    margin-bottom: .2rem;
}

.pe-uz   { background: rgba(34,197,94,.07);  border-color: rgba(34,197,94,.35); }
.pe-uz::before   { content: '🇺🇿'; }
.pe-uz .pe-call__t   { color: var(--online); }

.pe-tip  { background: rgba(202,138,4,.08);  border-color: rgba(202,138,4,.35); }
.pe-tip::before  { content: '💡'; }
.pe-tip .pe-call__t  { color: var(--pe-tip); }

.pe-warn { background: rgba(220,38,38,.06);  border-color: rgba(220,38,38,.3); }
.pe-warn::before { content: '⚠️'; }
.pe-warn .pe-call__t { color: var(--pe-warn); }

.pe-rule { background: rgba(56,189,248,.07); border-color: rgba(56,189,248,.35); }
.pe-rule::before { content: '📌'; }
.pe-rule .pe-call__t { color: var(--accent); }

/* ── Wrong ✗ / Right ✓ pairs ───────────────────────────────────── */
.pe-fix { margin: 1rem 0; display: flex; flex-direction: column; gap: .4rem; }
.pe-bad, .pe-good {
    display: flex; align-items: flex-start; gap: .55rem;
    padding: .5rem .8rem;
    border-radius: 10px;
    font-size: .95rem;
}
.pe-bad  { background: rgba(220,38,38,.07); color: var(--text); }
.pe-good { background: rgba(22,163,74,.08);  color: var(--text); }
.pe-bad::before  { content: '✗'; color: var(--pe-warn); font-weight: 800; }
.pe-good::before { content: '✓'; color: var(--pe-ok);   font-weight: 800; }
.pe-bad s { text-decoration-color: var(--pe-warn); }

/* ── Tense timeline ────────────────────────────────────────────── */
.pe-timeline {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 2.4rem 1.2rem 1rem;
    margin: 1.4rem 0;
}
.pe-tl-track {
    position: relative;
    height: 4px;
    background: var(--border);
    border-radius: 99px;
}
.pe-tl-track::after {
    content: '';
    position: absolute; right: -6px; top: 50%;
    transform: translateY(-50%);
    border-left: 9px solid var(--border);
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
}
.pe-tl-now {
    position: absolute; top: -16px; bottom: -16px;
    width: 2px; background: var(--danger);
}
.pe-tl-now::after {
    content: 'NOW';
    position: absolute; top: -18px; left: 50%;
    transform: translateX(-50%);
    font-size: .62rem; font-weight: 800; letter-spacing: .1em;
    color: var(--danger);
    /* the parent is a 2px-wide line — without this the label breaks one letter per row */
    white-space: nowrap;
}
.pe-tl-band {
    position: absolute; top: -5px; height: 14px;
    background: var(--accent-glow);
    border: 1.5px solid var(--accent);
    border-radius: 99px;
}
.pe-tl-dot {
    position: absolute; top: 50%;
    width: 14px; height: 14px; margin-left: -7px;
    transform: translateY(-50%);
    border-radius: 50%;
    background: var(--accent);
    border: 3px solid var(--surface);
    box-shadow: 0 0 0 2px var(--accent);
}
.pe-tl-dot--x { background: var(--danger); box-shadow: 0 0 0 2px var(--danger); }
.pe-tl-tag {
    position: absolute; top: -30px;
    transform: translateX(-50%);
    font-size: .72rem; font-weight: 600; color: var(--text);
    white-space: nowrap;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 1px 7px;
}
.pe-tl-foot {
    display: flex; justify-content: space-between;
    margin-top: .9rem;
    font-size: .68rem; letter-spacing: .1em; text-transform: uppercase;
    color: var(--text-muted);
}

/* ── Two-column comparison ─────────────────────────────────────── */
.pe-vs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: .8rem;
    margin: 1.3rem 0;
}
.pe-vs__card {
    border: 1px solid var(--border);
    border-top: 4px solid var(--accent);
    border-radius: 14px;
    background: var(--surface);
    padding: .9rem 1rem;
}
.pe-vs__card--alt { border-top-color: var(--pe-o); }
.pe-vs__h {
    font-family: 'Syne', sans-serif;
    font-weight: 700; font-size: .95rem;
    margin: 0 0 .5rem; color: var(--text);
}
.pe-vs__card p, .pe-vs__card li { font-size: .9rem; }
.pe-vs__card ul { padding-left: 1.1rem; margin-bottom: 0; }

/* ── Mini-card grid (uses of a tense, verb lists, …) ───────────── */
.pe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: .75rem;
    margin: 1.2rem 0;
}
.pe-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-2);
    padding: .8rem .95rem;
    transition: .18s;
}
.pe-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.pe-card__h {
    display: flex; align-items: center; gap: .4rem;
    font-weight: 700; font-size: .88rem; color: var(--text);
    margin-bottom: .3rem;
}
.pe-card__n {
    flex: 0 0 22px; height: 22px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: var(--accent-glow); color: var(--accent);
    font-size: .72rem; font-weight: 800;
}
.pe-card p { font-size: .85rem; margin: 0; color: var(--text-muted); line-height: 1.6; }
.pe-card em { color: var(--text); font-style: normal; font-weight: 600; }

/* ── Numbered steps ────────────────────────────────────────────── */
.pe-steps { list-style: none; padding: 0; margin: 1.2rem 0; counter-reset: pe-step; }
/* darslar ikki xil yozilgan: <ol class="pe-steps"> va
   <div class="pe-steps"><ol> — ikkalasi ham qoʻllab-quvvatlanadi */
.pe-steps > ol, .pe-steps > ul { list-style: none; padding: 0; margin: 0; }
.pe-steps > li,
.pe-steps > ol > li,
.pe-steps > ul > li {
    position: relative;
    counter-increment: pe-step;
    padding: .1rem 0 .9rem 2.6rem;
    border-left: 2px dashed var(--border);
    margin-left: .85rem;
}
.pe-steps > li:last-child,
.pe-steps > ol > li:last-child,
.pe-steps > ul > li:last-child { border-left-color: transparent; padding-bottom: 0; }
.pe-steps > li::before,
.pe-steps > ol > li::before,
.pe-steps > ul > li::before {
    content: counter(pe-step);
    position: absolute; left: -.9rem; top: -.15rem;
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: var(--accent); color: #fff;
    font-size: .8rem; font-weight: 800;
    box-shadow: 0 0 0 4px var(--surface);
}

/* ── Practice / quiz with tap-to-reveal answer ─────────────────── */
.pe-quiz {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-2);
    padding: .9rem 1.1rem;
    margin: .8rem 0;
}
.pe-quiz__q { margin: 0 0 .6rem; font-weight: 600; color: var(--text); }
.pe-quiz__n {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; margin-right: .45rem;
    border-radius: 50%;
    background: var(--accent); color: #fff;
    font-size: .72rem; font-weight: 800;
}

.pe-reveal { margin: 0; }
.pe-reveal > summary {
    display: inline-flex; align-items: center; gap: .4rem;
    list-style: none; cursor: pointer;
    padding: .3rem .85rem;
    border-radius: 99px;
    border: 1px solid var(--accent);
    color: var(--accent);
    background: transparent;
    font-size: .78rem; font-weight: 700;
    transition: .18s;
    -webkit-tap-highlight-color: transparent;
}
.pe-reveal > summary::-webkit-details-marker { display: none; }
.pe-reveal > summary::before { content: '👁'; font-size: .85rem; }
.pe-reveal > summary:hover { background: var(--accent); color: #fff; }
.pe-reveal[open] > summary { background: var(--accent); color: #fff; margin-bottom: .6rem; }
.pe-reveal[open] > summary::before { content: '✓'; }
.pe-reveal__a {
    border-left: 3px solid var(--online);
    background: rgba(34,197,94,.06);
    border-radius: 0 10px 10px 0;
    padding: .7rem 1rem;
    font-size: .9rem;
}
.pe-reveal__a p:last-child { margin-bottom: 0; }
.pe-reveal__a strong { color: var(--online); }

/* Inline reveal inside a sentence */
.pe-peek { display: inline-block; }
.pe-peek > summary {
    display: inline; list-style: none; cursor: pointer;
    border-bottom: 2px dashed var(--accent);
    color: var(--accent); font-weight: 600;
}
.pe-peek > summary::-webkit-details-marker { display: none; }
.pe-peek[open] > summary { display: none; }
.pe-peek__a { color: var(--online); font-weight: 700; }

/* Gap-fill blank */
.pe-blank {
    display: inline-block;
    min-width: 62px;
    border-bottom: 2px solid var(--accent);
    text-align: center;
    color: var(--text-muted);
}

/* ── Key words glossary ────────────────────────────────────────── */
.pe-gloss {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
    gap: .4rem;
    margin: 1.1rem 0;
    padding: 0;
    list-style: none;
}
.pe-gloss li {
    display: flex; align-items: baseline; gap: .5rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: .45rem .7rem;
    font-size: .87rem;
    margin: 0;
}
/* `.tut-prose` sets word-break:break-word, which chopped Prime Math's longer
   terms mid-word ("Koʻpaytuv / chi"). A term may wrap between its words, never
   inside one. */
.pe-gloss b {
    color: var(--text);
    font-weight: 700;
    word-break: keep-all;
    overflow-wrap: normal;
}
.pe-gloss span { color: var(--text-muted); margin-left: auto; text-align: right; }
@media (max-width: 767.98px) {
    .pe-gloss li { flex-direction: column; align-items: flex-start; gap: .15rem; }
    .pe-gloss span { margin-left: 0; text-align: left; }
}

/* ── Recap card ────────────────────────────────────────────────── */
.pe-recap {
    border: 1px solid var(--accent);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(56,189,248,.09), transparent 70%);
    padding: 1.1rem 1.3rem .6rem;
    margin: 1.6rem 0 1rem;
}
.pe-recap__t {
    font-family: 'Syne', sans-serif;
    font-weight: 800; font-size: 1rem;
    color: var(--text); margin: 0 0 .6rem;
    display: flex; align-items: center; gap: .45rem;
}
.pe-recap ul { padding-left: 1.2rem; margin-bottom: .6rem; }
.pe-recap li { margin-bottom: .35rem; }

/* ── Table wrapper (mobile scroll) ─────────────────────────────── */
/* The wrapper scrolls, so on a phone the TABLE has to be allowed to grow wider
   than it. `.tut-prose table` and `.pm-word` both set width:100%, which pinned
   the table to the screen — so instead of overflowing, the browser squeezed the
   flexible columns down to their minimum, and `.tut-prose`'s
   word-break:break-word then chopped those columns one character per line
   (PM-50's "k va b nimani bildiradi" read vertically on a phone).
   Desktop keeps width:100% — at that size the squeeze is harmless and a
   scrollbar would be noise. The grow-and-scroll behaviour is scoped to narrow
   SCREENS in the media query at the end of this block. */
.pe-table-wrap { overflow-x: auto; margin: 1.2rem 0; -webkit-overflow-scrolling: touch; }
/* Wide enough to fit: behave exactly as before — fill the column, no scroll. */
.pe-table-wrap table { margin: 0; width: 100%; }
/* A cell wraps between its words, never inside one. Undoes the break-word
   that `.tut-prose` sets for CKEditor content. */
.pe-table-wrap th,
.pe-table-wrap td {
    word-break: normal;
    overflow-wrap: normal;
}
/* `screen` is load-bearing: an unqualified media query also matches PRINT, and
   the A5 printed book (~559px) would match this width — a max-content table
   inside print_sheet.css's `overflow: visible` wrapper would then bleed off
   the page. Paper always gets the width:100% version above. */
@media screen and (max-width: 767.98px) {
    .pe-table-wrap table {
        width: max-content;   /* as wide as the content actually needs */
        min-width: 100%;      /* but never narrower than the wrapper */
        max-width: 42rem;     /* and never so wide the phone scrolls forever */
    }
}

/* ── Level badge ───────────────────────────────────────────────── */
.pe-badge {
    display: inline-block;
    padding: .18rem .6rem;
    border-radius: 99px;
    font-size: .68rem; font-weight: 800;
    letter-spacing: .06em; text-transform: uppercase;
    background: var(--accent-glow); color: var(--accent);
    border: 1px solid rgba(56,189,248,.4);
}

/* ── Mobile ────────────────────────────────────────────────────── */
@media (max-width: 575.98px) {
    .pe-formula { padding: .85rem .6rem; gap: .35rem; }
    .pe-chip { font-size: .8rem; padding: .3rem .6rem; }
    .pe-call { padding: .75rem .9rem .75rem 2.7rem; font-size: .89rem; }
    .pe-timeline { padding: 2.2rem .8rem .9rem; }
    .pe-tl-tag { font-size: .65rem; }
    .pe-goal { padding: .85rem 1rem .5rem; }
    .pe-gloss { grid-template-columns: 1fr; }
    .pe-steps > li { padding-left: 2.3rem; }
}

/* ══════════════════════════════════════════════════════════════════
   PRIME KOREAN — Korean-lesson component kit  (pk-*)
   Used inside .tut-prose by the "Prime Korean" tutorials (PK-1 …).
   EXTENDS the Prime English kit above — pe-goal, pe-formula, pe-chip,
   pe-call, pe-fix, pe-quiz, pe-reveal, pe-gloss, pe-recap, pe-grid,
   pe-vs, pe-steps and pe-table-wrap are all reused as-is. Only the
   things Korean needs and English does not live here.
   Pure CSS: every interaction is <details>/:hover, no JavaScript.
   Docs: tutorial/management/commands/STYLE_GUIDE_PRIME_KOREAN.md
   ══════════════════════════════════════════════════════════════════ */

.tut-prose {
    --pk-ko:   #7c3aed;   /* Korean text accent        */
    --pk-par:  #0891b2;   /* particle / qoʻshimcha     */
    --pk-stem: #2563eb;   /* verb stem / oʻzak         */
    --pk-end:  #16a34a;   /* ending / qoʻshimcha shakl */
    --pk-ini:  #2563eb;   /* 초성 initial              */
    --pk-med:  #d97706;   /* 중성 medial vowel         */
    --pk-fin:  #e11d48;   /* 종성 final / 받침         */
}

/* Korean glyphs need more line height and a font that actually has Hangul. */
.tut-prose :lang(ko),
.pk-ko, .pe-ex__ko, .pk-hangul__ch, .pk-block__cell, .pk-conj td:first-child {
    font-family: "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic",
                 "Nanum Gothic", var(--font-body, sans-serif);
    word-break: keep-all;
}

/* Korean sentence line inside a .pe-ex block (sits where .pe-ex__en does). */
.pe-ex__ko {
    font-size: 1.12rem;
    line-height: 1.75;
    margin: 0 0 .3rem;
    color: var(--text);
}
/* Romanisation line — early lessons only. */
.pe-ex__rom {
    font-size: .8rem;
    letter-spacing: .02em;
    color: var(--pk-ko);
    margin: 0 0 .2rem;
    opacity: .85;
}

/* Inline Korean chunk with its Uzbek gloss underneath, used mid-sentence. */
.pk-w {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    vertical-align: baseline;
    margin: 0 .15rem;
}
.pk-w b { font-weight: 700; color: var(--text); line-height: 1.3; }
.pk-w span { font-size: .68rem; color: var(--text-muted); line-height: 1.2; }

/* ── Alphabet cards — one letter per tile ───────────────────────── */
.pk-hangul {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
    gap: .55rem;
    margin: 1.2rem 0;
}
.pk-hangul__c {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-soft, rgba(127,127,127,.05));
    padding: .7rem .4rem .55rem;
    text-align: center;
    transition: border-color .15s ease, transform .15s ease;
}
.pk-hangul__c:hover { border-color: var(--accent); transform: translateY(-2px); }
.pk-hangul__ch {
    display: block;
    font-size: 2.1rem;
    line-height: 1.1;
    font-weight: 600;
    color: var(--text);
}
.pk-hangul__rom {
    display: block;
    font-size: .82rem; font-weight: 700;
    color: var(--pk-ko);
    margin-top: .25rem;
}
.pk-hangul__uz {
    display: block;
    font-size: .72rem;
    color: var(--text-muted);
    line-height: 1.35;
}

/* ── Syllable block diagram — 초성 / 중성 / 종성 ─────────────────── */
.pk-block {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: .5rem;
    margin: 1.2rem 0;
    padding: 1rem .7rem;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-soft, rgba(127,127,127,.05));
}
.pk-block__cell {
    min-width: 54px;
    padding: .45rem .5rem;
    border-radius: 10px;
    text-align: center;
    font-size: 1.5rem; font-weight: 600;
    color: #fff;
}
.pk-block__cell small {
    display: block;
    font-size: .6rem; font-weight: 700;
    letter-spacing: .04em;
    opacity: .9;
}
.pk-block__cell--i { background: var(--pk-ini); }
.pk-block__cell--m { background: var(--pk-med); }
.pk-block__cell--f { background: var(--pk-fin); }
.pk-block__eq { font-size: 1.3rem; font-weight: 700; color: var(--text-muted); }
.pk-block__out {
    font-size: 2.2rem; font-weight: 700;
    color: var(--text);
    padding: 0 .3rem;
}

/* ── 받침 switch — the "does it end in a consonant?" fork ────────── */
.pk-batchim {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .6rem;
    margin: 1.2rem 0;
}
.pk-batchim__side {
    border: 1px solid var(--border);
    border-top: 3px solid var(--pk-fin);
    border-radius: 12px;
    padding: .8rem .9rem;
    background: var(--bg-soft, rgba(127,127,127,.05));
}
.pk-batchim__side--no { border-top-color: var(--pk-med); }
.pk-batchim__h {
    font-size: .78rem; font-weight: 800;
    letter-spacing: .03em; text-transform: uppercase;
    color: var(--pk-fin);
    margin: 0 0 .45rem;
}
.pk-batchim__side--no .pk-batchim__h { color: var(--pk-med); }
.pk-batchim__form {
    font-size: 1.25rem; font-weight: 700;
    color: var(--text);
    margin: 0 0 .3rem;
}
.pk-batchim__side p { font-size: .85rem; color: var(--text-muted); margin: 0 0 .25rem; }
.pk-batchim__side p:last-child { margin-bottom: 0; }

/* ── Conjugation ladder — stem + ending → result ─────────────────── */
.pk-conj {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 1.2rem 0;
    font-size: .92rem;
}
.pk-conj th {
    font-size: .7rem; font-weight: 800;
    letter-spacing: .05em; text-transform: uppercase;
    color: var(--text-muted);
    text-align: left;
    padding: .4rem .6rem;
    border-bottom: 1px solid var(--border);
}
.pk-conj td {
    padding: .5rem .6rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}
.pk-conj tr:last-child td { border-bottom: none; }
.pk-conj .pk-stem { color: var(--pk-stem); font-weight: 700; }
.pk-conj .pk-end  { color: var(--pk-end);  font-weight: 700; }
.pk-conj .pk-res  { font-weight: 700; }
.pk-conj .pk-uz   { color: var(--text-muted); font-size: .82rem; font-style: italic; }

/* Same colours usable inline in running text. */
.pk-stem { color: var(--pk-stem); font-weight: 700; }
.pk-end  { color: var(--pk-end);  font-weight: 700; }
.pk-par  { color: var(--pk-par);  font-weight: 700; }

/* ── Speech-level ladder — 반말 → 해요체 → 합니다체 ───────────────── */
.pk-level { margin: 1.2rem 0; display: flex; flex-direction: column; gap: .4rem; }
.pk-level__row {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .6rem .8rem;
    border: 1px solid var(--border);
    border-left: 4px solid var(--pk-ko);
    border-radius: 10px;
    background: var(--bg-soft, rgba(127,127,127,.05));
}
.pk-level__row--1 { border-left-color: #94a3b8; }
.pk-level__row--2 { border-left-color: var(--pk-med); }
.pk-level__row--3 { border-left-color: var(--pk-stem); }
.pk-level__row--4 { border-left-color: var(--pk-fin); }
.pk-level__name {
    min-width: 88px;
    font-size: .78rem; font-weight: 800;
    color: var(--text-muted);
}
.pk-level__ko { font-size: 1.05rem; font-weight: 700; color: var(--text); }
.pk-level__who { font-size: .78rem; color: var(--text-muted); margin-left: auto; text-align: right; }

/* ── Pronunciation arrow — written form → spoken form ────────────── */
.pk-say {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
    margin: .8rem 0;
    padding: .6rem .85rem;
    border: 1px dashed var(--border);
    border-radius: 10px;
    font-size: 1.05rem;
}
.pk-say__from { color: var(--text); font-weight: 600; }
.pk-say__arrow { color: var(--pk-ko); font-weight: 800; }
.pk-say__to { color: var(--pk-ko); font-weight: 700; }
.pk-say__why { font-size: .78rem; color: var(--text-muted); font-style: italic; margin-left: auto; }

/* ── Mobile ────────────────────────────────────────────────────── */
@media (max-width: 575.98px) {
    .pk-batchim { grid-template-columns: 1fr; }
    .pk-hangul { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: .4rem; }
    .pk-hangul__ch { font-size: 1.8rem; }
    .pk-block { gap: .35rem; padding: .8rem .5rem; }
    .pk-block__cell { min-width: 44px; font-size: 1.25rem; }
    .pk-block__out { font-size: 1.8rem; }
    .pk-level__row { flex-wrap: wrap; gap: .35rem .6rem; }
    .pk-level__who { margin-left: 0; width: 100%; text-align: left; }
    .pk-say { font-size: .95rem; }
    .pk-say__why { margin-left: 0; width: 100%; }
    .pk-conj { font-size: .85rem; }
    .pk-conj td, .pk-conj th { padding: .4rem .35rem; }
}


/* ══════════════════════════════════════════════════════════════════
   PRIME RUSSIAN — Russian-lesson component kit  (pr-*)
   Used inside .tut-prose by the "Prime Russian" tutorials (PR-1 …).
   EXTENDS the Prime English kit above — pe-goal, pe-formula, pe-chip,
   pe-call, pe-fix, pe-quiz, pe-reveal, pe-gloss, pe-recap, pe-grid,
   pe-vs, pe-steps, pe-timeline and pe-table-wrap are all reused as-is.
   Only the things Russian needs and English/Korean do not live here.

   Russian forks on THREE axes that no other course on the site has:
     род      (m / f / n)          -> .pr-gender
     падеж    (six cases)          -> .pr-case, .pr-decl
     вид      (НСВ / СВ)           -> .pr-aspect
   plus ударение, which changes meaning -> .pr-stress, .pr-pair
   Pure CSS: every interaction is <details>/:hover, no JavaScript.
   Docs: tutorial/management/commands/STYLE_GUIDE_PRIME_RUSSIAN.md
   ══════════════════════════════════════════════════════════════════ */

.tut-prose {
    --pr-ru:   #b91c1c;   /* Russian text accent (matches the Russian shelf) */
    --pr-stem: #2563eb;   /* oʻzak / основа           */
    --pr-end:  #16a34a;   /* qoʻshimcha / окончание   */
    --pr-prep: #0891b2;   /* predlog / предлог        */
    --pr-m:    #2563eb;   /* мужской род              */
    --pr-f:    #db2777;   /* женский род              */
    --pr-n:    #d97706;   /* средний род              */
    --pr-nsv:  #d97706;   /* НСВ — jarayon            */
    --pr-sv:   #16a34a;   /* СВ  — natija             */
}

/* Cyrillic wants a face that actually has it, and a touch more leading. */
.tut-prose :lang(ru),
.pr-ru, .pe-ex__ru, .pr-cyr__ch, .pr-decl td:first-child, .pr-case__word {
    font-family: "PT Sans", "Noto Sans", "Segoe UI", "Helvetica Neue",
                 var(--font-body, sans-serif);
}

/* Russian sentence line inside a .pe-ex block (sits where .pe-ex__en does). */
.pe-ex__ru {
    font-size: 1.12rem;
    line-height: 1.75;
    margin: 0 0 .3rem;
    color: var(--text);
}
/* .pe-ex__rom is reused for the "oʻqilishi" line — [мълако́] — see the pk kit. */

/* Inline Russian chunk with its Uzbek gloss underneath, used mid-sentence. */
.pr-w {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    vertical-align: baseline;
    margin: 0 .15rem;
}
.pr-w b { font-weight: 700; color: var(--text); line-height: 1.3; }
.pr-w span { font-size: .68rem; color: var(--text-muted); line-height: 1.2; }

/* ── Alphabet cards — one letter per tile ────────────────────────
   Three families, because that is exactly how a Cyrillic-literate
   Uzbek pupil meets the Russian alphabet:
     --same  the letter looks like Latin AND sounds like it   (А К М О Т)
     --false FALSE FRIEND: looks Latin, sounds different      (В Н Р С У Х)
     --new   a brand-new shape                                (Б Г Д Ж З …) */
.pr-cyr {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: .55rem;
    margin: 1.2rem 0;
}
.pr-cyr__c {
    border: 1px solid var(--border);
    border-top: 3px solid var(--pr-ru);
    border-radius: 12px;
    background: var(--bg-soft, rgba(127,127,127,.05));
    padding: .7rem .4rem .55rem;
    text-align: center;
    transition: border-color .15s ease, transform .15s ease;
}
.pr-cyr__c:hover { border-color: var(--accent); transform: translateY(-2px); }
.pr-cyr__c--same  { border-top-color: #16a34a; }
.pr-cyr__c--false { border-top-color: #e11d48; }
.pr-cyr__c--new   { border-top-color: #2563eb; }
.pr-cyr__ch {
    display: block;
    font-size: 1.85rem;
    line-height: 1.15;
    font-weight: 600;
    color: var(--text);
    letter-spacing: .04em;
}
.pr-cyr__rom {
    display: block;
    font-size: .82rem; font-weight: 700;
    color: var(--pr-ru);
    margin-top: .25rem;
}
.pr-cyr__uz {
    display: block;
    font-size: .72rem;
    color: var(--text-muted);
    line-height: 1.35;
}
/* Warning triangle on the false friends, so the eye finds them instantly. */
.pr-cyr__c--false .pr-cyr__rom::before { content: "⚠ "; }

/* ── Gender fork — the Russian equivalent of the 받침 switch ─────
   Every noun, adjective, past-tense verb and possessive branches here. */
.pr-gender {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .6rem;
    margin: 1.2rem 0;
}
.pr-gender__side {
    border: 1px solid var(--border);
    border-top: 3px solid var(--pr-m);
    border-radius: 12px;
    padding: .8rem .9rem;
    background: var(--bg-soft, rgba(127,127,127,.05));
}
.pr-gender__side--f { border-top-color: var(--pr-f); }
.pr-gender__side--n { border-top-color: var(--pr-n); }
.pr-gender__h {
    font-size: .78rem; font-weight: 800;
    letter-spacing: .03em; text-transform: uppercase;
    color: var(--pr-m);
    margin: 0 0 .45rem;
}
.pr-gender__side--f .pr-gender__h { color: var(--pr-f); }
.pr-gender__side--n .pr-gender__h { color: var(--pr-n); }
.pr-gender__form {
    font-size: 1.25rem; font-weight: 700;
    color: var(--text);
    margin: 0 0 .3rem;
}
.pr-gender__side p { font-size: .85rem; color: var(--text-muted); margin: 0 0 .25rem; }
.pr-gender__side p:last-child { margin-bottom: 0; }

/* ── Case table — the six падежи with their question words ──────── */
.pr-case {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 1.2rem 0;
    font-size: .92rem;
}
.pr-case th {
    font-size: .7rem; font-weight: 800;
    letter-spacing: .05em; text-transform: uppercase;
    color: var(--text-muted);
    text-align: left;
    padding: .4rem .6rem;
    border-bottom: 1px solid var(--border);
}
.pr-case td {
    padding: .5rem .6rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: top;
}
.pr-case tr:last-child td { border-bottom: none; }
.pr-case__name { font-weight: 700; white-space: nowrap; }
.pr-case__q    { color: var(--pr-prep); font-weight: 700; white-space: nowrap; }
.pr-case__word { font-weight: 600; }
.pr-case__uz   { color: var(--text-muted); font-size: .82rem; font-style: italic; }
/* Highlight the one case the lesson is actually about. */
.pr-case tr.pr-case__on td { background: rgba(185,28,28,.07); }
.pr-case tr.pr-case__on .pr-case__name { color: var(--pr-ru); }

/* ── Declension / conjugation ladder — stem + ending → result ───── */
.pr-decl {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 1.2rem 0;
    font-size: .92rem;
}
.pr-decl th {
    font-size: .7rem; font-weight: 800;
    letter-spacing: .05em; text-transform: uppercase;
    color: var(--text-muted);
    text-align: left;
    padding: .4rem .6rem;
    border-bottom: 1px solid var(--border);
}
.pr-decl td {
    padding: .5rem .6rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}
.pr-decl tr:last-child td { border-bottom: none; }
.pr-decl .pr-stem { color: var(--pr-stem); font-weight: 700; }
.pr-decl .pr-end  { color: var(--pr-end);  font-weight: 700; }
.pr-decl .pr-res  { font-weight: 700; }
.pr-decl .pr-uz   { color: var(--text-muted); font-size: .82rem; font-style: italic; }

/* Same colours usable inline in running text. */
.pr-stem { color: var(--pr-stem); font-weight: 700; }
.pr-end  { color: var(--pr-end);  font-weight: 700; }
.pr-prep { color: var(--pr-prep); font-weight: 700; }

/* ── Aspect pair — НСВ (jarayon) vs СВ (natija) ─────────────────── */
.pr-aspect {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .6rem;
    margin: 1.2rem 0;
}
.pr-aspect__side {
    border: 1px solid var(--border);
    border-left: 4px solid var(--pr-nsv);
    border-radius: 12px;
    padding: .8rem .9rem;
    background: var(--bg-soft, rgba(127,127,127,.05));
}
.pr-aspect__side--sv { border-left-color: var(--pr-sv); }
.pr-aspect__h {
    font-size: .78rem; font-weight: 800;
    letter-spacing: .03em; text-transform: uppercase;
    color: var(--pr-nsv);
    margin: 0 0 .45rem;
}
.pr-aspect__side--sv .pr-aspect__h { color: var(--pr-sv); }
.pr-aspect__v {
    font-size: 1.2rem; font-weight: 700;
    color: var(--text);
    margin: 0 0 .3rem;
}
.pr-aspect__side p { font-size: .85rem; color: var(--text-muted); margin: 0 0 .25rem; }
.pr-aspect__side p:last-child { margin-bottom: 0; }

/* ── Pronunciation arrow — yozilishi → oʻqilishi ─────────────────
   Russian needs this constantly: аканье, иканье, оглушение. */
.pr-say {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
    margin: .8rem 0;
    padding: .6rem .85rem;
    border: 1px dashed var(--border);
    border-radius: 10px;
    font-size: 1.05rem;
}
.pr-say__from  { color: var(--text); font-weight: 600; }
.pr-say__arrow { color: var(--pr-ru); font-weight: 800; }
.pr-say__to    { color: var(--pr-ru); font-weight: 700; }
.pr-say__why   { font-size: .78rem; color: var(--text-muted); font-style: italic; margin-left: auto; }

/* ── Stress — the vowel that carries ударение ───────────────────
   Inline: за<span class="pr-stress">о</span>мок  (use the ́ mark in text too). */
.pr-stress {
    color: var(--pr-ru);
    font-weight: 800;
    border-bottom: 2px solid var(--pr-ru);
}
/* Minimal pair box — за́мок (qulf) vs замо́к (qasr). */
.pr-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .6rem;
    margin: 1.1rem 0;
}
.pr-pair__c {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: .75rem .9rem;
    background: var(--bg-soft, rgba(127,127,127,.05));
    text-align: center;
}
.pr-pair__w {
    display: block;
    font-size: 1.4rem; font-weight: 700;
    color: var(--text);
    margin-bottom: .2rem;
}
.pr-pair__uz { display: block; font-size: .82rem; color: var(--text-muted); }

/* ── Two aliases the Prime lessons already write ───────────────────
   `pe-vs__side` is what the Prime Russian/Korean lessons use instead of
   `pe-vs__card` (48 uses across 12 lesson files), and `pe-ex__t` is the
   little label at the top of a pe-ex block. Both were being written into
   lessons without ever being defined, so they rendered unstyled. Defined
   here so every existing lesson picks them up. */
.pe-vs__side {
    border: 1px solid var(--border);
    border-top: 4px solid var(--accent);
    border-radius: 14px;
    background: var(--surface);
    padding: .9rem 1rem;
}
.pe-vs__side:nth-child(2n) { border-top-color: var(--pe-o); }
.pe-vs__side p, .pe-vs__side li { font-size: .9rem; }
.pe-vs__side ul { padding-left: 1.1rem; margin-bottom: 0; }
.pe-vs__side p:last-child { margin-bottom: 0; }

.pe-ex__t {
    font-family: 'Syne', sans-serif;
    font-weight: 700; font-size: .72rem;
    text-transform: uppercase; letter-spacing: .06em;
    color: var(--text-muted);
    margin: 0 0 .4rem;
}

/* ── Mobile ────────────────────────────────────────────────────── */
@media (max-width: 575.98px) {
    .pr-gender { grid-template-columns: 1fr; }
    .pr-aspect { grid-template-columns: 1fr; }
    .pr-pair   { grid-template-columns: 1fr; }
    .pr-cyr { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: .4rem; }
    .pr-cyr__ch { font-size: 1.6rem; }
    .pr-say { font-size: .95rem; }
    .pr-say__why { margin-left: 0; width: 100%; }
    .pr-decl, .pr-case { font-size: .85rem; }
    .pr-decl td, .pr-decl th,
    .pr-case td, .pr-case th { padding: .4rem .35rem; }
}


/* ══════════════════════════════════════════════════════════════════
   PRIME MATH — maths-lesson component kit  (pm-*)
   Used inside .tut-prose by the "Prime Math" lessons (PM-1 …) and by the
   two Corner maths shelves. EXTENDS the Prime English kit above — pe-goal,
   pe-formula, pe-chip, pe-call, pe-fix, pe-quiz, pe-reveal, pe-gloss,
   pe-recap, pe-grid, pe-vs, pe-steps and pe-table-wrap are reused as-is.

   Maths needs four things the language courses never did:
     a worked solution where every line says WHY  -> .pm-solve
     fractions, columns and radicals without LaTeX -> .pm-frac, .pm-col, .pm-root
     pictures of quantity and of shape             -> .pm-num, .pm-model, .pm-fig
     the two habits that pass exams                -> .pm-est (taxmin qil),
                                                      .pm-check (tekshir)
   plus .pm-word, which tables an Uzbek phrase against the symbol it means —
   the piece that turns a word problem into mathematics.

   Figures are inline <svg> styled through .pm-ln / .pm-fill / .pm-lbl, so a
   drawing follows the site's palette instead of being a black-on-white image.
   Pure CSS: every interaction is <details>/:hover, no JavaScript.
   Docs: tutorial/management/commands/STYLE_GUIDE_PRIME_MATH.md
   ══════════════════════════════════════════════════════════════════ */

.tut-prose, .cn-reader {
    --pm-x:    #2563eb;   /* nomaʼlum (x), asosiy chizma rangi */
    --pm-num:  #d97706;   /* berilgan son                      */
    --pm-op:   #16a34a;   /* amal va natija                    */
    --pm-unit: #0891b2;   /* birlik (kg, km, soʻm)             */
    --pm-bad:  #e11d48;   /* xato                              */
}

/* Numbers must line up wherever they are compared or stacked. */
.pm-solve__step, .pm-col, .pm-frac, .pe-ex__math, .pm-num__tick i {
    font-variant-numeric: tabular-nums;
}

/* ── Solving ladder — the workhorse ──────────────────────────────
   Left: the line of maths. Right: why that line happened. A solution
   written as a paragraph hides the reasoning; this cannot. */
.pm-solve {
    margin: 1.2rem 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-soft, rgba(127,127,127,.05));
}
.pm-solve__row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    gap: .15rem 1rem;
    align-items: baseline;
    padding: .6rem .9rem;
    border-top: 1px solid var(--border);
}
.pm-solve__row:first-child { border-top: 0; }
.pm-solve__step {
    font-size: 1.14rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.5;
}
.pm-solve__why { font-size: .85rem; color: var(--text-muted); line-height: 1.45; }
.pm-solve__why::before { content: "← "; color: var(--border); }
.pm-solve__row--ans { background: rgba(22,163,74,.09); }
.pm-solve__row--ans .pm-solve__step { color: var(--pm-op); font-weight: 800; }

/* ── Fraction — a real one, built from two spans ─────────────────── */
.pm-frac {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    vertical-align: -0.45em;
    margin: 0 .18rem;
    line-height: 1.08;
}
.pm-frac__n { padding: 0 .22rem; }
.pm-frac__d { padding: 0 .22rem; border-top: 1.5px solid currentColor; }
.pm-frac--big { font-size: 1.35rem; vertical-align: -0.5em; }

/* ── Radical: √ plus the bar over the radicand ───────────────────── */
.pm-root {
    border-top: 1.5px solid currentColor;
    padding: 0 .14em;
    margin-left: .04em;
}
.pm-root::before {
    content: "√";
    display: inline-block;
    margin: 0 .04em 0 -.1em;
    border-top: 0;
}

/* ── Maths line inside a .pe-ex block (sits where .pe-ex__en does) ── */
.pe-ex__math {
    font-size: 1.16rem;
    font-weight: 600;
    line-height: 1.6;
    color: var(--text);
    margin: 0 0 .3rem;
}

/* ── Number line ─────────────────────────────────────────────────
   left / width are percentages of the track, set inline — the only
   place this course allows inline style (same exception as pe-timeline). */
.pm-num { margin: 1.5rem 0 2.4rem; padding: 0 1.2rem; }
.pm-num__track {
    position: relative;
    height: 3px;
    margin: 2.4rem 0 2.6rem;   /* room for the tick labels hanging below */
    background: var(--border);
    border-radius: 2px;
}
.pm-num__track::after {
    content: "";
    position: absolute; right: -14px; top: 50%;
    width: 0; height: 0;
    transform: translateY(-50%);
    border-left: 8px solid var(--border);
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
}
.pm-num__tick { position: absolute; top: -7px; width: 0; }
.pm-num__tick::before {
    content: "";
    position: absolute; left: -1px;
    width: 2px; height: 17px;
    background: var(--text-muted);
}
.pm-num__tick i {
    position: absolute; top: 21px; left: 0;
    transform: translateX(-50%);
    font-style: normal;
    font-size: .78rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.pm-num__dot {
    position: absolute; top: -6px;
    width: 15px; height: 15px;
    margin-left: -7.5px;
    border-radius: 50%;
    background: var(--pm-x);
    border: 2px solid var(--surface, #fff);
}
.pm-num__dot--open { background: var(--surface, #fff); border-color: var(--pm-x); }
.pm-num__dot i {
    position: absolute; bottom: 20px; left: 50%;
    transform: translateX(-50%);
    font-style: normal;
    font-size: .82rem; font-weight: 700;
    color: var(--pm-x);
    white-space: nowrap;
}
.pm-num__band {
    position: absolute; top: -3px;
    height: 9px;
    border-radius: 5px;
    background: rgba(37,99,235,.22);
}

/* ── Column arithmetic — ustunda qoʻshish, ayirish, koʻpaytirish ───
   A stacked sum is NOT a data table: it must stay narrow and centred, and it
   has no cell borders. `.tut-prose table` sets width:100% + row borders +
   hover, so every one of those is switched off here (the selectors are
   deliberately as specific as the prose ones). */
.tut-prose table.pm-col,
.cn-reader table.pm-col,
table.pm-col {
    width: auto;
    margin: 1.3rem auto;
    border-collapse: collapse;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text);
}
.tut-prose .pm-col td,
.cn-reader .pm-col td,
.pm-col td {
    padding: .1rem .4rem;
    text-align: center;
    min-width: 1.7rem;
    border: 0;
    background: none;
}
.tut-prose .pm-col tr:hover td,
.cn-reader .pm-col tr:hover td { background: none; }
.pm-col__carry td {
    font-size: .75rem; font-weight: 700;
    color: var(--pm-num);
    padding-bottom: 0;
}
.tut-prose .pm-col__op td,
.cn-reader .pm-col__op td,
.pm-col__op td { border-bottom: 2px solid var(--text); }
.pm-col__op td:first-child { text-align: left; color: var(--pm-op); }
.pm-col__res td { color: var(--pm-op); padding-top: .3rem; }

/* ── Figures — inline SVG that follows the theme ─────────────────── */
.pm-fig { margin: 1.4rem 0; text-align: center; }
.pm-fig svg { width: 100%; max-width: 340px; height: auto; }
.pm-fig figcaption {
    font-size: .82rem;
    color: var(--text-muted);
    margin-top: .45rem;
    line-height: 1.5;
}
.pm-ln {
    stroke: var(--text);
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.pm-ln--dash { stroke: var(--text-muted); stroke-width: 1.5; stroke-dasharray: 5 4; }
.pm-ln--hl   { stroke: var(--pm-x); stroke-width: 3; }
.pm-fill     { fill: rgba(37,99,235,.10); stroke: none; }
.pm-fill--hl { fill: rgba(217,119,6,.22); stroke: none; }
.pm-pt       { fill: var(--pm-x); stroke: none; }
.pm-lbl      { fill: var(--text); font-size: 13px; font-weight: 600; }
.pm-lbl--hl  { fill: var(--pm-num); }

/* ── Bar model — seeing a word problem before writing the equation ─ */
.pm-model {
    margin: 1.2rem 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: .9rem 1rem .8rem;
    background: var(--bg-soft, rgba(127,127,127,.05));
}
.pm-model__row {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin-bottom: .45rem;
}
.pm-model__lbl {
    flex: 0 0 5.5rem;
    text-align: right;
    font-size: .85rem;
    color: var(--text-muted);
}
.pm-model__bar {
    min-width: 2.6rem;
    padding: .35rem .6rem;
    border-radius: 8px;
    border: 1px solid rgba(37,99,235,.45);
    background: rgba(37,99,235,.16);
    font-size: .9rem; font-weight: 700;
    color: var(--text);
    text-align: center;
    white-space: nowrap;
}
.pm-model__bar--alt { border-color: rgba(217,119,6,.5); background: rgba(217,119,6,.16); }
.pm-model__tot {
    margin: .5rem 0 0;
    text-align: center;
    font-size: .92rem; font-weight: 700;
    color: var(--pm-op);
}

/* ── Word → symbol table — the signature piece of the text side ──── */
.pm-word { width: 100%; border-collapse: collapse; margin: 1.1rem 0; font-size: .95rem; }
.pm-word th {
    text-align: left;
    font-size: .74rem; font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
    padding: .4rem .6rem;
    border-bottom: 2px solid var(--border);
}
.pm-word td { padding: .5rem .6rem; border-bottom: 1px solid var(--border); }
.pm-word tr:last-child td { border-bottom: 0; }
.pm-word__sym {
    text-align: center;
    white-space: nowrap;
    font-size: 1.14rem; font-weight: 800;
    color: var(--pm-op);
}

/* ── Check and estimate — the two exam habits ────────────────────── */
.pm-check {
    margin: 1.1rem 0;
    padding: .7rem .95rem;
    border-left: 4px solid var(--pm-op);
    border-radius: 0 10px 10px 0;
    background: rgba(22,163,74,.09);
}
.pm-check__t {
    margin: 0 0 .25rem;
    font-size: .78rem; font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--pm-op);
}
.pm-check__t::before { content: "✓ "; }
.pm-check p:last-child { margin-bottom: 0; }

.pm-est {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .5rem;
    margin: 1.1rem 0;
    padding: .6rem .9rem;
    border: 1px dashed var(--border);
    border-radius: 10px;
    background: var(--bg-soft, rgba(127,127,127,.04));
    font-size: .95rem;
}
.pm-est__t {
    font-size: .72rem; font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--pm-num);
}
.pm-est__t::before { content: "≈ "; }

/* ── Wrong ✗ / Right ✓ pair, with the REASON line ──────────────────
   The language courses' .pe-fix holds a bare .pe-bad / .pe-good pair —
   in a language lesson the right form speaks for itself. Maths needs a
   third line: WHY the wrong line is wrong (which step broke, and what
   makes the mistake tempting). These element classes are the maths
   variant of .pe-bad / .pe-good plus that reason line.
   Docs: STYLE_GUIDE_PRIME_MATH.md section 5.                        */
.pe-fix__bad, .pe-fix__good {
    display: flex; align-items: flex-start; gap: .55rem;
    padding: .5rem .8rem;
    border-radius: 10px;
    font-size: .95rem;
}
.pe-fix__bad  { background: rgba(220,38,38,.07); color: var(--text); }
.pe-fix__good { background: rgba(22,163,74,.08); color: var(--text); }
.pe-fix__bad::before  { content: '✗'; color: var(--pe-warn); font-weight: 800; }
.pe-fix__good::before { content: '✓'; color: var(--pe-ok);   font-weight: 800; }
.pe-fix__bad s { text-decoration-color: var(--pe-warn); }
.pe-fix__why {
    margin: 0;
    padding: .1rem .8rem 0 1.35rem;
    font-size: .9rem;
    color: var(--text-muted, #6b7280);
}

/* ── Mobile ────────────────────────────────────────────────────── */
@media (max-width: 575.98px) {
    .pm-solve__row { grid-template-columns: 1fr; gap: .2rem; padding: .55rem .75rem; }
    .pm-solve__why { padding-left: .75rem; border-left: 2px solid var(--border); }
    .pm-solve__why::before { content: ""; }
    .pm-solve__step { font-size: 1.05rem; }
    .pm-model__row { flex-wrap: wrap; }
    .pm-model__lbl { flex: 0 0 100%; text-align: left; }
    .pm-word { font-size: .88rem; }
    .pm-word th, .pm-word td { padding: .4rem .35rem; }
    /* the nowrap formula column is the widest thing in the table — shrink it
       so the two text columns keep a readable share of the width */
    .pm-word__sym { font-size: 1rem; }
    .pm-col { font-size: 1.15rem; }
    .pm-num { padding: 0 1.4rem; }
    .pm-num__tick i { font-size: .72rem; }
}


/* ── DIAGRAMMALAR — Blok F (PM-75…84) ──────────────────────────────
   Ustunli, chiziqli va doiraviy diagrammalar uchun. Inline SVG,
   .pm-fig ichida — pm-ln / pm-fill bilan bir qatorda ishlaydi.
   Docs: STYLE_GUIDE_PRIME_MATH.md section 5 ("Diagrammalar").

   RANG QOIDASI (o'ylab topilgan emas, hisoblangan):
   • Ustunli va chiziqli diagramma — BITTA seriya, demak hamma ustun
     bitta rangda (--pm-x). Ustunning uzunligi sonni allaqachon
     ko'rsatib turibdi; ustunni qiymatiga qarab bo'yash identiflik
     kanalini behuda sarflaydi va legenda talab qiladi.
   • Doiraviy diagramma — bo'laklar KATTALIGI bo'yicha tartiblanadi,
     ya'ni tartibli (ordinal) kattalik. Shuning uchun bitta rangning
     to'rtta bosqichi: yorug'likda monoton (nisbiy yorqinlik 0.051 →
     0.107 → 0.236 → 0.363), har biri oq fonda kamida 2,5:1 kontrast.
     To'rt xil RANG ishlatilmadi: rang ko'rligida (protan/deutan) to'rt
     hue ning hammasi bir vaqtda ajralib turmaydi, yorqinlik esa har
     doim ajralib turadi — va A5 kitob oq-qora chop etilganda ham
     shu ramp ishlaydi.
   • Har bir ustun va har bir bo'lak YOZUV bilan belgilanadi. Rang
     hech qachon yagona ajratuvchi bo'lmasligi kerak.                */
.pm-ch__ax   { stroke: var(--text-muted); stroke-width: 1.5; fill: none; }
.pm-ch__grid { stroke: var(--border); stroke-width: 1; fill: none; }
.pm-ch__bar  { fill: var(--pm-x); }
.pm-ch__bar--hl { fill: var(--pm-num); }
.pm-ch__line { stroke: var(--pm-x); stroke-width: 2; fill: none;
               stroke-linejoin: round; stroke-linecap: round; }
.pm-ch__dot  { fill: var(--pm-x); stroke: var(--surface, #fff); stroke-width: 2; }
/* doiraviy diagramma — bitta hue, tartibli to'rt bosqich (katta → kichik).
   stroke: fon rangi = bo'laklar orasidagi 2px tirqish (mark spec).      */
.pm-ch__s1 { fill: #1e3a8a; stroke: var(--surface, #fff); stroke-width: 2; }
.pm-ch__s2 { fill: #1d4ed8; stroke: var(--surface, #fff); stroke-width: 2; }
.pm-ch__s3 { fill: #3b82f6; stroke: var(--surface, #fff); stroke-width: 2; }
.pm-ch__s4 { fill: #60a5fa; stroke: var(--surface, #fff); stroke-width: 2; }
/* taqqoslash chizigʻi — maʼlumot ustiga tortiladi (oʻrtacha, mediana…).
   Seriya rangida EMAS: u maʼlumot emas, maʼlumot haqidagi izoh, shuning
   uchun boshqa rang va punktir. Yozuvi ustunlar qiymatiga tegib
   ketmasligi kerak — baland ustunlarda tepaga, past ustunlarda chapga. */
.pm-ch__ref {
    stroke: var(--pm-num); stroke-width: 2;
    stroke-dasharray: 6 4; fill: none;
}
/* diagramma yozuvlari — matn rangida, hech qachon seriya rangida */
.pm-ch__lbl { fill: var(--text); font-size: 12px; font-weight: 600; }
.pm-ch__val { fill: var(--text); font-size: 12px; font-weight: 800; }
.pm-ch__cap { fill: var(--text-muted); font-size: 11px; font-weight: 600; }

@media screen and (max-width: 480px) {
    .pm-ch__lbl, .pm-ch__val { font-size: 11px; }
    .pm-ch__cap { font-size: 10px; }
}


/* =====================================================================
   CHEMPIONLAR DUELI — per-question countdown bar  (duel-timer)
   ---------------------------------------------------------------------
   Pure CSS: the bar drains over `animation-duration`, which the template
   sets to the seconds still left on the question (recomputed server-side,
   so a page reload picks the clock up where it really is). The animation
   is only the *display* — the server decides whether an answer was late.
   ===================================================================== */

.duel-timer {
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    background: var(--surface-2);
    border: 1px solid var(--border);
}

.duel-timer__bar {
    height: 100%;
    width: 100%;
    border-radius: 999px;
    background: #22c55e;
    animation-name: duel-timer-drain;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
    animation-iteration-count: 1;
}

.duel-timer__bar--out {
    width: 100%;
    background: #ef4444;
    animation: none;
}

@keyframes duel-timer-drain {
    0%   { width: 100%; background: #22c55e; }
    55%  { background: #f59e0b; }
    82%  { background: #ef4444; }
    100% { width: 0%;   background: #ef4444; }
}

/* Respect the pupil's motion preference: no drain animation, just the
   colour of the state the clock is in. */
@media (prefers-reduced-motion: reduce) {
    .duel-timer__bar { animation: none; background: #f59e0b; }
}

/* When the bar empties, the page has to SAY so — otherwise the players just
   sit there waiting. No JS: the banner and the "next question" button are in
   the DOM from the start, invisible and unclickable, and a keyframe reveals
   them after `animation-delay`, which the template sets to the seconds left.
   The answer cards fade at the same moment. The server still has the final
   say on whether an answer was in time. */

.duel-timeup {
    opacity: 0;
    pointer-events: none;
    animation-name: duel-timeup-show;
    animation-duration: .3s;
    animation-timing-function: ease-out;
    animation-fill-mode: forwards;
    animation-iteration-count: 1;
}

/* Already expired when the page was rendered (e.g. after a reload). */
.duel-timeup--now {
    opacity: 1;
    pointer-events: auto;
    animation: none;
}

@keyframes duel-timeup-show {
    from { opacity: 0; transform: translateY(-6px); pointer-events: none; }
    to   { opacity: 1; transform: none;             pointer-events: auto; }
}

.duel-answers {
    animation-name: duel-answers-dim;
    animation-duration: .3s;
    animation-fill-mode: forwards;
    animation-iteration-count: 1;
}

.duel-answers--dim { opacity: .4; animation: none; }

@keyframes duel-answers-dim { to { opacity: .4; } }

@media (prefers-reduced-motion: reduce) {
    @keyframes duel-timeup-show {
        from { opacity: 0; pointer-events: none; }
        to   { opacity: 1; pointer-events: auto; }
    }
}


/* =====================================================================
   PRIME JOURNEY — the travelling adventure  (pj-*)
   ---------------------------------------------------------------------
   The game where a road IS a Prime course and every obstacle is one of
   that lesson's practice questions. Rules: games/journey.py.

   Pure CSS, like every other component kit here — no JavaScript anywhere
   in this game. The map is a flex strip, the "current position" pulse is
   a keyframe, and everything else is server-rendered between form posts.

   One convention worth keeping: anything that sends the pupil AWAY from
   the game and into a lesson (.pj-btn--study, .pj-peek, .pj-fastest) is
   green — the colour of the way forward — because in this game leaving
   the road to go and read is the strongest move, not the losing one.

   Never invent a pj-* class without adding it here.
   ===================================================================== */

:root {
    --pj-ink:    #2e1065;   /* deep adventure purple  */
    --pj-accent: #7c3aed;
    --pj-gold:   #d97706;
    --pj-study:  #15803d;   /* the way forward = the lesson */
}

/* ── shared bits ──────────────────────────────────────────────────── */

.pj-back {
    display: inline-block;
    margin-bottom: 1rem;
    color: var(--text-muted);
    font-size: 0.86rem;
    text-decoration: none;
}
.pj-back:hover { color: var(--pj-accent); }

.pj-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.72rem 1.35rem;
    border: none;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: transform .12s ease, filter .12s ease;
}
.pj-btn:active { transform: translateY(1px); }

.pj-btn--go     { background: var(--pj-accent); color: #fff; }
.pj-btn--go:hover { filter: brightness(1.08); color: #fff; }
.pj-btn--study  { background: var(--pj-study); color: #fff; }
.pj-btn--study:hover { filter: brightness(1.1); color: #fff; }
.pj-btn--quiet  { background: transparent; color: var(--text-muted); font-weight: 500; }
.pj-btn--quiet:hover { color: var(--text); }
.pj-btn:disabled { opacity: .5; cursor: default; }

.pj-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.25rem;
}

/* ── home: the premise ────────────────────────────────────────────── */

.pj-hero {
    text-align: center;
    padding: 2rem 1.25rem;
    border-radius: 18px;
    background: linear-gradient(150deg, var(--pj-ink) 0%, #4c1d95 55%, #6d28d9 100%);
    color: #fff;
}
.pj-hero__glyph { font-size: 3rem; line-height: 1; }
.pj-hero__title {
    font-size: 1.65rem;
    font-weight: 800;
    margin: 0.5rem 0 0.65rem;
    color: #fff;
}
.pj-hero__lead {
    margin: 0 auto;
    max-width: 46ch;
    font-size: 0.92rem;
    line-height: 1.6;
    color: rgba(255,255,255,0.88);
}
.pj-hero__rule {
    margin: 1rem auto 0;
    max-width: 44ch;
    padding: 0.7rem 0.9rem;
    border-radius: 12px;
    background: rgba(255,255,255,0.12);
    border: 1px dashed rgba(255,255,255,0.35);
    font-size: 0.87rem;
    line-height: 1.55;
    color: #fff;
}

.pj-resume {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.9rem 1rem;
    border-radius: 14px;
    background: var(--surface);
    border: 2px solid var(--pj-accent);
    box-shadow: 0 3px 14px rgba(124,58,237,0.15);
}
.pj-resume__emoji { font-size: 1.8rem; line-height: 1; }
.pj-resume__label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--pj-accent);
    font-weight: 700;
}
.pj-resume__where { font-size: 0.95rem; font-weight: 600; color: var(--text); }
.pj-resume__go { font-size: 0.88rem; font-weight: 600; color: var(--pj-accent); white-space: nowrap; }

/* ── home: the road cards ─────────────────────────────────────────── */

.pj-road {
    height: 100%;
    border-radius: 14px;
    overflow: hidden;
    background: var(--surface);
    box-shadow: 0 2px 10px rgba(15,23,42,0.07);
    transition: transform .15s ease, box-shadow .15s ease;
}
.pj-road:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(15,23,42,0.12); }

.pj-road__head {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 1.1rem 1.2rem;
    background: linear-gradient(135deg, var(--pj-a) 0%, var(--pj-b) 100%);
}
.pj-road__emoji { font-size: 1.9rem; line-height: 1; }
.pj-road__name { margin: 0; font-size: 1.1rem; font-weight: 700; color: #fff; }

.pj-road__body { padding: 0.9rem 1.2rem 1.1rem; }
.pj-road__blurb {
    margin: 0 0 0.8rem;
    font-size: 0.84rem;
    line-height: 1.5;
    color: var(--text-muted);
}
.pj-road__meter {
    height: 7px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    overflow: hidden;
}
.pj-road__fill {
    height: 100%;
    background: linear-gradient(90deg, var(--pj-a), var(--pj-b));
}
.pj-road__stat {
    margin-top: 0.45rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ── home: the rules panel ────────────────────────────────────────── */

.pj-rules {
    padding: 1.1rem 1.25rem;
    border-radius: 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
}
.pj-rules__title {
    margin: 0 0 0.7rem;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}
.pj-rules__list { list-style: none; margin: 0; padding: 0; }
.pj-rules__list li {
    display: flex;
    gap: 0.6rem;
    padding: 0.42rem 0;
    font-size: 0.86rem;
    line-height: 1.5;
    color: var(--text-muted);
}
.pj-rules__list strong { color: var(--text); }

/* ── road: the header and the stage list ──────────────────────────── */

.pj-roadhead {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.3rem 1.3rem;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--pj-a) 0%, var(--pj-b) 100%);
}
.pj-roadhead__emoji { font-size: 2.6rem; line-height: 1; }
.pj-roadhead__name { margin: 0; font-size: 1.35rem; font-weight: 800; color: #fff; }
.pj-roadhead__blurb {
    margin: 0.2rem 0 0;
    font-size: 0.86rem;
    line-height: 1.5;
    color: rgba(255,255,255,0.88);
}

.pj-legs { display: flex; flex-direction: column; }

.pj-leg {
    display: flex;
    gap: 0.9rem;
    padding-bottom: 1rem;
    position: relative;
}
/* the road drawn down the left, connecting the stage markers */
.pj-leg::before {
    content: "";
    position: absolute;
    left: 21px;
    top: 44px;
    bottom: 0;
    width: 3px;
    border-radius: 2px;
    background: repeating-linear-gradient(
        to bottom, var(--border) 0 6px, transparent 6px 12px);
}
.pj-leg:last-child::before { display: none; }
.pj-leg--done::before {
    background: var(--pj-accent);
    opacity: .45;
}

.pj-leg__marker {
    flex: 0 0 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    background: var(--surface);
    border: 2.5px solid var(--pj-accent);
    color: var(--pj-accent);
    z-index: 1;
}
.pj-leg--done .pj-leg__marker { background: var(--pj-accent); color: #fff; }
.pj-leg--locked .pj-leg__marker {
    border-color: var(--border);
    color: var(--text-muted);
    font-size: 1rem;
}

.pj-leg__body {
    flex: 1 1 auto;
    padding: 0.6rem 0.95rem 0.8rem;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    min-width: 0;
}
.pj-leg--locked .pj-leg__body { background: var(--surface-2); }

.pj-leg__place { font-size: 1rem; font-weight: 700; color: var(--text); }
.pj-leg__range {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
    overflow-wrap: anywhere;
}
.pj-leg__actions {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    flex-wrap: wrap;
    margin-top: 0.7rem;
}
.pj-leg__actions .pj-btn { padding: 0.5rem 1rem; font-size: 0.87rem; }
.pj-leg__best { font-size: 0.8rem; color: var(--pj-gold); font-weight: 600; }
.pj-leg__hint {
    margin-top: 0.55rem;
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--text-muted);
}
.pj-leg__studied {
    display: inline-block;
    margin-left: 0.35rem;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    font-size: 0.72rem;
}

/* ── road: leaderboard ────────────────────────────────────────────── */

.pj-board {
    padding: 1rem 1.1rem;
    border-radius: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
}
.pj-board__title {
    margin: 0 0 0.6rem;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}
.pj-board__table { width: 100%; font-size: 0.85rem; }
.pj-board__table td { padding: 0.4rem 0.3rem; border-top: 1px solid var(--border); }
.pj-board__table tr:first-child td { border-top: none; }
.pj-board__rank  { width: 1.8rem; color: var(--text-muted); font-weight: 700; }
.pj-board__who   { font-weight: 600; color: var(--text); }
.pj-board__leg   { color: var(--text-muted); font-size: 0.78rem; }
.pj-board__coins { color: var(--pj-gold); font-weight: 700; white-space: nowrap; }
.pj-board__time  { color: var(--text-muted); text-align: right; font-size: 0.78rem; }

/* ── play: the head-up display ────────────────────────────────────── */

.pj-hud {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.6rem;
}
.pj-hud__where { display: flex; flex-direction: column; min-width: 0; }
.pj-hud__road  { font-size: 0.76rem; color: var(--text-muted); }
.pj-hud__place { font-size: 0.98rem; font-weight: 700; color: var(--text); }
.pj-hud__meters { display: flex; align-items: center; gap: 0.7rem; }
.pj-kuch  { font-size: 0.95rem; letter-spacing: 0.04em; white-space: nowrap; }
.pj-coins {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--pj-gold);
    white-space: nowrap;
}

/* ── play: the trail strip ────────────────────────────────────────── */

.pj-trail {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    overflow-x: auto;
    padding: 0.55rem 0.15rem;
    margin-bottom: 1rem;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    scrollbar-width: thin;
}
.pj-dot {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    background: var(--surface-2);
    border: 1.5px solid var(--border);
    filter: grayscale(1);
    opacity: .55;
}
.pj-dot--done    { filter: none; opacity: 1; border-color: var(--pj-accent); }
.pj-dot--current {
    filter: none;
    opacity: 1;
    border-color: var(--pj-gold);
    box-shadow: 0 0 0 3px rgba(217,119,6,0.2);
    animation: pj-pulse 1.8s ease-in-out infinite;
}
.pj-dot--fork  { border-style: dashed; }
.pj-dot--guard { border-width: 2.5px; }

@keyframes pj-pulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(217,119,6,0.20); }
    50%      { box-shadow: 0 0 0 6px rgba(217,119,6,0.08); }
}
@media (prefers-reduced-motion: reduce) {
    .pj-dot--current { animation: none; }
}

/* ── play: the encounter card ─────────────────────────────────────── */

.pj-card {
    padding: 1.5rem 1.25rem 1.35rem;
    border-radius: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: 0 3px 16px rgba(15,23,42,0.07);
    text-align: center;
}
.pj-card--gate   { border-top: 4px solid var(--pj-t, var(--pj-accent)); }
.pj-card--fork   { border-top: 4px solid var(--pj-accent); }
.pj-card--rest   { border-top: 4px solid #0891b2; }
.pj-card--chest  { border-top: 4px solid var(--pj-gold); }
.pj-card--sealed { border-top: 4px solid #64748b; background: var(--surface-2); }
.pj-card--win    { border-top: 4px solid #16a34a; }
.pj-card--lose   { border-top: 4px solid #dc2626; }

.pj-card__terrain {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--pj-t, var(--text-muted));
    font-weight: 700;
    margin-bottom: 0.4rem;
}
.pj-card__emoji { font-size: 2.6rem; line-height: 1; }
.pj-card__title {
    margin: 0.5rem 0 0.5rem;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--text);
}
.pj-card__intro {
    margin: 0 auto;
    max-width: 46ch;
    font-size: 0.9rem;
    line-height: 1.65;
    color: var(--text-muted);
    font-style: italic;
}
.pj-card__aside {
    margin: 1rem 0 0;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--pj-gold);
}

/* ── play: tags above a question ──────────────────────────────────── */

.pj-tags {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin: 1rem 0 0.9rem;
}
.pj-tag {
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--text-muted);
}
.pj-tag--guard { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }
.pj-tag--twin  { background: #fef3c7; border-color: #fcd34d; color: #92400e; }

/* ── play: the question itself ────────────────────────────────────── */

.pj-q {
    text-align: left;
    padding: 1rem 1.1rem;
    border-radius: 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    font-size: 1rem;
    line-height: 1.65;
    color: var(--text);
}
.pj-q p:last-child { margin-bottom: 0; }
.pj-q img { max-width: 100%; height: auto; }

.pj-choices {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.9rem;
}
.pj-choice-btn {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    width: 100%;
    text-align: left;
    padding: 0.8rem 0.9rem;
    border-radius: 12px;
    background: var(--surface);
    border: 2px solid var(--border);
    color: var(--text);
    font-size: 0.95rem;
    cursor: pointer;
    transition: border-color .12s ease, background .12s ease;
}
.pj-choice-btn:hover {
    border-color: var(--pj-accent);
    background: rgba(124,58,237,0.04);
}
.pj-choice-btn__letter {
    flex: 0 0 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ede9fe;
    color: #5b21b6;
    font-weight: 700;
    font-size: 0.82rem;
}
.pj-choice-btn__text { font-weight: 500; overflow-wrap: anywhere; }
.pj-choice-btn__text p { margin: 0; }

/* The quiet link to the lesson, always available under a question. */
.pj-peek {
    display: inline-block;
    margin-top: 0.9rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--pj-study);
    text-decoration: none;
}
.pj-peek:hover { text-decoration: underline; color: var(--pj-study); }

/* ── play: what happened ──────────────────────────────────────────── */

.pj-answer {
    margin: 1rem 0 0;
    border-radius: 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    overflow: hidden;
}
.pj-answer__row {
    display: flex;
    justify-content: space-between;
    gap: 0.9rem;
    padding: 0.55rem 0.85rem;
    font-size: 0.87rem;
    text-align: left;
}
.pj-answer__row + .pj-answer__row { border-top: 1px solid var(--border); }
.pj-answer__row span { color: var(--text-muted); flex: 0 0 auto; }
.pj-answer__row b { color: var(--text); overflow-wrap: anywhere; }
.pj-answer__row b p { margin: 0; }
.pj-answer__right { color: #15803d !important; }

.pj-explain {
    margin-top: 0.8rem;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    font-size: 0.87rem;
    line-height: 1.6;
    color: #78350f;
    text-align: left;
}
.pj-explain p:last-child { margin-bottom: 0; }

/* ── play: the way forward is always the lesson ───────────────────── */
/* Green, prominent, and present on every card where a pupil is stuck.
   This block is the whole point of the game. */

.pj-fastest {
    margin-top: 1.1rem;
    padding: 1rem;
    border-radius: 14px;
    background: #f0fdf4;
    border: 1.5px solid #86efac;
    text-align: left;
}
.pj-fastest__head {
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--pj-study);
    margin-bottom: 0.35rem;
}
.pj-fastest p {
    margin: 0 0 0.75rem;
    font-size: 0.86rem;
    line-height: 1.6;
    color: #14532d;
}
.pj-fastest .pj-btn { width: 100%; }

/* ── play: forks and chest choices ────────────────────────────────── */

.pj-branches, .pj-choice {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 1.1rem;
}
.pj-branch {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    width: 100%;
    text-align: left;
    padding: 0.85rem 0.95rem;
    border-radius: 14px;
    background: var(--surface);
    border: 2px solid var(--border);
    color: var(--text);
    cursor: pointer;
    transition: border-color .12s ease, transform .12s ease;
}
.pj-branch:hover { border-color: var(--pj-accent); transform: translateY(-1px); }
.pj-branch--sealed { opacity: .5; cursor: default; }
.pj-branch--sealed:hover { border-color: var(--border); transform: none; }
.pj-branch__icon { font-size: 1.5rem; line-height: 1; flex: 0 0 auto; }
.pj-branch__body { flex: 1 1 auto; min-width: 0; }
.pj-branch__name { display: block; font-weight: 700; font-size: 0.94rem; }
.pj-branch__note {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--text-muted);
}
.pj-branch__pay {
    flex: 0 0 auto;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--pj-gold);
    white-space: nowrap;
}

.pj-loot {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 1rem;
    padding: 0.7rem 1.1rem;
    border-radius: 999px;
    background: #fffbeb;
    border: 1.5px dashed var(--pj-gold);
}
.pj-loot__emoji { font-size: 1.5rem; line-height: 1; }
.pj-loot__name { font-weight: 700; font-size: 0.95rem; color: #92400e; }

/* ── play: the diary ──────────────────────────────────────────────── */

.pj-diary {
    margin-top: 1.25rem;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
}
.pj-diary__head {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}
.pj-diary ul { list-style: none; margin: 0; padding: 0; }
.pj-diary li {
    padding: 0.22rem 0 0.22rem 0.85rem;
    position: relative;
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--text-muted);
}
.pj-diary li::before {
    content: "·";
    position: absolute;
    left: 0.2rem;
    color: var(--pj-accent);
    font-weight: 700;
}

/* ── play: arrival ────────────────────────────────────────────────── */

.pj-end {
    text-align: center;
    padding: 2.25rem 1.25rem;
    border-radius: 18px 18px 0 0;
    color: #fff;
}
.pj-end--win { background: linear-gradient(140deg, #7c3aed 0%, #4c1d95 100%); }
.pj-end__glyph { font-size: 3.4rem; line-height: 1; }
.pj-end__title { margin: 0.4rem 0 0.2rem; font-size: 1.5rem; font-weight: 800; color: #fff; }
.pj-end__where { margin: 0; font-size: 0.95rem; color: rgba(255,255,255,0.85); }
.pj-end__note {
    margin: 1rem 0 0;
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-muted);
    text-align: center;
}

.pj-panel {
    padding: 1.4rem 1.25rem;
    border-radius: 0 0 18px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: none;
}
.pj-stats { display: flex; gap: 0.6rem; }
.pj-stat {
    flex: 1 1 0;
    padding: 0.8rem 0.4rem;
    border-radius: 12px;
    background: var(--surface-2);
    text-align: center;
}
.pj-stat b { display: block; font-size: 1.3rem; line-height: 1.2; }
.pj-stat span {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.pj-guestnote {
    margin-top: 1rem;
    padding: 0.75rem 0.9rem;
    border-radius: 12px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    font-size: 0.85rem;
    line-height: 1.55;
    color: #1e40af;
    text-align: center;
}

/* ── the prize chest ──────────────────────────────────────────────── */

.pj-pending {
    padding: 0.75rem 1rem;
    border-radius: 12px;
    background: #fffbeb;
    border: 1.5px solid #fcd34d;
    color: #92400e;
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.pj-prizes { display: flex; flex-direction: column; gap: 0.55rem; }
.pj-prize {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
}
.pj-prize--done { opacity: .6; }
.pj-prize__emoji { font-size: 1.6rem; line-height: 1; flex: 0 0 auto; }
.pj-prize__body { flex: 1 1 auto; min-width: 0; }
.pj-prize__name { font-weight: 700; font-size: 0.94rem; color: var(--text); }
.pj-prize__meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.1rem; }
.pj-prize__state { flex: 0 0 auto; font-size: 0.78rem; font-weight: 600; color: var(--text-muted); }

/* ── the teacher's hand-out list ──────────────────────────────────── */

.pj-handout { display: flex; flex-direction: column; gap: 0.55rem; }
.pj-handout__row {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    flex-wrap: wrap;
}
.pj-handout__row--done { opacity: .55; }
.pj-handout__who { font-weight: 700; font-size: 0.92rem; color: var(--text); }
.pj-handout__what { font-size: 0.85rem; color: var(--text-muted); }
.pj-handout__when { font-size: 0.76rem; color: var(--text-muted); }
.pj-handout__act { margin-left: auto; }

/* ── phones ───────────────────────────────────────────────────────── */

@media (max-width: 480px) {
    .pj-hero { padding: 1.6rem 1rem; }
    .pj-hero__title { font-size: 1.4rem; }
    .pj-card { padding: 1.25rem 1rem 1.15rem; }
    .pj-card__title { font-size: 1.05rem; }
    .pj-card__emoji { font-size: 2.2rem; }
    .pj-roadhead { flex-direction: column; text-align: center; gap: 0.5rem; }
    .pj-roadhead__name { font-size: 1.2rem; }
    .pj-stat b { font-size: 1.1rem; }
    .pj-leg__marker { flex-basis: 38px; height: 38px; font-size: 0.85rem; }
    .pj-leg::before { left: 18px; top: 38px; }
}

/* ── Prime Journey: the second key ────────────────────────────────────────
   Reading the lesson is green (.pj-btn--study) because it is the way forward.
   PASSING the practice is gold, and outranks it: it is the only claim about
   study on this platform that is scored rather than self-reported, so it is
   the one the game actually pays for. Keep gold above green everywhere. */

.pj-btn--proof {
    background: var(--pj-gold);
    color: #fff;
    width: 100%;
    margin-top: 0.15rem;
}
.pj-btn--proof:hover { filter: brightness(1.08); color: #fff; }

.pj-fastest__strong {
    margin-top: 0.9rem !important;
    padding-top: 0.8rem;
    border-top: 1.5px dashed #86efac;
    font-weight: 600;
    color: #14532d;
}

.pj-card--proven { border-top: 4px solid var(--pj-gold); }

/* The torch: burns two wrong answers away. Earned by reading the lesson's
   Corner story, or found on the old track at a fork. */
.pj-torch {
    width: 100%;
    padding: 0.6rem 0.9rem;
    border-radius: 12px;
    background: #fffbeb;
    border: 1.5px dashed var(--pj-gold);
    color: #92400e;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .12s ease;
}
.pj-torch:hover { background: #fef3c7; }

/* ── Prime Journey: hearts are scarce, so say so loudly ───────────────────
   Six hearts a stage, never refilled by resting, two wrong answers each.
   The traveller has to be able to feel that draining, so the warning under a
   wrong answer is a first-class element rather than small print. */

.pj-heartwarn {
    margin: 0.9rem 0 0;
    padding: 0.6rem 0.9rem;
    border-radius: 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--text);
}

.pj-card__aside--quiet {
    color: var(--text-muted) !important;
    font-weight: 500;
    font-size: 0.83rem;
    line-height: 1.55;
    max-width: 44ch;
    margin-left: auto;
    margin-right: auto;
}

/* Losing a stage is a real outcome now — it gets its own grave-grey card. */
.pj-card--failed { border-top: 4px solid #475569; background: var(--surface-2); }

.pj-tally {
    margin-top: 1.1rem;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
    text-align: left;
}
.pj-tally__row {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.65rem 0.9rem;
    font-size: 0.86rem;
    line-height: 1.5;
}
.pj-tally__row + .pj-tally__row { border-top: 1px solid var(--border); }
.pj-tally__row--lost { background: #fef2f2; color: #991b1b; }
.pj-tally__row--kept { background: #f0fdf4; color: #14532d; }

/* The reward for arriving with the chest still out on the road. */
.pj-bigprize {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin-top: 1rem;
    padding: 0.9rem 1rem;
    border-radius: 14px;
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 1.5px solid var(--pj-gold);
    text-align: left;
}
.pj-bigprize__glyph { font-size: 2rem; line-height: 1; flex: 0 0 auto; }
.pj-bigprize__head {
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #92400e;
}
.pj-bigprize__what {
    font-size: 0.88rem;
    line-height: 1.55;
    color: #78350f;
    margin-top: 0.15rem;
}

/* ── Prime Journey: the wayfarer's riddles ────────────────────────────────
   Riddles come from journey_riddles.py, not from a lesson, so they get their
   own badge and their own note: there is nothing to go and read. */

.pj-tag--riddle { background: #ede9fe; border-color: #c4b5fd; color: #5b21b6; }

.pj-riddlenote {
    margin: 0.9rem 0 0;
    padding: 0.6rem 0.9rem;
    border-radius: 12px;
    background: #faf5ff;
    border: 1px dashed #c4b5fd;
    font-size: 0.83rem;
    line-height: 1.55;
    color: #5b21b6;
}

/* A stage that carries a prize is marked on the road map, so a traveller can
   see one coming and decide whether to spend hearts getting there. */
.pj-leg__prize {
    margin-left: 0.35rem;
    font-size: 0.95rem;
    vertical-align: middle;
}


/* =====================================================================
   LOGIC ARENA — sealed-answer puzzle kit  (lg-*)
   ---------------------------------------------------------------------
   The section's whole promise is that you do NOT find out whether you were
   right until the reveal date, so the visual language has three states and
   never blurs them:

       sealed    indigo / wax-red   — an envelope you cannot open yet
       open      amber              — live, answers accepted
       revealed  green or rose      — the verdict, at last

   Pure CSS, no JavaScript: the countdown is a server-rendered number, the
   hint and the solution are native <details>, and every figure is inline
   SVG in the puzzle body (`lg-fig`) so a page weighs a few KB, not a few
   hundred. Figures inherit `currentColor` where they can, so one SVG works
   on a card, in the prose and on a print sheet.
   ===================================================================== */

/* ── Hero: this week's puzzle ─────────────────────────────────────────── */

.lg-hero {
    position: relative;
    overflow: hidden;
    border-radius: 20px;
    padding: 1.6rem 1.4rem;
    color: #f8fafc;
    background: linear-gradient(135deg, #312e81 0%, #4c1d95 55%, #6d28d9 100%);
    box-shadow: 0 10px 30px rgba(49, 46, 129, 0.25);
}

/* The faint gear/lightbulb wash behind the hero — decoration only, so it is a
   background gradient rather than an <img>. */
.lg-hero::after {
    content: '';
    position: absolute;
    right: -40px;
    top: -40px;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(250, 204, 21, 0.22) 0%, transparent 70%);
    pointer-events: none;
}

.lg-hero__eyebrow {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #fcd34d;
    margin-bottom: 0.35rem;
}

.lg-hero__title {
    font-size: 1.45rem;
    font-weight: 800;
    line-height: 1.25;
    margin: 0 0 0.5rem;
}

.lg-hero__teaser {
    font-size: 0.94rem;
    line-height: 1.6;
    color: rgba(248, 250, 252, 0.85);
    margin: 0 0 1rem;
    max-width: 60ch;
}

.lg-hero__meta { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1rem; }

.lg-hero .lg-chip {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.22);
    color: #f8fafc;
}

.lg-hero__btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.62rem 1.15rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.92rem;
    text-decoration: none;
    background: #fcd34d;
    color: #422006;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.lg-hero__btn:hover {
    color: #422006;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(252, 211, 77, 0.35);
}

/* ── Chips: category, difficulty, points, countdown ───────────────────── */

.lg-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.32rem;
    padding: 0.24rem 0.65rem;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
    line-height: 1.5;
    white-space: nowrap;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.lg-chip--cat  { background: var(--lg-c-bg, #eef2ff); border-color: transparent; color: var(--lg-c, #4338ca); }
.lg-chip--star { color: #b45309; background: #fef3c7; border-color: #fde68a; letter-spacing: 0.08em; }
.lg-chip--pts  { color: #065f46; background: #d1fae5; border-color: #a7f3d0; }
.lg-chip--time { color: #9a3412; background: #ffedd5; border-color: #fed7aa; }
.lg-chip--lock { color: #475569; background: #e2e8f0; border-color: #cbd5e1; }
.lg-chip--done { color: #3730a3; background: #e0e7ff; border-color: #c7d2fe; }
.lg-chip--ok   { color: #065f46; background: #d1fae5; border-color: #6ee7b7; }
.lg-chip--miss { color: #9f1239; background: #ffe4e6; border-color: #fecdd3; }

/* ── The puzzle card ──────────────────────────────────────────────────── */

.lg-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1.05rem 1.1rem;
    border-radius: 16px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    text-decoration: none;
    color: var(--text);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.lg-card:hover {
    color: var(--text);
    transform: translateY(-2px);
    border-color: var(--lg-c, #6366f1);
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
}

/* The left edge carries the category colour, so a grid of cards reads as
   families at a glance without a legend. */
.lg-card--tinted { border-left: 5px solid var(--lg-c, #6366f1); }

.lg-card__top {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.55rem;
}

.lg-card__glyph {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    font-size: 1.25rem;
    background: var(--lg-c-bg, #eef2ff);
}

.lg-card__num {
    margin-left: auto;
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--text-muted);
}

.lg-card__title {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.35;
    margin: 0 0 0.3rem;
}

.lg-card__teaser {
    font-size: 0.84rem;
    line-height: 1.55;
    color: var(--text-muted);
    margin: 0 0 0.75rem;
}

.lg-card__foot { margin-top: auto; display: flex; flex-wrap: wrap; gap: 0.35rem; }

/* An upcoming puzzle is a closed door: dimmed, dashed, not a link. */
.lg-card--locked {
    border-style: dashed;
    background: var(--surface-2);
    cursor: default;
}
.lg-card--locked .lg-card__title,
.lg-card--locked .lg-card__glyph { opacity: 0.65; }
.lg-card--locked:hover { transform: none; box-shadow: none; border-color: var(--border); }

/* ── Status banner on the puzzle page ─────────────────────────────────── */

.lg-status {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    padding: 0.9rem 1.05rem;
    border-radius: 14px;
    font-size: 0.88rem;
    line-height: 1.55;
    margin-bottom: 1.25rem;
    border: 1.5px solid;
}
.lg-status__glyph { font-size: 1.4rem; line-height: 1.2; flex: 0 0 auto; }
.lg-status__head  { font-weight: 800; display: block; margin-bottom: 0.1rem; }

.lg-status--open     { background: #fffbeb; border-color: #fcd34d; color: #78350f; }
.lg-status--sealed   { background: #eef2ff; border-color: #a5b4fc; color: #3730a3; }
.lg-status--revealed { background: #f1f5f9; border-color: #cbd5e1; color: #334155; }
.lg-status--correct  { background: #ecfdf5; border-color: #6ee7b7; color: #065f46; }
.lg-status--wrong    { background: #fff1f2; border-color: #fda4af; color: #9f1239; }

/* ── The problem text ─────────────────────────────────────────────────── */

.lg-body {
    font-size: 1rem;
    line-height: 1.75;
    color: var(--text);
}
.lg-body p { margin-bottom: 0.95rem; }
.lg-body ul, .lg-body ol { margin: 0 0 1rem; padding-left: 1.35rem; }
.lg-body li { margin-bottom: 0.4rem; }
.lg-body strong { color: #4338ca; }

/* A fact the solver must not miss — the constraint that makes the puzzle a
   puzzle ("at most two weighings"). */
.lg-rule {
    display: flex;
    gap: 0.7rem;
    align-items: flex-start;
    margin: 1.1rem 0;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    background: #fef2f2;
    border: 1.5px solid #fecaca;
    color: #991b1b;
    font-size: 0.9rem;
    line-height: 1.6;
    font-weight: 600;
}
.lg-rule__glyph { font-size: 1.1rem; line-height: 1.4; flex: 0 0 auto; }

/* What exactly to type in the box. */
.lg-ask {
    margin: 1.2rem 0 0;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    background: #eef2ff;
    border-left: 4px solid #6366f1;
    font-size: 0.95rem;
    font-weight: 700;
    color: #3730a3;
}

/* ── Figures ──────────────────────────────────────────────────────────── */

.lg-fig {
    margin: 1.2rem 0;
    padding: 1rem;
    border-radius: 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    text-align: center;
}
.lg-fig svg { max-width: 100%; height: auto; }
.lg-fig__cap {
    margin: 0.6rem 0 0;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Drawing primitives the puzzle SVGs share, so a figure carries no styling of
   its own beyond geometry. */
.lg-ln     { stroke: #475569; stroke-width: 2; fill: none; }
.lg-ln--th { stroke-width: 3.5; stroke-linecap: round; }
.lg-fill   { fill: #e0e7ff; stroke: #6366f1; stroke-width: 2; }
.lg-fill--gold { fill: #fef3c7; stroke: #d97706; stroke-width: 2; }
.lg-fill--rose { fill: #ffe4e6; stroke: #e11d48; stroke-width: 2; }
.lg-fill--mint { fill: #d1fae5; stroke: #059669; stroke-width: 2; }
.lg-lbl {
    font-size: 13px;
    font-weight: 700;
    fill: #334155;
    text-anchor: middle;
    font-family: inherit;
}
.lg-lbl--sm { font-size: 11px; font-weight: 600; fill: #64748b; }

/* ── Hint & solution: native <details>, no script ─────────────────────── */

.lg-fold {
    margin: 1.2rem 0;
    border-radius: 14px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    overflow: hidden;
}
.lg-fold > summary {
    cursor: pointer;
    list-style: none;
    padding: 0.8rem 1.05rem;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--text);
    background: var(--surface-2);
}
.lg-fold > summary::-webkit-details-marker { display: none; }
.lg-fold > summary::after {
    content: '\203A';
    margin-left: auto;
    font-size: 1.3rem;
    line-height: 1;
    transition: transform 0.18s ease;
}
.lg-fold[open] > summary::after { transform: rotate(90deg); }
.lg-fold__inner { padding: 1rem 1.05rem; }

.lg-fold--hint > summary { background: #fffbeb; color: #92400e; }
.lg-fold--sol  > summary { background: #ecfdf5; color: #065f46; }

/* The solution prose gets the same treatment as the problem, plus numbered
   reasoning steps. */
.lg-steps { counter-reset: lgstep; list-style: none; margin: 0; padding: 0; }
.lg-steps > li {
    position: relative;
    counter-increment: lgstep;
    padding: 0 0 0.9rem 2.4rem;
    font-size: 0.94rem;
    line-height: 1.65;
}
.lg-steps > li::before {
    content: counter(lgstep);
    position: absolute;
    left: 0;
    top: 0.1rem;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 800;
    background: #d1fae5;
    color: #065f46;
}

/* The one line that names the trick — every solution ends with it. */
.lg-moral {
    margin: 1.1rem 0 0;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    background: #f5f3ff;
    border-left: 4px solid #7c3aed;
    font-size: 0.92rem;
    line-height: 1.65;
    color: #4c1d95;
}
.lg-moral strong { color: #5b21b6; }

/* ── The answer form / the sealed envelope ────────────────────────────── */

.lg-form {
    margin-top: 1.5rem;
    padding: 1.15rem;
    border-radius: 16px;
    background: var(--surface);
    border: 1.5px solid var(--border);
}
.lg-form__head {
    font-size: 1rem;
    font-weight: 800;
    margin: 0 0 0.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.lg-form__note {
    font-size: 0.83rem;
    color: var(--text-muted);
    margin: 0 0 0.9rem;
    line-height: 1.55;
}
.lg-form input[type="text"],
.lg-form textarea {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border-radius: 12px;
    border: 1.5px solid var(--border);
    background: var(--surface-2);
    font-size: 0.95rem;
    color: var(--text);
}
.lg-form input[type="text"]:focus,
.lg-form textarea:focus {
    outline: none;
    border-color: #6366f1;
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.14);
}
.lg-form label {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}
.lg-form__row + .lg-form__row { margin-top: 0.9rem; }

.lg-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 0.65rem 1.3rem;
    border: none;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.92rem;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #fff;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.lg-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(79, 70, 229, 0.3); }

/* The envelope shown once an answer is in and the reveal has not come. Its
   wax seal is a CSS circle rather than an image. */
.lg-envelope {
    position: relative;
    margin-top: 1.5rem;
    padding: 1.3rem 1.15rem 1.15rem;
    border-radius: 16px;
    background: linear-gradient(160deg, #eef2ff 0%, #e0e7ff 100%);
    border: 1.5px dashed #818cf8;
    text-align: center;
}
.lg-envelope__seal {
    width: 52px;
    height: 52px;
    margin: 0 auto 0.7rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: #fff;
    background: radial-gradient(circle at 35% 30%, #f87171, #b91c1c);
    box-shadow: 0 4px 12px rgba(185, 28, 28, 0.3);
}
.lg-envelope__head {
    font-size: 1rem;
    font-weight: 800;
    color: #3730a3;
    margin: 0 0 0.3rem;
}
.lg-envelope__note {
    font-size: 0.85rem;
    color: #4338ca;
    line-height: 1.6;
    margin: 0 0 0.9rem;
}
.lg-envelope__answer {
    display: inline-block;
    padding: 0.45rem 1rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid #c7d2fe;
    font-weight: 700;
    color: #312e81;
    word-break: break-word;
}

/* ── Verdict + solver wall ────────────────────────────────────────────── */

.lg-wall {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.8rem;
}
.lg-solver {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}
.lg-solver--first { background: #fef3c7; border-color: #fcd34d; color: #92400e; }

/* ── Stat strip ───────────────────────────────────────────────────────── */

.lg-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.6rem;
    margin-bottom: 1.5rem;
}
.lg-stat {
    padding: 0.75rem 0.6rem;
    border-radius: 14px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    text-align: center;
}
.lg-stat__num { font-size: 1.35rem; font-weight: 800; line-height: 1.1; color: var(--text); }
.lg-stat__lbl {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-top: 0.2rem;
}
.lg-stat--fire .lg-stat__num { color: #ea580c; }
.lg-stat--seal .lg-stat__num { color: #4f46e5; }

@media (max-width: 575px) {
    .lg-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .lg-hero { padding: 1.25rem 1.05rem; }
    .lg-hero__title { font-size: 1.2rem; }
}

/* ── Category filter pills ────────────────────────────────────────────── */

.lg-pills { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1.1rem; }
.lg-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none;
    background: var(--surface);
    border: 1.5px solid var(--border);
    color: var(--text-muted);
    transition: border-color 0.15s ease, color 0.15s ease;
}
.lg-pill:hover { color: var(--text); border-color: #a5b4fc; }
.lg-pill--on {
    background: #4f46e5;
    border-color: #4f46e5;
    color: #fff;
}
.lg-pill--on:hover { color: #fff; }

/* ── Leaderboard ──────────────────────────────────────────────────────── */

.lg-rank {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.9rem;
    border-radius: 12px;
    background: var(--surface);
    border: 1.5px solid var(--border);
}
.lg-rank + .lg-rank { margin-top: 0.4rem; }
.lg-rank--me { border-color: #6366f1; background: #eef2ff; }
.lg-rank__pos {
    flex: 0 0 auto;
    width: 32px;
    text-align: center;
    font-weight: 800;
    color: var(--text-muted);
}
.lg-rank__name { font-weight: 700; font-size: 0.92rem; }
.lg-rank__pts { margin-left: auto; font-weight: 800; color: #4338ca; font-size: 0.92rem; }

/* ── Section heads ────────────────────────────────────────────────────── */

.lg-head {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin: 1.9rem 0 0.9rem;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text);
}
.lg-head__count {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.1rem 0.55rem;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-muted);
}

/* =====================================================================
   CLASSROOM — the teacher's workspace
   ---------------------------------------------------------------------
   One room holds the lessons, the homework, the roster, the register, the
   money and the shelf, so every one of those pages wears the same frame:
   a coloured header strip, a row of tabs, then the page's own content.
   Pure CSS, no script — the tabs are links, not panels.
   ===================================================================== */

.cr-shell { padding-bottom: 2rem; }

/* ── Header ───────────────────────────────────────────────────────────── */
.cr-header {
  padding: 1.35rem 0 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.1rem;
}
.cr-header-strip { height: 4px; width: 40px; border-radius: 2px; margin-bottom: .8rem; }
.cr-eyebrow {
  font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent); margin-bottom: .3rem;
  display: flex; align-items: center; gap: .35rem; flex-wrap: wrap;
}
.cr-title {
  font-family: 'Syne', sans-serif; font-size: 1.6rem; font-weight: 800;
  color: var(--text); margin: 0 0 .3rem; line-height: 1.2;
}
.cr-title a { color: inherit; text-decoration: none; }
.cr-desc { color: var(--text-muted); font-size: .87rem; max-width: 620px; margin: 0 0 .7rem; }
.cr-meta-row { display: flex; align-items: center; gap: .85rem; flex-wrap: wrap; }
.cr-meta-item { display: flex; align-items: center; gap: .3rem; font-size: .77rem; color: var(--text-muted); }
.cr-meta-item i { color: var(--accent); }
.cr-action-row { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .7rem; }

/* ── Tabs: the whole room in one row ──────────────────────────────────── */
.cr-tabs {
  display: flex; gap: .3rem; overflow-x: auto; margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border); padding-bottom: 0;
  scrollbar-width: none;
}
.cr-tabs::-webkit-scrollbar { display: none; }
.cr-tab {
  display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap;
  padding: .55rem .85rem; font-size: .82rem; font-weight: 600;
  color: var(--text-muted); text-decoration: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}
.cr-tab:hover { color: var(--text); }
.cr-tab.is-active { color: var(--accent); border-bottom-color: var(--accent); }
.cr-tab-count {
  font-size: .68rem; font-weight: 700; padding: 1px 6px; border-radius: 20px;
  background: var(--surface-2); color: var(--text-muted);
}
.cr-tab.is-active .cr-tab-count { background: var(--accent-glow); color: var(--accent); }

/* ── Section headers ──────────────────────────────────────────────────── */
.cr-section-hdr {
  display: flex; align-items: center; justify-content: space-between;
  gap: .75rem; flex-wrap: wrap; margin-bottom: .85rem;
}
.cr-section-title {
  font-family: 'Syne', sans-serif; font-size: 1rem; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: .45rem;
}
.cr-section-title i { color: var(--accent); }
.cr-section-note { font-size: .76rem; color: var(--text-muted); }

/* ── The generic row card, used by every list in the room ─────────────── */
.cr-list { display: flex; flex-direction: column; gap: .55rem; margin-bottom: 1.75rem; }
.cr-row {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: .8rem 1rem; display: flex; align-items: center; gap: .8rem;
  transition: border-color .18s, box-shadow .18s;
}
.cr-row:hover { border-color: var(--accent); box-shadow: 0 4px 14px rgba(0,0,0,.06); }
.cr-row-icon {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  background: var(--surface-2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem; font-weight: 700; color: var(--text-muted);
}
.cr-row-body { flex: 1; min-width: 0; }
.cr-row-title {
  font-weight: 600; font-size: .9rem; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cr-row-title a { color: inherit; text-decoration: none; }
.cr-row-title a:hover { color: var(--accent); }
.cr-row-sub {
  font-size: .74rem; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cr-row-side { display: flex; align-items: center; gap: .4rem; flex-shrink: 0; }
.cr-row-link {
  color: var(--accent); font-size: .8rem; font-weight: 600; text-decoration: none;
  white-space: nowrap; display: inline-flex; align-items: center; gap: .2rem;
}

/* ── Chips and badges ─────────────────────────────────────────────────── */
.cr-chip {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .68rem; font-weight: 600; padding: 2px 8px; border-radius: 20px;
  background: var(--surface-2); color: var(--text-muted); white-space: nowrap;
}
.cr-chip--accent { background: var(--accent-glow); color: var(--accent); }
.cr-chip--ok { background: rgba(34,197,94,.12); color: #16a34a; }
.cr-chip--warn { background: rgba(251,191,36,.14); color: #b45309; }
.cr-chip--bad { background: rgba(239,68,68,.12); color: #dc2626; }
.cr-chip--kind-tutorial { background: rgba(56,189,248,.14); color: #0284c7; }
.cr-chip--kind-practice { background: rgba(167,139,250,.16); color: #7c3aed; }
.cr-chip--kind-story { background: rgba(251,146,60,.16); color: #c2410c; }
.cr-chip--kind-exam_lesson { background: rgba(52,211,153,.16); color: #047857; }

/* ── Progress bar on an assignment ────────────────────────────────────── */
.cr-bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; min-width: 70px; }
.cr-bar > span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.cr-bar--done > span { background: #16a34a; }

/* ── Panels: a bordered box for a form or a small table ───────────────── */
.cr-panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 1.1rem 1.2rem; margin-bottom: 1.5rem;
}
.cr-panel-title {
  font-family: 'Syne', sans-serif; font-size: .92rem; font-weight: 700;
  color: var(--text); margin: 0 0 .8rem;
  display: flex; align-items: center; gap: .4rem;
}
.cr-panel-title i { color: var(--accent); }
.cr-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .7rem; }
.cr-field-label {
  display: block; font-size: .74rem; font-weight: 600; color: var(--text-muted);
  margin-bottom: .25rem;
}
.cr-help { font-size: .72rem; color: var(--text-muted); margin-top: .25rem; }

/* ── Stat tiles (money totals, attendance) ────────────────────────────── */
.cr-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .6rem; margin-bottom: 1.5rem; }
.cr-stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: .8rem .9rem;
}
.cr-stat-label { font-size: .7rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }
.cr-stat-value { font-family: 'Syne', sans-serif; font-size: 1.25rem; font-weight: 800; color: var(--text); line-height: 1.2; }

/* ── Empty states ─────────────────────────────────────────────────────── */
.cr-empty {
  text-align: center; padding: 2.25rem 1.5rem; background: var(--surface);
  border: 1px dashed var(--border); border-radius: 12px; color: var(--text-muted);
  font-size: .85rem;
}
.cr-empty-icon { font-size: 1.9rem; opacity: .3; margin-bottom: .5rem; }

/* ── Student chips ────────────────────────────────────────────────────── */
.cr-students-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.cr-student-chip {
  display: inline-flex; align-items: center; gap: .4rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 4px 10px; font-size: .75rem; color: var(--text);
  text-decoration: none; transition: border-color .12s;
}
.cr-student-chip:hover { border-color: var(--accent); color: var(--text); }
.cr-student-chip-ava { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); }

/* ── Tables (payments, register) ──────────────────────────────────────── */
.cr-table-wrap { overflow-x: auto; margin-bottom: 1.5rem; }
.cr-table { width: 100%; border-collapse: collapse; font-size: .82rem; min-width: 520px; }
.cr-table th {
  text-align: left; font-size: .7rem; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--text-muted);
  padding: .5rem .6rem; border-bottom: 1px solid var(--border);
}
.cr-table td { padding: .6rem; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; }
.cr-table tr:last-child td { border-bottom: 0; }

/* ── The register's three radio buttons per pupil ─────────────────────── */
.cr-reg-choice { display: inline-flex; gap: .35rem; flex-wrap: wrap; }
.cr-reg-choice label {
  display: inline-flex; align-items: center; gap: .25rem; cursor: pointer;
  font-size: .75rem; color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 20px; padding: 2px 9px;
}
.cr-reg-choice input { margin: 0; }

/* ── Filter pills (payment status, picker kind) ───────────────────────── */
.cr-pills { display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: .85rem; }
.cr-pill {
  font-size: .76rem; font-weight: 600; padding: .3rem .75rem; border-radius: 20px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-muted); text-decoration: none;
  display: inline-flex; align-items: center; gap: .3rem;
}
.cr-pill:hover { border-color: var(--accent); color: var(--text); }
.cr-pill.is-active { background: var(--accent-glow); border-color: var(--accent); color: var(--accent); }

/* ── The add-content search bar on a homework ─────────────────────────── */
.cr-search { display: flex; gap: .45rem; margin-bottom: .85rem; flex-wrap: wrap; }
.cr-search input[type="search"], .cr-search input[type="text"] { flex: 1; min-width: 160px; }

@media (max-width: 575.98px) {
  .cr-title { font-size: 1.3rem; }
  .cr-row { padding: .7rem .8rem; gap: .6rem; }
  .cr-row-sub { display: none; }
  .cr-panel { padding: .9rem 1rem; }
}
