/* ========== 设计令牌 ========== */
:root {
    --bg: #f7f4ee;
    --bg-elevated: #fbf8f2;
    --surface: #fffdf8;
    --surface-strong: #ffffff;
    --surface-muted: #f0ebe2;
    --ink: #191714;
    --ink-soft: #3c3832;
    --muted: #756f66;
    --muted-2: #a29a8f;
    --line: #e8dfd2;
    --line-strong: #d8cebf;
    --primary: #191714;
    --primary-light: #2d2923;
    --primary-bg: #efebe3;
    --success: #5f8a72;
    --warning: #bd8128;
    --danger: #c75d4b;
    --verbal: #76709a;
    --logic: #c58a2b;
    --math: #678a78;
    --data: #cf6f58;
    --political: #5b6b8c;
    --common: #7a8c5b;
    --radius-xl: 30px;
    --radius-lg: 24px;
    --radius-md: 18px;
    --radius-sm: 12px;
    --radius-pill: 999px;
    --shadow-soft: 0 18px 45px rgba(39, 34, 27, 0.08);
    --shadow-tiny: 0 1px 2px rgba(39, 34, 27, 0.06), 0 12px 24px rgba(39, 34, 27, 0.04);
    --sidebar-width: 248px;
    --content-max: 1440px;
    --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    min-width: 320px;
    background: var(--bg);
}

body {
    min-height: 100vh;
    color: var(--ink);
    font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI",
        "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    line-height: 1.55;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
}

