/* ═══════════════════════════════════════════════
   LGU HUB - Style Sheet
   ═══════════════════════════════════════════════ */

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #a5b4fc;
    --secondary: #8b5cf6;
    --accent: #06b6d4;
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #3b82f6;
    --info-light: #dbeafe;

    --bg: #f0f2f5;
    --bg-dark: #e2e5ea;
    --card: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);

    --nav-height: 56px;
    --topbar-height: 56px;
    --sidebar-width: 220px;
    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.2s ease;

    --meteor-head: rgba(0, 0, 0, 0.35);
    --meteor-color: rgba(0, 0, 0, 0.15);
    --meteor-glow: rgba(0, 0, 0, 0.05);

    /* 置顶公告（日间） */
    --ca-border: rgba(251, 191, 36, 0.45);
    --ca-g1: rgba(254, 243, 199, 0.95);
    --ca-g2: rgba(253, 224, 154, 0.72);
    --ca-g3: rgba(253, 230, 138, 0.5);
    --ca-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

/* ═══════ DARK MODE ═══════ */

body.dark-mode {
    --bg: #0f172a;
    --bg-dark: #020617;
    --card: #1e293b;
    --text: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: #334155;
    --border-light: #1e293b;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow: 0 1px 3px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.5);
    --info-light: #1e3a5f;
    --success-light: #064e3b;
    --warning-light: #78350f;
    --danger-light: #7f1d1d;
    --meteor-head: rgba(255, 255, 255, 0.9);
    --meteor-color: rgba(255, 255, 255, 0.7);
    --meteor-glow: rgba(165, 180, 252, 0.15);
}

/* 夜间公告：同时挂在 html 与 body，避免桌面端仅一处有 class 时变量未生效 */
html.dark-mode,
body.dark-mode {
    --ca-border: rgba(129, 140, 248, 0.4);
    --ca-g1: rgba(30, 27, 75, 0.92);
    --ca-g2: rgba(30, 41, 59, 0.96);
    --ca-g3: rgba(15, 23, 42, 0.99);
    --ca-shadow:
        0 4px 24px rgba(0, 0, 0, 0.45),
        0 0 0 1px rgba(99, 102, 241, 0.12) inset;
    --ca-title: #f8fafc;
    --ca-body: #e2e8f0;
    --ca-until: #94a3b8;
    --ca-meta: #a5b4fc;
}

body.dark-mode .navbar { background: rgba(15, 23, 42, 0.95); border-bottom-color: #334155; }
body.dark-mode .auth-panel { background: #0b1120; }
body.dark-mode .auth-card { color: #e2e8f0; }
body.dark-mode .auth-input-wrap { background: #0f172a; border-color: #334155; }
body.dark-mode .auth-input { color: #f1f5f9; }
body.dark-mode .auth-input::placeholder { color: #64748b; }
body.dark-mode .auth-hero-feature-icon { background: rgba(255, 255, 255, 0.08); }
body.dark-mode .auth-maintenance-notice { background: rgba(239, 68, 68, 0.15); }
body.dark-mode .search-input { background: #0f172a; color: #e2e8f0; }
body.dark-mode .bounty-info-card { background: #422006; border-color: #92400e; }
body.dark-mode .bounty-info-card p { color: #fbbf24; }
body.dark-mode .fav-btn.fav-active { background: #422006; }
body.dark-mode .search-result-hint { background: #1e3a5f; color: #93c5fd; }
body.dark-mode img { opacity: 0.92; }

/* ═══════ METEOR SHOWER ═══════ */

.meteors {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.meteor {
    position: absolute;
    top: -120px;
    width: 2px;
    height: 100px;
    background: linear-gradient(to bottom, transparent, var(--meteor-color), var(--meteor-head));
    border-radius: 999px;
    filter: drop-shadow(0 0 4px var(--meteor-glow));
    transform: rotate(-45deg);
    opacity: 0;
    animation: meteor-fall var(--dur) var(--del) linear infinite;
}

.meteor:nth-child(1) { left: 2%;  --dur: 3.5s; --del: 0s; }
.meteor:nth-child(2) { left: 12%; --dur: 4.5s; --del: 1.4s; }
.meteor:nth-child(3) { left: 25%; --dur: 3s;   --del: 3s; }
.meteor:nth-child(4) { left: 38%; --dur: 4s;   --del: 0.5s; }
.meteor:nth-child(5) { left: 50%; --dur: 3.8s; --del: 4s; }
.meteor:nth-child(6) { left: 62%; --dur: 5s;   --del: 2s; }
.meteor:nth-child(7) { left: 30%; --dur: 4.2s; --del: 5.5s; }
.meteor:nth-child(8) { left: 55%; --dur: 3.2s; --del: 7s; }

@keyframes meteor-fall {
    0%   { opacity: 0; transform: translateY(0) translateX(0) rotate(-45deg); }
    4%   { opacity: 1; }
    50%  { opacity: 0.5; }
    100% { opacity: 0; transform: translateY(110vh) translateX(110vh) rotate(-45deg); }
}

/* ═══════ DARK MODE TOGGLE ═══════ */

.dark-mode-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 34px; height: 34px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all var(--transition);
    flex-shrink: 0;
}

.dark-mode-toggle:hover { background: var(--border-light); transform: rotate(20deg); }

/* ═══════ USER TITLE BADGES ═══════ */

.user-title {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.45rem;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
    vertical-align: middle;
}

.user-title.tier-1 { background: #dbeafe; color: #2563eb; }
.user-title.tier-2 { background: #ede9fe; color: #7c3aed; }
.user-title.tier-3 { background: #fef3c7; color: #d97706; }
.user-title.tier-4 { background: #fee2e2; color: #dc2626; }

body.dark-mode .user-title.tier-1 { background: #1e3a5f; color: #60a5fa; }
body.dark-mode .user-title.tier-2 { background: #2e1065; color: #a78bfa; }
body.dark-mode .user-title.tier-3 { background: #78350f; color: #fbbf24; }
body.dark-mode .user-title.tier-4 { background: #7f1d1d; color: #fca5a5; }
body.dark-mode .title-option { background: var(--card); border-color: var(--border); }
body.dark-mode .title-option.selected { background: rgba(99,102,241,0.12); }
body.dark-mode .title-option-name { color: var(--text); }
body.dark-mode .title-option-tier.tier-1 { background: #1e3a5f; color: #60a5fa; }
body.dark-mode .title-option-tier.tier-2 { background: #2e1065; color: #a78bfa; }
body.dark-mode .title-option-tier.tier-3 { background: #78350f; color: #fbbf24; }
body.dark-mode .title-option-tier.tier-4 { background: #7f1d1d; color: #fca5a5; }

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica,
                 Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

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

code {
    background: var(--border-light);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.875rem;
    color: var(--primary-dark);
}

/* ═══════ APP SHELL (topbar + sidebar) ═══════ */

.app-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem 0 0.75rem;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

body.dark-mode .app-topbar {
    background: var(--card);
    border-bottom-color: var(--border);
}

.app-topbar-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--text);
    font-size: 1.2rem;
    font-weight: 700;
    white-space: nowrap;
    text-decoration: none;
}

.app-brand:hover { color: var(--primary); }

.brand-icon { font-size: 1.45rem; }
.brand-accent { color: var(--primary); font-weight: 600; }

.app-topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card);
    color: var(--text);
    cursor: pointer;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    text-decoration: none;
    color: var(--text);
    max-width: 10rem;
}

.topbar-user-name {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-topbar-logout {
    color: #1e293b !important;
    border: 1px solid #e2e8f0 !important;
    background: #ffffff !important;
    padding: 0.35rem 0.75rem !important;
    white-space: nowrap;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

.btn-topbar-logout:hover {
    color: #0f172a !important;
    border-color: #cbd5e1 !important;
    background: #f8fafc !important;
}

body.dark-mode .btn-topbar-logout {
    color: #ffffff !important;
    background: var(--bg) !important;
    border-color: var(--border) !important;
}

body.dark-mode .btn-topbar-logout:hover {
    color: #ffffff !important;
    background: var(--bg-dark) !important;
    border-color: var(--border) !important;
}

.btn-topbar-feedback {
    flex-shrink: 0;
    padding: 0.35rem 0.7rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(99, 102, 241, 0.35);
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-dark);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.btn-topbar-feedback:hover {
    background: rgba(99, 102, 241, 0.18);
    border-color: rgba(99, 102, 241, 0.55);
    color: var(--primary);
}

body.dark-mode .btn-topbar-feedback {
    color: #c4b5fd;
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(129, 140, 248, 0.45);
}

body.dark-mode .btn-topbar-feedback:hover {
    color: #e9d5ff;
    background: rgba(99, 102, 241, 0.32);
}

.feedback-modal-content {
    max-width: 520px;
}

.feedback-modal-hint {
    margin: 0 0 0.75rem;
    font-size: 0.88rem;
    line-height: 1.55;
    color: var(--text-secondary);
}

.feedback-textarea {
    min-height: 140px;
    resize: vertical;
}

.feedback-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.65rem;
}

.admin-feedback-message {
    max-width: 36rem;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.55;
    font-size: 0.88rem;
}

.admin-feedback-page {
    max-width: 14rem;
    font-size: 0.8rem;
    word-break: break-all;
}

.admin-feedback-page a {
    color: var(--primary);
}

.admin-feedback-time {
    white-space: nowrap;
    font-size: 0.82rem;
}

.app-sidebar {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    z-index: 1050;
    background: var(--card);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 0.85rem 0.65rem 1.5rem;
    box-shadow: var(--shadow-sm);
}

.sidebar-section-label {
    margin: 0 0.5rem 0.5rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
}

.sidebar-link:hover {
    color: var(--text);
    background: var(--border-light);
}

.sidebar-link.active {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.12);
    font-weight: 600;
}

.sidebar-link .nav-icon {
    width: 1.25rem;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    top: var(--topbar-height);
    z-index: 1040;
    background: rgba(15, 23, 42, 0.45);
}

body.sidebar-open .sidebar-backdrop {
    display: block;
}

.nav-icon { margin-right: 0.15rem; }

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    text-transform: uppercase;
    overflow: hidden;
    flex-shrink: 0;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.avatar-letter {
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
}

.user-info { text-decoration: none; }

.user-name { color: rgba(255,255,255,0.9); font-size: 0.9rem; }

.admin-badge {
    background: linear-gradient(135deg, var(--warning), #f97316);
    color: #fff;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
}

.btn-logout {
    color: rgba(255,255,255,0.7) !important;
    border: 1px solid rgba(255,255,255,0.2);
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    transition: all var(--transition);
}

.btn-logout:hover { color: #fff !important; background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.4); }

/* Top bar: white button, dark text (overrides legacy .btn-logout light-on-dark styles) */
.app-topbar-actions .btn-logout.btn-topbar-logout,
.app-topbar-actions a.btn-topbar-logout {
    color: #1e293b !important;
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
}

body.dark-mode .app-topbar-actions .btn-logout.btn-topbar-logout,
body.dark-mode .app-topbar-actions a.btn-topbar-logout {
    color: #ffffff !important;
    background: var(--bg) !important;
    border-color: var(--border) !important;
}

body.dark-mode .app-topbar-actions .btn-logout.btn-topbar-logout:hover,
body.dark-mode .app-topbar-actions a.btn-topbar-logout:hover {
    color: #ffffff !important;
    background: var(--bg-dark) !important;
    border-color: var(--border) !important;
}

.nav-toggle { display: none; background: none; border: none; color: #fff; font-size: 1.5rem; cursor: pointer; padding: 0.5rem; margin-left: auto; }

/* ═══════ MAIN CONTENT ═══════ */

.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: calc(var(--nav-height) + 1.5rem) 1.5rem 2rem;
    position: relative;
    z-index: 1;
}

.main-content.with-sidebar {
    max-width: none;
    margin-left: var(--sidebar-width);
    padding: calc(var(--topbar-height) + 1.25rem) 1.5rem 2rem;
    min-height: calc(100vh - var(--topbar-height));
}

.main-content.no-nav { padding: 0; max-width: none; margin-left: 0; }

/* ═══════ BUTTONS ═══════ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1.1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1.5;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4); color: #fff; }

.btn-secondary {
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border-light); border-color: var(--text-muted); color: var(--text); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }

.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.8rem; }
.btn-lg { padding: 0.7rem 1.5rem; font-size: 1rem; }
.btn-full { width: 100%; justify-content: center; }

.btn-download {
    background: linear-gradient(135deg, var(--success), #059669);
    color: #fff !important;
}
.btn-download:hover { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(16, 185, 129, 0.3); }

/* ═══════ ALERTS ═══════ */

.alerts-container { margin-bottom: 1rem; }

.alert {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    animation: slideDown 0.3s ease;
}

.alert-success { background: var(--success-light); color: #065f46; border-left: 4px solid var(--success); }
.alert-error { background: var(--danger-light); color: #991b1b; border-left: 4px solid var(--danger); }
.alert-info { background: var(--info-light); color: #1e40af; border-left: 4px solid var(--info); }

/* 夜间模式：登录/注册页等顶栏闪存提示用浅色字（否则深底+深字看不清） */
html.dark-mode .alert-success,
body.dark-mode .alert-success {
    background: rgba(16, 185, 129, 0.22);
    color: #ecfdf5;
    border-left-color: #34d399;
}
html.dark-mode .alert-error,
body.dark-mode .alert-error {
    background: rgba(239, 68, 68, 0.25);
    color: #ffffff;
    border-left-color: #f87171;
}
html.dark-mode .alert-info,
body.dark-mode .alert-info {
    background: rgba(59, 130, 246, 0.22);
    color: #eff6ff;
    border-left-color: #60a5fa;
}

.alert-close {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0.5;
    color: inherit;
}
.alert-close:hover { opacity: 1; }

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ═══════ PAGE HEADER ═══════ */

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h2 { font-size: 1.5rem; font-weight: 700; color: var(--text); }
.page-desc { color: var(--text-secondary); font-size: 0.9rem; margin-top: 0.25rem; }

.page-header-right { display: flex; gap: 0.5rem; align-items: center; }

/* ═══════ COMMUNITY TOP ANNOUNCEMENT ═══════ */

.community-announcement {
    margin: -0.5rem 0 1.25rem;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-lg, 12px);
    border: 1px solid var(--ca-border);
    background: linear-gradient(145deg, var(--ca-g1) 0%, var(--ca-g2) 55%, var(--ca-g3) 100%);
    box-shadow: var(--ca-shadow);
}

html.dark-mode .community-announcement-icon,
body.dark-mode .community-announcement-icon {
    filter: drop-shadow(0 0 8px rgba(129, 140, 248, 0.35));
}

.community-announcement-inner {
    display: flex;
    gap: 0.875rem;
    align-items: flex-start;
}
.community-announcement-icon { font-size: 1.5rem; flex-shrink: 0; line-height: 1; }
.community-announcement-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--ca-title, var(--text));
    margin-bottom: 0.35rem;
}
.community-announcement-meta {
    font-weight: 500;
    color: var(--ca-meta, var(--text-secondary));
    font-size: 0.85rem;
}
.community-announcement-body {
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--ca-body, var(--text));
    font-size: 0.95rem;
    line-height: 1.55;
}
.community-announcement-until {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--ca-until, var(--text-secondary));
}

/* Login maintenance notice */
.auth-maintenance-notice {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: var(--text);
    font-size: 0.9rem;
}
.auth-maintenance-notice strong { display: block; margin-bottom: 0.35rem; color: #b91c1c; }
.auth-maintenance-notice p { margin: 0; line-height: 1.5; }

.admin-announce-active {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.25);
    margin-bottom: 1rem;
}
.admin-announce-preview {
    margin: 0.5rem 0;
    white-space: pre-wrap;
    word-break: break-word;
}
.admin-announce-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.admin-maint-toggle { margin: 0.75rem 0; }
.admin-maint-toggle input { margin-right: 0.5rem; }

/* ═══════ BREADCRUMB ═══════ */

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    flex-wrap: wrap;
}

.breadcrumb-item { color: var(--primary); }
.breadcrumb-item.active { color: var(--text-secondary); }
.breadcrumb-sep { color: var(--text-muted); }

/* ═══════ FILE GRID ═══════ */

.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 0.75rem;
}

.file-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: all var(--transition);
}

.file-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--primary-light);
}

.file-icon-wrap { flex-shrink: 0; }

.file-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    font-size: 1.5rem;
    background: var(--border-light);
}

.folder-icon { background: #fef3c7; cursor: pointer; text-decoration: none; }
.folder-icon:hover { background: #fde68a; }

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

.file-name {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

a.file-name:hover { color: var(--primary); }

.file-meta {
    display: flex;
    gap: 1rem;
    margin-top: 2px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.file-actions {
    display: flex;
    gap: 0.35rem;
    flex-shrink: 0;
}

/* ═══════ EMPTY STATE ═══════ */

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-icon { font-size: 4rem; margin-bottom: 1rem; opacity: 0.5; }
.empty-state h3 { font-size: 1.25rem; margin-bottom: 0.5rem; color: var(--text); }
.empty-state p { font-size: 0.9rem; }

/* ═══════ AUTH PAGES (split layout) ═══════ */

body:has(.auth-page) .meteors {
    opacity: 0.35;
}

body:has(.auth-page) .main-content.no-nav .alerts-container {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    width: min(420px, calc(100% - 2rem));
}

.auth-page {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    min-height: 100vh;
    width: 100%;
    margin: 0;
    padding: 0;
    background: #0b0f1a;
    overflow: hidden;
}

/* —— Left brand panel —— */
.auth-hero {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(2rem, 4vw, 3.5rem);
    color: #f8fafc;
    overflow: hidden;
    background: linear-gradient(145deg, #0f0a1f 0%, #1e1060 38%, #4c1d95 72%, #7c3aed 100%);
}

.auth-hero-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.auth-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.55;
    animation: auth-blob-float 14s ease-in-out infinite;
}

.auth-blob--1 {
    width: 420px;
    height: 420px;
    top: -12%;
    left: -8%;
    background: #a855f7;
}

.auth-blob--2 {
    width: 360px;
    height: 360px;
    bottom: -10%;
    right: -5%;
    background: #6366f1;
    animation-delay: -4s;
}

.auth-blob--3 {
    width: 280px;
    height: 280px;
    top: 42%;
    left: 38%;
    background: #ec4899;
    opacity: 0.35;
    animation-delay: -8s;
}

.auth-grid-overlay {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse 80% 70% at 30% 40%, black 20%, transparent 75%);
}

@keyframes auth-blob-float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(24px, -18px) scale(1.06); }
    66% { transform: translate(-16px, 14px) scale(0.96); }
}

.auth-hero-inner {
    position: relative;
    z-index: 1;
    width: min(100%, 40rem);
    max-width: 40rem;
    margin: 0 auto;
}

.auth-hero-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
    padding: 0.55rem 1.1rem 0.55rem 0.65rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(12px);
}

.auth-hero-logo {
    font-size: 2rem;
    line-height: 1;
}

.auth-hero-wordmark {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.auth-hero-wordmark .text-accent {
    color: #c4b5fd;
}

.auth-hero-title {
    margin: 0 0 1rem;
    font-size: clamp(2rem, 3.8vw, 2.85rem);
    font-weight: 800;
    line-height: 1.18;
    letter-spacing: -0.02em;
}

.auth-hero-lead {
    margin: 0 0 2.25rem;
    font-size: clamp(1.05rem, 1.6vw, 1.2rem);
    line-height: 1.7;
    color: rgba(248, 250, 252, 0.85);
    max-width: 36rem;
}

.auth-hero-features {
    --auth-feat-icon-size: 3.5rem;
    --auth-feat-icon-gap: 1.15rem;
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: var(--auth-feat-icon-size) 1fr;
    column-gap: var(--auth-feat-icon-gap);
    row-gap: 1rem;
}

.auth-hero-features li {
    display: grid;
    grid-template-columns: subgrid;
    grid-column: 1 / -1;
    align-items: center;
    padding: 1.1rem 1.25rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
    transition: transform 0.25s ease, background 0.25s ease;
}

@supports not (grid-template-columns: subgrid) {
    .auth-hero-features {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    .auth-hero-features li {
        display: grid;
        grid-template-columns: var(--auth-feat-icon-size) 1fr;
        column-gap: var(--auth-feat-icon-gap);
        grid-column: auto;
    }
}

.auth-hero-features li:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.12);
}

.auth-hero-feature-icon {
    grid-column: 1;
    justify-self: center;
    align-self: center;
    box-sizing: border-box;
    width: var(--auth-feat-icon-size);
    height: var(--auth-feat-icon-size);
    min-width: var(--auth-feat-icon-size);
    min-height: var(--auth-feat-icon-size);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    line-height: 1;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.12);
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
    /* 统一 emoji 光学居中 */
    text-align: center;
    overflow: hidden;
}

.auth-hero-feature-body {
    grid-column: 2;
    min-width: 0;
}

.auth-hero-features strong {
    display: block;
    font-size: 1.08rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    line-height: 1.3;
}

.auth-hero-feature-desc {
    margin: 0;
    font-size: 0.95rem;
    color: rgba(248, 250, 252, 0.75);
    line-height: 1.5;
}

/* —— Right form panel —— */
.auth-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(1.5rem, 4vw, 3rem);
    background: #f8fafc;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.auth-header {
    margin-bottom: 1.75rem;
}

.auth-header h1 {
    margin: 0 0 0.4rem;
    font-size: 1.85rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
    line-height: 1.2;
}

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

.auth-subtitle {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.auth-field label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
}

.auth-input-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.85rem 0 0.75rem;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    background: #ffffff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-input-wrap:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.14);
}

.auth-input-icon {
    font-size: 1rem;
    opacity: 0.55;
    flex-shrink: 0;
    user-select: none;
}

.auth-input {
    flex: 1;
    min-width: 0;
    padding: 0.8rem 0.25rem;
    border: none;
    background: transparent;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.auth-input::placeholder {
    color: #94a3b8;
}

.auth-field--checkbox {
    margin-top: 0.15rem;
}

.auth-field--checkbox .checkbox-label {
    font-size: 0.9rem;
}

.auth-field--turnstile {
    margin-top: 0.25rem;
}

.auth-form-hint {
    margin: -0.35rem 0 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.55;
}

.auth-submit-btn {
    margin-top: 0.35rem;
    padding: 0.9rem 1rem !important;
    font-size: 1rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.04em;
    border-radius: 12px !important;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%) !important;
    border: none !important;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
}

.auth-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(99, 102, 241, 0.45);
}

.auth-footer {
    margin-top: 1.75rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-align: center;
}

.auth-footer a {
    font-weight: 600;
    color: var(--primary);
    margin-left: 0.2rem;
}

.auth-footer a:hover {
    text-decoration: underline;
}

.auth-footer-split {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    text-align: left;
}

.auth-footer-split span { margin: 0; }

.auth-link-muted {
    font-weight: 600;
    color: var(--text-secondary);
}

.auth-link-muted:hover {
    color: var(--primary);
}

/* Legacy form-group still used on register checkbox etc. */
.auth-page .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.auth-page .form-group label {
    font-size: 0.875rem;
    font-weight: 600;
}

.auth-page .form-group input[type="text"],
.auth-page .form-group input[type="password"],
.auth-page .form-group input[type="email"] {
    padding: 0.7rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    font-size: 0.95rem;
    width: 100%;
    box-sizing: border-box;
}

/* 强制改密（邮件重置后）须高于引导/打赏层 */
.force-password-modal {
    z-index: 8500 !important;
}
.force-password-hint {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.55;
    margin-bottom: 1rem;
}

/* ═══════ UPLOAD ═══════ */

.upload-page {
    width: 100%;
    max-width: none;
}

.main-content.with-sidebar:has(.upload-page) {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.upload-page .page-header {
    margin-bottom: 1.75rem;
}

.upload-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    gap: 1.75rem;
    align-items: stretch;
}

.upload-layout-left,
.upload-layout-right {
    display: flex;
    flex-direction: column;
    gap: 1.35rem;
    min-width: 0;
}

.upload-layout-right {
    min-height: 100%;
}

.upload-drop-panel {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    min-height: 100%;
}

.upload-layout-right .drop-zone {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 100%;
    background: #ffffff;
    box-sizing: border-box;
}

.upload-layout-right .drop-zone.drag-over {
    transform: none;
}

.upload-layout-right .drop-zone-large .drop-zone-inner {
    flex: 1;
    min-height: 14rem;
    justify-content: center;
    box-sizing: border-box;
    width: 100%;
}

body.dark-mode .upload-layout-right .drop-zone {
    background: var(--card);
}

.upload-panel-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem 1.75rem;
    overflow: hidden;
    box-sizing: border-box;
    min-width: 0;
}

body.dark-mode .upload-panel-card {
    background: var(--card);
}

.upload-container {
    max-width: none;
    width: 100%;
}

@media (max-width: 960px) {
    .upload-layout {
        grid-template-columns: 1fr;
    }
}

.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    background: var(--card);
    transition: all var(--transition);
    cursor: pointer;
}

.drop-zone:hover, .drop-zone.drag-over {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.03);
}

.drop-zone.drag-over {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.06);
    transform: scale(1.01);
}

.drop-zone-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
}

.drop-zone-large .drop-zone-inner { padding: 3rem 2rem; }

.drop-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.drop-icon-large { font-size: 4rem; margin-bottom: 0.75rem; opacity: 0.7; }

.drop-zone-inner p { color: var(--text-secondary); font-size: 0.9rem; margin-top: 0.25rem; }
.drop-zone-inner h3 { color: var(--text); font-size: 1.1rem; }
.drop-hint { font-size: 0.8rem !important; color: var(--text-muted) !important; margin-top: 1rem !important; }
.drop-zone-buttons { display: flex; gap: 0.5rem; margin-top: 0.75rem; }

.upload-file-list { margin-top: 1rem; }

.upload-file-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
}

.upload-page .upload-file-item {
    background: #ffffff;
    max-width: 100%;
    box-sizing: border-box;
}

body.dark-mode .upload-page .upload-file-item {
    background: var(--bg);
}

.upload-file-icon { font-size: 1.2rem; }
.upload-file-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload-file-size { color: var(--text-muted); font-size: 0.8rem; white-space: nowrap; }

.upload-file-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0 0.25rem;
}
.upload-file-remove:hover { color: var(--danger); }

.upload-progress { margin-top: 1rem; }

.progress-bar {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

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

.progress-text { font-size: 0.8rem; color: var(--text-secondary); margin-top: 0.25rem; display: block; }

.upload-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.upload-result { margin-top: 1rem; }

.upload-result-success {
    background: var(--success-light);
    color: #065f46;
    padding: 1rem;
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--success);
}

.upload-result-error {
    background: var(--danger-light);
    color: #991b1b;
    padding: 1rem;
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--danger);
}

/* ═══════ MODAL ═══════ */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(4px);
}

