/* 华文 Kertas 2 (owner 2026-11-27): passages read like a printed paper in 仿宋, and the 概述 answer is 方格稿纸
   (js/bc-grid.js). Font: 朱雀仿宋 Zhuque Fangsong (SIL OFL 1.1, fonts/zhuque/OFL.txt), cut down to the characters
   the 华文 papers use (tools: /root/fonts-zhuque); missing ones fall back to the system's 仿宋. */
@font-face {
    font-family: 'Cerdek Fangsong';
    src: url('../fonts/zhuque/zhuque-fangsong-bc-v2.woff2') format('woff2');
    font-display: swap;
}

body.bc-paper {
    --bc-ink: #2b2925;
    --bc-soft: #77726a;
    --bc-rule: #ece6dc;
    --bc-line: #e6ddd0;
    --bc-line-strong: #d7cab8;
    --bc-accent: #c2410c;
    --bc-over: #fdecec;
}
:root[data-theme="dark"] body.bc-paper {
    --bc-ink: #ece8e1;
    --bc-soft: #a39d93;
    --bc-rule: #34312c;
    --bc-line: #3b3832;
    --bc-line-strong: #4a463f;
    --bc-accent: #fb923c;
    --bc-over: #3a2222;
}

/* ---------- the passages ---------- */
body.bc-paper .wp-stimulus {
    max-width: 40em;
    color: var(--bc-ink);
    font-family: 'Cerdek Fangsong', 'FangSong', 'STFangsong', 'Fangsong SC', 'FangSong_GB2312', serif;
    font-size: 18.5px;
    line-height: 2;
    letter-spacing: 0.03em;
}
body.bc-paper .wp-stimulus p { margin: 0.5em 0; text-indent: 2em; }
body.bc-paper .wp-stimulus h3 {
    display: flex; align-items: center; gap: 10px;
    margin: 1.1em 0 0.7em; text-indent: 0;
    color: var(--bc-ink); font-family: inherit; font-size: 21px; font-weight: 700; letter-spacing: 0.12em;
}
body.bc-paper .wp-stimulus h3::after { content: ''; flex: 1; height: 1px; background: var(--bc-rule); }
/* "阅读下面的文章，然后回答问题。" — the instruction, in the page's own type, quietly above the passage. */
body.bc-paper .wp-stimulus .bc-ask {
    margin: 0 0 0.2em; text-indent: 0;
    color: var(--bc-soft); font-family: var(--font-sans, system-ui, sans-serif); font-size: 14px; letter-spacing: 0; line-height: 1.6;
}
body.bc-paper .wp-stimulus .bc-src { margin-top: 0.8em; text-indent: 0; text-align: right; color: var(--bc-soft); font-size: 15.5px; }
body.bc-paper .wp-stimulus .bc-poem { margin: 0.6em 0 0.4em; text-align: center; letter-spacing: 0.14em; }
body.bc-paper .wp-stimulus .bc-poem p { margin: 0.15em 0; text-indent: 0; }
body.bc-paper .wp-stimulus .bc-notes {
    margin-top: 1.1em; padding-top: 0.7em; border-top: 1px solid var(--bc-rule);
    color: var(--bc-soft); font-size: 15px; line-height: 1.8;
}
body.bc-paper .wp-stimulus .bc-notes p { margin: 0.15em 0; text-indent: 0; }
body.bc-paper .wp-stimulus .bc-notes .bc-notes-h { margin-bottom: 0.3em; color: var(--bc-ink); font-weight: 700; letter-spacing: 0.1em; }
body.bc-paper .wp-stimulus u { text-decoration-thickness: 1px; text-underline-offset: 0.28em; }
@media (max-width: 720px) {
    body.bc-paper .wp-stimulus { font-size: 17.5px; line-height: 1.95; }
    body.bc-paper .wp-stimulus .bc-poem { letter-spacing: 0.04em; }
}