svg {
    width: 1em;
    height: 1em;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.icon-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ========== 应用骨架 ========== */
.app-shell {
    background:
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.82), transparent 32rem),
        linear-gradient(135deg, #f7f4ee 0%, #f3eee5 48%, #f8f5ef 100%);
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.sidebar {
    position: fixed;
    top: 18px;
    bottom: 18px;
    left: 18px;
    z-index: 80;
    display: flex;
    width: var(--sidebar-width);
    flex-direction: column;
    gap: 22px;
    padding: 20px;
    border: 1px solid rgba(232, 223, 210, 0.9);
    border-radius: var(--radius-xl);
    background: rgba(255, 253, 248, 0.86);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(22px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    display: inline-flex;
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 16px;
    color: var(--ink);
    background: linear-gradient(145deg, #ffffff, #efe8db);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 8px 18px rgba(35, 29, 20, 0.08);
}

.brand-mark svg {
    width: 22px;
    height: 22px;
}

.brand-title {
    color: var(--ink);
    font-size: 15px;
    font-weight: 780;
    letter-spacing: 0;
}

.brand-subtitle {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
}

.nav-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-btn {
    display: flex;
    width: 100%;
    min-height: 46px;
    align-items: center;
    gap: 12px;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: 17px;
    color: var(--muted);
    background: transparent;
    cursor: pointer;
    text-align: left;
    transition: transform 160ms var(--ease), background 160ms var(--ease), color 160ms var(--ease),
        border-color 160ms var(--ease);
}

.nav-btn:hover {
    border-color: var(--line);
    color: var(--ink);
    background: rgba(255, 255, 255, 0.55);
}

.nav-btn.active {
    border-color: rgba(25, 23, 20, 0.08);
    color: var(--ink);
    background: #ece6dc;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.74);
    font-weight: 680;
}

.nav-icon {
    width: 19px;
    height: 19px;
    flex: 0 0 auto;
}

.nav-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-note {
    margin-top: auto;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: linear-gradient(155deg, #fffdf8 0%, #efe8dc 100%);
}

.sidebar-note strong {
    display: block;
    margin: 6px 0;
    color: var(--ink);
    font-size: 15px;
}

.sidebar-note p {
    color: var(--muted);
    font-size: 12px;
}

.main-content {
    width: min(calc(100% - var(--sidebar-width) - 72px), var(--content-max));
    min-height: 100vh;
    margin-left: calc(var(--sidebar-width) + 42px);
    padding: 20px 26px 34px 0;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 86px;
    padding: 14px 0 18px;
    background: linear-gradient(180deg, rgba(247, 244, 238, 0.96) 0%, rgba(247, 244, 238, 0.72) 80%, transparent 100%);
    backdrop-filter: blur(16px);
}

.app-header h1 {
    color: var(--ink);
    font-size: clamp(24px, 2.3vw, 34px);
    font-weight: 760;
    letter-spacing: 0;
}

.header-eyebrow,
.page-kicker,
.panel-label,
.note-kicker {
    color: var(--muted-2);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.user-pill {
    display: inline-flex;
    min-width: 0;
    max-width: 260px;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    color: var(--ink);
    background: rgba(255, 253, 248, 0.82);
    box-shadow: var(--shadow-tiny);
    cursor: pointer;
}

.user-pill svg {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

.user-pill span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ========== 页面布局 ========== */
.page {
    display: none;
}

.page.active {
    display: block;
    animation: pageIn 220ms var(--ease);
}

.page-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 22px;
    align-items: start;
}

.page-main,
.insight-rail {
    min-width: 0;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.page-header h2 {
    margin-top: 2px;
    color: var(--ink);
    font-size: clamp(26px, 3vw, 38px);
    font-weight: 780;
    letter-spacing: 0;
    line-height: 1.08;
}

.page-subtitle {
    max-width: 620px;
    margin-top: 10px;
    color: var(--muted);
    font-size: 14px;
}

.header-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 24px 0 12px;
}

.section-title-row h3,
.history-section h3,
.card h3 {
    color: var(--ink);
    font-size: 17px;
    font-weight: 720;
}

.section-title-row span {
    color: var(--muted-2);
    font-size: 12px;
}

.quick-panel,
.side-panel,
.card,
.analysis-content,
.history-section {
    border: 1px solid rgba(232, 223, 210, 0.92);
    background: rgba(255, 253, 248, 0.86);
    box-shadow: var(--shadow-tiny);
    backdrop-filter: blur(14px);
}

.quick-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
    padding: 20px;
    border-radius: var(--radius-lg);
}

.quick-panel strong {
    display: block;
    margin-top: 4px;
    font-size: 17px;
}

.quick-panel p {
    margin-top: 5px;
    color: var(--muted);
    font-size: 13px;
}

.insight-rail {
    position: sticky;
    top: 104px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.side-panel {
    padding: 20px;
    border-radius: var(--radius-lg);
}

.side-panel-header,
.card-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.side-panel-header span {
    font-size: 16px;
    font-weight: 720;
}

.side-panel-header small {
    color: var(--muted-2);
    font-size: 12px;
}

.side-panel p,
.muted-text {
    color: var(--muted);
    font-size: 13px;
}

.muted-panel {
    background: rgba(240, 235, 226, 0.72);
}

.action-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
    padding-left: 18px;
    color: var(--muted);
    font-size: 13px;
}

.metric-rule {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 12px;
    padding: 10px 0;
    border-top: 1px solid var(--line);
}

.metric-rule:first-of-type {
    border-top: none;
}

.metric-rule span {
    color: var(--ink);
    font-weight: 760;
}

.mode-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.mode-list span {
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    color: var(--muted);
    background: var(--surface);
    font-size: 12px;
}

/* ========== 按钮与表单 ========== */
.btn {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    font-size: 14px;
    font-weight: 680;
    line-height: 1;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: transform 160ms var(--ease), background 160ms var(--ease), color 160ms var(--ease),
        border-color 160ms var(--ease), opacity 160ms var(--ease);
}

.btn svg {
    width: 15px;
    height: 15px;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:focus-visible,
.nav-btn:focus-visible,
.bottom-nav-btn:focus-visible,
.auth-tab:focus-visible,
.modal-close:focus-visible,
.hw-tool:focus-visible,
.note-type-tab:focus-visible {
    outline: 3px solid rgba(25, 23, 20, 0.16);
    outline-offset: 3px;
}

.btn:disabled,
.btn[disabled] {
    cursor: not-allowed;
    opacity: 0.58;
    transform: none;
}

.btn-primary {
    color: #fffdf8;
    background: var(--primary);
    box-shadow: 0 10px 24px rgba(25, 23, 20, 0.15);
}

.btn-primary:hover {
    background: var(--primary-light);
}

.btn-primary.is-running {
    background: var(--danger);
}

.btn-secondary {
    border-color: var(--line);
    color: var(--ink);
    background: rgba(255, 253, 248, 0.82);
}

.btn-secondary:hover {
    background: #fff;
    border-color: var(--line-strong);
}

.btn-outline {
    border-color: var(--line);
    color: var(--ink);
    background: rgba(255, 253, 248, 0.7);
}

.btn-outline:hover {
    border-color: var(--ink);
    background: #fff;
}

.btn-dark-soft {
    color: var(--ink);
    background: #e8dfd2;
}

.btn-danger {
    color: #fff;
    background: var(--danger);
}

.btn-sm {
    min-height: 34px;
    padding: 7px 12px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
    margin-top: 14px;
}

.filter-select,
.form-input,
.hw-select {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 15px;
    color: var(--ink);
    background: rgba(255, 253, 248, 0.88);
    transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease), background 160ms var(--ease);
}

.filter-select {
    width: auto;
    max-width: 100%;
    padding: 0 38px 0 14px;
    cursor: pointer;
}

.form-input {
    padding: 10px 13px;
    font-size: 14px;
}

.form-input:focus,
.filter-select:focus,
.hw-select:focus,
.voice-result:focus {
    outline: none;
    border-color: rgba(25, 23, 20, 0.45);
    box-shadow: 0 0 0 4px rgba(25, 23, 20, 0.08);
    background: #fff;
}

.form-textarea {
    min-height: 118px;
    resize: vertical;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 7px;
    color: var(--ink-soft);
    font-size: 13px;
    font-weight: 680;
}

.form-row {
    display: grid;
    gap: 12px;
}

.form-row.two-cols {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-row.three-cols {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-divider {
    margin: 18px 0;
    border: none;
    border-top: 1px solid var(--line);
}

/* ========== 列表与卡片 ========== */
.card-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.card {
    position: relative;
    overflow: hidden;
    padding: 20px;
    border-radius: var(--radius-lg);
    transition: transform 180ms var(--ease), box-shadow 180ms var(--ease), border-color 180ms var(--ease);
}

.card:hover {
    border-color: var(--line-strong);
    box-shadow: var(--shadow-soft);
    transform: translateY(-1px);
}

.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.card-title-row {
    margin-bottom: 12px;
}

.card-date {
    flex: 0 0 auto;
    color: var(--muted-2);
    font-size: 12px;
}

.card-body {
    color: var(--ink-soft);
    font-size: 14px;
    line-height: 1.75;
    white-space: pre-wrap;
    word-break: break-word;
}

.card-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
}

.card-image {
    margin-top: 12px;
}

.card-image img {
    display: block;
    max-width: 100%;
    max-height: 220px;
    border: 1px solid var(--line);
    border-radius: 18px;
    cursor: zoom-in;
    object-fit: contain;
}

.empty-state {
    display: flex;
    min-height: 180px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 34px 20px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-lg);
    color: var(--muted);
    background: rgba(255, 253, 248, 0.42);
    text-align: center;
}

.empty-state strong {
    color: var(--ink);
    font-size: 16px;
}

.empty-state span {
    max-width: 320px;
    color: var(--muted);
    font-size: 13px;
}

.type-chip,
.card-type {
    display: inline-flex;
    min-height: 26px;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    color: #fff;
    font-size: 12px;
    font-weight: 720;
    line-height: 1;
}

.type-verbal,
.type-言语理解 {
    background: var(--verbal);
}

.type-logic,
.type-逻辑判断,
.type-判断推理 {
    background: var(--logic);
}

.type-math,
.type-数量关系,
.type-数量分析 {
    background: var(--math);
}

.type-data,
.type-资料分析 {
    background: var(--data);
}

.type-political,
.type-政治理论 {
    background: var(--political);
}

.type-common,
.type-常识 {
    background: var(--common);
}

.type-general,
.type-通用 {
    color: var(--ink);
    background: #e8dfd2;
}

.answer-info {
    display: grid;
    gap: 10px;
    margin-top: 14px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(240, 235, 226, 0.58);
}

.answer-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    color: var(--ink-soft);
    font-size: 13px;
}

.answer-row .label {
    flex: 0 0 auto;
    padding: 3px 9px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 700;
}

.answer-row .label.correct {
    color: #315d47;
    background: rgba(95, 138, 114, 0.16);
}

.answer-row .label.wrong {
    color: #8b3326;
    background: rgba(199, 93, 75, 0.14);
}

.answer-row .label.review-label {
    color: var(--ink);
    background: #e8dfd2;
}

.answer-value {
    min-width: 0;
    word-break: break-word;
}

.answer-row.review-row {
    flex-direction: column;
}

.review-content {
    width: 100%;
    padding: 10px 12px;
    border-left: 3px solid var(--ink);
    border-radius: 0 14px 14px 0;
    color: var(--ink-soft);
    background: var(--surface);
    white-space: pre-wrap;
    word-break: break-word;
}

.answer-divider {
    border: none;
    border-top: 1px solid var(--line);
}

/* ========== 正确率 ========== */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.stat-card {
    position: relative;
    overflow: hidden;
    min-height: 154px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: rgba(255, 253, 248, 0.86);
    box-shadow: var(--shadow-tiny);
}

.stat-card::after {
    position: absolute;
    right: -24px;
    bottom: -30px;
    width: 94px;
    height: 94px;
    border-radius: 50%;
    background: currentColor;
    content: "";
    opacity: 0.1;
}

.stat-verbal,
.stats-cards .stat-card:nth-child(1) {
    color: var(--verbal);
}

.stat-logic,
.stats-cards .stat-card:nth-child(2) {
    color: var(--logic);
}

.stat-math,
.stats-cards .stat-card:nth-child(3) {
    color: var(--math);
}

.stat-data,
.stats-cards .stat-card:nth-child(4) {
    color: var(--data);
}

.stat-political {
    color: var(--political);
}

.stat-common {
    color: var(--common);
}

.stat-type {
    color: var(--muted);
    font-size: 13px;
    font-weight: 680;
}

.stat-rate {
    margin-top: 18px;
    color: var(--ink);
    font-size: clamp(28px, 3vw, 40px);
    font-weight: 800;
    line-height: 1;
}

.stat-detail {
    margin-top: 9px;
    color: var(--muted);
    font-size: 12px;
}

.accuracy-card-main {
    display: flex;
    align-items: baseline;
    gap: 16px;
    flex-wrap: wrap;
}

.accuracy-rate {
    color: var(--rate-color, var(--ink));
    font-size: 32px;
    font-weight: 800;
    line-height: 1;
}

.accuracy-meta {
    color: var(--muted);
    font-size: 13px;
}

.accuracy-meta strong {
    color: var(--ink);
}

/* ========== AI ========== */
.analysis-content,
.history-section {
    padding: 22px;
    border-radius: var(--radius-lg);
}

.analysis-empty {
    display: flex;
    min-height: 260px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--muted);
    text-align: center;
}

.analysis-empty strong {
    color: var(--ink);
    font-size: 18px;
}

.analysis-empty p {
    max-width: 420px;
    font-size: 13px;
}

.ai-orbit {
    display: inline-flex;
    width: 58px;
    height: 58px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 22px;
    color: var(--ink);
    background: linear-gradient(145deg, #ffffff, #ebe4d9);
}

.ai-orbit svg {
    width: 26px;
    height: 26px;
}

.analysis-report {
    display: grid;
    gap: 18px;
}

.analysis-report-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
}

.analysis-report-body {
    color: var(--ink-soft);
    font-size: 14px;
    line-height: 1.9;
}

.analysis-report-body h2,
.analysis-report-body h3 {
    margin: 18px 0 8px;
    color: var(--ink);
}

.analysis-report-body strong {
    color: var(--ink);
    font-weight: 780;
}

.analysis-working {
    display: grid;
    gap: 16px;
    min-height: 260px;
    align-content: center;
}

.progress-line {
    width: 100%;
    height: 8px;
    overflow: hidden;
    border-radius: var(--radius-pill);
    background: #e8dfd2;
}

.progress-line span {
    display: block;
    width: 42%;
    height: 100%;
    border-radius: inherit;
    background: var(--ink);
    animation: progressMove 1.2s var(--ease) infinite alternate;
}

.skeleton-stack {
    display: grid;
    gap: 10px;
}

.skeleton-line {
    height: 12px;
    border-radius: var(--radius-pill);
    background: linear-gradient(90deg, #ece5da 0%, #f8f4ed 50%, #ece5da 100%);
    background-size: 220% 100%;
    animation: skeleton 1.2s linear infinite;
}

.skeleton-line:nth-child(2) {
    width: 78%;
}

.skeleton-line:nth-child(3) {
    width: 56%;
}

.analysis-error {
    display: grid;
    min-height: 220px;
    gap: 12px;
    place-items: center;
    text-align: center;
}

.analysis-error strong {
    color: var(--danger);
}

.history-section {
    margin-top: 18px;
}

.history-section h3 {
    margin-bottom: 12px;
}

.analysis-history-card {
    cursor: pointer;
}

.analysis-history-preview {
    max-height: 92px;
    overflow: hidden;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.7;
}

/* ========== 笔记 / 语音 / 手写 ========== */
.note-card-meta {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.note-title {
    min-width: 0;
    color: var(--ink);
    font-weight: 720;
    overflow-wrap: anywhere;
}

.note-type-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 9px;
    border-radius: var(--radius-pill);
    color: var(--muted);
    background: var(--surface-muted);
    font-size: 12px;
    font-weight: 650;
}

.note-type-badge.text {
    color: var(--verbal);
    background: rgba(118, 112, 154, 0.14);
}

.note-type-badge.voice {
    color: var(--logic);
    background: rgba(197, 138, 43, 0.15);
}

.note-type-badge.handwriting {
    color: var(--math);
    background: rgba(103, 138, 120, 0.15);
}

.note-content-preview {
    max-height: 72px;
    overflow: hidden;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.7;
    word-break: break-word;
}

.note-thumbnail {
    display: block;
    max-width: 100%;
    max-height: 150px;
    margin-top: 8px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
}

.note-type-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    background: var(--surface-muted);
}

.note-type-tab {
    flex: 1;
    min-height: 38px;
    border: none;
    border-radius: var(--radius-pill);
    color: var(--muted);
    background: transparent;
    cursor: pointer;
    font-size: 13px;
    font-weight: 680;
    transition: background 160ms var(--ease), color 160ms var(--ease);
}

.note-type-tab.active {
    color: var(--ink);
    background: var(--surface);
    box-shadow: var(--shadow-tiny);
}

.note-input-mode {
    display: none;
}

.note-input-mode.active {
    display: block;
}

.voice-input-area {
    display: grid;
    gap: 14px;
    justify-items: center;
}

.btn-voice {
    display: inline-flex;
    min-width: 180px;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 22px 28px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    color: var(--ink);
    background: var(--surface);
    cursor: pointer;
    transition: transform 160ms var(--ease), border-color 160ms var(--ease), background 160ms var(--ease);
}

.btn-voice:hover {
    transform: translateY(-1px);
    border-color: var(--line-strong);
}

.btn-voice.recording {
    border-color: rgba(199, 93, 75, 0.45);
    background: rgba(199, 93, 75, 0.08);
}

.voice-icon {
    display: inline-flex;
    width: 48px;
    height: 48px;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    color: #fff;
    background: var(--ink);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.voice-text,
.voice-status {
    color: var(--muted);
    font-size: 13px;
}

.voice-result {
    width: 100%;
    min-height: 150px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 18px;
    color: var(--ink-soft);
    background: var(--surface);
    line-height: 1.7;
    text-align: left;
    white-space: pre-wrap;
    word-break: break-word;
}

.voice-result:empty::before {
    color: var(--muted-2);
    content: attr(placeholder);
}

.handwriting-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px;
    border: 1px solid var(--line);
    border-bottom: none;
    border-radius: 20px 20px 0 0;
    background: var(--surface-muted);
}

.hw-tool-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.hw-tool {
    display: inline-flex;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 14px;
    color: var(--ink);
    background: var(--surface);
    cursor: pointer;
    font-size: 12px;
    font-weight: 760;
}

.hw-tool:hover,
.hw-tool.active {
    border-color: var(--ink);
}

.hw-tool.active {
    color: #fff;
    background: var(--ink);
}

.hw-tool-danger:hover {
    border-color: var(--danger);
    color: var(--danger);
}

.hw-select {
    width: auto;
    min-height: 38px;
    padding: 0 10px;
    font-size: 12px;
}

.hw-color-input {
    width: 38px;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 3px;
    background: var(--surface);
    cursor: pointer;
}

.handwriting-canvas-wrapper {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 0 0 20px 20px;
    background: #fff;
    touch-action: none;
    user-select: none;
}

.handwriting-canvas-wrapper canvas {
    display: block;
    width: 100%;
    cursor: crosshair;
}

/* ========== 上传 / Toast / Loading ========== */
.upload-area {
    padding: 22px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-lg);
    background: rgba(240, 235, 226, 0.42);
    text-align: center;
}

.upload-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.upload-buttons .btn {
    flex: 1 1 160px;
}

.upload-hint,
.ocr-status {
    display: block;
    margin-top: 10px;
    color: var(--muted);
    font-size: 12px;
}

.ocr-status.success {
    color: var(--success);
}

.ocr-status.error {
    color: var(--danger);
}

.upload-preview {
    margin-top: 12px;
}

.upload-preview img {
    display: block;
    max-width: 100%;
    max-height: 240px;
    border: 1px solid var(--line);
    border-radius: 18px;
    object-fit: contain;
}

.ocr-queue-panel {
    margin-top: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface-strong);
}