.modal.show { display: flex; animation: fadeIn 0.2s ease; }

.modal-content {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    animation: scaleIn 0.2s ease;
}

.modal-sm { max-width: 400px; }

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

.modal-header h3 { font-size: 1.1rem; font-weight: 700; }

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}
.modal-close:hover { background: var(--border-light); color: var(--text); }

.modal-body { padding: 1.5rem; }
.modal-footer { display: flex; justify-content: flex-end; gap: 0.5rem; padding: 1rem 1.5rem; border-top: 1px solid var(--border); }

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

/* ═══════ ADMIN STATS ═══════ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border-left: 4px solid transparent;
    transition: all var(--transition);
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-primary { border-left-color: var(--primary); }
.stat-success { border-left-color: var(--success); }
.stat-warning { border-left-color: var(--warning); }
.stat-info { border-left-color: var(--info); }
.stat-purple { border-left-color: var(--secondary); }

.stat-icon { font-size: 2rem; }
.stat-value { font-size: 1.75rem; font-weight: 800; color: var(--text); line-height: 1; }
.stat-label { font-size: 0.8rem; color: var(--text-secondary); margin-top: 0.15rem; }

/* ═══════ TABS ═══════ */

.admin-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--border);
    overflow-x: auto;
}

.tab-btn {
    padding: 0.7rem 1.25rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition);
    white-space: nowrap;
}

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

.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s ease; }

/* ═══════ CARDS ═══════ */

.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.card-header h3 { font-size: 1rem; font-weight: 600; }
.card-body { padding: 1.25rem; }

/* ═══════ TABLES ═══════ */

.table-wrap { overflow-x: auto; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-table th {
    background: var(--border-light);
    padding: 0.65rem 0.75rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.data-table td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--border-light);
}

.data-table tbody tr:hover { background: rgba(99, 102, 241, 0.02); }

.text-nowrap { white-space: nowrap; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }

.path-cell {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
    background: var(--border-light);
    color: var(--text-secondary);
}

