/* 输入题 page (papers-written.blade.php) over paper.css + paper-ui-a.css: the same soft cards,
   only the --pa-* colours (dark.css redefines them, so no new colours to generate). */

.wp { display: flex; flex-direction: column; gap: 16px; padding-bottom: 96px; }
.wp .paper-info { margin-bottom: 0; }
.wp-note { display: flex; align-items: center; gap: 6px; margin: 12px 0 0; color: var(--pa-muted); font-size: 13px; line-height: 1.5; }
.wp-note .material-symbols-outlined { font-size: 17px; }
.wp-note-test { color: var(--pa-accent-ink); }
.wp-last { margin-top: 12px; padding: 7px 12px; border: 0; border-radius: 999px; background: var(--pa-soft); color: var(--pa-text); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.wp-last:hover { background: var(--pa-soft-hover); }
/* 历次成绩 (paper-written.js): earlier hand-ins, each opens again. */
.wp-history { display: flex; flex-direction: column; gap: 4px; margin-top: 14px; }
.wp-history-title { margin: 0 0 2px; color: var(--pa-muted); font-size: 12.5px; font-weight: 700; }
.wp-history-row { display: flex; align-items: baseline; gap: 10px; padding: 8px 12px; border: 0; border-radius: 12px; background: var(--pa-soft); color: var(--pa-text); font: inherit; font-size: 13px; text-align: left; cursor: pointer; font-variant-numeric: tabular-nums; }
.wp-history-row:hover { background: var(--pa-soft-hover); }
.wp-history-row b { color: var(--pa-ink); }
.wp-history-row small { color: var(--pa-muted); }
.wp-history-open { margin-left: auto; color: var(--pa-accent-ink); font-weight: 700; }
.wp-history-row.is-current { background: var(--pa-accent-soft); }
.wp-history-row.is-current .wp-history-open { visibility: hidden; }

/* 封面: the paper in a few lines, then 开始作答. */
.wp-cover { display: flex; flex-direction: column; gap: 10px; padding: 26px 24px 22px; border-radius: 24px; background: var(--pa-card); }
.wp-cover-title { margin: 0; color: var(--pa-ink); font-size: 21px; line-height: 1.35; }
.wp-cover-meta { margin: 0; color: var(--pa-muted); font-size: 14px; font-weight: 600; }
.wp-cover-sections { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 0; padding: 0; list-style: none; }
.wp-cover-sections li { display: flex; align-items: baseline; gap: 10px; padding: 10px 14px; border-radius: 14px; background: var(--pa-soft); color: var(--pa-text); font-size: 14px; }
.wp-cover-sections b { color: var(--pa-ink); }
.wp-cover .wp-note { margin: 4px 0 0; }
.wp-cover .wp-history { margin-top: 6px; }
.wp-start { align-self: stretch; margin-top: 10px; height: 48px; border: 0; border-radius: 14px; background: var(--pa-ink); color: var(--pa-card); font: inherit; font-size: 16px; font-weight: 700; cursor: pointer; }
.wp-start:hover { opacity: 0.9; }

/* Question dots: one per main question; the grid button goes back to the cover / result. */
.wp-nav { position: sticky; top: 0; z-index: 3; flex-shrink: 0; display: flex; align-items: center; gap: 3px; margin: -4px -4px 0; padding: 4px; overflow-x: auto; scrollbar-width: none; background: var(--pa-bg); }
.wp-nav::-webkit-scrollbar { display: none; }
/* Covers the scroll padding above the stuck row, so the card doesn't peek out over it. */
.wp-nav { box-shadow: 0 -24px 0 var(--pa-bg); }
.wp-nav-home, .wp-dot { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 999px; background: var(--pa-card); color: var(--pa-text); font: inherit; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; cursor: pointer; }
.wp-nav-home .material-symbols-outlined { font-size: 19px; }
.wp-nav-sec { flex-shrink: 0; padding: 0 1px 0 6px; color: var(--pa-muted); font-size: 12px; font-weight: 800; }
@media (max-width: 420px) {
    .wp-nav { gap: 2px; }
    .wp-nav-home, .wp-dot { width: 30px; height: 30px; font-size: 13px; }
    .wp-nav-sec { padding: 0 0 0 4px; }
}
.wp-dot.is-done { box-shadow: inset 0 0 0 2px var(--pa-ink); }
.wp-dot.is-off { color: var(--pa-muted); }
.wp-dot.is-current { background: var(--pa-ink); color: var(--pa-card); box-shadow: none; }

/* One main question shows at a time (paper-written.js marks it .is-current). */
.wp[data-view="q"] .wp-group:not(.is-current) { display: none; }

/* Sections */
.wp-section { display: flex; flex-direction: column; gap: 10px; }
.wp-section-head { display: flex; align-items: baseline; gap: 10px; margin: 4px 4px 0; }
.wp-section-title { color: var(--pa-muted); font-size: 13px; font-weight: 800; letter-spacing: 0.02em; text-transform: uppercase; }
.wp-choose-note { color: var(--pa-muted); font-size: 13px; }
.wp-choose-note b { color: var(--pa-ink); }

/* A main question */
.wp-group { display: flex; flex-direction: column; gap: 14px; padding: 22px 24px 18px; border-radius: 24px; background: var(--pa-card); scroll-margin-top: 16px; }
.wp-group-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.wp-qnum { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 999px; background: var(--pa-ink); color: var(--pa-card); font-size: 15px; font-weight: 800; }
.wp-group-marks { color: var(--pa-muted); font-size: 13px; font-weight: 600; }
.wp-head-gap { flex: 1; }
.wp-group-score { padding: 4px 11px; border-radius: 999px; background: var(--pa-accent-soft); color: var(--pa-accent-ink); font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.wp-choose { padding: 6px 13px; border: 0; border-radius: 999px; background: var(--pa-soft); color: var(--pa-text); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.wp-choose:hover { background: var(--pa-soft-hover); }
.wp-choose[aria-pressed="true"] { background: var(--pa-accent-mid); color: var(--pa-accent-ink); }
.wp-stimulus { color: var(--pa-text); font-size: 15px; line-height: 1.7; }
.wp-stimulus blockquote, .wp-part-text blockquote { margin: 8px 0; padding: 10px 14px; border-left: 3px solid var(--pa-line); border-radius: 0 12px 12px 0; background: var(--pa-soft); }
.wp-figure { max-height: 320px; }

/* Parts */
.wp-parts { display: flex; flex-direction: column; gap: 18px; }
.wp-part { display: flex; flex-direction: column; gap: 8px; }
.wp-lead { color: var(--pa-text); font-size: 15px; line-height: 1.6; }
.wp-part-q { display: flex; gap: 8px; align-items: flex-start; color: var(--pa-ink); font-size: 15px; line-height: 1.65; }
.wp-label { flex-shrink: 0; min-width: 14px; font-weight: 800; }
.wp-part-text { flex: 1; min-width: 0; }
/* Writing on ruled lines, like the answer lines of the printed paper: no box, one rule per
   line (--wp-line), more lines appearing as the answer grows (paper-written.js autosize). */
.wp-answer-wrap { display: flex; flex-direction: column; gap: 2px; padding: 0 2px; }
.wp-answer {
    --wp-line: 34px;
    --wp-rule: var(--pa-line);
    --wp-ink: #1e3a8a;
    display: block;
    box-sizing: border-box;
    width: 100%;
    padding: 0 4px;
    border: 0;
    border-radius: 0;
    background-color: transparent;
    background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--wp-line) - 1.5px), var(--wp-rule) calc(var(--wp-line) - 1.5px), var(--wp-rule) var(--wp-line));
    background-attachment: local;
    color: var(--wp-ink);
    font: inherit;
    font-size: 15.5px;
    line-height: var(--wp-line);
    resize: none;
    overflow: hidden;
    transition: background-image 0.15s ease;
}
.wp-answer::placeholder { color: var(--pa-muted); opacity: 0.7; }
.wp-answer:focus { outline: none; --wp-rule: var(--pa-accent-mid); }
.wp-answer:focus-visible { outline: none; }
.wp-answer[readonly] { color: var(--wp-ink); }
/* What the student writes is dark blue, like pen on the printed paper, so it never blends into the question. */
:root[data-theme="dark"] .wp-answer { --wp-ink: #9db8f2; }
.wp-marks { flex-shrink: 0; padding-top: 1px; color: var(--pa-muted); font-size: 12.5px; font-weight: 600; white-space: nowrap; }

/* Passages, lists and tables inside a question (rendered from markdown by paper-math.js). */
.wp-rich p { margin: 0 0 8px; }
.wp-rich > :first-child { margin-top: 0; }
.wp-rich > :last-child { margin-bottom: 0; }
.wp-rich ul, .wp-rich ol { margin: 0 0 8px; padding-left: 22px; }
.wp-rich li { margin-bottom: 3px; }
.wp-rich table { display: block; width: max-content; max-width: 100%; overflow-x: auto; margin: 8px 0 10px; border: 1px solid var(--pa-line); border-collapse: separate; border-spacing: 0; border-radius: 12px; font-size: 14px; line-height: 1.5; }
.wp-rich th, .wp-rich td { padding: 8px 12px; border-right: 1px solid var(--pa-line); border-bottom: 1px solid var(--pa-line); text-align: left; vertical-align: top; }
.wp-rich th { background: var(--pa-soft); color: var(--pa-ink); font-weight: 700; }
.wp-rich th:last-child, .wp-rich td:last-child { border-right: 0; }
.wp-rich tr:last-child td { border-bottom: 0; }
.wp-part-text { display: flex; flex-direction: column; gap: 10px; }
.wp-part-text .wp-figure, .wp-group > .wp-figure { order: 0; margin: 4px auto; }

/* An optional question (choose N) not picked: its answer boxes are quiet until picked. */
.wp-group.is-optional:not(.is-chosen) .wp-answer { opacity: 0.45; }
.wp-group.is-optional:not(.is-chosen) .wp-group-foot { display: none; }

.wp-group-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; padding-top: 2px; }
.wp-grade { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 16px; border: 1px solid var(--pa-line); border-radius: 999px; background: var(--pa-card); color: var(--pa-ink); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.wp-grade:hover { background: var(--pa-soft); }
.wp-grade .material-symbols-outlined { font-size: 18px; color: var(--pa-accent-ink); }
.wp-grade.is-busy { opacity: 0.6; cursor: progress; }
.wp-grade.is-busy .material-symbols-outlined { animation: wp-spin 1s linear infinite; }
.wp.is-submitted .wp-group-foot, .wp.is-submitted .wp-choose { display: none; }

/* A graded part */
.wp-feedback { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: 14px; background: var(--pa-soft); }
.wp-fb-head { display: flex; align-items: flex-start; gap: 10px; }
.wp-fb-score { flex-shrink: 0; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }
.wp-fb-score.is-full { background: var(--pa-mint-mid); color: var(--pa-mint-ink); }
.wp-fb-score.is-some { background: var(--pa-accent-mid); color: var(--pa-accent-ink); }
.wp-fb-score.is-zero { background: var(--pa-pink-mid); color: var(--pa-pink-ink); }
.wp-fb-comment { margin: 2px 0 0; color: var(--pa-text); font-size: 14px; line-height: 1.6; }
.wp-fb-stale { display: none; margin: 0; color: var(--pa-accent-ink); font-size: 12.5px; font-weight: 600; }
.wp-feedback.is-stale .wp-fb-stale { display: block; }
.wp-feedback.is-stale .wp-fb-score { opacity: 0.5; }
.wp-fb-scheme summary { color: var(--pa-muted); font-size: 13px; font-weight: 700; cursor: pointer; }
.wp-fb-sub { margin: 10px 0 4px; color: var(--pa-muted); font-size: 12.5px; font-weight: 700; }
.wp-points, .wp-ideas { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 0; padding: 0; list-style: none; }
.wp-points li { display: flex; gap: 8px; color: var(--pa-muted); font-size: 13.5px; line-height: 1.5; }
.wp-points li .material-symbols-outlined { flex-shrink: 0; font-size: 18px; }
.wp-points li.is-hit { color: var(--pa-ink); }
.wp-points li.is-hit .material-symbols-outlined { color: var(--pa-mint-ink); }
.wp-points q, .wp-ideas q { display: block; margin-top: 2px; color: var(--pa-muted); font-size: 12.5px; font-style: italic; }
.wp-ideas li { display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; }
.wp-kind { align-self: flex-start; padding: 1px 8px; border-radius: 999px; background: var(--pa-chip); color: var(--pa-chip-ink); font-size: 11.5px; font-weight: 700; }
.wp-kind-explained { background: var(--pa-accent-soft); color: var(--pa-accent-ink); }
.wp-kind-beyond { background: var(--pa-mint); color: var(--pa-mint-ink); }

/* The result, on top after handing in */
.wp-result { display: flex; flex-direction: column; gap: 14px; padding: 22px 24px; border-radius: 24px; background: var(--pa-card); scroll-margin-top: 16px; }
.wp-result-progress { display: flex; align-items: center; gap: 10px; color: var(--pa-text); font-size: 15px; font-weight: 600; }
.wp-spinner { width: 18px; height: 18px; border: 2.5px solid var(--pa-line); border-top-color: var(--pa-accent); border-radius: 50%; animation: wp-spin 0.8s linear infinite; }
.wp-result-head { display: flex; align-items: baseline; gap: 10px; }
.wp-result-label { color: var(--pa-muted); font-size: 14px; font-weight: 700; }
.wp-result-score { color: var(--pa-ink); font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; }
.wp-result-score small { color: var(--pa-muted); font-size: 18px; font-weight: 700; }
.wp-result-pct { padding: 3px 10px; border-radius: 999px; background: var(--pa-accent-soft); color: var(--pa-accent-ink); font-size: 13px; font-weight: 800; }
.wp-result-warn { margin: 0; color: var(--pa-pink-ink); font-size: 13.5px; }
.wp-retry { margin-left: 6px; padding: 4px 10px; border: 0; border-radius: 999px; background: var(--pa-pink); color: var(--pa-pink-ink); font: inherit; font-weight: 700; cursor: pointer; }
.wp-result-rows { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.wp-result-row { display: flex; justify-content: space-between; padding: 9px 12px; border: 0; border-radius: 12px; background: var(--pa-soft); color: var(--pa-text); font: inherit; font-size: 13.5px; text-align: left; cursor: pointer; }
.wp-result-row b { font-variant-numeric: tabular-nums; }
.wp-result-row:hover { background: var(--pa-soft-hover); }

/* ⋯ on a main question: 举报 each part. */
.wp-more { position: relative; }
.wp-more-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 999px; background: transparent; color: var(--pa-muted); cursor: pointer; }
.wp-more-btn:hover { background: var(--pa-soft); }
.wp-more-menu { position: absolute; right: 0; top: 40px; z-index: 5; display: flex; flex-direction: column; min-width: 150px; padding: 6px; border: 1px solid var(--pa-line); border-radius: 14px; background: var(--pa-card); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08); }
.wp-more-menu[hidden] { display: none; }
.wp-more-item.paper-report-btn { display: flex; align-items: center; gap: 8px; width: 100%; height: 40px; padding: 0 10px; border: 0; border-radius: 10px; background: transparent; color: var(--pa-text); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.wp-more-item.paper-report-btn:hover { background: var(--pa-soft); }
.wp-more-item .material-symbols-outlined { font-size: 18px; color: var(--pa-muted); }
.wp-more-item.is-reported .material-symbols-outlined { color: var(--pa-accent-ink); }

/* 交卷 in the header; ← / 下一题 → in the bar (下一题 turns into 交卷 on the last question). */
.wp-head-submit { height: 36px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--pa-ink); color: var(--pa-card); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.wp-head-submit:disabled { opacity: 0.4; cursor: default; }
.pui-a .wp-bar .wp-next { background: var(--pa-ink); color: var(--pa-card); padding: 0 16px; }
.pui-a .wp-bar .wp-next:hover { background: var(--pa-ink); opacity: 0.9; }
.wp-bar .wp-prev { width: 44px; padding: 0; }
.wp-bar .wp-prev:disabled { opacity: 0.35; cursor: default; }

@keyframes wp-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .wp-spinner, .wp-grade.is-busy .material-symbols-outlined { animation: none; } }
@media (max-width: 720px) {
    .wp-group, .wp-result { padding: 18px 16px 16px; }
    .wp-result-score { font-size: 30px; }
}

/* Sources quoted in a question (a URL, an e-mail) are part of the text, not links to follow. */
.wp-stimulus a, .wp-part-text a, .wp-lead a { color: inherit; text-decoration: none; pointer-events: none; }

/* 题目语言: empty text blocks stay hidden; the original under a translated skema line; the note while the
   questions are in a language the answers can't be written in. */
.wp [data-slot][hidden] { display: none !important; }
.wp-points .wp-orig { display: block; margin-top: 2px; color: var(--pa-muted); font-size: 0.9em; }
.wp-lang-note { margin: 0 0 12px; }
.wp-lang-note { padding: 8px 12px; border-radius: 12px; background: var(--pa-soft); color: var(--pa-text); }
.wp-lang-note[hidden] { display: none; }