.ocr-queue-panel.recognizing {
    border-color: rgba(189, 129, 40, 0.34);
    background: rgba(255, 250, 240, 0.96);
}

.ocr-queue-head,
.crop-editor-head,
.crop-editor-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.ocr-queue-head {
    margin-bottom: 10px;
    color: var(--ink-soft);
    font-size: 13px;
    font-weight: 680;
}

.ocr-queue-message {
    margin: -2px 0 10px;
    color: var(--muted);
    font-size: 12px;
}

.ocr-queue-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ocr-queue-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
    gap: 10px;
}

.ocr-queue-item {
    position: relative;
    overflow: hidden;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: rgba(255, 253, 248, 0.74);
}

.ocr-queue-panel.recognizing .ocr-queue-item {
    border-color: rgba(25, 23, 20, 0.12);
}

.ocr-queue-item.active {
    border-color: rgba(189, 129, 40, 0.45);
    background: rgba(250, 244, 232, 0.92);
}

.ocr-thumb-button {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    color: var(--ink-soft);
    background: transparent;
    cursor: pointer;
    text-align: left;
}

.ocr-thumb-button:disabled,
.ocr-remove:disabled {
    cursor: wait;
}

.ocr-thumb-button img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    background: #f3eee5;
}

.ocr-thumb-button span {
    display: block;
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 680;
}