.rank-badge.rank-1 { background: #fef3c7; color: #92400e; }
.rank-badge.rank-2 { background: #e5e7eb; color: #374151; }
.rank-badge.rank-3 { background: #fed7aa; color: #9a3412; }

.method-badge {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.method-get { background: var(--success-light); color: #065f46; }
.method-post { background: var(--info-light); color: #1e40af; }

.role-badge {
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.role-admin { background: linear-gradient(135deg, #fef3c7, #fde68a); color: #92400e; }
.role-user { background: var(--border-light); color: var(--text-secondary); }
.role-super {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #fff;
    box-shadow: 0 1px 4px rgba(99, 102, 241, 0.35);
}

/* ═══════ CHART ═══════ */

.chart-container {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 1.5rem;
    padding: 1rem 0;
    min-height: 240px;
}

.chart-bar-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
}

.chart-bar {
    width: 40px;
    min-height: 4px;
    background: linear-gradient(180deg, var(--primary), var(--secondary));
    border-radius: 4px 4px 0 0;
    transition: height 0.5s ease;
}

.chart-value { font-size: 0.8rem; font-weight: 700; color: var(--text); }
.chart-label { font-size: 0.75rem; color: var(--text-muted); }

/* ═══════ ERROR PAGE ═══════ */

.error-page {
    text-align: center;
    padding: 5rem 2rem;
}

.error-code {
    font-size: 6rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

.error-message { font-size: 1.25rem; color: var(--text-secondary); margin-top: 0.5rem; }

/* ═══════ RESPONSIVE ═══════ */

@media (max-width: 768px) {
    .sidebar-toggle { display: inline-flex; }
    .has-sidebar .app-sidebar {
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        box-shadow: var(--shadow-lg);
    }
    body.sidebar-open .app-sidebar {
        transform: translateX(0);
    }
    .has-sidebar .main-content.with-sidebar {
        margin-left: 0;
    }
    .topbar-user-name { display: none; }
    .topbar-dark-mode-desktop,
    .topbar-feedback-desktop {
        display: none !important;
    }
    .app-topbar {
        padding: 0 0.5rem 0 0.35rem;
    }
    .app-topbar-actions {
        gap: 0.35rem;
    }
    .nav-points {
        padding: 0.28rem 0.5rem;
        font-size: 0.82rem;
    }
    .btn-topbar-logout {
        padding: 0.28rem 0.55rem !important;
        font-size: 0.8rem;
    }
    .topbar-user {
        gap: 0;
        max-width: none;
    }
    .app-brand {
        font-size: 1.05rem;
    }
    .brand-icon {
        font-size: 1.25rem;
    }
    /* Extra bottom space for fixed FABs (donate, lang, bug, theme) */
    .main-content:not(.no-nav) {
        padding-bottom: calc(2rem + 4.5rem + env(safe-area-inset-bottom, 0px));
    }
    .page-header { flex-direction: column; }
    .file-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .chart-container { gap: 0.5rem; }
    .chart-bar { width: 24px; }
    .auth-page {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .auth-hero {
        padding: 1.75rem 1.5rem 1.5rem;
        min-height: auto;
        justify-content: flex-start;
    }

    .auth-hero-inner {
        width: 100%;
        max-width: none;
    }

    .auth-hero-lead {
        margin-bottom: 1.25rem;
        font-size: 0.92rem;
    }

    .auth-hero-features {
        display: none;
    }

    .auth-hero-title {
        font-size: 1.45rem;
    }

    .auth-panel {
        padding: 1.5rem 1.25rem 2rem;
    }

    .main-content.no-nav {
        padding-bottom: calc(3rem + 58px + env(safe-area-inset-bottom, 0px));
    }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .file-card { flex-wrap: wrap; }
    .file-actions { width: 100%; justify-content: flex-end; }
}

/* ═══════ CHECKBOX (Register) ═══════ */

.checkbox-group { margin-top: 0.25rem; }

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text);
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}

.checkbox-label small { color: var(--text-muted); }

/* ═══════ SORT TOGGLE ═══════ */

.sort-toggle {
    display: flex;
    background: var(--card);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    overflow: hidden;
}

.sort-btn {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: all var(--transition);
    border-right: 1px solid var(--border);
    white-space: nowrap;
}

.sort-btn:last-child { border-right: none; }
.sort-btn:hover { background: var(--border-light); color: var(--text); }

.sort-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
}

.sort-btn.active:hover { color: #fff; }

/* ═══════ SEARCH + SORT BAR ═══════ */

.search-sort-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.search-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    flex: 1;
    min-width: 250px;
    align-items: center;
}

.search-form.search-form--community {
    align-items: stretch;
}

.search-form.search-form--community .search-input-wrap {
    flex: 1 1 220px;
    min-width: 0;
}

.search-filters-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.search-filters-actions .tag-filter-input {
    width: 7rem;
}

.search-filters-actions .btn-search-submit {
    flex-shrink: 0;
    justify-content: center;
    text-align: center;
}

.tag-filter-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.tag-filter-input {
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    background: var(--card);
    color: var(--text);
}
.tag-filter-input::placeholder { color: var(--text-secondary); }
body.dark-mode .tag-filter-input { background: var(--bg); border-color: var(--border); }

.batch-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.75rem;
    margin-bottom: 0.75rem;
    padding: 0 1.25rem;
}
.batch-tag {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary);
    border-radius: 6px;
    letter-spacing: 0.02em;
}
body.dark-mode .batch-tag { background: rgba(99, 102, 241, 0.2); }

.search-input-wrap {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    font-size: 0.9rem;
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 0.55rem 0.75rem 0.55rem 2.2rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    outline: none;
    transition: border-color var(--transition);
    font-family: inherit;
}

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

.search-clear {
    position: absolute;
    right: 0.6rem;
    font-size: 1.2rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    text-decoration: none;
}
.search-clear:hover { color: var(--danger); }

.search-result-hint {
    padding: 0.6rem 1rem;
    background: var(--info-light);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    color: #1e40af;
    margin-bottom: 1rem;
    border-left: 4px solid var(--info);
}

.search-result-hint a { margin-left: 0.75rem; font-weight: 600; }

/* ═══════ BATCH CARDS ═══════ */

.batch-list { display: flex; flex-direction: column; gap: 1.25rem; }

.community-feed-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.community-loading-more {
    text-align: center;
    padding: 0.5rem 1rem 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.community-loading-inner {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.community-infinite-sentinel {
    min-height: 8px;
    margin: 0;
    pointer-events: none;
    flex-shrink: 0;
}

.batch-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: box-shadow var(--transition);
}

.batch-card:hover { box-shadow: var(--shadow-md); }

.batch-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.65rem;
    padding: 1rem 1.25rem;
    background: var(--border-light);
    border-bottom: 1px solid var(--border);
}

.batch-user { display: flex; align-items: center; gap: 0.75rem; }

.batch-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    flex-shrink: 0;
    overflow: hidden;
}

.batch-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.batch-avatar-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.batch-description {
    padding: 0.6rem 1.25rem;
    background: var(--border-light);
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.batch-description p { margin: 0; white-space: pre-wrap; }

.batch-username { font-weight: 600; font-size: 0.95rem; display: block; }
.batch-time { font-size: 0.8rem; color: var(--text-muted); }
.batch-time--short { display: none; }

.batch-zip-label--short { display: none; }

.batch-zip-del-group {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 0.35rem;
}

.batch-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.batch-header-actions .btn-batch-zip,
.batch-header-actions .btn-batch-del {
    white-space: nowrap;
    writing-mode: horizontal-tb;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.batch-stat {
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 0.25rem 0.5rem;
    background: var(--border-light);
    border-radius: 20px;
    white-space: nowrap;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--card);
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: all var(--transition);
}

.btn-icon:hover { border-color: #f59e0b; color: #f59e0b; }

.fav-btn.fav-active {
    background: #fffbeb;
    border-color: #f59e0b;
    color: #f59e0b;
}

.fav-btn.fav-active .fav-icon { color: #f59e0b; }
.fav-icon { font-size: 1rem; line-height: 1; }
.fav-count { font-size: 0.75rem; font-weight: 600; }

.batch-file-dl-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Image Preview Grid */

.image-preview-grid {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem 0;
    flex-wrap: wrap;
}

.image-preview-thumb {
    width: 100px;
    height: 100px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    border: 2px solid var(--border);
    transition: all var(--transition);
    flex-shrink: 0;
}

.image-preview-thumb:hover {
    border-color: var(--primary);
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

.image-preview-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Image Preview Modal */

.image-preview-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.image-preview-modal-content img {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.image-preview-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition);
}

.image-preview-close:hover { background: rgba(255, 255, 255, 0.4); }

.image-preview-name {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
    margin-top: 0.75rem;
    text-align: center;
}

/* Batch Files */

.batch-files { padding: 0.75rem 1.25rem; }
.batch-tags + .batch-files { padding-top: 0; }

.batch-file-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.875rem;
}

.batch-file-item:last-child { border-bottom: none; }

.batch-file-icon { font-size: 1.1rem; flex-shrink: 0; }

.batch-file-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.batch-file-size { color: var(--text-muted); font-size: 0.8rem; white-space: nowrap; }

/* ═══════ STAR RATING ═══════ */

.batch-rating {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.rating-display { display: flex; align-items: center; gap: 0.4rem; }

.stars-show { position: relative; display: inline-block; }

.stars-outer {
    color: #ddd;
    font-size: 1.35rem;
    letter-spacing: 2px;
    position: relative;
    display: inline-block;
    user-select: none;
}

.stars-inner {
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden;
    white-space: nowrap;
    color: #f59e0b;
    pointer-events: none;
}

.rating-avg { font-weight: 700; font-size: 1.1rem; color: var(--text); }
.rating-divider { color: var(--text-muted); }
.rating-max { color: var(--text-muted); font-size: 0.9rem; }
.rating-count { color: var(--text-muted); font-size: 0.8rem; }

.rating-input {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.rating-label { font-size: 0.85rem; color: var(--text-secondary); white-space: nowrap; }

.stars-interactive {
    display: inline-flex;
    gap: 2px;
    cursor: pointer;
}

.star-btn {
    font-size: 1.4rem;
    color: #ddd;
    transition: color 0.15s ease, transform 0.15s ease;
    user-select: none;
    line-height: 1;
}

.star-btn:hover { transform: scale(1.15); }
.star-btn.active { color: #f59e0b; }
.star-btn.hover-active { color: #fbbf24; }

.rating-user-val {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
    min-width: 1.5rem;
}

/* ═══════ COMMENTS ═══════ */

.batch-comments { border-top: 1px solid var(--border); }

.comments-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 1.25rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: background var(--transition);
    user-select: none;
}

.comments-header:hover { background: var(--border-light); }
.comments-toggle { font-size: 0.7rem; transition: transform 0.2s ease; }
.comments-toggle.open { transform: rotate(180deg); }

.comments-body { padding: 0 1.25rem 1rem; }
.comments-list { max-height: 400px; overflow-y: auto; }
.comments-empty { text-align: center; padding: 1rem; color: var(--text-muted); font-size: 0.85rem; }

.comment-item {
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border-light);
}

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

.comment-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.25rem;
}

.comment-header-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.25rem;
}

.comment-avatar-small {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary-light);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    flex-shrink: 0;
    text-transform: uppercase;
    overflow: hidden;
}

.comment-avatar-img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

.comment-avatar-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.comment-author { font-size: 0.85rem; }
.comment-time { font-size: 0.75rem; color: var(--text-muted); }

.comment-delete {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 0 4px;
    line-height: 1;
}
.comment-delete:hover { color: var(--danger); }

.comment-content { font-size: 0.875rem; color: var(--text); padding-left: 1.6rem; line-height: 1.5; }

.comment-form {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.comment-input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    outline: none;
    transition: border-color var(--transition);
    font-family: inherit;
}

.comment-input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1); }

/* ═══════ APPROVAL ═══════ */

.approval-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.25rem;
    background: var(--warning-light);
    border: 1px solid #fde68a;
    border-radius: var(--radius-sm);
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    color: #92400e;
}

.approval-icon { font-size: 1.25rem; }

.approval-list { display: flex; flex-direction: column; gap: 0.5rem; }

.approval-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--border-light);
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}

.approval-item:hover { background: #e8eaf0; }

.approval-info { display: flex; align-items: center; gap: 0.75rem; }

.approval-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--warning), #f97316);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
}

.approval-info small { display: block; margin-top: 1px; }
.approval-actions { display: flex; gap: 0.4rem; }

.tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 10px;
    background: var(--danger);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    margin-left: 4px;
}

/* ═══════ UPLOAD DESCRIPTION ═══════ */

.upload-panel-card.upload-desc-section,
.upload-panel-card.upload-tags-section,
.upload-panel-card.upload-taxonomy-section,
.upload-panel-card.upload-ai-option {
    margin-bottom: 0;
}

.upload-desc-section,
.upload-tags-section,
.upload-taxonomy-section {
    background: transparent;
    border: none;
    padding: 0;
    margin-bottom: 0;
    box-shadow: none;
}

.upload-desc-label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    color: var(--text);
}

.upload-desc-input {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    outline: none;
    transition: border-color var(--transition);
    line-height: 1.5;
    background: #ffffff;
}

body.dark-mode .upload-desc-input {
    color: var(--text);
    background-color: var(--card);
    border-color: var(--border);
}

.upload-desc-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

.upload-desc-count {
    text-align: right;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.upload-tags-hint {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.6;
}

.upload-tags-input-row {
    display: flex;
    gap: 0.65rem;
    align-items: center;
    margin-bottom: 1rem;
}

.upload-tag-input {
    flex: 1;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0.65rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    text-transform: uppercase;
    background: #ffffff;
}

body.dark-mode .upload-tag-input {
    color: var(--text);
    background-color: var(--card);
    border-color: var(--border);
}

.upload-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.upload-tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary);
    border-radius: 6px;
}

.upload-tag-remove {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0 0.15rem;
    opacity: 0.8;
}

.upload-tag-remove:hover { opacity: 1; }

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

.profile-container,
.profile-hub {
    max-width: none;
    margin: 0;
    width: 100%;
}

.main-content.with-sidebar:has(.profile-hub),
.main-content.with-sidebar:has(.user-profile-hub) {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
}

/* —— Public user profile (/user/<name>) —— */
.user-profile-layout {
    display: grid;
    gap: 1.15rem;
    width: 100%;
}

.user-profile-hub .profile-card {
    max-width: none;
    width: 100%;
    margin-bottom: 0;
}

.user-profile-meta-inline {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.user-profile-bio-card .user-bio-text {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.75;
    color: var(--text-secondary);
    white-space: pre-wrap;
}

.user-profile-hub .profile-stat-pills {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: stretch;
    width: fit-content;
    max-width: 100%;
    gap: 0;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    overflow: hidden;
    background: var(--card);
    box-shadow: var(--shadow-sm);
}

.user-profile-hub .profile-stat-pill {
    flex: 0 0 auto;
    min-width: 5.25rem;
    padding: 0.55rem 1rem;
    border: none;
    border-radius: 0;
    box-shadow: none;
    border-right: 1px solid var(--border);
}

.user-profile-hub .profile-stat-pill:last-child {
    border-right: none;
}

.user-profile-hub .profile-achievements-card {
    grid-column: 1 / -1;
}

.user-profile-hub .profile-achievements-card .ach-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem 1rem;
}

@media (min-width: 768px) {
    .user-profile-hub .profile-achievements-card .ach-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 900px) {
    .user-profile-layout:has(.user-profile-bio-card) {
        grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
        align-items: stretch;
    }

    .user-profile-layout:has(.user-profile-bio-card) .user-profile-hero {
        grid-column: 1;
    }

    .user-profile-layout:has(.user-profile-bio-card) .user-profile-bio-card {
        grid-column: 2;
        display: flex;
        flex-direction: column;
    }

    .user-profile-layout:not(:has(.user-profile-bio-card)) .user-profile-hero {
        grid-column: 1 / -1;
    }
}

