/* 页面：登录、首页、题库、记录、设置（v2 编辑部学习手册） */

/* ============================== 登录 / 注册 ============================== */

.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    background: var(--bg);
}

.auth-visual {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: clamp(36px, 5vw, 72px);
    border-right: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
}

.auth-visual::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: repeating-linear-gradient(
        to bottom,
        transparent 0,
        transparent 31px,
        color-mix(in srgb, var(--line) 46%, transparent) 31px,
        color-mix(in srgb, var(--line) 46%, transparent) 32px
    );
    opacity: 0.5;
    pointer-events: none;
    mask-image: linear-gradient(to bottom, transparent 0%, #000 18%, #000 82%, transparent 100%);
}

.auth-visual > * { position: relative; z-index: 1; }

.auth-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.auth-brand .brand-name { color: var(--ink); }
.auth-brand .brand-sub { color: var(--muted-2); }

.auth-quote {
    margin: clamp(40px, 8vh, 96px) 0;
    max-width: 540px;
}

.auth-rule {
    width: 48px;
    height: 2px;
    background: var(--brand);
    margin-bottom: 26px;
}

.auth-quote h1 {
    font-family: var(--font-display);
    font-size: clamp(40px, 4.4vw, 64px);
    line-height: 1.12;
    font-weight: var(--weight-medium);
    letter-spacing: -0.035em;
    color: var(--ink);
}

.auth-quote h1 em {
    font-style: normal;
    color: var(--accent);
}

.auth-quote p {
    margin-top: 22px;
    font-size: 15px;
    line-height: 1.9;
    color: var(--muted);
    max-width: 420px;
}

.auth-motif {
    margin-top: 52px;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand);
    opacity: 0.72;
    border: 1px solid var(--line);
    border-radius: 50%;
    transform: rotate(-6deg);
}

.auth-motif svg {
    width: 30px;
    height: 30px;
}

.auth-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    font-size: 12px;
    color: var(--muted-2);
}

.auth-foot .num { color: var(--muted); }

.auth-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(24px, 5vw, 72px);
    background: var(--bg);
}

.auth-form {
    width: 100%;
    max-width: 420px;
    animation: fade-up var(--dur-3) var(--ease-out) both;
}

.auth-head { margin-bottom: 32px; }

.auth-head h2 {
    font-family: var(--font-display);
    font-size: 30px;
    font-weight: var(--weight-semibold);
    letter-spacing: -0.03em;
    line-height: 1.25;
}

.auth-head p {
    margin-top: 8px;
    font-size: 13.5px;
    color: var(--muted);
    line-height: 1.7;
}

.auth-fields {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.auth-switch {
    margin-top: 24px;
    font-size: 13px;
    color: var(--muted);
    text-align: center;
}

.auth-switch button {
    color: var(--brand-strong);
    font-weight: var(--weight-semibold);
    margin-left: 4px;
}

[data-theme="dark"] .auth-switch button { color: var(--brand); }

.auth-submit {
    margin-top: 4px;
}

.auth-divider,
.auth-demo {
    display: none;
}

.auth-mobile-brand {
    display: none;
}

@media (max-width: 900px) {
    .auth-shell { grid-template-columns: minmax(0, 1fr); }
    .auth-visual { display: none; }
    .auth-panel {
        min-height: 100vh;
        padding: 32px 22px calc(32px + env(safe-area-inset-bottom));
        align-items: flex-start;
        padding-top: 10vh;
    }
    .auth-mobile-brand {
        display: flex;
        align-items: center;
        gap: 10px;
        margin-bottom: 32px;
    }
    .auth-head h2 { font-size: 27px; }
    .auth-form { max-width: 100%; }
}

/* ============================== 首页 ============================== */

.greeting {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}

.greeting h1 {
    font-family: var(--font-display);
    font-size: var(--text-h1);
    font-weight: var(--weight-semibold);
    letter-spacing: -0.03em;
    line-height: var(--leading-h1);
}

.greeting .sub {
    margin-top: 8px;
    font-size: 13.5px;
    color: var(--muted);
    line-height: 1.7;
}

.greeting .date-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: auto;
    padding: 0;
    border-radius: 0;
    background: transparent;
    border: 0;
    font-size: 12.5px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.greeting .date-chip svg { width: 14px; height: 14px; color: var(--brand); }

.continue-card {
    position: relative;
    padding: 28px 0;
    border-radius: 0;
    border: 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: transparent;
    overflow: visible;
    transition: none;
}

.continue-card:hover {
    border-color: var(--line);
    box-shadow: none;
}

.continue-card .cc-head {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: var(--weight-semibold);
    color: var(--brand-strong);
    letter-spacing: 0.04em;
}

[data-theme="dark"] .continue-card .cc-head { color: var(--brand); }

.continue-card h3 {
    margin-top: 12px;
    font-family: var(--font-display);
    font-size: 30px;
    font-weight: var(--weight-semibold);
    letter-spacing: -0.03em;
    line-height: 1.25;
}

.continue-card .cc-meta {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--muted);
}