.ocr-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 2;
    width: 26px;
    height: 26px;
    border: 1px solid rgba(25, 23, 20, 0.12);
    border-radius: 999px;
    color: #fff;
    background: rgba(25, 23, 20, 0.72);
    cursor: pointer;
    font-size: 18px;
    line-height: 20px;
    display: grid;
    place-items: center;
}

.ocr-remove:hover {
    background: rgba(199, 93, 75, 0.9);
}

.ocr-card-loading {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #fffdf8;
    background: rgba(25, 23, 20, 0.58);
    font-size: 12px;
    font-weight: 680;
    text-align: center;
}

.ocr-card-spinner {
    width: 28px;
    height: 28px;
    border: 2px solid rgba(255, 253, 248, 0.38);
    border-top-color: #fffdf8;
    border-radius: 999px;
    animation: spin 0.8s linear infinite;
}

.crop-editor {
    position: fixed;
    inset: 0;
    z-index: 420;
    display: none;
    flex-direction: column;
    margin: 0;
    padding: max(14px, env(safe-area-inset-top)) 14px max(16px, env(safe-area-inset-bottom));
    border: 0;
    border-radius: 0;
    background: #11100e;
}

.crop-editor-head {
    flex: 0 0 auto;
    margin-bottom: 8px;
    color: #fffdf8;
    font-size: 15px;
    font-weight: 680;
}