@media (min-width: 1100px) {
    .user-profile-hub .profile-achievements-card .ach-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (min-width: 1400px) {
    .user-profile-hub .profile-achievements-card .ach-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

.profile-hub-header {
    margin-bottom: 1.25rem;
}

.profile-hub-header h2 {
    margin: 0 0 0.35rem;
    font-size: 1.75rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.profile-hub-header .page-desc {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.profile-hub-layout {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.profile-hub-row-label {
    margin: 1.5rem 0 0.65rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.profile-hub-row-label:first-of-type {
    margin-top: 0;
}

.profile-hub-row {
    display: grid;
    gap: 1.15rem;
    margin-bottom: 0.25rem;
}

.profile-hub-row--profile,
.profile-hub-row--points {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
}

.profile-hub-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}

.profile-hub-row .profile-card {
    margin-bottom: 0;
    height: 100%;
    min-width: 0;
}

.profile-hub .profile-card {
    padding: 1.35rem 1.5rem;
}

.profile-account-actions {
    display: flex;
    justify-content: center;
    margin-top: 1.1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.profile-account-pw-btn {
    min-width: 9.5rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.profile-points-panel {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

@media (min-width: 900px) {
    .profile-points-panel {
        display: grid;
        grid-template-columns: 1fr 1.15fr;
        column-gap: 1.25rem;
        row-gap: 0.65rem;
        align-content: start;
    }

    .profile-points-panel > .profile-section-title {
        grid-column: 1 / -1;
    }

    .profile-points-balance-row {
        grid-column: 1;
        grid-row: 2;
    }

    .profile-points-checkin-wrap {
        grid-column: 2;
        grid-row: 2 / span 2;
        align-self: stretch;
    }

    .profile-points-actions {
        grid-column: 1;
        grid-row: 3;
        margin-top: 0;
    }
}

.profile-points-balance-row {
    position: relative;
}

.profile-points-balance {
    text-align: center;
    padding: 0.75rem 0;
}

.profile-points-balance-num {
    display: block;
    font-size: 2.75rem;
    font-weight: 800;
    line-height: 1;
    color: var(--primary);
    transition: transform 0.25s ease;
}

.profile-points-balance-num.is-bumping {
    animation: points-balance-bump 0.55s ease;
}

.profile-points-balance-label {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.profile-points-subtitle {
    margin: 0 0 0.35rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.profile-points-checkin-wrap .checkin-widget {
    min-height: 9rem;
}

.profile-points-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: auto;
}

.profile-points-meta-card .profile-section-title--spaced {
    margin-top: 1.25rem;
}

.points-rules-cols--compact {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

@media (min-width: 900px) {
    .profile-points-meta-card .points-rules-cols--compact {
        grid-template-columns: 1fr 1fr;
    }
}

.points-rules-cols--compact h4 {
    margin: 0 0 0.4rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.profile-points-history-card .points-history-list {
    max-height: 26rem;
}

.profile-hub .ach-progress {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    padding: 1rem 1.25rem;
}

.profile-hub .ach-progress-bar-wrap {
    flex: none;
    width: 100%;
    min-width: 0;
}

.profile-hub .ach-stats {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.75rem;
    width: 100%;
}

.profile-hub .ach-stat {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.5rem 0.75rem;
    min-width: 0;
    min-height: 2.25rem;
}

.profile-hub .ach-stat-num {
    font-size: 1rem;
    line-height: 1.2;
}

.profile-hub .ach-stat-label {
    font-size: 0.75rem;
    white-space: nowrap;
}

@media (max-width: 900px) {
    .profile-hub .ach-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 480px) {
    .profile-hub .ach-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1100px) {
    .profile-hub-row--profile,
    .profile-hub-row--points {
        grid-template-columns: 1fr 1fr;
    }
    .profile-hub-row--profile .profile-hero-card {
        grid-column: 1 / -1;
    }
    .profile-hub-row--points .profile-points-history-card {
        grid-column: 1 / -1;
    }
}

@media (max-width: 640px) {
    .profile-hub-row--profile,
    .profile-hub-row--points {
        grid-template-columns: 1fr;
    }
}

.profile-hero-card {
    margin-bottom: 0;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(139, 92, 246, 0.06) 50%, rgba(6, 182, 212, 0.05) 100%);
    border-color: rgba(99, 102, 241, 0.2);
}

.profile-hero-row {
    display: flex;
    gap: 1.5rem 2rem;
    align-items: center;
    flex-wrap: wrap;
}

@media (min-width: 900px) {
    .profile-hero-card .profile-hero-row {
        flex-wrap: nowrap;
    }

    .profile-hero-main {
        flex: 1;
        min-width: 0;
    }

    .profile-stat-pills {
        gap: 1rem;
    }

    .profile-stat-pill {
        flex: 1;
        min-width: 6.5rem;
        max-width: 11rem;
    }
}

.profile-hero-avatar .profile-avatar {
    width: 7.5rem;
    height: 7.5rem;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3);
}

.profile-hero-avatar .profile-avatar-fallback {
    font-size: 3rem;
}

.profile-hero-main {
    flex: 1;
    min-width: 12rem;
}

.profile-hero-name-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    margin-bottom: 0.35rem;
}

.profile-hero-name {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.25;
}

.profile-hero-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
    font-size: 0.88rem;
}

.profile-stat-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.profile-stat-pill {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 5.5rem;
    padding: 0.55rem 0.85rem;
    border-radius: var(--radius-sm);
    background: var(--card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    color: inherit;
    transition: border-color var(--transition), transform var(--transition);
}

a.profile-stat-pill:hover {
    border-color: var(--primary-light);
    transform: translateY(-1px);
}

.profile-stat-pill-num {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.2;
}

.profile-stat-pill-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.1rem;
}

/* legacy alias */
.profile-hub-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.profile-account-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
}

@media (max-width: 560px) {
    .profile-account-meta {
        grid-template-columns: 1fr;
    }
}

.profile-account-field {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.04);
    border: 1px solid rgba(15, 23, 42, 0.08);
    min-width: 0;
}

.profile-account-field-label {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.profile-account-field-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.35;
    word-break: break-word;
}

body.dark-mode .profile-account-field {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.07);
}

body.dark-mode .profile-account-field-label {
    color: rgba(255, 255, 255, 0.5);
}

body.dark-mode .profile-account-field-value {
    color: rgba(255, 255, 255, 0.92);
}

.profile-account-field-value--email {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.profile-account-email {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.92rem;
}

.profile-account-edit-btn {
    flex-shrink: 0;
    padding: 0.25rem 0.45rem;
    line-height: 1;
}

.profile-account-verify {
    margin-top: 0.85rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
}

.profile-account-verify-alert {
    margin: 0;
    width: 100%;
    justify-content: center;
}

.profile-account-verify-form {
    margin: 0;
}

.profile-quick-card .profile-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.profile-hub .profile-achievements-card {
    margin-left: 0;
    margin-right: 0;
    max-width: none;
    width: 100%;
}

.profile-hub .profile-titles-card .title-select-grid {
    grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
}

.profile-hub .profile-achievements-card .ach-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem 1rem;
}

.profile-hub .profile-achievements-card .ach-card {
    padding: 0.55rem 1rem;
    gap: 0.7rem;
    align-items: center;
    min-height: 3.1rem;
}

.profile-hub .profile-achievements-card .ach-icon {
    font-size: 1.35rem;
    width: 1.75rem;
    text-align: center;
    flex-shrink: 0;
}

.profile-hub .profile-achievements-card .ach-info {
    min-width: 0;
}

.profile-hub .profile-achievements-card .ach-name {
    font-size: 0.86rem;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-hub .profile-achievements-card .ach-desc {
    margin-top: 0.1rem;
    font-size: 0.72rem;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    overflow: hidden;
}

@media (min-width: 768px) {
    .profile-hub .profile-achievements-card .ach-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.profile-bottom-actions {
    max-width: none;
    margin: 0;
    padding-bottom: 1rem;
    justify-content: flex-start;
}

body.dark-mode .profile-hero-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(30, 41, 59, 0.9) 100%);
    border-color: #334155;
}

.profile-card {
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.profile-avatar-section {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.profile-avatar-section--hero {
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.profile-avatar-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-avatar-fallback {
    color: #fff;
    font-size: 2.5rem;
    font-weight: 700;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.avatar-upload-btn { cursor: pointer; }
.avatar-hint { font-size: 0.75rem; color: var(--text-muted); }

.profile-info-side { flex: 1; }

.profile-info-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.9rem;
}

.profile-info-item:last-child { border-bottom: none; }
.info-label {
    color: var(--text-secondary);
    font-weight: 500;
    flex-shrink: 0;
    min-width: 4.75rem;
}
.info-value { color: var(--text); font-weight: 600; text-align: right; }

/* 右侧值+操作按钮（与「仅标签+值」两行结构一致，避免三列导致邮箱居中） */
.info-value-group {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex: 1;
    min-width: 0;
    gap: 0.5rem;
    text-align: right;
}
.info-value-group .info-value-email {
    text-align: right;
    word-break: break-all;
    line-height: 1.45;
}

.nickname-edit-btn {
    margin-left: 0.6rem;
    padding: 0.25rem 0.55rem;
    border-radius: 10px;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.info-value-group .email-bind-btn {
    margin-left: 0;
    flex-shrink: 0;
}

.profile-section-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text);
}

.profile-bio {
    width: 100%;
    min-height: 100px;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    outline: none;
    transition: border-color var(--transition);
    line-height: 1.6;
}

.profile-bio:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

.profile-bio-count {
    text-align: right;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

.profile-actions { text-align: right; }
.profile-form { max-width: 720px; }
.profile-page-inner { max-width: none; margin: 0; width: 100%; }

.profile-bio-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.profile-bio-card-header .profile-bio-title,
.profile-bio-card-header .profile-section-title {
    margin-bottom: 0;
}
.bio-edit-btn {
    padding: 0.35rem 0.65rem;
    border-radius: 10px;
    font-size: 0.9rem;
    flex-shrink: 0;
}
.profile-bio-display {
    min-height: 3rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    background: rgba(99, 102, 241, 0.04);
    border: 1px solid var(--border-light);
}
.profile-bio-display .user-bio-text {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.6;
    color: var(--text);
    font-size: 0.95rem;
}
.profile-bio-placeholder {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}
.profile-bio-modal-input {
    width: 100%;
    min-height: 140px;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    resize: vertical;
    outline: none;
    line-height: 1.55;
}
.profile-bio-modal-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.12);
}
.profile-bio-count-modal {
    text-align: right;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

.profile-bottom-actions {
    max-width: 720px;
    margin: 1.75rem auto 0;
    padding-bottom: 2rem;
    display: flex;
    justify-content: center;
}

.title-select-desc { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 1rem; }
.title-select-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
}
.title-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 0.75rem 0.5rem;
    border: 2px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--card);
    position: relative;
}
.title-option:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(99,102,241,0.12); }
.title-option.selected { border-color: var(--primary); background: rgba(99,102,241,0.06); box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }
.title-option-icon { font-size: 1.5rem; }
.title-option-name { font-size: 0.85rem; font-weight: 600; color: var(--text); }
.title-option-tier {
    font-size: 0.7rem;
    padding: 1px 8px;
    border-radius: 8px;
    font-weight: 600;
}
.title-option-tier.tier-1 { background: #dbeafe; color: #2563eb; }
.title-option-tier.tier-2 { background: #ede9fe; color: #7c3aed; }
.title-option-tier.tier-3 { background: #fef3c7; color: #d97706; }
.title-option-tier.tier-4 { background: #fee2e2; color: #dc2626; }
.title-select-empty { color: var(--text-secondary); font-size: 0.9rem; text-align: center; padding: 1rem; }
.title-select-empty a { color: var(--primary); }
.user-bio-text { color: var(--text-secondary); line-height: 1.8; white-space: pre-wrap; }

a.user-link { color: inherit; text-decoration: none; transition: color 0.2s; }
a.user-link:hover { color: var(--primary); }

/* ═══════ LEGAL / FOOTER ═══════ */

.legal-page {
    max-width: 820px;
    margin: 0 auto;
}

.legal-updated {
    margin-top: 0.35rem;
    font-size: 0.82rem;
}

.legal-notice-banner {
    margin-bottom: 1.25rem;
    padding: 1rem 1.15rem;
    border-left: 4px solid var(--warning);
    background: var(--warning-light);
    font-size: 0.9rem;
    line-height: 1.65;
}

body.dark-mode .legal-notice-banner {
    background: rgba(120, 53, 15, 0.35);
}

.legal-section {
    margin-bottom: 1rem;
    padding: 1.25rem 1.35rem;
}

.legal-section h3 {
    margin: 0 0 0.75rem;
    font-size: 1.05rem;
    color: var(--text);
}

.legal-section p {
    margin: 0 0 0.65rem;
    font-size: 0.9rem;
    line-height: 1.75;
    color: var(--text-secondary);
}

.legal-section p:last-child {
    margin-bottom: 0;
}

.legal-contact-list {
    margin: 0.5rem 0 0.75rem;
    padding-left: 1.25rem;
    line-height: 1.7;
    font-size: 0.9rem;
}

.legal-contact-note {
    font-size: 0.82rem;
    margin: 0;
}

.legal-inline-notice {
    margin: 1rem 0 1.25rem;
    padding: 1rem 1.15rem;
}

.legal-inline-notice h3 {
    margin: 0 0 0.65rem;
    font-size: 0.95rem;
}

.legal-inline-notice ul {
    margin: 0 0 0.65rem;
    padding-left: 1.2rem;
    font-size: 0.88rem;
    line-height: 1.65;
    color: var(--text-secondary);
}

.upload-legal-notice {
    margin-bottom: 1.25rem;
    padding: 1rem 1.15rem;
    border: 1px solid rgba(99, 102, 241, 0.25);
    background: rgba(99, 102, 241, 0.06);
}

.upload-legal-title {
    margin: 0 0 0.5rem;
    font-size: 0.95rem;
}

.upload-legal-summary {
    margin: 0 0 0.65rem;
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.upload-legal-list {
    margin: 0 0 0.85rem;
    padding-left: 1.2rem;
    font-size: 0.86rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.upload-legal-agree {
    font-size: 0.86rem;
    line-height: 1.5;
}

.legal-checkin-hint {
    margin: 0.65rem 0 0;
    text-align: center;
    font-size: 0.78rem;
}

.auth-field--legal .checkbox-label {
    align-items: flex-start;
}

.auth-field--legal a {
    color: var(--primary);
    font-weight: 600;
}

.auth-legal-link {
    margin: 0.75rem 0 0;
    text-align: center;
    font-size: 0.82rem;
}

.auth-legal-link a {
    color: var(--text-muted);
    text-decoration: underline;
}

.site-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1500;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.65rem 1rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
    pointer-events: none;
    background: linear-gradient(to top, var(--bg) 62%, rgba(0, 0, 0, 0));
}

body.dark-mode .site-footer {
    background: linear-gradient(to top, var(--bg) 70%, rgba(0, 0, 0, 0));
}

.site-footer--with-sidebar {
    left: var(--sidebar-width);
}

.site-footer-inner {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.35rem 0.5rem;
    max-width: min(96vw, 720px);
    pointer-events: auto;
    text-align: center;
    font-size: 0.84rem;
    line-height: 1.4;
    color: var(--text-muted);
}

.site-footer a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
}

.site-footer a:hover {
    color: var(--primary);
    text-decoration: underline;
}

.site-footer-sep {
    opacity: 0.45;
}

body.has-sidebar .main-content.with-sidebar {
    padding-bottom: calc(2rem + 2.75rem);
}

@media (max-width: 900px) {
    .site-footer--with-sidebar {
        left: 0;
    }
}

/* ═══════ DONATION MODAL ═══════ */

.donation-modal {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    transition: opacity 0.3s ease;
}

.donation-modal-content {
    position: relative;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 20px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
    animation: scaleIn 0.4s ease;
}

.donation-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(0, 0, 0, 0.06);
    color: #666;
    font-size: 1.4rem;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
}

.donation-close:hover { background: rgba(0, 0, 0, 0.12); color: #333; }

.donation-header {
    text-align: center;
    padding: 1.75rem 1.5rem 0.75rem;
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
}

.donation-heart { font-size: 2.5rem; display: block; margin-bottom: 0.5rem; }

.donation-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #065f46;
}

.donation-body { padding: 1.5rem; }

.donation-message {
    font-size: 0.9rem;
    line-height: 1.8;
    color: var(--text);
    margin-bottom: 1.25rem;
}

.donation-message p { margin-bottom: 0.5rem; }
.donation-message strong { color: var(--primary-dark); }

.donation-thanks {
    text-align: center;
    font-weight: 600;
    color: #059669 !important;
    margin-top: 0.75rem !important;
    font-size: 0.95rem;
}

.donation-qr {
    text-align: center;
    padding: 0.5rem;
}

.donation-qr img {
    max-width: 280px;
    width: 100%;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}

.donation-footer {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.5rem 1.5rem;
    justify-content: center;
}

.donation-footer .btn { min-width: 140px; justify-content: center; }

/* ═══════ CORNER FAB (language + donate — shared look) ═══════ */

.corner-fab {
    position: fixed;
    z-index: 2200;
    width: 58px;
    height: 58px;
    border-radius: 18px;
    border: 1px solid rgba(99, 102, 241, 0.35);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.95), rgba(139, 92, 246, 0.95));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    text-decoration: none;
    font-family: inherit;
    padding: 0;
    margin: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.corner-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.26);
}

.corner-fab-main {
    font-weight: 900;
    line-height: 1;
    text-align: center;
}

/* ENG / CHI — three letters, fills the tile */
.corner-fab-main--code {
    font-size: 0.95rem;
    letter-spacing: 0.08em;
}

/* 赏 — single glyph */
.corner-fab-main--glyph {
    font-size: 1.55rem;
    letter-spacing: 0;
}

.lang-corner-desktop {
    bottom: 1.25rem;
    left: 1.25rem;
}

/* Mobile: language switch — same size as donate FAB, immediately to its right */
.lang-fab-mobile-bottom {
    display: none;
}

/* Mobile: BUG + theme FABs (bottom-right); hidden on desktop */
.corner-fab-mobile-bug,
.corner-fab-mobile-theme {
    display: none;
}

.lang-fab-mobile-bottom .corner-fab-main--code {
    font-size: 0.82rem;
}

@media (max-width: 768px) {
    .lang-corner-desktop { display: none; }
    .lang-fab-mobile-bottom {
        display: flex;
        bottom: max(1.25rem, env(safe-area-inset-bottom, 0px));
        left: calc(1.25rem + 44px + 0.35rem);
        right: auto;
        transform: none;
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
        border-radius: 14px;
    }
    .lang-fab-mobile-bottom .corner-fab-main--code {
        font-size: 0.68rem;
        letter-spacing: 0.04em;
    }
    .corner-fab.lang-fab-mobile-bottom:hover {
        transform: translateY(-2px);
    }

    .corner-fab-mobile-bug,
    .corner-fab-mobile-theme {
        display: flex;
        bottom: max(1.25rem, env(safe-area-inset-bottom, 0px));
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
        border-radius: 14px;
    }

    .corner-fab-mobile-theme {
        right: max(1.25rem, env(safe-area-inset-right, 0px));
        left: auto;
    }

    .corner-fab-mobile-bug {
        right: calc(max(1.25rem, env(safe-area-inset-right, 0px)) + 44px + 0.35rem);
        left: auto;
    }

    .corner-fab-mobile-bug .corner-fab-main--code {
        font-size: 0.62rem;
        letter-spacing: 0.02em;
    }

    .corner-fab-mobile-theme .corner-fab-main--glyph {
        font-size: 1.05rem;
    }

    .corner-fab-mobile-bug:hover,
    .corner-fab-mobile-theme:hover {
        transform: translateY(-2px);
    }
}

.batch-ai-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    margin-left: 0.35rem;
    padding: 0.12rem 0.45rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    border-radius: 6px;
    vertical-align: middle;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.18), rgba(99, 102, 241, 0.2));
    color: var(--secondary);
    border: 1px solid rgba(139, 92, 246, 0.35);
}