.continue-card .cc-actions {
    margin-top: 22px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.cc-progress {
    margin-top: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cc-progress .progress { flex: 1; }

.mini-stats {
    display: flex;
    gap: 24px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.mini-stat .v {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: var(--weight-semibold);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.mini-stat .k {
    margin-top: 3px;
    font-size: 12px;
    color: var(--muted-2);
}

.home-grid .card {
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
    padding-top: 24px;
    box-shadow: none;
}

.home-grid .card-header {
    padding: 0 0 10px;
}

.home-grid .card-title {
    font-size: var(--text-h2);
}

.home-grid .list-row {
    padding-left: 0;
    padding-right: 0;
}

.chart-wrap {
    padding: 8px 0 0;
}

.chart-svg { width: 100%; height: 150px; overflow: visible; }

.chart-legend {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 11px;
    color: var(--muted-2);
    margin-top: 8px;
    font-variant-numeric: tabular-nums;
}

.recent-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 0;
    border-bottom: 1px solid var(--line);
    cursor: pointer;
}

.recent-item:last-child { border-bottom: 0; }

.recent-item .ri-main { flex: 1; min-width: 0; }

.recent-item .ri-title {
    font-size: 14px;
    font-weight: var(--weight-medium);
    color: var(--ink-2);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.recent-item .ri-time {
    font-size: 12px;
    color: var(--muted-2);
    margin-top: 2px;
}

.score-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 24px;
    padding: 0 7px;
    border-radius: 4px;
    border: 1px solid var(--line);
    font-size: 12px;
    font-weight: var(--weight-semibold);
    font-variant-numeric: tabular-nums;
    background: transparent;
    color: var(--ink-2);
}

.score-pill.good { border-color: var(--success-line); color: var(--success); }
.score-pill.mid { border-color: var(--warn-line); color: var(--warn); }
.score-pill.low { border-color: var(--danger-line); color: var(--danger); }

.reco-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 0;
    border-radius: 0;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: transparent;
    cursor: pointer;
    transition: color var(--dur-2);
}

.reco-card:hover {
    border-color: var(--line);
    transform: none;
    box-shadow: none;
}

.reco-card .rc-index {
    width: 32px;
    height: 32px;
    border-radius: 0;
    background: transparent;
    color: var(--muted-2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: var(--weight-medium);
    flex: none;
}

.reco-card .rc-main { flex: 1; min-width: 0; }

.reco-card .rc-title {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: var(--weight-semibold);
}

.reco-card .rc-meta {
    margin-top: 3px;
    font-size: 12.5px;
    color: var(--muted);
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

/* ============================== 题库 ============================== */

.library-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.library-toolbar .search-wrap {
    flex: 1;
    min-width: 200px;
    max-width: 340px;
}

.library-toolbar .search-wrap .input { height: 42px; }

.library-count {
    font-size: 12.5px;
    color: var(--muted-2);
    margin-left: auto;
}

.library-card {
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
}

.lib-table {
    width: 100%;
}

.lib-table-head {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 128px 68px 68px 72px 64px 24px;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
    font-size: 11.5px;
    color: var(--muted-2);
    letter-spacing: 0.04em;
}

.lib-row {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 128px 68px 68px 72px 64px 24px;
    align-items: center;
    gap: 12px;
    padding: 18px 0;
    border-bottom: 1px solid var(--line);
    cursor: pointer;
    transition: background var(--dur-2), padding var(--dur-2), color var(--dur-2);
}

.lib-row:hover {
    background: var(--surface-2);
    padding-left: 8px;
    padding-right: 8px;
}

.lib-num {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--muted-2);
    text-align: right;
}

.lib-main { min-width: 0; }

.lib-title {
    display: block;
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: var(--weight-semibold);
    letter-spacing: -0.02em;
    line-height: 1.4;
    color: var(--ink);
}

.lib-mobile-meta {
    display: none;
    margin-top: 3px;
    font-size: 12.5px;
    color: var(--muted);
}

.lib-year,
.lib-sent,
.lib-diff,
.lib-attempts {
    font-size: 13px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.lib-attempts {
    color: var(--brand-strong);
}

[data-theme="dark"] .lib-attempts {
    color: var(--brand);
}

.lib-best {
    font-size: 13px;
    color: var(--muted-2);
    font-variant-numeric: tabular-nums;
}

.lib-best b {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: var(--weight-semibold);
    color: var(--ink);
}

.lib-arrow {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    color: var(--muted-2);
    transition: color var(--dur-2), transform var(--dur-2);
}

.lib-arrow svg { width: 16px; height: 16px; }

.lib-row:hover .lib-arrow {
    color: var(--brand-strong);
    transform: translateX(3px);
}

[data-theme="dark"] .lib-row:hover .lib-arrow { color: var(--brand); }

.library-list .list-row { padding: 18px 0; }

.row-status {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
    min-width: 62px;
}

.row-status .s-label {
    font-size: 11.5px;
    color: var(--muted-2);
}

.mobile-row-extra { display: none; }

@media (max-width: 900px) {
    .library-toolbar .search-wrap { max-width: none; flex-basis: 100%; }
    .library-toolbar .dropdown,
    .library-toolbar .dropdown-trigger { width: 100%; }
    .library-toolbar .dropdown-trigger { justify-content: space-between; }
    .library-toolbar .dropdown { flex: 1; }
    .lib-table-head { display: none; }
    .lib-row {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 10px;
        padding: 16px 0;
    }
    .lib-num,
    .lib-year,
    .lib-sent,
    .lib-diff,
    .lib-attempts,
    .lib-arrow { display: none; }
    .lib-title { font-size: 17px; }
    .lib-mobile-meta { display: block; }
    .lib-best { text-align: right; }
    .lib-best::before {
        content: "最佳 ";
        font-size: 11px;
        color: var(--muted-2);
    }
    .lib-best b { font-size: 17px; }
    .library-list .list-row { padding: 16px 0; }
    .library-list .row-index { display: none; }
    .library-list .row-meta { display: none; }
    .row-status { display: none; }
    .row-arrow { width: 26px; }
}

/* 题目练习历史 */

.question-history {
    margin: 0 0 16px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface);
    overflow: hidden;
}

.question-history-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    padding: 11px 14px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-2);
}

.question-history-head .group-title {
    margin: 0;
    font-size: 13px;
}

.question-history-summary {
    font-size: 11.5px;
    color: var(--muted-2);
    font-variant-numeric: tabular-nums;
}

.question-history-list {
    max-height: 220px;
    overflow-y: auto;
}

.question-history-row {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 78px 84px 60px 18px;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: background var(--dur-2);
}

.question-history-row:last-child {
    border-bottom: 0;
}

.question-history-row:hover {
    background: var(--surface-2);
}

.qh-date {
    min-width: 0;
    font-size: 12px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.qh-score {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: var(--weight-semibold);
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

.qh-score small {
    margin-left: 1px;
    font-family: var(--font-ui);
    font-size: 10.5px;
    font-weight: 400;
    color: var(--muted-2);
}

.qh-score.good { color: var(--success); }
.qh-score.mid { color: var(--warn); }
.qh-score.low { color: var(--danger); }

.qh-710 {
    font-size: 12px;
    color: var(--muted);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.qh-pass {
    justify-self: end;
    padding: 2px 8px;
    border: 1px solid var(--line);
    border-radius: var(--r-full);
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
}

.qh-pass.is-pass {
    border-color: var(--success-line);
    background: var(--success-soft);
    color: var(--success);
}

.qh-pass.is-fail {
    border-color: var(--danger-line);
    background: var(--danger-soft);
    color: var(--danger);
}

.qh-arrow {
    display: flex;
    justify-content: flex-end;
    color: var(--muted-2);
}

.qh-arrow svg {
    width: 14px;
    height: 14px;
}

.question-history-empty {
    padding: 16px 14px;
    font-size: 12.5px;
    line-height: 1.7;
    color: var(--muted-2);
}

.question-history-empty.is-error {
    color: var(--danger);
}

@media (max-width: 640px) {
    .question-history-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }

    .question-history-row {
        grid-template-columns: minmax(0, 1fr) 62px 18px;
    }

    .qh-710,
    .qh-pass {
        display: none;
    }
}

/* ============================== 记录 ============================== */

.records-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.trend-panel {
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    padding: 24px 0 0;
    margin-top: 32px;
}

.trend-panel .card-title {
    font-size: var(--text-h2);
}

.trend-card {
    padding: 10px 0 0;
}

.trend-svg { width: 100%; height: 160px; overflow: visible; }

.record-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 0;
    border-bottom: 1px solid var(--line);
    cursor: pointer;
    transition: background var(--dur-2), padding var(--dur-2);
}

.record-row:last-child { border-bottom: 0; }
.record-row:hover {
    background: var(--surface-2);
    padding-left: 8px;
    padding-right: 8px;
}

.record-row:hover .row-arrow {
    color: var(--brand-strong);
    transform: translateX(3px);
}

[data-theme="dark"] .record-row:hover .row-arrow {
    color: var(--brand);
}

.record-thumb {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--line);
    background: var(--surface-3);
    flex: none;
    padding: 0;
    transition: border-color var(--dur-2);
}

.record-thumb:hover {
    border-color: var(--brand-line);
    transform: none;
}

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

.record-score {
    width: 56px;
    height: 48px;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    line-height: 1;
    flex: none;
    font-variant-numeric: tabular-nums;
    background: transparent;
    color: var(--ink-2);
}

.record-score b {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: var(--weight-semibold);
    letter-spacing: -0.03em;
}

.record-score span {
    font-size: 10.5px;
    color: var(--muted-2);
    margin-top: 3px;
}

.record-score.good { color: var(--success); }
.record-score.mid { color: var(--warn); }
.record-score.low { color: var(--danger); }

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

.record-title {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: var(--weight-semibold);
    letter-spacing: -0.02em;
    line-height: 1.4;
}

.record-meta {
    margin-top: 3px;
    font-size: 12.5px;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
}

.record-status {
    font-weight: var(--weight-medium);
}

.record-status.is-pass { color: var(--success); }
.record-status.is-fail { color: var(--danger); }
.record-status.is-muted { color: var(--muted-2); }

@media (max-width: 640px) {
    .record-row { padding: 15px 0; gap: 12px; }
    .record-thumb { width: 40px; height: 40px; border-radius: 7px; }
    .record-score { width: 46px; height: 42px; }
    .record-score b { font-size: 20px; }
    .record-title { font-size: 17px; }
    .records-toolbar .dropdown { flex: 1; }
    .records-toolbar .dropdown-trigger { width: 100%; justify-content: space-between; }
}

/* ============================== 设置 ============================== */

.settings-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
    gap: 48px;
    align-items: start;
}

