/* ================================
   CSS 变量
   ================================ */
:root {
    --primary: #4f46e5;
    --primary-light: #6366f1;
    --primary-bg: #eef2ff;
    --accent: #f59e0b;
    --accent-light: #fef3c7;
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --bg: #f8fafc;
    --surface: #ffffff;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.03);
    --shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.04), 0 2px 4px rgba(0,0,0,0.03);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.06), 0 4px 10px rgba(0,0,0,0.03);
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
    --font-mono: "SF Mono", "Fira Code", "JetBrains Mono", "Consolas", "Monaco", monospace;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --max-width: 880px;
    --nav-height: 52px;
}

/* ================================
   重置
   ================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 16px;
    overflow-x: hidden;
    width: 100%;
}

img, svg, video {
    max-width: 100%;
    height: auto;
}

/* ================================
   导航栏
   ================================ */
.navbar {
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
}

.nav-container {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 0 16px;
    height: var(--nav-height);
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    white-space: nowrap;
}


.nav-container::-webkit-scrollbar {
    display: none;
}

.nav-container a {
    text-decoration: none;
    color: var(--text-secondary);
    padding: 8px 14px;
    border-radius: 18px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition);
    flex-shrink: 0;
    min-height: 36px;
    display: flex;
    align-items: center;
}

.nav-container a:hover {
    color: var(--primary);
    background: var(--primary-bg);
}

.nav-container a.active {
    color: var(--primary);
    background: var(--primary-bg);
    font-weight: 600;
}

/* ================================
   导航栏用户区域
   ================================ */
#navUser {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
}

.nav-user-name {
    color: var(--text-secondary);
    font-size: 0.8rem;
    padding: 6px 10px;
    border-radius: 16px;
    cursor: default;
}

.nav-logout {
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 0.78rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    background: transparent;
    user-select: none;
    white-space: nowrap;
}

.nav-logout:hover {
    color: #dc2626;
    background: #fef2f2;
    border-color: #fecaca;
}

.nav-logout:active {
    transform: scale(0.95);
    background: #fee2e2;
}

/* ================================
   头部
   ================================ */
header {
    text-align: center;
    padding: clamp(28px, 5vw, 48px) 16px clamp(24px, 4vw, 36px);
    background: var(--surface);
    border-bottom: 1px solid var(--border-light);
    width: 100%;
}

header h1 {
    font-size: clamp(1.3rem, 3vw, 1.75rem);
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
    margin-bottom: 6px;
    word-break: break-word;
}

header p {
    font-size: clamp(0.8rem, 1.8vw, 0.9375rem);
    color: var(--text-muted);
    max-width: 480px;
    margin: 0 auto;
    padding: 0 8px;
}

/* ================================
   容器
   ================================ */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: clamp(16px, 3vw, 28px) 16px clamp(40px, 6vw, 60px);
    width: 100%;
}

/* ================================
   分区标题
   ================================ */
.section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 28px 0 14px;
    padding-left: 4px;
}

/* ================================
   卡片网格
   ================================ */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(clamp(135px, 22vw, 180px), 1fr));
    gap: clamp(8px, 1.5vw, 12px);
}

/* ================================
   通用卡片
   ================================ */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: clamp(14px, 2.5vw, 20px) clamp(16px, 3vw, 24px);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
    transition: all var(--transition);
    word-break: break-word;
}

.card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border);
    transform: translateY(-1px);
}

.card h2 {
    font-size: clamp(0.95rem, 1.6vw, 1.0625rem);
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.card p {
    color: var(--text-secondary);
    font-size: clamp(0.8rem, 1.4vw, 0.875rem);
    line-height: 1.6;
}

.card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

/* ================================
   分类卡片
   ================================ */
.cat-card {
    display: flex;
    align-items: center;
    gap: clamp(8px, 1.5vw, 12px);
    padding: clamp(14px, 2vw, 18px) clamp(14px, 2vw, 20px);
    border-radius: var(--radius);
    cursor: pointer;
    border: 1px solid var(--border-light);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
}

.cat-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border);
    transform: translateY(-2px);
}

.cat-card .cat-icon {
    width: clamp(34px, 5vw, 40px);
    height: clamp(34px, 5vw, 40px);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(1rem, 1.8vw, 1.2rem);
    flex-shrink: 0;
}

.cat-card .cat-info {
    flex: 1;
    min-width: 0;
}