body.dark-mode .batch-ai-badge {
    color: #c4b5fd;
    border-color: rgba(167, 139, 250, 0.45);
    background: linear-gradient(135deg, rgba(76, 29, 149, 0.45), rgba(49, 46, 129, 0.5));
}

.batch-meta-flags {
    margin: 0;
    padding: 0.5rem 1.25rem;
    background: var(--border-light);
    border-bottom: 1px solid var(--border);
}

.batch-course-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.7rem 1.25rem;
    align-items: center;
    background: var(--border-light);
    border-bottom: 1px solid var(--border);
}

.batch-study-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin: 0.65rem 1.25rem 0.25rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(129, 140, 248, 0.06));
    border: 1px solid rgba(99, 102, 241, 0.18);
}

body.dark-mode .batch-study-bar {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.18), rgba(49, 46, 129, 0.22));
    border-color: rgba(129, 140, 248, 0.28);
}

.batch-course-chip,
.batch-material-chip,
.batch-meta-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.18rem 0.5rem;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
    text-decoration: none;
    background: var(--border-light);
    color: var(--text-secondary);
}

.batch-course-chip {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.12);
}

.batch-course-chip:hover {
    color: var(--secondary);
}

.batch-study-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 2.35rem;
    padding: 0.55rem 1.15rem;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.28);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.batch-study-link--secondary {
    color: var(--primary);
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(99, 102, 241, 0.35);
    box-shadow: none;
}

body.dark-mode .batch-study-link--secondary {
    background: rgba(30, 27, 75, 0.65);
    color: #c7d2fe;
}

.batch-study-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.35);
    color: #fff;
}

.batch-study-link--secondary:hover {
    color: var(--secondary);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
}

.batch-tags:empty {
    display: none;
    margin: 0;
    padding: 0;
}

.upload-taxonomy-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.15rem 1.25rem;
}

.upload-taxonomy-grid .upload-course-codes-group {
    grid-column: 1 / -1;
}

.upload-taxonomy-grid .form-group {
    min-width: 0;
    margin: 0;
    gap: 0.5rem;
}

.upload-taxonomy-grid .form-group .form-input,
.upload-taxonomy-grid .form-group select.form-input {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    background: #ffffff;
}

body.dark-mode .upload-taxonomy-grid .form-group .form-input,
body.dark-mode .upload-taxonomy-grid .form-group select.form-input {
    color: var(--text);
    background-color: var(--card);
    border-color: var(--border);
}

body.dark-mode .upload-taxonomy-grid .form-group select.form-input {
    color-scheme: dark;
}

body.dark-mode .upload-taxonomy-grid .form-group select.form-input option {
    background-color: var(--card);
    color: var(--text);
}

.upload-taxonomy-grid .form-group label .upload-optional {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.82em;
}

.upload-taxonomy-grid .form-hint {
    margin: 0.5rem 0 0;
    font-size: 0.75rem;
    line-height: 1.45;
}

.upload-school-input {
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-family: ui-monospace, monospace;
    width: 100%;
    max-width: none;
}

.upload-panel-card.upload-ai-option {
    background: #ffffff;
    border: 1px solid var(--border);
    padding: 1.5rem 1.75rem;
    width: 100%;
    box-sizing: border-box;
    min-height: 4.5rem;
}

body.dark-mode .upload-panel-card.upload-ai-option {
    background: var(--card);
}

.upload-panel-card.upload-ai-option label {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.5;
}

.upload-panel-card.upload-ai-option input[type="checkbox"] {
    margin-top: 0.15rem;
    flex-shrink: 0;
    width: 1.05rem;
    height: 1.05rem;
}

.upload-panel-card.upload-ai-option .upload-ai-hint {
    margin: 0.85rem 0 0;
    padding-left: 1.7rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.55;
}

/* Upload page — extra breathing room in dark mode */
body.dark-mode .main-content.with-sidebar:has(.upload-page) {
    padding-left: 1.85rem;
    padding-right: 1.85rem;
}

body.dark-mode .upload-page .page-header {
    margin-bottom: 2rem;
}

body.dark-mode .upload-layout {
    gap: 2.25rem;
}

body.dark-mode .upload-layout-left,
body.dark-mode .upload-layout-right {
    gap: 1.65rem;
}

body.dark-mode .upload-panel-card,
body.dark-mode .upload-panel-card.upload-ai-option {
    padding: 1.65rem 2rem;
}

body.dark-mode .upload-drop-panel {
    gap: 1.5rem;
}

body.dark-mode .upload-desc-label {
    margin-bottom: 0.85rem;
}

body.dark-mode .upload-desc-input,
body.dark-mode .upload-tag-input,
body.dark-mode .upload-taxonomy-grid .form-group .form-input,
body.dark-mode .upload-taxonomy-grid .form-group select.form-input {
    padding-top: 0.85rem;
    padding-bottom: 0.85rem;
}

body.dark-mode .upload-tags-hint {
    margin-bottom: 1.15rem;
}

body.dark-mode .upload-tags-input-row {
    margin-bottom: 1.15rem;
}

body.dark-mode .upload-taxonomy-grid {
    gap: 1.35rem 1.5rem;
}

body.dark-mode .upload-taxonomy-grid .form-group {
    gap: 0.6rem;
}

body.dark-mode .upload-taxonomy-grid .form-hint {
    margin-top: 0.55rem;
}

body.dark-mode .upload-layout-right .drop-zone-large .drop-zone-inner {
    padding: 3.25rem 2.25rem;
    min-height: 16rem;
}

body.dark-mode .drop-zone-inner h3 {
    margin-top: 0.35rem;
}

body.dark-mode .drop-zone-buttons {
    margin-top: 1.25rem !important;
}

body.dark-mode .drop-hint {
    margin-top: 1.35rem !important;
}

/* ═══════ DONATE ENTRY (position only; visuals = .corner-fab) ═══════ */

.donate-entry {
    bottom: 1.25rem;
    right: 1.25rem;
}

@media (max-width: 768px) {
    .donate-entry {
        left: 1.25rem;
        right: auto;
        bottom: 1.25rem;
        width: 44px;
        height: 44px;
        border-radius: 14px;
    }

    .donate-entry .corner-fab-main--glyph {
        font-size: 1.05rem;
    }
}

/* ═══════ GUIDE MODAL (onboarding) ═══════ */

.guide-modal {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.guide-modal.show {
    opacity: 1;
    visibility: visible;
}

.guide-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(6, 10, 24, 0.72);
    backdrop-filter: blur(12px);
}

.guide-shell {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
    width: min(980px, 100%);
    max-height: min(90vh, 680px);
    border-radius: 24px;
    overflow: hidden;
    background: var(--card);
    border: 1px solid var(--border);
    box-shadow:
        0 32px 90px rgba(0, 0, 0, 0.45),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    animation: guideShellIn 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes guideShellIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* —— Left stage —— */
.guide-stage {
    position: relative;
    color: #f8fafc;
    overflow: hidden;
}

.guide-stage-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(160deg, #4338ca 0%, #6d28d9 45%, #1e1b4b 100%);
    transition: background 0.45s ease;
}

.guide-stage-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 28px 28px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.5), transparent 85%);
}