.crop-editor-hint {
    flex: 0 0 auto;
    margin: 0 0 10px;
    color: rgba(255, 253, 248, 0.68);
    font-size: 12px;
}

.crop-canvas-wrap {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    width: 100%;
    min-height: 0;
    padding: 8px;
    border: 1px solid rgba(255, 253, 248, 0.12);
    border-radius: 18px;
    background: #050504;
}

.crop-canvas-wrap canvas {
    display: block;
    max-width: 100%;
    height: auto;
    cursor: crosshair;
    touch-action: none;
}

.crop-editor-actions {
    flex: 0 0 auto;
    justify-content: flex-end;
    margin-top: 12px;
}

.crop-editor-actions .btn {
    min-width: 92px;
}

.crop-fullscreen-active {
    overflow: hidden;
}

.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    z-index: 300;
    max-width: min(92vw, 520px);
    padding: 12px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    color: var(--ink);
    background: rgba(255, 253, 248, 0.94);
    box-shadow: var(--shadow-soft);
    font-size: 13px;
    font-weight: 680;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -8px);
    transition: opacity 180ms var(--ease), transform 180ms var(--ease);
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

.toast.success {
    border-color: rgba(95, 138, 114, 0.35);
    color: #315d47;
}

.toast.error {
    border-color: rgba(199, 93, 75, 0.35);
    color: #8b3326;
}