.cat-card .cat-info h3 {
    font-size: clamp(0.8rem, 1.5vw, 0.9375rem);
    font-weight: 600;
    color: var(--text);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cat-card .cat-info span {
    font-size: clamp(0.65rem, 1.1vw, 0.75rem);
    color: var(--text-muted);
    display: block;
}

.cat-card .cat-arrow {
    color: var(--text-muted);
    font-size: 0.875rem;
    flex-shrink: 0;
}

/* ================================
   图标颜色
   ================================ */
.cat-tense .cat-icon { background: #fef2f2; color: #dc2626; }
.cat-passive .cat-icon { background: #fff7ed; color: #ea580c; }
.cat-subjunctive .cat-icon { background: #fefce8; color: #ca8a04; }
.cat-nonfinite .cat-icon { background: #f0fdf4; color: #16a34a; }
.cat-attr .cat-icon { background: #f0fdfa; color: #0d9488; }
.cat-noun .cat-icon { background: #eff6ff; color: #2563eb; }
.cat-adv .cat-icon { background: #eef2ff; color: #4f46e5; }
.cat-inversion .cat-icon { background: #faf5ff; color: #7c3aed; }
.cat-emphasis .cat-icon { background: #fdf2f8; color: #db2777; }
.cat-exclaim .cat-icon { background: #fef2f2; color: #dc2626; }
.cat-imperative .cat-icon { background: #fff7ed; color: #ea580c; }
.cat-ellipsis .cat-icon { background: #f0fdf4; color: #16a34a; }
.cat-tag .cat-icon { background: #f0fdfa; color: #0d9488; }
.cat-compound .cat-icon { background: #eff6ff; color: #2563eb; }
.cat-therebe .cat-icon { background: #eef2ff; color: #4f46e5; }
.cat-modal .cat-icon { background: #faf5ff; color: #7c3aed; }
.cat-article .cat-icon { background: #fdf2f8; color: #db2777; }
.cat-prep .cat-icon { background: #fff7ed; color: #ea580c; }
.cat-pronoun .cat-icon { background: #fef2f2; color: #dc2626; }
.cat-adjadv .cat-icon { background: #f0fdf4; color: #16a34a; }
.cat-number .cat-icon { background: #eff6ff; color: #2563eb; }
.cat-agreement .cat-icon { background: #fefce8; color: #ca8a04; }
.cat-pattern .cat-icon { background: #fef2f2; color: #dc2626; }
.cat-multiple .cat-icon { background: #faf5ff; color: #7c3aed; }
.cat-wordform .cat-icon { background: #f0fdfa; color: #0d9488; }
.cat-confusing .cat-icon { background: #fdf2f8; color: #db2777; }

/* ================================
   小卡片（相关知识点）
   ================================ */
.card-sm {
    padding: 12px 16px;
    margin: 6px 0;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    background: var(--surface);
    transition: all var(--transition);
}

.card-sm:hover {
    border-color: var(--primary-light);
    background: var(--primary-bg);
}

.card-sm h3 {
    font-size: 0.9rem;
    font-weight: 500;
    margin: 0;
    color: var(--text);
}

/* ================================
   首页卡片
   ================================ */
.home-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: clamp(10px, 2vw, 16px);
}

.home-card {
    text-align: center;
    padding: clamp(24px, 4vw, 36px) clamp(16px, 3vw, 24px);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
}

.home-card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--border);
    transform: translateY(-3px);
}

.home-card .icon {
    font-size: clamp(2rem, 4vw, 2.5rem);
    margin-bottom: 10px;
}

.home-card h2 {
    font-size: clamp(1rem, 1.8vw, 1.125rem);
    font-weight: 600;
    margin-bottom: 4px;
}

.home-card p {
    color: var(--text-muted);
    font-size: clamp(0.75rem, 1.3vw, 0.875rem);
}

/* ================================
   进度条
   ================================ */
.progress-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: clamp(18px, 3vw, 24px) clamp(18px, 3vw, 28px);
    margin: 16px auto 0;
    max-width: min(480px, 90vw);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.progress-card h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text);
}

.progress-track {
    width: 100%;
    height: 8px;
    background: var(--border-light);
    border-radius: 4px;
    overflow: hidden;
    margin: 10px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 4px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0%;
}

#progressText {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 8px 0;
    line-height: 1.8;
}

.reset-btn {
    display: inline-block;
    padding: 8px 18px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
    transition: all var(--transition);
    margin-top: 4px;
    font-family: var(--font);
    min-height: 36px;
}

.reset-btn:hover {
    background: #fee2e2;
    color: #dc2626;
    border-color: #fecaca;
}

/* ================================
   列表卡片
   ================================ */
.list-card {
    display: flex;
    align-items: center;
    gap: clamp(8px, 2vw, 14px);
    padding: clamp(12px, 2vw, 16px) clamp(14px, 2.5vw, 20px);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
    margin-bottom: 8px;
}

.list-card:hover {
    border-color: var(--border);
    box-shadow: var(--shadow-md);
    transform: translateX(3px);
}

.list-card .list-icon {
    width: clamp(32px, 5vw, 38px);
    height: clamp(32px, 5vw, 38px);
    border-radius: 10px;
    background: var(--primary-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(0.85rem, 1.5vw, 1rem);
    flex-shrink: 0;
}

.list-card .list-info {
    flex: 1;
    min-width: 0;
}

.list-card .list-info h3 {
    font-size: clamp(0.85rem, 1.5vw, 0.9375rem);
    font-weight: 600;
    color: var(--text);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-card .list-info span {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.list-card .list-arrow {
    color: var(--text-muted);
    flex-shrink: 0;
    font-size: 0.8rem;
}

/* ================================
   搜索框
   ================================ */
.search-box {
    width: 100%;
    padding: clamp(10px, 1.8vw, 14px) clamp(14px, 2.5vw, 20px);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: clamp(0.875rem, 1.5vw, 0.9375rem);
    background: var(--surface);
    color: var(--text);
    outline: none;
    transition: all var(--transition);
    margin-bottom: clamp(16px, 3vw, 24px);
    font-family: var(--font);
    -webkit-appearance: none;
    appearance: none;
}

.search-box::placeholder {
    color: var(--text-muted);
}

.search-box:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(99,102,241,0.08);
}

/* ================================
   详情页卡片
   ================================ */
.detail-card {
    margin-bottom: clamp(10px, 1.8vw, 14px);
}

.detail-card h2 {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 10px;
}

/* ================================
   面包屑
   ================================ */
.breadcrumb {
    font-size: 0.8rem;
    margin-bottom: 6px;
    word-break: break-word;
}

.breadcrumb a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb span {
    color: var(--text-muted);
}

/* ================================
   收藏按钮
   ================================ */
.favorite-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: clamp(8px, 1.5vw, 10px) clamp(16px, 3vw, 22px);
    border: 1.5px solid var(--border);
    background: var(--surface);
    border-radius: 24px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    transition: all var(--transition);
    margin-top: 8px;
    font-family: var(--font);
    min-height: 40px;
    -webkit-tap-highlight-color: transparent;
}

.favorite-btn:hover {
    border-color: var(--accent);
    color: #b45309;
    background: var(--accent-light);
}

.favorite-btn.favorited {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* ================================
   结构代码块
   ================================ */
.structure-code {
    display: block;
    background: #0f172a;
    color: #facc15;
    padding: clamp(12px, 2vw, 16px) clamp(14px, 2.5vw, 22px);
    border-radius: var(--radius-sm);
    font-size: clamp(0.8rem, 1.4vw, 0.9375rem);
    font-family: var(--font-mono);
    letter-spacing: 0.3px;
    overflow-x: auto;
    line-height: 1.8;
    border: 1px solid #1e293b;
    -webkit-overflow-scrolling: touch;
    word-break: break-all;
}

/* ================================
   例句引用块
   ================================ */
blockquote {
    background: #fffbeb;
    border-left: 4px solid var(--accent);
    padding: clamp(10px, 2vw, 14px) clamp(14px, 2.5vw, 20px);
    margin: 0;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: clamp(0.85rem, 1.5vw, 0.9375rem);
    color: #78350f;
    font-style: italic;
    line-height: 1.6;
    word-break: break-word;
}

/* ================================
   表格
   ================================ */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 8px 0;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    max-width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: clamp(0.7rem, 1.3vw, 0.875rem);
    min-width: 400px;
}

thead th {
    background: #f8fafc;
    color: var(--text);
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

tbody td {
    padding: 8px 14px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover td {
    background: #fafafa;
}

/* ================================
   导航按钮
   ================================ */
.nav-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: clamp(12px, 2vw, 20px);
    gap: 8px;
    flex-wrap: wrap;
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px 18px;
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
    border-radius: 24px;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid var(--border);
    transition: all var(--transition);
    white-space: nowrap;
    min-height: 40px;
    min-width: 44px;
}

.nav-btn:hover {
    background: var(--primary-bg);
    border-color: var(--primary-light);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.nav-btn:active {
    transform: scale(0.97);
}

/* ================================
   空状态
   ================================ */
.empty-state {
    text-align: center;
    padding: clamp(32px, 6vw, 48px) 16px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: clamp(2.2rem, 5vw, 3rem);
    margin-bottom: 10px;
}

.empty-state h2 {
    font-size: clamp(1rem, 1.8vw, 1.125rem);
    color: var(--text);
    margin-bottom: 4px;
}

.empty-state p {
    font-size: 0.85rem;
}

/* ================================
   加载与错误
   ================================ */
.status-card {
    text-align: center;
    padding: clamp(24px, 4vw, 32px) 16px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border-light);
}

.status-card h2 {
    margin-bottom: 8px;
}

.status-card p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ================================
   关键词标签
   ================================ */
.keyword-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    margin-top: -4px;
}

.keyword-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.keyword-tag {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    background: #fef3c7;
    color: #92400e;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid #fde68a;
    transition: all var(--transition);
    cursor: default;
    white-space: nowrap;
}

.keyword-tag:hover {
    background: #fde68a;
    border-color: #fbbf24;
    transform: translateY(-1px);
}

/* ================================
   表单组件（登录页用）
   ================================ */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: var(--font);
    color: var(--text);
    background: var(--surface);
    outline: none;
    transition: all var(--transition);
}

.form-input:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(99,102,241,0.08);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-btn {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font);
    letter-spacing: 0.5px;
}

.form-btn:hover {
    background: #4338ca;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79,70,229,0.3);
}

.form-btn:active {
    transform: scale(0.98);
}

/* ================================
   演示账号卡片中的代码样式
   ================================ */
.card code {
    background: var(--primary-bg);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* ================================
   响应式 — 平板 (≤ 768px)
   ================================ */
@media (max-width: 768px) {
    :root {
        --nav-height: 46px;
    }

    .card-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 8px;
    }

    .cat-card {
        padding: 12px 14px;
    }

    .home-cards {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .nav-buttons {
        gap: 6px;
    }

    .nav-btn {
        padding: 8px 14px;
        font-size: 0.8rem;
    }
}

/* ================================
   响应式 — 手机 (≤ 480px)
   ================================ */
@media (max-width: 480px) {
    :root {
        --nav-height: 44px;
    }

    body {
        font-size: 15px;
    }

    .nav-container {
        gap: 0;
        padding: 0 8px;
    }

    .nav-container a {
        padding: 6px 10px;
        font-size: 0.75rem;
        border-radius: 14px;
        min-height: 30px;
    }

    header {
        padding: 24px 12px 20px;
    }

    header h1 {
        font-size: 1.25rem;
    }

    header p {
        font-size: 0.8rem;
    }

    .container {
        padding: 14px 12px 40px;
    }

    .card {
        padding: 14px 16px;
        border-radius: 10px;
    }

    .card-grid {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }

    .cat-card {
        padding: 10px 12px;
        border-radius: 10px;
        gap: 8px;
    }

    .cat-card .cat-icon {
        width: 30px;
        height: 30px;
        border-radius: 8px;
        font-size: 0.9rem;
    }

    .cat-card .cat-info h3 {
        font-size: 0.8rem;
    }

    .cat-card .cat-info span {
        font-size: 0.65rem;
    }

    .cat-card .cat-arrow {
        font-size: 0.7rem;
    }

    .list-card {
        padding: 12px 14px;
        gap: 10px;
        border-radius: 10px;
        margin-bottom: 6px;
    }

    .list-card .list-icon {
        width: 30px;
        height: 30px;
        border-radius: 8px;
        font-size: 0.8rem;
    }

    .list-card .list-info h3 {
        font-size: 0.85rem;
    }

    .list-card .list-arrow {
        display: none;
    }

    table {
        font-size: 0.7rem;
        min-width: 320px;
    }

    thead th, tbody td {
        padding: 7px 10px;
    }

    .nav-buttons {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
    }

    .nav-btn {
        flex: 1;
        min-width: 0;
        padding: 10px 8px;
        font-size: 0.78rem;
        text-align: center;
    }

    #backBtn {
        flex: 2;
    }

    .structure-code {
        font-size: 0.78rem;
        padding: 10px 14px;
        line-height: 1.6;
    }

    blockquote {
        font-size: 0.82rem;
        padding: 10px 14px;
    }

    .section-title {
        margin: 20px 0 10px;
        font-size: 0.7rem;
    }

    .home-card {
        padding: 22px 16px;
    }

    .home-card .icon {
        font-size: 1.8rem;
    }

    .progress-card {
        margin: 12px 12px 0;
        padding: 16px;
        max-width: none;
    }

    .search-box {
        padding: 10px 14px;
        font-size: 0.85rem;
        border-radius: 10px;
        margin-bottom: 16px;
    }

    .favorite-btn {
        padding: 8px 16px;
        font-size: 0.8rem;
        min-height: 36px;
    }

    .detail-card {
        margin-bottom: 10px;
    }

    .detail-card h2 {
        font-size: 0.7rem;
        margin-bottom: 8px;
    }

    .keyword-tags {
        gap: 6px;
    }

    .keyword-tag {
        padding: 5px 12px;
        font-size: 0.78rem;
    }

    .keyword-hint {
        font-size: 0.72rem;
    }

    .form-input {
        padding: 10px 14px;
        font-size: 0.9rem;
    }

    .form-btn {
        padding: 12px;
        font-size: 0.95rem;
    }

    .nav-user-name {
        font-size: 0.7rem;
        padding: 4px 6px;
    }

    .nav-logout {
        font-size: 0.7rem;
        padding: 4px 10px;
    }
}

/* ================================
   响应式 — 极小屏 (≤ 360px)
   ================================ */
@media (max-width: 360px) {
    .card-grid {
        grid-template-columns: 1fr 1fr;
        gap: 5px;
    }

    .cat-card {
        padding: 8px 10px;
        gap: 6px;
    }

    .cat-card .cat-icon {
        width: 26px;
        height: 26px;
        font-size: 0.8rem;
    }

    .cat-card .cat-info h3 {
        font-size: 0.72rem;
    }

    .cat-card .cat-info span {
        font-size: 0.6rem;
    }

    .nav-container a {
        padding: 5px 8px;
        font-size: 0.7rem;
    }

    .nav-btn {
        padding: 8px 6px;
        font-size: 0.72rem;
    }
}

/* ================================
   响应式 — 大屏优化 (≥ 1024px)
   ================================ */
@media (min-width: 1024px) {
    .card-grid {
        grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    }

    .card:hover {
        transform: translateY(-2px);
    }

    .cat-card:hover {
        transform: translateY(-3px);
    }
}

/* ================================
   打印样式
   ================================ */
@media print {
    .navbar, .nav-buttons, .favorite-btn, .search-box, .reset-btn, #navUser {
        display: none;
    }

    body {
        background: white;
        color: black;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
        break-inside: avoid;
    }

    header {
        background: none;
        border-bottom: 2px solid #333;
    }
}
/* ================================
   题库页面样式
   ================================ */

/* 统计卡片 */
.quiz-stats-card {
    margin-bottom: 16px;
}

.quiz-stats {
    display: flex;
    justify-content: space-around;
    text-align: center;
    margin-bottom: 12px;
}

.quiz-stat-num {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.quiz-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.quiz-progress-track {
    width: 100%;
    height: 8px;
    background: var(--border-light);
    border-radius: 4px;
    overflow: hidden;
}

.quiz-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 4px;
    transition: width 0.4s ease;
    width: 0%;
}

/* 答题卡片 */
.quiz-question-card {
    min-height: 200px;
}

.quiz-question-type {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.quiz-question-text {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 20px;
    line-height: 1.7;
}

/* 选项 */
.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quiz-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border: 2px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all var(--transition);
    background: var(--surface);
    font-size: 0.93rem;
    line-height: 1.5;
}

.quiz-option:hover {
    border-color: var(--primary-light);
    background: var(--primary-bg);
}

.quiz-option-locked {
    pointer-events: none;
    cursor: default;
}

.quiz-option-locked:hover {
    border-color: var(--border);
    background: var(--surface);
}

.quiz-option-correct {
    border-color: #16a34a !important;
    background: #f0fdf4 !important;
}

.quiz-option-wrong {
    border-color: #dc2626 !important;
    background: #fef2f2 !important;
}

.quiz-option-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--border-light);
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.quiz-option-correct .quiz-option-label {
    background: #16a34a;
    color: white;
}

.quiz-option-wrong .quiz-option-label {
    background: #dc2626;
    color: white;
}

/* 答题结果 */
.quiz-result {
    margin-top: 16px;
    padding: 14px 18px;
    border-radius: 10px;
    background: var(--border-light);
}

.quiz-result-correct {
    font-size: 1rem;
    font-weight: 600;
    color: #16a34a;
    margin-bottom: 4px;
}

.quiz-result-wrong {
    font-size: 1rem;
    font-weight: 600;
    color: #dc2626;
    margin-bottom: 4px;
}

.quiz-explanation {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--border);
    line-height: 1.6;
}

/* 完成页面 */
#finishCard h2 {
    margin-bottom: 4px;
}

#finishStats {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

@media (max-width: 480px) {
    .quiz-stats {
        gap: 4px;
    }

    .quiz-stat-num {
        font-size: 1.3rem;
    }

    .quiz-stat-label {
        font-size: 0.68rem;
    }

    .quiz-question-text {
        font-size: 0.95rem;
    }

    .quiz-option {
        padding: 12px 14px;
        font-size: 0.85rem;
        gap: 10px;
    }

    .quiz-option-label {
        width: 28px;
        height: 28px;
        font-size: 0.78rem;
    }

    .quiz-result {
        padding: 12px 14px;
    }

    .quiz-result-correct,
    .quiz-result-wrong {
        font-size: 0.9rem;
    }

    .quiz-explanation {
        font-size: 0.8rem;
    }
}
/* ================================
   弹窗
   ================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 28px 28px 20px;
    max-width: 440px;
    width: 100%;
    box-shadow: var(--shadow-lg), 0 20px 60px rgba(0,0,0,0.12);
    border: 1px solid var(--border-light);
    animation: slideUp 0.25s ease;
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    text-align: center;
    margin-bottom: 20px;
}

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.modal-header p {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.modal-presets {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.modal-preset-btn {
    padding: 10px 8px;
    border: 2px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    transition: all var(--transition);
    font-family: var(--font);
    text-align: center;
}

.modal-preset-btn:hover {
    border-color: var(--primary-light);
    background: var(--primary-bg);
    color: var(--primary);
}

.modal-preset-btn:active {
    transform: scale(0.96);
}

.modal-preset-btn:nth-child(7) {
    grid-column: span 2;
}

.modal-divider {
    text-align: center;
    margin: 8px 0 16px;
    position: relative;
}

.modal-divider::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border);
}

.modal-divider span {
    position: relative;
    display: inline-block;
    background: var(--surface);
    padding: 0 14px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.modal-custom label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.modal-custom-row {
    display: flex;
    gap: 8px;
}

.modal-input {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: var(--font);
    color: var(--text);
    background: var(--surface);
    outline: none;
    transition: all var(--transition);
    -webkit-appearance: none;
    appearance: none;
}

.modal-input:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(99,102,241,0.08);
}

.modal-input::placeholder {
    color: var(--text-muted);
}

.modal-go-btn {
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font);
    white-space: nowrap;
}

.modal-go-btn:hover {
    background: #4338ca;
    box-shadow: 0 4px 12px rgba(79,70,229,0.3);
}

.modal-go-btn:active {
    transform: scale(0.97);
}

.modal-close-btn {
    display: block;
    width: 100%;
    padding: 10px;
    margin-top: 16px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.82rem;
    cursor: pointer;
    border-radius: 8px;
    transition: all var(--transition);
    font-family: var(--font);
}

.modal-close-btn:hover {
    background: var(--bg);
    color: var(--text-secondary);
}

@media (max-width: 480px) {
    .modal-card {
        padding: 22px 18px 16px;
    }

    .modal-presets {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }

    .modal-preset-btn {
        padding: 8px 6px;
        font-size: 0.8rem;
    }

    .modal-preset-btn:nth-child(7) {
        grid-column: span 2;
    }

    .modal-custom-row {
        flex-direction: column;
    }

    .modal-go-btn {
        text-align: center;
    }
}
/* ================================
   用户下拉菜单
   ================================ */
.user-dropdown-trigger {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border-radius: 18px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    user-select: none;
    border: 1px solid transparent;
    background: transparent;
}

.user-dropdown-trigger:hover {
    color: var(--primary);
    background: var(--primary-bg);
    border-color: var(--border);
}

/* 下拉菜单面板 — 由 JS 动态定位到 body 下 */
.user-dropdown-menu {
    position: fixed;
    top: 0;
    right: 0;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12), 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid var(--border);
    min-width: 160px;
    padding: 6px;
    display: none;
    z-index: 9999;
}

/* 菜单项 */
.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    font-family: var(--font);
}

.user-dropdown-item:hover {
    background: var(--primary-bg);
    color: var(--primary);
}

/* 退出按钮特殊样式 */
.user-dropdown-item-logout:hover {
    background: #fef2f2;
    color: #dc2626;
}

/* 分割线 */
.user-dropdown-divider {
    height: 1px;
    background: var(--border-light);
    margin: 4px 6px;
}

/* 下拉菜单头部 — 用户信息 */
.user-dropdown-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
}

.user-dropdown-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-bg);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.user-dropdown-info {
    flex: 1;
    min-width: 0;
}

.user-dropdown-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-dropdown-email {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


@media (max-width: 480px) {
    .user-dropdown-menu {
        min-width: 140px;
    }

    .user-dropdown-trigger {
        padding: 5px 10px;
        font-size: 0.75rem;
    }

    .user-dropdown-item {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
}
/* ================================
   每日知识点卡片
   ================================ */
.daily-card {
    position: relative;
    margin-bottom: 20px;
    padding: 20px 24px;
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, #faf5ff 0%, #eef2ff 100%);
    overflow: hidden;
    transition: all var(--transition);
}

.daily-card:hover {
    border-color: #c4b5fd;
    box-shadow: 0 4px 16px rgba(139,92,246,0.08);
}

.daily-badge {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(139,92,246,0.12);
    color: #7c3aed;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.daily-tag {
    display: inline-block;
    padding: 2px 10px;
    background: rgba(255,255,255,0.7);
    color: var(--text-muted);
    border-radius: 14px;
    font-size: 0.72rem;
    font-weight: 500;
    margin-bottom: 6px;
}

.daily-card h2 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    margin: 4px 0;
}

.daily-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 14px;
}

.daily-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 18px;
    background: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all var(--transition);
}

.daily-btn:hover {
    background: #4338ca;
    box-shadow: 0 4px 12px rgba(79,70,229,0.3);
    transform: translateY(-1px);
}

.daily-date {
    position: absolute;
    top: 20px;
    right: 24px;
    font-size: 0.72rem;
    color: var(--text-muted);
}

@media (max-width: 480px) {
    .daily-card {
        padding: 16px 18px;
    }

    .daily-date {
        position: static;
        margin-top: 8px;
        text-align: right;
    }

    .daily-card h2 {
        font-size: 0.95rem;
    }
}
/* ================================
   用户角色徽章
   ================================ */
.user-role-badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 0.62rem;
    font-weight: 700;
    margin-left: 4px;
    vertical-align: middle;
    line-height: 1.7;
}

.role-admin {
    background: #fef3c7;
    color: #92400e;
}

.role-svip {
    background: linear-gradient(135deg, #fce7f3, #e0e7ff);
    color: #9d174d;
    border: 1px solid #f9a8d4;
}

.role-vip {
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #fcd34d;
}

.role-user {
    background: #f3f4f6;
    color: #6b7280;
}
/* ================================
   搜索历史样式
   ================================ */

.history-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #f8f9fa;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 6px;
    border: 1px solid #e9ecef;
}

.history-item:hover {
    background: #e9ecef;
}

.history-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

.history-text {
    flex: 1;
    font-size: 0.92rem;
    color: #1e293b;
}
/* ================================
   搜索栏（输入框内嵌图标）
   ================================ */

.search-bar {
    position: relative;
    margin-bottom: 20px;
}

.search-bar .search-box {
    width: 100%;
    margin-bottom: 0;
    padding-right: 44px; /* 给图标留出空间 */
    box-sizing: border-box;
}

.search-inner-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.2s;
    padding: 0;
    line-height: 1;
}

.search-inner-btn:hover {
    background: #1d4ed8;
}

.search-inner-btn:active {
    transform: translateY(-50%) scale(0.93);
}