.guide-shell[data-guide-accent="violet"] .guide-stage-bg {
    background: linear-gradient(160deg, #4338ca 0%, #6d28d9 50%, #1e1b4b 100%);
}

.guide-shell[data-guide-accent="blue"] .guide-stage-bg {
    background: linear-gradient(160deg, #1d4ed8 0%, #2563eb 45%, #0c4a6e 100%);
}

.guide-shell[data-guide-accent="emerald"] .guide-stage-bg {
    background: linear-gradient(160deg, #047857 0%, #059669 45%, #134e4a 100%);
}

.guide-shell[data-guide-accent="amber"] .guide-stage-bg {
    background: linear-gradient(160deg, #b45309 0%, #d97706 45%, #78350f 100%);
}

.guide-shell[data-guide-accent="rose"] .guide-stage-bg {
    background: linear-gradient(160deg, #be123c 0%, #e11d48 45%, #881337 100%);
}

.guide-shell[data-guide-accent="cyan"] .guide-stage-bg {
    background: linear-gradient(160deg, #0e7490 0%, #0891b2 45%, #164e63 100%);
}

.guide-stage-inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1.6rem 1.35rem 1.4rem;
}

.guide-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.guide-brand-icon {
    font-size: 1.45rem;
    line-height: 1;
}

.guide-brand-wordmark {
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: 0.03em;
}

.guide-brand-wordmark .text-accent {
    color: #c4b5fd;
}

.guide-stage-tagline {
    margin: 0 0 auto;
    font-size: 0.84rem;
    line-height: 1.55;
    color: rgba(248, 250, 252, 0.78);
}

.guide-stage-icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1.5rem 0 1rem;
    min-height: 7rem;
}

.guide-stage-icon {
    font-size: 4.5rem;
    line-height: 1;
    filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.35));
    animation: guideIconPop 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes guideIconPop {
    from {
        opacity: 0;
        transform: scale(0.75) translateY(12px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.guide-stage-welcome {
    margin: 0 0 0.75rem;
    font-size: 0.9rem;
    line-height: 1.6;
    color: rgba(248, 250, 252, 0.9);
    transition: opacity 0.25s ease;
}

.guide-stage-welcome.is-hidden {
    opacity: 0;
    height: 0;
    margin: 0;
    overflow: hidden;
}

.guide-stage-counter {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: rgba(248, 250, 252, 0.55);
}

/* —— Right panel —— */
.guide-panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    background: var(--card);
}

.guide-panel-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1rem 0.65rem;
    border-bottom: 1px solid var(--border);
}

.guide-stepper {
    display: flex;
    flex: 1;
    min-width: 0;
    gap: 0.35rem;
    overflow-x: auto;
    padding-bottom: 0.15rem;
    scrollbar-width: thin;
}

.guide-step-btn {
    flex: 1 0 auto;
    min-width: 4.1rem;
    max-width: 5.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 0.45rem 0.35rem;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.2s;
}

.guide-step-btn:hover {
    background: rgba(99, 102, 241, 0.08);
    color: var(--text);
}

.guide-step-btn.is-active {
    background: rgba(99, 102, 241, 0.14);
    border-color: rgba(99, 102, 241, 0.35);
    color: var(--primary);
    transform: translateY(-1px);
}

.guide-step-btn.is-done {
    color: var(--text-secondary);
}

.guide-step-btn-icon {
    font-size: 1.15rem;
    line-height: 1;
}

.guide-step-btn-label {
    text-align: center;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.guide-panel-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}

.guide-skip-btn {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.35rem 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
}

.guide-skip-btn:hover {
    color: var(--text);
    background: rgba(0, 0, 0, 0.05);
}

.guide-close {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(0, 0, 0, 0.06);
    color: var(--text-secondary);
    font-size: 1.3rem;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.guide-close:hover {
    background: rgba(0, 0, 0, 0.1);
}

.guide-panel-body {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding: 1rem 1.25rem 0.5rem;
}

.guide-track {
    position: relative;
    min-height: 240px;
    height: 100%;
}

.guide-slide {
    display: none;
    flex-direction: column;
    gap: 0.5rem;
    height: 100%;
    overflow-y: auto;
    padding-right: 0.2rem;
}

.guide-slide.is-active {
    display: flex;
    animation: guideContentIn 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}

.guide-slide.is-exit-left,
.guide-slide.is-exit-right {
    display: flex;
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.guide-slide.is-exit-left {
    animation: guideContentOutLeft 0.26s ease forwards;
}

.guide-slide.is-exit-right {
    animation: guideContentOutRight 0.26s ease forwards;
}

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

@keyframes guideContentOutLeft {
    to {
        opacity: 0;
        transform: translateX(-16px);
    }
}

@keyframes guideContentOutRight {
    to {
        opacity: 0;
        transform: translateX(16px);
    }
}

.guide-slide-kicker {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--primary);
}

.guide-slide-title {
    margin: 0;
    font-size: clamp(1.35rem, 2.8vw, 1.65rem);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.025em;
    color: var(--text);
}

.guide-slide-lead {
    margin: 0 0 0.5rem;
    font-size: 0.94rem;
    line-height: 1.65;
    color: var(--text-secondary);
}

.guide-tip-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    counter-reset: guide-tip;
}

.guide-tip-list li {
    counter-increment: guide-tip;
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.7rem 0.9rem;
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--text);
    background: rgba(99, 102, 241, 0.06);
    border: 1px solid rgba(99, 102, 241, 0.12);
    border-radius: 12px;
}

.guide-tip-list li::before {
    content: counter(guide-tip);
    flex-shrink: 0;
    width: 1.35rem;
    height: 1.35rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
}

.guide-panel-footer {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    grid-template-rows: auto auto;
    align-items: center;
    gap: 0.5rem 0.75rem;
    padding: 0.85rem 1.25rem 1.1rem;
    border-top: 1px solid var(--border);
}

.guide-btn-prev {
    grid-column: 1;
    grid-row: 1;
}

.guide-footer-progress {
    grid-column: 2;
    grid-row: 1;
    height: 6px;
    border-radius: 999px;
    background: var(--border);
    overflow: hidden;
    min-width: 0;
}

.guide-footer-progress-fill {
    height: 100%;
    width: 16.66%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.guide-footer-step {
    grid-column: 2;
    grid-row: 2;
    margin: 0;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
}

.guide-btn-next,
.guide-btn-done {
    grid-column: 3 / -1;
    grid-row: 1 / span 2;
    align-self: center;
    min-width: 7.5rem;
}

.guide-btn-prev,
.guide-btn-next,
.guide-btn-done {
    justify-self: start;
}

.guide-panel-footer #guidePrev {
    display: none;
}

.guide-panel-footer #guideDone {
    display: none;
}

.guide-panel-footer.is-first #guidePrev {
    display: none;
}

.guide-panel-footer.is-last .guide-btn-next {
    display: none;
}

.guide-panel-footer.is-last .guide-btn-done {
    display: inline-flex;
}

.guide-panel-footer:not(.is-first) #guidePrev {
    display: inline-flex;
}

body.dark-mode .guide-shell {
    border-color: #334155;
}

body.dark-mode .guide-tip-list li {
    background: rgba(99, 102, 241, 0.12);
    border-color: rgba(129, 140, 248, 0.22);
}

body.dark-mode .guide-step-btn.is-active {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(129, 140, 248, 0.4);
}

body.dark-mode .guide-skip-btn:hover {
    background: rgba(255, 255, 255, 0.06);
}

body.dark-mode .guide-close {
    background: rgba(255, 255, 255, 0.08);
}

body.dark-mode .guide-footer-progress {
    background: #334155;
}

@media (max-width: 800px) {
    .guide-shell {
        grid-template-columns: 1fr;
        max-height: 94vh;
    }

    .guide-stage {
        min-height: 10.5rem;
    }

    .guide-stage-inner {
        padding: 1rem 1.1rem;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 0 1rem;
    }

    .guide-stage-tagline,
    .guide-stage-welcome {
        display: none;
    }

    .guide-stage-icon-wrap {
        margin: 0;
        min-height: 0;
        order: 3;
        margin-left: auto;
    }

    .guide-stage-icon {
        font-size: 2.75rem;
    }

    .guide-stage-counter {
        order: 4;
        width: 100%;
        margin-top: 0.35rem;
    }

    .guide-panel-footer {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto auto;
    }

    .guide-btn-prev {
        grid-column: 1;
        grid-row: 3;
    }

    .guide-footer-progress {
        grid-column: 1 / -1;
        grid-row: 1;
    }

    .guide-footer-step {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .guide-btn-next,
    .guide-btn-done {
        grid-column: 2;
        grid-row: 3;
        justify-self: end;
    }
}

/* ═══════ RESPONSIVE (new components) ═══════ */

/* ═══════ QUESTIONS ═══════ */

.question-filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.4rem 0.9rem;
    border-radius: 20px;
    font-size: 0.85rem;
    text-decoration: none;
    color: var(--text-secondary);
    background: var(--card);
    border: 1px solid var(--border);
    transition: all var(--transition);
}

.filter-btn:hover { background: var(--border-light); color: var(--text); }
.filter-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.question-list { display: flex; flex-direction: column; gap: 0.75rem; }
.question-card-link { text-decoration: none; color: inherit; }

.question-card {
    display: flex;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: all var(--transition);
}

.question-card:hover { border-color: var(--primary); box-shadow: var(--shadow); transform: translateY(-1px); }

.question-card-left { flex-shrink: 0; display: flex; align-items: center; }

.question-answer-count {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    min-width: 55px;
    color: var(--text-muted);
}

.question-answer-count.has-answers { border-color: var(--success); color: var(--success); }
.count-num { font-size: 1.2rem; font-weight: 700; line-height: 1; }
.count-label { font-size: 0.7rem; margin-top: 0.15rem; }

.question-card-body { flex: 1; min-width: 0; }

.question-card-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.35rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.question-card-content {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.question-card-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.question-card-author { display: flex; align-items: center; gap: 0.3rem; }
.question-card-avatar-img { width: 18px; height: 18px; border-radius: 50%; object-fit: cover; }

.q-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
}

.q-badge-resolved { background: #d1fae5; color: #059669; }
.q-badge-open { background: #dbeafe; color: #2563eb; }
.q-badge-bounty { background: #fef3c7; color: #d97706; }

/* Question Detail */

.question-back { margin-bottom: 1rem; }
.question-back a { color: var(--primary); text-decoration: none; font-size: 0.9rem; }
.question-back a:hover { text-decoration: underline; }

.question-detail {
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.question-badges { display: flex; gap: 0.4rem; margin-bottom: 0.5rem; }

.question-detail-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0 0 1rem;
    color: var(--text);
}

.question-detail-body {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    white-space: pre-wrap;
}

.bounty-info-card {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.bounty-info-header { font-weight: 700; font-size: 0.9rem; color: #d97706; margin-bottom: 0.3rem; }
.bounty-info-card p { margin: 0.25rem 0; font-size: 0.9rem; color: #92400e; }
.bounty-awarded-text { color: #059669 !important; font-weight: 600; }
.bounty-timer { color: #b45309 !important; font-weight: 500; font-size: 0.85rem !important; }

.question-detail-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.question-detail-author { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; }
.qd-author-name { font-weight: 600; }
.qd-author-time { color: var(--text-muted); font-size: 0.85rem; }

/* Answers */

.answers-section { margin-bottom: 1.5rem; }
.answers-header { margin-bottom: 1rem; }
.answers-header h3 { font-size: 1.1rem; font-weight: 600; margin: 0; }

.answer-card {
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 1.25rem;
    margin-bottom: 0.75rem;
    transition: all var(--transition);
}

.answer-card.answer-accepted {
    border-color: #10b981;
    background: linear-gradient(135deg, #ecfdf5, #f0fdf4);
}

.accepted-banner {
    background: #10b981;
    color: #fff;
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-block;
    margin-bottom: 0.75rem;
}

.answer-body {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    white-space: pre-wrap;
}

.answer-files-list {
    background: var(--border-light);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
}

.answer-file-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0;
    font-size: 0.85rem;
}

.answer-file-icon { font-size: 1rem; flex-shrink: 0; }
.answer-file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.answer-file-size { color: var(--text-muted); font-size: 0.8rem; white-space: nowrap; }

.answer-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 0.5rem;
}

.answer-author-info { display: flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; }
.answer-actions { display: flex; align-items: center; gap: 0.5rem; }

.vote-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--card);
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: all var(--transition);
}

.vote-btn:hover { border-color: var(--primary); color: var(--primary); }
.vote-btn.voted { background: #eef2ff; border-color: var(--primary); color: var(--primary); font-weight: 600; }

.empty-answers {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

/* Post Answer Form */

.post-answer-section {
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 1.25rem;
}

.post-answer-section h3 { font-size: 1rem; font-weight: 600; margin: 0 0 0.75rem; }

.form-textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    resize: vertical;
    transition: border-color var(--transition);
    box-sizing: border-box;
}

.form-textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1); }

.form-input {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition);
    box-sizing: border-box;
}

.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1); }

body.dark-mode .form-input,
body.dark-mode select.form-input {
    color: var(--text);
    background-color: var(--card);
    border-color: var(--border);
}

body.dark-mode .form-input::placeholder {
    color: var(--text-muted);
}

body.dark-mode select.form-input {
    color-scheme: dark;
}

body.dark-mode select.form-input option {
    background-color: var(--card);
    color: var(--text);
}

.form-group { margin-bottom: 0.75rem; }
.form-group label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 0.35rem; }
.form-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.25rem; }
.form-required { color: var(--danger); }

.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    font-weight: 600;
}

.checkbox-label input { width: 16px; height: 16px; cursor: pointer; }

.answer-upload-area {
    margin: 0.75rem 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.answer-file-label {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 0.75rem;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: all var(--transition);
}

.answer-file-label:hover { border-color: var(--primary); color: var(--primary); }

.answer-file-list { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.answer-file-tag {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    background: var(--border-light);
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    color: var(--text-secondary);
}

/* Question Modal */

.q-modal-wrap {
    padding: 2rem 2.25rem;
}

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

.q-modal-header h3 { margin: 0; font-size: 1.2rem; }

.q-modal-body .form-group { margin-bottom: 1rem; }

.q-modal-body .form-group label { margin-bottom: 0.5rem; }

.q-modal-body .form-textarea { min-height: 130px; }

.q-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding-top: 1rem;
    margin-top: 0.5rem;
    border-top: 1px solid var(--border);
}

/* ═══════ ACHIEVEMENTS PAGE ═══════ */

.ach-progress {
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.ach-progress-bar-wrap { flex: 1; min-width: 200px; }
.ach-progress-label { font-weight: 700; font-size: 0.95rem; margin-bottom: 0.4rem; }
.ach-progress-bar { height: 10px; background: var(--border); border-radius: 5px; overflow: hidden; }
.ach-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 5px;
    transition: width 0.6s ease;
}

.ach-stats { display: flex; gap: 1rem; flex-wrap: wrap; }
.ach-stat {
    text-align: center;
    padding: 0.4rem 0.75rem;
    background: var(--border-light);
    border-radius: var(--radius-sm);
    min-width: 70px;
}
.ach-stat-num { font-size: 1.2rem; font-weight: 700; color: var(--primary); display: block; }
.ach-stat-label { font-size: 0.7rem; color: var(--text-muted); }

.ach-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.75rem;
}

.ach-card {
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all var(--transition);
    overflow: hidden;
}

.ach-card.unlocked { border-left: 4px solid; }
.ach-card.unlocked.t-1 { border-left-color: #3b82f6; }
.ach-card.unlocked.t-2 { border-left-color: #8b5cf6; }
.ach-card.unlocked.t-3 { border-left-color: #f59e0b; }
.ach-card.unlocked.t-4 { border-left-color: #ef4444; }
.ach-card.locked { opacity: 0.45; filter: grayscale(0.8); }
.ach-card.locked:hover { opacity: 0.65; }
.ach-card.newly { animation: ach-glow 1.5s ease infinite alternate; }
@keyframes ach-glow { from { box-shadow: 0 0 8px rgba(99,102,241,0.2); } to { box-shadow: 0 0 20px rgba(99,102,241,0.4); } }

.ach-icon { font-size: 1.8rem; flex-shrink: 0; }
.ach-info { flex: 1; min-width: 0; }
.ach-name { font-weight: 700; font-size: 0.9rem; display: flex; align-items: center; gap: 0.4rem; }
.ach-desc { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.15rem; }
.ach-tier { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.ach-tier.t-1 { background: #3b82f6; }
.ach-tier.t-2 { background: #8b5cf6; }
.ach-tier.t-3 { background: #f59e0b; }
.ach-tier.t-4 { background: #ef4444; }
.ach-lock-icon { font-size: 1.1rem; color: var(--text-muted); }

/* ═══════ COURSE + STUDY TOOLS ═══════ */

.course-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.course-summary-card {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--card);
}

.course-summary-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary);
}

.course-summary-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.compact-empty {
    padding: 1.5rem 1rem;
}

.question-course-filter {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1rem;
}

.question-course-filter .form-input {
    max-width: 14rem;
}

.q-badge-course {
    background: rgba(99, 102, 241, 0.14);
    color: var(--primary);
    text-decoration: none;
}

.study-tools-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(16rem, 22rem);
    gap: 1rem;
    align-items: start;
}

.study-main {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.study-summary-text {
    line-height: 1.7;
    color: var(--text-secondary);
}

.study-list {
    margin: 0;
    padding-left: 1.2rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

.study-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: 0.75rem;
}

.study-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.8rem;
    background: var(--border-light);
}

.study-card-front {
    font-weight: 700;
    margin-bottom: 0.45rem;
}

.study-card-back {
    color: var(--text-secondary);
}

.study-quiz-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 0.9rem;
    margin-bottom: 0.6rem;
    background: var(--card);
}

.study-quiz-item summary {
    cursor: pointer;
    font-weight: 700;
}

.study-source-files {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.study-source-file {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.45rem;
    align-items: center;
    font-size: 0.85rem;
}

.study-source-file span:nth-child(2) {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.study-ask-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.study-ask-row .form-input {
    flex: 1;
}

.study-ask-answer {
    margin-top: 0.75rem;
    padding: 0.8rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--border-light);
    white-space: pre-wrap;
    line-height: 1.65;
    color: var(--text-secondary);
}

/* ═══════ COURSE CATALOG & STUDY TOOLS ═══════ */

.courses-page-hero {
    margin: -0.5rem -0.25rem 2rem;
    padding: 2.5rem 2rem 2rem;
    border-radius: calc(var(--radius) + 4px);
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 42%, #4338ca 100%);
    color: #f8fafc;
    box-shadow: 0 18px 48px rgba(30, 27, 75, 0.22);
}

.courses-hero-kicker {
    margin: 0 0 0.35rem;
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    opacity: 0.85;
}

.courses-hero-title {
    margin: 0 0 0.5rem;
    font-size: clamp(1.75rem, 4vw, 2.35rem);
    font-weight: 800;
    line-height: 1.15;
}

.courses-hero-desc {
    margin: 0 0 1.5rem;
    max-width: 36rem;
    font-size: 1rem;
    line-height: 1.6;
    opacity: 0.92;
}

.courses-search-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
    max-width: 42rem;
    padding: 0.45rem 0.45rem 0.45rem 1rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.22);
    backdrop-filter: blur(8px);
}

.courses-search-icon {
    font-size: 1.1rem;
    opacity: 0.9;
}

.courses-search-input {
    flex: 1 1 12rem;
    min-width: 10rem;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 1rem;
    padding: 0.55rem 0;
    outline: none;
}

.courses-search-input::placeholder {
    color: rgba(255, 255, 255, 0.65);
}

.courses-search-btn {
    border-radius: 999px;
    padding: 0.55rem 1.25rem;
    white-space: nowrap;
}

.courses-search-clear {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.88rem;
    text-decoration: none;
    padding: 0 0.5rem;
}

.courses-search-clear:hover {
    color: #fff;
    text-decoration: underline;
}

.courses-hero-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.35rem;
}

.courses-stat-pill {
    display: flex;
    align-items: baseline;
    gap: 0.45rem;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.courses-stat-num {
    font-size: 1.35rem;
    font-weight: 800;
}

.courses-stat-label {
    font-size: 0.88rem;
    opacity: 0.9;
}

.course-catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.15rem;
}

.course-catalog-card {
    display: block;
    text-decoration: none;
    color: inherit;
    border-radius: calc(var(--radius) + 2px);
    border: 1px solid var(--border);
    background: var(--card);
    transition: transform 0.18s ease, border-color 0.18s, box-shadow 0.18s;
}

.course-catalog-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
    box-shadow: 0 12px 32px rgba(67, 56, 202, 0.12);
}

.course-card-inner {
    padding: 1.25rem 1.35rem 1.15rem;
}

.course-catalog-code {
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: var(--primary);
    margin-bottom: 0.55rem;
}

.course-catalog-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.85rem;
    min-height: 1.5rem;
}