.toast.info {
    color: var(--ink);
}

.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 250;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(247, 244, 238, 0.72);
    backdrop-filter: blur(8px);
}

.loading-panel {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}

.loading-spinner {
    width: 22px;
    height: 22px;
    border: 2px solid var(--line);
    border-top-color: var(--ink);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-text {
    color: var(--ink-soft);
    font-size: 13px;
    font-weight: 680;
}

/* ========== 弹窗 ========== */
.modal {
    display: none;
}

.modal.active {
    display: block;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(25, 23, 20, 0.38);
    backdrop-filter: blur(7px);
    animation: fadeIn 180ms var(--ease);
}

.modal-content {
    position: fixed;
    left: 50%;
    top: 50%;
    z-index: 201;
    display: flex;
    width: min(560px, calc(100vw - 32px));
    max-height: min(86vh, 760px);
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 28px;
    background: var(--surface);
    box-shadow: 0 30px 80px rgba(25, 23, 20, 0.2);
    transform: translate(-50%, -50%);
    animation: modalIn 180ms var(--ease);
}

.modal-content.modal-large {
    width: min(760px, calc(100vw - 32px));
}

.modal-header,
.modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px;
    background: rgba(255, 253, 248, 0.92);
}

.modal-header {
    border-bottom: 1px solid var(--line);
}

.modal-header h3 {
    color: var(--ink);
    font-size: 18px;
    font-weight: 760;
}

.modal-close {
    display: inline-flex;
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    color: var(--ink);
    background: var(--surface-muted);
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}

.modal-body {
    overflow-y: auto;
    padding: 20px;
}

.modal-footer {
    justify-content: flex-end;
    border-top: 1px solid var(--line);
}

/* ========== 我的 / 邀请码 ========== */
.profile-card,
.admin-card {
    margin-bottom: 16px;
}

.profile-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 0;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 14px;
}

.profile-row:last-of-type {
    border-bottom: none;
}

.profile-row strong {
    color: var(--ink);
}

.invite-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(240, 235, 226, 0.44);
}

.invite-item + .invite-item {
    margin-top: 10px;
}

.invite-code {
    color: var(--ink);
    font-family: "SF Mono", "Menlo", "Consolas", monospace;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0.08em;
    cursor: pointer;
}

.invite-meta {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

.invite-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* ========== 登录页 ========== */
.auth-body {
    min-height: 100vh;
    padding: 24px;
    background:
        radial-gradient(circle at 16% 18%, rgba(255, 255, 255, 0.9), transparent 25rem),
        linear-gradient(135deg, #f7f4ee 0%, #efe7db 100%);
}

.auth-layout {
    display: grid;
    width: min(1080px, 100%);
    min-height: calc(100vh - 48px);
    grid-template-columns: minmax(0, 1fr) 420px;
    gap: 28px;
    align-items: center;
    margin: 0 auto;
}

.auth-intro {
    padding: clamp(24px, 5vw, 56px);
}

.auth-brand {
    margin-bottom: 36px;
}

.auth-mark {
    color: var(--surface);
    background: var(--ink);
    font-size: 20px;
    font-weight: 820;
}

.auth-intro h1 {
    max-width: 620px;
    color: var(--ink);
    font-size: clamp(36px, 6vw, 70px);
    font-weight: 780;
    letter-spacing: 0;
    line-height: 1.03;
}

.auth-intro p {
    max-width: 560px;
    margin-top: 20px;
    color: var(--muted);
    font-size: 16px;
}

.auth-proof {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 28px;
}

.auth-proof span {
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    color: var(--ink-soft);
    background: rgba(255, 253, 248, 0.68);
    font-size: 12px;
    font-weight: 680;
}

.auth-card {
    width: 100%;
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    background: rgba(255, 253, 248, 0.9);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(18px);
}

.auth-card-header {
    margin-bottom: 22px;
}

.auth-card h2 {
    margin-top: 4px;
    color: var(--ink);
    font-size: 26px;
}

.auth-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 22px;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    background: var(--surface-muted);
}

.auth-tab {
    flex: 1;
    min-height: 38px;
    border: none;
    border-radius: var(--radius-pill);
    color: var(--muted);
    background: transparent;
    cursor: pointer;
    font-weight: 720;
}

.auth-tab.active {
    color: var(--ink);
    background: var(--surface);
    box-shadow: var(--shadow-tiny);
}

.auth-form {
    display: flex;
    flex-direction: column;
}

.auth-submit {
    width: 100%;
    margin-top: 6px;
}

.auth-error {
    min-height: 22px;
    margin-top: 10px;
    color: var(--danger);
    font-size: 13px;
    text-align: center;
}

.auth-hint {
    margin-top: 7px;
    color: var(--muted);
    font-size: 12px;
}

.auth-foot {
    margin-top: 16px;
    text-align: center;
}

/* ========== 移动端导航 ========== */
.bottom-nav {
    display: none;
}

.bottom-nav-btn {
    display: flex;
    flex: 1;
    min-width: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 58px;
    border: none;
    border-radius: 18px;
    color: var(--muted);
    background: transparent;
    cursor: pointer;
    font-size: 11px;
    font-weight: 680;
}

.bottom-nav-btn.active {
    color: var(--ink);
    background: #ece6dc;
}

.bottom-nav-icon {
    width: 19px;
    height: 19px;
}

/* ========== 动画 ========== */
@keyframes pageIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: translate(-50%, -48%) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes progressMove {
    from { transform: translateX(0); }
    to { transform: translateX(138%); }
}

@keyframes skeleton {
    from { background-position: 220% 0; }
    to { background-position: -220% 0; }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.001ms !important;
    }
}