/* ---------- 概述: 方格稿纸 (js/bc-grid.js) ---------- */
body.bc-paper { --bc-paper: #fcfaf6; --bc-frame: #e7ddcf; --bc-sqline: #e4d8c8; --bc-sqline-on: #d9c2a6; }
:root[data-theme="dark"] body.bc-paper { --bc-paper: #1f1e1b; --bc-frame: #36332e; --bc-sqline: #3a3631; --bc-sqline-on: #5a4a3a; }
body.bc-paper .bc-grid { position: relative; width: min(100%, 460px); margin: 6px 0 0; }
body.bc-paper .bc-caret { display: none; } /* an anchor only; the current square lights up instead */
body.bc-paper .bc-squares {
    position: relative; container-type: inline-size;
    display: grid; grid-template-columns: repeat(var(--bc-cols, 10), 1fr); row-gap: 7px;
}
body.bc-paper .bc-sq {
    position: relative; aspect-ratio: 1;
    display: grid; place-items: center;
    border-top: 1px solid var(--bc-sqline); border-bottom: 1px solid var(--bc-sqline); border-right: 1px solid var(--bc-sqline);
    color: var(--bc-ink);
    font-family: 'Cerdek Fangsong', 'FangSong', 'STFangsong', 'Fangsong SC', serif;
    font-size: 20px; font-size: calc(100cqw / var(--bc-cols, 10) * 0.6); line-height: 1;
    transition: border-color 0.3s ease, background-color 0.3s ease;
}
body.bc-paper .bc-sq:nth-child(10n + 1) { border-left: 1px solid var(--bc-sqline); }
/* The square the next character goes into: its border lights up (no caret bar). */
body.bc-paper .bc-sq::after {
    content: ''; position: absolute; inset: -1px; z-index: 1; border: 1.5px solid var(--bc-accent); border-radius: 1px;
    opacity: 0; transform: scale(0.92); pointer-events: none;
    transition: opacity 0.16s ease, transform 0.18s cubic-bezier(0.2, 0.8, 0.3, 1);
}
body.bc-paper .bc-grid.is-focus .bc-sq.is-cur::after { opacity: 1; transform: none; }
body.bc-paper .bc-sq.is-over { background: var(--bc-over); }
body.bc-paper .bc-sq.is-new .bc-ch { animation: bc-rise 0.22s cubic-bezier(0.2, 0.8, 0.3, 1) both; }
@keyframes bc-rise { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
/* Punctuation lives on the line between two squares and takes none. */
body.bc-paper .bc-p {
    position: absolute; top: 50%; z-index: 1;
    color: var(--bc-ink); font-size: 0.78em; line-height: 1; white-space: nowrap; pointer-events: none;
    transform: translate(-50%, -50%);
}
body.bc-paper .bc-p-after { left: 100%; }
body.bc-paper .bc-p-before { left: 0; }
body.bc-paper .bc-p.is-low { top: auto; bottom: -2px; transform: translate(-35%, 0); }
/* The real textarea: over the paper, invisible, still taking every key, IME and paste. */
body.bc-paper .bc-grid .bc-input {
    position: absolute; inset: 0; z-index: 3;
    width: 100% !important; height: 100% !important; min-height: 0 !important;
    margin: 0; padding: 0; border: 0; border-radius: 0;
    background: transparent !important; color: transparent !important; caret-color: transparent;
    font-size: 16px; resize: none; overflow: hidden; outline: none; box-shadow: none !important;
    -webkit-text-fill-color: transparent; cursor: text;
}
body.bc-paper .bc-grid .bc-input::selection { background: transparent; }
body.bc-paper .wp-answer-wrap .bc-count {
    margin: 9px 0 0 2px; color: var(--bc-soft) !important; opacity: 1;
    font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; letter-spacing: 0.04em;
    transition: color 0.2s ease;
}
body.bc-paper .wp-answer-wrap .bc-count.is-over { color: var(--bc-accent) !important; }
@media (prefers-reduced-motion: reduce) {
    body.bc-paper .bc-sq.is-new .bc-ch { animation: none; }
    body.bc-paper .bc-sq::after { transition: none; }
}