.course-tag {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    background: var(--border-light);
    color: var(--text-secondary);
}

.course-tag.muted {
    opacity: 0.85;
}

.course-catalog-stats {
    display: flex;
    gap: 1rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border);
}

.course-stat-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.course-stat-item strong {
    font-size: 1.05rem;
    color: var(--text);
}

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

.courses-no-match {
    text-align: center;
    margin-top: 1rem;
}

.courses-empty {
    margin-top: 1rem;
}

.study-analysis-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.5rem;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.78rem;
    background: rgba(67, 56, 202, 0.1);
    color: var(--primary);
    border: 1px solid rgba(67, 56, 202, 0.2);
}

.study-analysis-badge.cached {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    border-color: rgba(16, 185, 129, 0.25);
}

.course-back {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.course-back a {
    color: var(--primary);
    text-decoration: none;
}

.course-back-secondary {
    color: var(--text-muted) !important;
}

.course-hero {
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--card);
    margin-bottom: 1.5rem;
}

.course-hero-code {
    font-size: 1.75rem;
    margin: 0 0 0.5rem;
    color: var(--primary);
}

.course-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.course-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.course-material-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.5rem;
}

.material-chip {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    background: var(--border-light);
    color: var(--text-secondary);
}

.course-section {
    margin-bottom: 2rem;
}

.course-section h3 {
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.course-uploaders {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.course-uploader-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    background: var(--border-light);
    text-decoration: none;
    color: var(--text);
    font-size: 0.85rem;
}

.course-uploader-cnt {
    font-weight: 700;
    color: var(--primary);
}

.course-question-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.course-question-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--card);
    text-decoration: none;
    color: inherit;
}

.course-q-title {
    flex: 1;
    font-weight: 600;
}

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

.course-faq-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.course-faq-item {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--card);
}

.course-faq-item summary {
    cursor: pointer;
    font-weight: 600;
}

.course-empty-hint {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.study-meta-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1.25rem;
    font-size: 0.88rem;
}

.study-panel {
    margin-bottom: 1.5rem;
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--card);
}

.study-panel h3 {
    margin: 0 0 0.75rem;
    font-size: 1.05rem;
}

.study-key-points {
    margin: 0;
    padding-left: 1.25rem;
}

.flashcard-deck {
    position: relative;
    min-height: 140px;
}

.flashcard {
    display: none;
}

.flashcard.active {
    display: block;
}

.flashcard-inner {
    perspective: 800px;
    cursor: pointer;
    min-height: 120px;
}

.flashcard-face {
    padding: 1.25rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--border-light);
    text-align: center;
    font-size: 1rem;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.flashcard-inner.flipped .flashcard-front {
    display: none;
}

.flashcard-inner:not(.flipped) .flashcard-back {
    display: none;
}

.flashcard-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 0.75rem;
}

.study-quiz-item {
    margin-bottom: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-light);
}