/* ========== 响应式 ========== */
@media (max-width: 1180px) {
    .page-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .insight-rail {
        position: static;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 920px) {
    .sidebar {
        display: none;
    }

    .main-content {
        width: 100%;
        margin-left: 0;
        padding: 14px 14px calc(94px + env(safe-area-inset-bottom, 0));
    }

    .app-header {
        min-height: 72px;
        padding: 10px 0 14px;
    }

    .app-header h1 {
        font-size: 22px;
    }

    .header-eyebrow {
        display: none;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .header-actions {
        justify-content: flex-start;
    }

    .header-actions .btn,
    .header-actions .filter-select {
        flex: 1 1 auto;
    }

    .quick-panel {
        flex-direction: column;
        align-items: stretch;
    }

    .stats-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .insight-rail {
        grid-template-columns: 1fr;
    }

    .bottom-nav {
        position: fixed;
        right: 12px;
        bottom: 12px;
        left: 12px;
        z-index: 100;
        display: flex;
        gap: 4px;
        padding: 6px;
        padding-bottom: calc(6px + env(safe-area-inset-bottom, 0));
        border: 1px solid var(--line);
        border-radius: 26px;
        background: rgba(255, 253, 248, 0.92);
        box-shadow: var(--shadow-soft);
        backdrop-filter: blur(18px);
    }

    .auth-layout {
        min-height: calc(100vh - 32px);
        grid-template-columns: 1fr;
    }

    .auth-intro {
        padding: 8px 4px 0;
    }

    .auth-intro h1 {
        font-size: clamp(34px, 10vw, 48px);
    }
}

@media (max-width: 640px) {
    .app-header {
        align-items: flex-start;
    }

    .user-pill {
        max-width: 148px;
        padding: 8px 11px;
        font-size: 12px;
    }

    .page-header h2 {
        font-size: 28px;
    }

    .page-subtitle {
        font-size: 13px;
    }

    .card,
    .quick-panel,
    .side-panel,
    .analysis-content,
    .history-section {
        border-radius: 22px;
    }

    .stats-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stat-card {
        min-height: 132px;
    }

    .form-row.two-cols,
    .form-row.three-cols {
        grid-template-columns: 1fr;
    }

    .card-header,
    .card-title-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .card-actions {
        justify-content: stretch;
    }

    .card-actions .btn {
        flex: 1;
    }

    .modal-content {
        top: auto;
        bottom: 0;
        left: 0;
        width: 100%;
        max-height: 90vh;
        border-radius: 28px 28px 0 0;
        transform: none;
        animation: slideUp 180ms var(--ease);
    }

    .modal-content.modal-large {
        width: 100%;
    }

    .modal-footer {
        flex-wrap: wrap;
    }

    .modal-footer .btn {
        flex: 1;
    }

    .note-type-tabs {
        border-radius: 20px;
        flex-wrap: wrap;
    }

    .note-type-tab {
        flex: 1 1 120px;
    }

    .invite-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .invite-actions {
        width: 100%;
    }

    .invite-actions .btn {
        flex: 1;
    }

    .auth-body {
        padding: 16px;
    }

    .auth-card {
        padding: 22px;
    }
}

@media (max-width: 360px) {
    .stats-cards {
        grid-template-columns: 1fr;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== #3/#1/#4 增强组件（遵循 UI_DESIGN_SPEC） ========== */

/* 诱饵字段：吸收浏览器账号自动填充，离屏隐藏但保留可填充性 */
.autofill-decoy {
    position: absolute;
    left: -9999px;
    top: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
    border: 0;
    padding: 0;
}

/* 错题筛选栏：作为一个克制的工具条面板 */
.error-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding: 12px;
    margin-bottom: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(255, 253, 248, 0.7);
}
/* 筛选控件统一沿用 .filter-select / .form-input 的视觉（15px 圆角、42px 高、统一 focus） */
.error-filter-bar .filter-input {
    flex: 1 1 140px;
    min-width: 140px;
    min-height: 42px;
    padding: 0 14px;
    font-size: 14px;
    border: 1px solid var(--line);
    border-radius: 15px;
    color: var(--ink);
    background: var(--surface-strong);
    transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}
.error-filter-bar .filter-input:focus {
    outline: none;
    border-color: rgba(25, 23, 20, 0.45);
    box-shadow: 0 0 0 4px rgba(25, 23, 20, 0.08);
    background: #fff;
}
.error-filter-bar .subtype-select { min-width: 120px; }
.error-filter-bar .date-input { flex: 0 0 auto; min-width: 140px; }
.error-total {
    font-size: 13px;
    color: var(--muted);
    margin: 0 2px 14px;
}
.error-total strong { color: var(--ink-soft); font-weight: 680; }

/* 二级分类联动下拉（弹窗内） */
.subtype-group { display: none; }
.subtype-group.show { display: block; }

/* 错题卡片：原图默认收起 */
.image-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 10px;
    padding: 5px 12px;
    font: inherit;
    font-size: 12px;
    font-weight: 620;
    color: var(--muted);
    background: var(--surface-muted);
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: color 160ms var(--ease), background 160ms var(--ease);
}
.image-toggle svg { width: 14px; height: 14px; }
.image-toggle:hover { color: var(--ink-soft); background: #ece6dc; }
.card-image.collapsed { display: none; }

/* 单题分析折叠区：诊断报告风格，实线边框、低对比 */
.single-analysis {
    margin-top: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(240, 235, 226, 0.45);
    overflow: hidden;
}
.single-analysis-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    font-size: 12px;
    color: var(--muted);
    cursor: pointer;
}
.single-analysis-header strong {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--ink-soft);
    font-size: 13px;
    font-weight: 680;
}
.single-analysis-header strong svg { width: 15px; height: 15px; color: var(--primary); }
.single-analysis-body {
    padding: 12px 16px 14px;
    font-size: 13px;
    line-height: 1.75;
    color: var(--ink-soft);
    border-top: 1px solid var(--line);
}
.single-analysis-body h4 { margin: 10px 0 2px; font-size: 13px; font-weight: 680; color: var(--primary); }
.single-analysis-body h4:first-child { margin-top: 0; }
.single-analysis-body .sa-empty { color: var(--muted-2); font-size: 12px; }
.single-analysis .sa-loading { font-size: 12px; color: var(--muted); }
.single-analysis .sa-loading::after {
    content: '';
    display: inline-block;
    width: 10px;
    text-align: left;
    animation: sa-dots 1.2s steps(4, end) infinite;
}
@keyframes sa-dots { 0%{content:''} 25%{content:'.'} 50%{content:'..'} 75%{content:'...'} 100%{content:''} }
.btn-reanalyze {
    min-height: 30px;
    padding: 3px 12px;
    font-size: 12px;
    border-radius: var(--radius-pill);
}

/* 单题分析在编辑弹窗内 */
#errorFormAnalysis { margin-top: 6px; }

/* 多图上传草稿列表 */
.draft-list { display: grid; gap: 10px; margin-top: 12px; }
.draft-item {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface-strong);
}
.draft-item-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 680;
    color: var(--ink-soft);
}
.draft-item textarea { width: 100%; min-height: 72px; resize: vertical; }
.draft-thumb {
    max-width: 80px;
    max-height: 80px;
    margin-top: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
}
.draft-mini-row { display: flex; gap: 8px; flex-wrap: wrap; }
.draft-mini-row .form-input { min-height: 38px; padding: 6px 10px; font-size: 13px; flex: 1 1 90px; }