.profile-card {
    padding: 0;
    text-align: left;
}

.profile-card .avatar-xl { margin: 0 0 18px; }

.profile-card h3 {
    font-family: var(--font-display);
    font-size: 27px;
    font-weight: var(--weight-semibold);
    letter-spacing: -0.03em;
}

.profile-card .username {
    margin-top: 3px;
    font-size: 12px;
    color: var(--muted-2);
    font-family: var(--font-mono);
}

.profile-meta {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0;
    margin-top: 24px;
    border-radius: 0;
    overflow: visible;
    background: transparent;
    border-top: 1px solid var(--line);
    border-left: 1px solid var(--line);
}

.profile-meta > div {
    background: transparent;
    padding: 14px 16px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.profile-meta .k { font-size: 11px; color: var(--muted-2); }
.profile-meta .v { font-size: 14px; font-weight: var(--weight-medium); margin-top: 3px; }

.settings-grid .card {
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    padding: 24px 0 0;
}

.setting-group {
    border: 0;
    border-radius: 0;
    background: transparent;
    overflow: visible;
    border-top: 1px solid var(--line);
}

.setting-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 0;
    border-bottom: 1px solid var(--line);
}

.setting-group .setting-row:last-child { border-bottom: 0; }

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

.setting-title {
    font-size: 15px;
    font-weight: var(--weight-semibold);
    letter-spacing: -0.01em;
}

.setting-desc {
    margin-top: 3px;
    font-size: 12.5px;
    color: var(--muted);
    line-height: 1.6;
}

.setting-control { flex: none; }

.theme-options {
    display: flex;
    gap: 8px;
}

.theme-option {
    width: 50px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--line);
    padding: 4px;
    transition: border-color var(--dur-2);
}

.theme-option:hover { border-color: var(--line-strong); }

.theme-option.is-active {
    border-color: var(--brand);
    box-shadow: none;
}

.theme-preview {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 5px;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.theme-preview.light {
    background: #f6f2e8;
    box-shadow: inset 0 0 0 1px rgba(27, 26, 23, 0.1);
}
.theme-preview.dark { background: #12110f; }
.theme-preview.auto {
    background: linear-gradient(100deg, #f6f2e8 0 50%, #12110f 50% 100%);
}

.kv-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 6px;
}

.kv-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    font-size: 13px;
}

.kv-row .k { color: var(--muted-2); }
.kv-row .v { color: var(--ink-2); font-weight: var(--weight-medium); text-align: right; word-break: break-all; }

@media (max-width: 900px) {
    .settings-grid { grid-template-columns: minmax(0, 1fr); gap: 40px; }
}