.contrib-history-section {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.contrib-history-title {
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

.contrib-history-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 240px;
    overflow-y: auto;
}

.contrib-history-list li {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    padding: 0.45rem 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.85rem;
}

.contrib-points {
    font-weight: 700;
    color: var(--primary);
    min-width: 2.5rem;
}

.contrib-reason {
    flex: 1;
}

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

.q-badge-course {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
    text-decoration: none;
}

/* ═══════ FINAL RESPONSIVE ═══════ */

@media (max-width: 768px) {
    .batch-rating { flex-direction: column; gap: 0.75rem; align-items: flex-start; }
    .sort-toggle { width: 100%; }
    .sort-btn { flex: 1; text-align: center; }
    .batch-file-item { flex-wrap: wrap; }
    .approval-item { flex-direction: column; gap: 0.75rem; align-items: flex-start; }
    .profile-avatar-section { flex-direction: column; align-items: center; text-align: center; }
    .profile-info-side { width: 100%; text-align: left; }
    .profile-info-side .info-value,
    .profile-info-side .info-value-group { text-align: right; justify-content: flex-end; }
    .question-card { flex-direction: column; gap: 0.5rem; }
    .question-card-left { justify-content: flex-start; }
    .question-detail-meta { flex-direction: column; gap: 0.75rem; align-items: flex-start; }
    .answer-meta { flex-direction: column; align-items: flex-start; }
    .search-sort-bar { flex-direction: column; }
    .search-form { width: 100%; }
    .search-form.search-form--community {
        flex-direction: column;
        align-items: stretch;
    }
    .search-form.search-form--community .search-input-wrap {
        flex: none;
        width: 100%;
    }
    .search-form.search-form--community .search-filters-actions {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.5rem;
        width: 100%;
    }
    .search-form.search-form--community .search-filters-actions .tag-filter-input {
        width: 100%;
        min-width: 0;
    }
    .search-form.search-form--community .search-filters-actions .btn-search-submit {
        width: 100%;
        min-width: 0;
        display: flex;
        justify-content: center;
        align-items: center;
        text-align: center;
        padding: 0.45rem 0.5rem;
        font-size: 0.72rem;
        line-height: 1.25;
        white-space: normal;
        word-break: keep-all;
    }
    .batch-time--full { display: none; }
    .batch-time--short { display: inline; white-space: nowrap; }
    .batch-zip-label--long { display: none; }
    .batch-zip-label--short { display: inline; }
    .batch-zip-del-group .btn-batch-zip,
    .batch-zip-del-group .btn-batch-del {
        flex: 1 1 0;
        min-width: 0;
        min-height: 2.35rem;
    }
    .batch-header {
        flex-direction: column;
        align-items: stretch;
    }
    .batch-header-actions {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .batch-zip-del-group {
        flex: 1 1 100%;
        width: 100%;
    }
    .upload-taxonomy-grid,
    .course-summary-grid,
    .study-tools-layout {
        grid-template-columns: 1fr;
    }
    .question-course-filter {
        flex-wrap: wrap;
    }
    .question-course-filter .form-input {
        max-width: none;
        flex: 1 1 12rem;
    }
    .study-ask-row {
        flex-direction: column;
        align-items: stretch;
    }
    .ach-grid { grid-template-columns: 1fr; }
    .ach-progress { flex-direction: column; }
}

/* ═══════ COURSE-LEVEL STUDY & PRACTICE ═══════ */

.course-study-hub-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.course-study-hub-card {
    display: block;
    padding: 1.35rem 1.5rem;
    border-radius: calc(var(--radius) + 2px);
    border: 1px solid var(--border);
    background: var(--card);
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.course-study-hub-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.course-study-hub-card--primary {
    border-color: rgba(99, 102, 241, 0.35);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(129, 140, 248, 0.05));
}

.course-study-hub-icon {
    font-size: 1.75rem;
    display: block;
    margin-bottom: 0.5rem;
}

.course-study-hub-card h3 {
    margin: 0 0 0.35rem;
    font-size: 1.15rem;
    color: var(--primary);
}

.course-study-hub-card p {
    margin: 0;
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.course-study-status-pill {
    display: inline-block;
    margin-top: 0.5rem;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    background: rgba(245, 158, 11, 0.15);
    color: #b45309;
}

.course-section-materials-compact .course-materials-compact-desc {
    color: var(--text-secondary);
    line-height: 1.65;
}

.course-learn-layout {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.course-learn-heading {
    margin: 0 0 0.75rem;
    font-size: 1.1rem;
    color: var(--primary);
}

.course-learn-summary {
    line-height: 1.75;
    color: var(--text);
    white-space: pre-wrap;
}

.course-topic-list {
    margin: 0.75rem 0 0;
    padding-left: 1.25rem;
    color: var(--text-secondary);
}

.course-doc-catalog {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.course-doc-item {
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--border-light);
}

.course-doc-item--exam {
    border-color: rgba(239, 68, 68, 0.2);
    background: rgba(239, 68, 68, 0.04);
}

.course-doc-item h3 {
    margin: 0 0 0.35rem;
    font-size: 0.98rem;
}

.course-doc-files {
    margin: 0.35rem 0 0;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.course-learn-practice-cta {
    text-align: center;
}

.course-learn-practice-cta .btn-lg {
    margin-top: 0.75rem;
    padding: 0.65rem 1.5rem;
}

.course-practice-header h1 {
    margin: 0 0 0.35rem;
    font-size: 1.5rem;
}

.course-practice-layout {
    display: grid;
    grid-template-columns: minmax(140px, 200px) 1fr;
    gap: 1.25rem;
    align-items: start;
}

.practice-q-index {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    max-height: 70vh;
    overflow-y: auto;
}

.practice-q-tab {
    width: 100%;
    border: 1px solid var(--border);
    background: var(--card);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.5rem;
    cursor: pointer;
    font-weight: 600;
}

.practice-q-tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.practice-card.hidden {
    display: none !important;
}

.practice-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.85rem;
}

.practice-type-badge,
.practice-source-badge {
    font-size: 0.72rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: var(--border-light);
    color: var(--text-secondary);
}

.practice-source-badge.ai {
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary);
}

.practice-stem {
    font-size: 1.05rem;
    line-height: 1.75;
    margin-bottom: 1rem;
}

.practice-choices {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    margin-bottom: 0.85rem;
}

.practice-submit-btn {
    margin-top: 1.15rem;
}

.practice-choice-label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.practice-choice-label:has(input:checked) {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.06);
}

.practice-choice-text {
    flex: 1;
    line-height: 1.55;
}

.practice-choice-text mjx-container {
    font-size: 1.05em;
}

.practice-result {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.practice-result.hidden {
    display: none;
}

.practice-result-verdict {
    font-weight: 800;
    font-size: 1rem;
    margin-bottom: 0.65rem;
}

.practice-result-verdict.is-correct {
    color: #059669;
}

.practice-result-verdict.is-wrong {
    color: #dc2626;
}

.practice-result-explanation,
.practice-result-answer {
    margin-top: 0.5rem;
    line-height: 1.65;
}

.practice-nav-row {
    display: flex;
    gap: 0.65rem;
    margin-top: 1rem;
}

.course-practice-single {
    max-width: none;
    width: 100%;
}

.practice-carousel-shell {
    width: 100%;
}

.course-practice-toolbar {
    margin: 2rem 0 2rem;
    padding-top: 0.35rem;
}

.practice-carousel-viewport {
    overflow: hidden;
    padding: 0.5rem 0 1rem;
}

.practice-carousel-track {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.45fr) minmax(0, 1fr);
    gap: 1.25rem;
    align-items: stretch;
    max-width: 1400px;
    margin: 0 auto;
    min-height: min(560px, 75vh);
    transform: translateX(0);
    transition: transform 0.65s cubic-bezier(0.4, 0, 0.15, 1);
    will-change: transform;
}

.practice-carousel-slot {
    position: relative;
    left: auto;
    top: auto;
    width: 100%;
    margin: 0;
    min-width: 0;
    pointer-events: none;
    z-index: 1;
    opacity: 0.88;
}

.practice-carousel-slot .practice-slide-card {
    transform: translateX(0);
    transition:
        transform 0.55s cubic-bezier(0.4, 0, 0.15, 1),
        opacity 0.45s ease,
        box-shadow 0.45s ease,
        border-color 0.45s ease;
}

.practice-carousel-slot--center {
    z-index: 2;
    pointer-events: auto;
    opacity: 1;
}

.practice-carousel-slot--prev,
.practice-carousel-slot--next {
    opacity: 0.92;
}

.practice-carousel-slot--next .practice-slide-card:not(.is-ghost) {
    opacity: 1;
    pointer-events: auto;
}

.practice-carousel-slot--next .practice-submit-btn {
    display: none !important;
}

.practice-carousel-track.is-advancing .practice-carousel-slot--next .practice-slide-card:not(.is-ghost) {
    box-shadow: 0 14px 44px rgba(99, 102, 241, 0.22);
    border-color: rgba(99, 102, 241, 0.35);
}

/* 桌面：轨道平移，下一题滑入中间 */
.practice-carousel-track.is-advancing {
    transform: translateX(calc(-1 * var(--advance-shift, 0px)));
}

.practice-carousel-track.is-advancing .practice-carousel-slot--center .practice-slide-card {
    transform: translateX(-28px) scale(0.98);
    opacity: 0;
    pointer-events: none;
}

.practice-carousel-track.is-advancing .practice-carousel-slot--next {
    opacity: 1;
    z-index: 3;
}

.practice-carousel-track.is-advancing .practice-carousel-slot--next .practice-slide-card {
    transform: translateX(0) scale(1);
    opacity: 1;
    box-shadow: 0 14px 44px rgba(99, 102, 241, 0.28);
    border-color: rgba(99, 102, 241, 0.45);
}

.practice-carousel-track.is-advancing .practice-carousel-slot--prev .practice-slide-card {
    transform: translateX(28px) scale(0.96);
    opacity: 0;
}

/* 单栏：当前题左滑出，新题从右侧滑入中间 */
.practice-slide-card--active.practice-card-exit {
    transform: translateX(-36px);
    opacity: 0;
    pointer-events: none;
}

.practice-slide-card--active.practice-card-enter {
    transform: translateX(36px);
    opacity: 0;
}

.practice-slide-card--active.practice-card-enter.practice-card-enter-play {
    transform: translateX(0);
    opacity: 1;
}

.practice-carousel-shell.is-transitioning .practice-carousel-slot {
    pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
    .practice-carousel-track,
    .practice-carousel-slot .practice-slide-card,
    .practice-slide-card--active.practice-card-enter,
    .practice-slide-card--active.practice-card-exit {
        transition: none !important;
        animation: none !important;
    }

    .practice-carousel-track.is-advancing {
        transform: none !important;
    }
}

.practice-slide-card {
    height: 100%;
    min-height: min(420px, 60vh);
    max-height: min(680px, 78vh);
    overflow: auto;
    box-sizing: border-box;
    padding: 1.35rem 1.5rem;
}

.practice-slide-card--active {
    padding: 1.5rem 1.75rem;
    box-shadow: 0 12px 40px rgba(99, 102, 241, 0.18);
    border-color: rgba(99, 102, 241, 0.35);
}

body.dark-mode .practice-slide-card--active {
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
    border-color: rgba(129, 140, 248, 0.45);
}

.practice-slide-card.is-ghost {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: min(420px, 60vh);
    border-style: dashed;
    opacity: 0.5;
}

.practice-slide-ghost-label,
.practice-slide-side-label {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0 0 0.65rem;
}

.practice-carousel-slot--center .practice-stem {
    font-size: 1.12rem;
    line-height: 1.8;
}

.practice-carousel-slot--prev .practice-stem,
.practice-carousel-slot--next .practice-stem {
    font-size: 0.95rem;
    line-height: 1.65;
    margin-bottom: 0.75rem;
}

.practice-choices--readonly {
    margin-bottom: 0;
}

.practice-choice-label--readonly {
    cursor: default;
    pointer-events: none;
    opacity: 0.92;
    padding: 0.45rem 0.65rem;
}

.practice-choice-label--readonly .practice-choice-text {
    font-size: 0.88rem;
}

.practice-fill-preview {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}

.practice-answer-dock {
    max-width: min(640px, 92vw);
    margin: 1rem auto 0;
    animation: practice-dock-in 0.45s ease;
}

@keyframes practice-dock-in {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.practice-answer-dock.hidden {
    display: none !important;
}

.practice-mode-tabs {
    max-width: none;
    margin: 0;
}

@media (max-width: 1100px) {
    .practice-carousel-track {
        grid-template-columns: 1fr;
        min-height: 0;
        transform: none !important;
    }
    .practice-carousel-slot--prev,
    .practice-carousel-slot--next {
        display: none;
    }
    .practice-carousel-track.is-advancing .practice-carousel-slot--center .practice-slide-card,
    .practice-carousel-track.is-advancing .practice-carousel-slot--next .practice-slide-card {
        transform: none;
        opacity: 1;
        box-shadow: none;
    }
}

@media (max-width: 768px) {
    .course-practice-toolbar {
        margin: 1rem 0 1.25rem;
    }
}

.course-practice-single .hidden {
    display: none !important;
}

.practice-points-bar {
    margin: 0.35rem 0 0;
    font-size: 0.9rem;
    color: var(--text-muted, #666);
}

.practice-mode-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.practice-mode-tab {
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text-secondary);
    border-radius: 999px;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s;
}

.practice-mode-tab:hover {
    border-color: var(--primary-light);
    color: var(--text);
}

.practice-mode-tab[data-mode="all"].active {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.practice-mode-tab[data-mode="wrong"].active {
    background: linear-gradient(135deg, #ef4444, #f97316);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
}

.practice-mode-tab[data-mode="favorite"].active {
    background: linear-gradient(135deg, #f59e0b, #eab308);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
}

body.dark-mode .practice-mode-tab {
    background: #1e293b;
    border-color: #334155;
    color: #94a3b8;
}

body.dark-mode .practice-mode-tab:hover {
    background: #273449;
    border-color: #64748b;
    color: #e2e8f0;
}

body.dark-mode .practice-mode-tab.active {
    color: #fff;
}

.practice-mode-count {
    display: inline-block;
    min-width: 1.25rem;
    padding: 0 0.35rem;
    margin-left: 0.2rem;
    border-radius: 999px;
    font-size: 0.75rem;
    background: rgba(0, 0, 0, 0.1);
}

.practice-mode-tab.active .practice-mode-count {
    background: rgba(255, 255, 255, 0.28);
}

body.dark-mode .practice-mode-tab .practice-mode-count {
    background: rgba(255, 255, 255, 0.08);
}

.practice-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.practice-favorite-btn {
    flex-shrink: 0;
    border: none;
    background: transparent;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--text-muted, #888);
    padding: 0.1rem 0.25rem;
    position: relative;
    z-index: 3;
    pointer-events: auto;
}

.practice-favorite-btn:hover,
.practice-favorite-btn.is-active {
    color: #f59e0b;
}

.practice-progress-text {
    font-size: 0.85rem;
    color: var(--text-muted, #666);
    margin-bottom: 0;
    flex: 1;
}

.nav-points {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius-sm);
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
}

.nav-points:hover {
    background: rgba(245, 158, 11, 0.22);
}

.nav-points-value {
    min-width: 1.5rem;
    text-align: center;
}

/* ── Points hub ── */
.points-hub {
    max-width: 56rem;
    margin: 0 auto;
}

.points-hub-header {
    margin-bottom: 1.25rem;
}

.points-hub-header h1 {
    margin: 0 0 0.35rem;
    font-size: 1.75rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.points-hub-header p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
}

.points-hub-top {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

@media (max-width: 768px) {
    .points-hub-top {
        grid-template-columns: 1fr;
    }
}

.points-hero-card {
    position: relative;
    overflow: hidden;
    margin-bottom: 0;
    background: linear-gradient(145deg, #4f46e5 0%, #7c3aed 55%, #6366f1 100%);
    border: none;
    color: #fff;
}

.points-hero-glow {
    position: absolute;
    inset: -40% -20% auto auto;
    width: 70%;
    height: 120%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.22) 0%, transparent 65%);
    pointer-events: none;
}

.points-hero-inner {
    position: relative;
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 1;
}

.points-hero-icon {
    font-size: 2.75rem;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.2));
    animation: points-coin-float 3s ease-in-out infinite;
}

@keyframes points-coin-float {
    0%, 100% { transform: translateY(0) rotate(-6deg); }
    50% { transform: translateY(-6px) rotate(6deg); }
}

.points-hero-label {
    font-size: 0.85rem;
    opacity: 0.9;
    letter-spacing: 0.04em;
}

.points-hero-balance {
    margin: 0.15rem 0 0;
    font-size: 3rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.02em;
    transition: transform 0.25s ease;
}

.points-hero-balance.is-bumping {
    animation: points-balance-bump 0.55s ease;
}

@keyframes points-balance-bump {
    0% { transform: scale(1); }
    40% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

.points-hero-actions {
    position: relative;
    z-index: 1;
    margin-top: 1rem;
}

.points-hero-actions .btn-secondary {
    background: rgba(255, 255, 255, 0.95);
    border-color: transparent;
    color: var(--primary-dark);
}

.points-float-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 2;
}

.points-float-reward {
    position: absolute;
    left: 50%;
    top: 42%;
    transform: translateX(-50%);
    font-size: 1.75rem;
    font-weight: 800;
    color: #fde68a;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    animation: points-float-up 1.35s ease-out forwards;
}

@keyframes points-float-up {
    0% { opacity: 0; transform: translate(-50%, 12px) scale(0.6); }
    20% { opacity: 1; transform: translate(-50%, 0) scale(1.1); }
    100% { opacity: 0; transform: translate(-50%, -48px) scale(1); }
}

.points-checkin-card {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
}

.points-checkin-title {
    margin: 0 0 0.75rem;
    font-size: 1rem;
    font-weight: 700;
}

.checkin-widget {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 11rem;
    padding: 0.5rem 0;
}

.checkin-ring {
    position: absolute;
    width: 7.5rem;
    height: 7.5rem;
    border-radius: 50%;
    border: 2px dashed rgba(99, 102, 241, 0.35);
    animation: checkin-ring-spin 12s linear infinite;
    pointer-events: none;
}

.checkin-widget.is-done .checkin-ring {
    border-color: rgba(16, 185, 129, 0.4);
    animation: none;
}

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

.checkin-btn {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    width: 6.5rem;
    height: 6.5rem;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    background: linear-gradient(145deg, var(--primary), var(--secondary));
    color: #fff;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.45);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: checkin-pulse 2.2s ease-in-out infinite;
}

.checkin-widget.is-done .checkin-btn {
    animation: none;
}

@keyframes checkin-pulse {
    0%, 100% { box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4); }
    50% { box-shadow: 0 8px 32px rgba(99, 102, 241, 0.65), 0 0 0 8px rgba(99, 102, 241, 0.12); }
}

.checkin-btn:hover:not(:disabled) {
    transform: scale(1.06);
}

.checkin-btn.is-pressing {
    transform: scale(0.92);
}

.checkin-btn.is-success {
    animation: checkin-success-pop 0.45s ease forwards;
}

@keyframes checkin-success-pop {
    0% { transform: scale(0.92); }
    50% { transform: scale(1.15); background: linear-gradient(145deg, #10b981, #34d399); }
    100% { transform: scale(1); opacity: 0; }
}

.checkin-btn-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.checkin-btn-text {
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.2;
}

.checkin-btn-reward {
    font-size: 0.85rem;
    font-weight: 800;
    color: #fde68a;
}

.checkin-done-panel {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.35rem;
}

.checkin-done-panel.stamp-in {
    animation: checkin-stamp-in 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes checkin-stamp-in {
    0% { opacity: 0; transform: scale(0.5) rotate(-12deg); }
    100% { opacity: 1; transform: scale(1) rotate(0); }
}

.checkin-stamp {
    width: 5rem;
    height: 5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #10b981, #34d399);
    color: #fff;
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.checkin-widget.is-done .checkin-stamp {
    animation: checkin-stamp-glow 2.5s ease-in-out infinite;
}

@keyframes checkin-stamp-glow {
    0%, 100% { box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35); }
    50% { box-shadow: 0 6px 28px rgba(16, 185, 129, 0.55); }
}

.checkin-stamp-icon {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
}

.checkin-done-text {
    margin: 0.25rem 0 0;
    font-weight: 700;
    color: var(--success);
    font-size: 1rem;
}

.checkin-done-sub {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.checkin-particle-layer {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 3;
}

.checkin-particle {
    position: absolute;
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    animation: checkin-particle-burst 0.85s ease-out forwards;
}

@keyframes checkin-particle-burst {
    0% { opacity: 1; transform: translate(0, 0) scale(1); }
    100% { opacity: 0; transform: translate(var(--tx), var(--ty)) scale(0.2); }
}

.points-hub-grid {
    display: grid;
    gap: 1rem;
}

.points-quota-card h2,
.points-rules-card h2,
.points-history-card h2 {
    margin: 0 0 1rem;
    font-size: 1rem;
    font-weight: 700;
}

.quota-meter + .quota-meter {
    margin-top: 1rem;
}

.quota-meter-head {
    display: flex;
    justify-content: space-between;
    font-size: 0.88rem;
    margin-bottom: 0.4rem;
    color: var(--text-secondary);
}

.quota-meter-bar {
    height: 0.55rem;
    border-radius: 999px;
    background: var(--border);
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
}

.quota-meter-fill {
    height: 100%;
    min-width: 0;
    border-radius: 999px;
    transition: width 0.5s ease;
}

.quota-meter-fill--download {
    background: linear-gradient(90deg, var(--primary), var(--accent));
}

.quota-meter-fill--ai {
    background: linear-gradient(90deg, var(--secondary), #ec4899);
}

body.dark-mode .quota-meter-bar {
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(148, 163, 184, 0.28);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.35);
}

body.dark-mode .quota-meter-fill--download {
    background: linear-gradient(90deg, #818cf8, #38bdf8);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.35);
}

body.dark-mode .quota-meter-fill--ai {
    background: linear-gradient(90deg, #a78bfa, #f472b6);
    box-shadow: 0 0 10px rgba(167, 139, 250, 0.35);
}

.quota-meter-hint {
    margin: 0.35rem 0 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.points-rules-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

@media (max-width: 600px) {
    .points-rules-cols {
        grid-template-columns: 1fr;
    }
}

.points-rules-block h3 {
    margin: 0 0 0.6rem;
    font-size: 0.88rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.points-rules-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.points-rules-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.4rem 0;
    font-size: 0.88rem;
    line-height: 1.45;
    border-bottom: 1px solid var(--border-light);
}

.points-rules-list li:last-child {
    border-bottom: none;
}

.points-rule-badge {
    flex-shrink: 0;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-sm);
}

.points-rule-badge.earn {
    background: var(--success-light);
    color: #047857;
}

.points-rule-badge.spend {
    background: var(--danger-light);
    color: #b91c1c;
}

.points-history-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 280px;
    overflow-y: auto;
}

.points-history-list li {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.65rem;
    align-items: center;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.88rem;
}

.points-history-delta {
    font-weight: 800;
    color: var(--primary);
    min-width: 2.5rem;
}

.points-history-delta.negative {
    color: var(--danger);
}

.points-history-reason {
    color: var(--text);
}

.points-history-time {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
}

body.dark-mode .points-hero-card {
    background: linear-gradient(145deg, #3730a3 0%, #5b21b6 50%, #4338ca 100%);
}

body.dark-mode .points-checkin-card,
body.dark-mode .points-quota-card,
body.dark-mode .points-rules-card,
body.dark-mode .points-history-card {
    background: var(--card);
}

.points-page .points-grid,
.points-balance-num,
.points-actions,
.points-quota-list {
    /* legacy aliases */
}

.points-balance-num {
    font-size: 2.5rem;
    font-weight: 800;
    margin: 0.25rem 0 1rem;
    color: var(--primary);
}

.points-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.points-quota-list {
    margin: 0;
    padding-left: 1.2rem;
}

.contrib-delta.negative {
    color: #dc2626;
}

.recharge-packages {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.recharge-price {
    font-size: 1.75rem;
    font-weight: 800;
    margin: 0.5rem 0;
}

.recharge-qr-wrap {
    display: flex;
    justify-content: center;
    margin: 1rem 0;
}

.math-content mjx-container {
    font-size: 1.05em;
}

@media (max-width: 768px) {
    .course-practice-layout {
        grid-template-columns: 1fr;
    }
    .practice-q-index {
        flex-direction: row;
        flex-wrap: wrap;
        max-height: none;
    }
    .practice-q-tab {
        width: auto;
        min-width: 2.25rem;
    }
}
