:root {
    --bg: #f5f7fb;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --line: #e5e7eb;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: linear-gradient(180deg, #f8fbff 0%, var(--bg) 100%);
    color: var(--text);
}

.container {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(229, 231, 235, 0.8);
}

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 68px;
}

.nav nav {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
}

.nav a {
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
}

.brand {
    font-size: 20px;
    color: var(--primary) !important;
}

.main-content {
    padding: 28px 0 48px;
}

.hero,
.card {
    background: var(--card);
    border: 1px solid rgba(229, 231, 235, 0.9);
    border-radius: 20px;
    box-shadow: var(--shadow);
}

.hero {
    padding: 36px;
    margin-bottom: 22px;
    background: radial-gradient(circle at top right, rgba(37, 99, 235, 0.12), transparent 28%), #ffffff;
}

.badge {
    display: inline-flex;
    padding: 6px 12px;
    border-radius: 999px;
    background: #dbeafe;
    color: var(--primary-dark);
    font-size: 14px;
    font-weight: 700;
}

.hero h1,
.page-head h1,
.auth-card h1 {
    margin: 16px 0 12px;
    font-size: 34px;
    line-height: 1.2;
}

.hero p,
.page-head p,
.card p,
.card li,
.card span,
.card label {
    color: var(--muted);
    line-height: 1.7;
}

.hero-actions,
.submit-bar,
.inline-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 22px;
}

.btn-hint {
    display: inline-block;
    margin-top: 8px;
    padding: 4px 12px;
    font-size: 13px;
    color: #6366f1;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-hint:hover {
    background: #e0e7ff;
    border-color: #a5b4fc;
}

.hint-answer {
    display: none;
    margin-top: 6px;
    padding: 8px 12px;
    font-size: 14px;
    color: #1e40af;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
}

.hint-answer.show {
    display: block;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 18px;
    border-radius: 12px;
    border: 1px solid transparent;
    text-decoration: none;
    cursor: pointer;
    font-weight: 700;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: #fff;
    color: var(--primary);
    border-color: #bfdbfe;
}

.stats-grid,
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 22px;
}

.dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
}

.secondary-grid {
    grid-template-columns: 1fr 3fr;
}

.stat-card,
.score-card {
    padding: 24px;
    text-align: center;
}

.stat-card strong,
.score-card strong,
.stat-note-card strong {
    display: block;
    font-size: 34px;
    color: var(--primary);
    margin-bottom: 8px;
}

.stat-note-card {
    text-align: left;
}

.stat-note-card strong {
    font-size: 24px;
}

.section-card,
.toolbar,
.question-card,
.review-card,
.result-card,
.admin-login-card,
.empty-card {
    padding: 24px;
}

.feature-list,
.review-options {
    margin: 0;
    padding-left: 18px;
}

.page-head {
    margin-bottom: 18px;
}

.filter-form,
.admin-form,
.auth-form {
    display: flex;
    gap: 16px;
    align-items: end;
    flex-wrap: wrap;
}

.filter-form label,
.admin-form label,
.auth-form label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 180px;
    flex: 1;
}

select,
textarea,
input[type="password"],
input[type="text"] {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #fff;
    font: inherit;
}

.question-list,
.result-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 18px;
}

.compact-list {
    gap: 12px;
}

.inner-card {
    box-shadow: none;
    border-radius: 16px;
}

.question-meta {
    font-weight: 700;
    line-height: 1.7;
    margin-bottom: 14px;
}

.multi-badge {
    display: inline-block;
    padding: 1px 8px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    background: #f59e0b;
    border-radius: 4px;
    margin-left: 6px;
    vertical-align: middle;
}

.option-list {
    display: grid;
    gap: 12px;
}

.option-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.result-card {
    padding: 24px;
}

.result-header {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
}

.result-header .result-index {
    color: var(--primary);
    font-weight: 700;
    flex-shrink: 0;
}

.result-header .result-question {
    font-weight: 700;
    color: var(--text);
    line-height: 1.7;
}