/* 错题集翻页浏览 */
.error-pager {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
}
.error-pager button { min-width: 72px; }
.error-pager .pager-info { font-size: 13px; color: var(--muted); }

/* AI 分析筛选栏：与错题筛选栏一致的克制面板 */
.analysis-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(255, 253, 248, 0.7);
    margin-bottom: 14px;
}
.analysis-filter .filter-input {
    flex: 1 1 140px;
    min-width: 140px;
    min-height: 40px;
    padding: 0 14px;
    font-size: 14px;
    border: 1px solid var(--line);
    border-radius: 15px;
    color: var(--ink);
    background: var(--surface-strong);
    transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}
.analysis-filter .filter-input:focus {
    outline: none;
    border-color: rgba(25, 23, 20, 0.45);
    box-shadow: 0 0 0 4px rgba(25, 23, 20, 0.08);
    background: #fff;
}
.analysis-filter .date-input { flex: 0 0 auto; min-width: 140px; }
.analysis-qselect {
    margin-bottom: 16px;
    max-height: 200px;
    overflow-y: auto;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface-strong);
    width: 100%;
}
.analysis-qselect label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    font-size: 13px;
    color: var(--ink-soft);
    cursor: pointer;
}
.analysis-qselect label strong { color: var(--primary); font-weight: 680; min-width: 48px; }
.analysis-qselect .qselect-tools {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 6px;
    font-size: 12px;
}
.analysis-qselect .qselect-tools a { color: var(--primary); cursor: pointer; text-decoration: underline; }
.analysis-qselect .qselect-tools span { color: var(--muted); }

/* 导出选项弹窗 */
.export-options {
    display: grid;
    gap: 6px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface);
}
.export-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 6px;
    font-size: 14px;
    color: var(--ink-soft);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background 160ms var(--ease);
}
.export-option:hover { background: var(--surface-muted); }
.export-option input { width: 16px; height: 16px; cursor: pointer; }

/* 移动端：筛选栏纵向堆叠，避免横向滚动 */
@media (max-width: 720px) {
    .error-filter-bar,
    .analysis-filter { gap: 8px; }
    .error-filter-bar .filter-input,
    .error-filter-bar .date-input,
    .analysis-filter .filter-input,
    .analysis-filter .date-input { flex: 1 1 100%; }
    .error-filter-bar .subtype-select,
    .analysis-filter .filter-select { flex: 1 1 calc(50% - 4px); }
    .error-pager .pager-info { font-size: 12px; }
}