.result-options {
    list-style: none;
    margin: 0 0 16px 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.result-option {
    position: relative;
    padding: 10px 14px 10px 30px;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #475569;
    line-height: 1.6;
}

.result-option::before {
    content: "•";
    position: absolute;
    left: 14px;
    color: #94a3b8;
    font-size: 12px;
}

.result-option strong {
    color: var(--text);
}

.result-option.opt-correct {
    background: #f0fdf4;
    border-color: #86efac;
    color: #166534;
}

.result-option.opt-correct::before {
    content: "✓";
    color: #16a34a;
    font-size: 14px;
    font-weight: 700;
}

.result-option.opt-wrong {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #991b1b;
}

.result-option.opt-wrong::before {
    content: "✗";
    color: #dc2626;
    font-size: 14px;
    font-weight: 700;
}

.result-option.opt-missed {
    background: #fffbeb;
    border-color: #fcd34d;
    color: #92400e;
}

.result-option.opt-missed::before {
    content: "!";
    color: #d97706;
    font-size: 14px;
    font-weight: 700;
}

.result-answer {
    color: #475569;
    font-size: 15px;
    margin-bottom: 8px;
    line-height: 1.7;
}

.result-answer strong {
    color: #334155;
}

.result-analysis {
    color: #64748b;
    font-size: 14px;
    line-height: 1.8;
    margin-bottom: 12px;
}

.result-analysis strong {
    color: #475569;
}

.result-status {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    margin: 0;
}

.result-status.correct {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.result-status.wrong {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.score-detail {
    margin-left: 8px;
    font-size: 12px;
    color: #6366f1;
    font-weight: 600;
}

/* ── 填空题红色下划线占位符 ── */
span.blank {
    display: inline-block;
    min-width: 80px;
    padding: 0 4px;
    border-bottom: 2px dashed #ef4444;
    color: #ef4444;
    font-weight: 600;
    text-align: center;
    margin: 0 2px;
    vertical-align: -1px;
}

/* ── 填空徽章（橙色，与多选徽章风格一致）── */
.fill-badge {
    display: inline-block;
    padding: 1px 8px;
    font-size: 12px;
    color: #d97706;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 12px;
    margin-left: 4px;
    vertical-align: middle;
}

/* ── 简答 / 综合 / 判断徽章 ── */
.sa-badge, .cs-badge, .j-badge {
    display: inline-block;
    padding: 1px 8px;
    font-size: 12px;
    border-radius: 12px;
    margin-left: 4px;
    vertical-align: middle;
}

.sa-badge {
    color: #7c3aed;
    background: #f5f3ff;
    border: 1px solid #ddd6fe;
}

.cs-badge {
    color: #059669;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
}

.j-badge {
    color: #4f46e5;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
}

.flash-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 18px;
}

.flash-item {
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #fff;
    font-weight: 600;
}

.flash-success {
    color: var(--success);
    border-color: rgba(22, 163, 74, 0.2);
    background: rgba(220, 252, 231, 0.8);
}

.flash-warning {
    color: var(--warning);
    border-color: rgba(217, 119, 6, 0.2);
    background: rgba(255, 247, 237, 0.9);
}

.flash-error {
    border-color: rgba(220, 38, 38, 0.2);
    background: rgba(254, 242, 242, 0.95);
}

.user-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}

.user-row:last-child {
    border-bottom: 0;
}

.user-row.compact {
    align-items: center;
}

.bank-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.bank-card {
    padding: 18px 20px;
    text-decoration: none;
    color: var(--text);
    border-radius: 16px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.bank-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 18px rgba(37, 99, 235, 0.12);
}

.bank-card-wrap {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.bank-card-wrap .bank-card {
    flex: 1;
    min-width: 0;
}

.bank-card-wrap.disabled .bank-card {
    opacity: 0.55;
    background: #f1f5f9;
}

.bank-card strong {
    display: block;
    font-size: 18px;
    color: var(--text);
    margin-bottom: 6px;
}

.bank-card span {
    color: var(--muted);
    font-size: 14px;
}

.disabled-tag {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    color: #9ca3af;
    background: #e5e7eb;
    padding: 1px 8px;
    border-radius: 6px;
    margin-left: 8px;
    vertical-align: middle;
}

.bank-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}

.btn-sm {
    padding: 4px 12px;
    font-size: 13px;
    border-radius: 8px;
    white-space: nowrap;
}

.btn-warning {
    background: #f59e0b;
    color: #fff;
    border: none;
    cursor: pointer;
    font-weight: 600;
}

.btn-warning:hover {
    background: #d97706;
}

.btn-danger {
    background: #fff;
    color: var(--danger);
    border: 1px solid var(--danger);
    cursor: pointer;
    font-weight: 600;
}

.btn-danger:hover {
    background: var(--danger);
    color: #fff;
}

.bank-delete-form {
    flex-shrink: 0;
    margin-top: 10px;
}

.btn-delete {
    padding: 4px 10px;
    border-radius: 8px;
    border: 1px solid var(--danger);
    background: #fff;
    color: var(--danger);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}

.btn-delete:hover {
    background: var(--danger);
    color: #fff;
}

.auth-card {
    max-width: 720px;
    margin: 0 auto;
}

@media (max-width: 900px) {
    .stats-grid,
    .dashboard-grid,
    .secondary-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .nav,
    .admin-form,
    .filter-form,
    .hero-actions,
    .submit-bar,
    .inline-actions,
    .auth-form {
        flex-direction: column;
        align-items: stretch;
    }

    .hero,
    .section-card,
    .toolbar,
    .question-card,
    .review-card,
    .result-card,
    .admin-login-card {
        padding: 18px;
    }

    .hero h1,
    .page-head h1,
    .auth-card h1 {
        font-size: 28px;
    }

    .user-row {
        flex-direction: column;
        align-items: stretch;
    }
}
