/* 阅读伙伴 pupil screens: direction A, "my textbook and my 作业本" (design/mockups/redesign/A_*.jpg, A_notes.md).
   Sizes are in rem: 1rem = 16px on the iPad (1180×820); the root size follows the screen (15px floor, 22px on the board).
   Colour meanings: blue = press (one solid blue button at a time), yellow = picked/added passage sentence, pink = looked-up word,
   red = marks (marks screen only), tangerine = the bookmark. No outside fonts or scripts. */
:root {
  --desk: #DCE4EA; --desk-shadow: #C3CED8; --paper: #F6FAF1; --ink: #1B2330; --ink2: #3E4E46; --edge: #7F909E;
  --py: #33556B; --green: #1E7A34; --tab: #D2E4D6;
  --blue: #2456E0; --blue-edge: #1A3FA8;
  --yellow: #FFE45C; --added: #F9F0AF; --dash: #9A7300; --dock: #FFF6C4;
  --pink: #FFC4DD; --pink-soft: #FFE0EC; --pink-edge: #B0306A; --pink-py: #8E2152; --pink-line: #D9468A;
  --tang: #FF7A1A; --tang-edge: #D95E00;
  --book: #FBFCF8; --rule: #B7CBE3; --margin: #8FA9CF; --tabline: #5E6E7C;
  --red: #D8352A; --red-text: #C8302A; --teal: #2F7D74; --teal-dark: #23615A;
  --kai: "Kaiti SC", "STKaiti", "KaiTi", "BiauKai", "Kaiti TC", "AR PL UKai CN", serif;
  --ui: -apple-system, "PingFang SC", "Noto Sans CJK SC", "Noto Sans SC", "Source Han Sans SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --round: "Yuanti SC", "YuanTi SC", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  --pitch: 2.875rem;   /* one ruled line in the 作业本 */
}
html { font-size: clamp(15px, min(1.356vw, 1.951vh), 22px); -webkit-text-size-adjust: 100%; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { margin: 0; background: var(--desk); color: var(--ink); font-family: var(--ui); overflow: hidden; height: 100vh; height: 100dvh; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
[hidden] { display: none !important; }
.kai { font-family: var(--kai); }

/* ---------- buttons ---------- */
.btn-blue { background: var(--blue); color: #fff; border: 0; border-radius: 0.6rem; box-shadow: 0 0.25rem 0 var(--blue-edge);
  font-weight: 700; font-size: 1.25rem; min-height: 3.6rem; padding: 0 1.6rem; display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; }
.btn-blue:active { transform: translateY(0.15rem); box-shadow: 0 0.1rem 0 var(--blue-edge); }
.btn-blue[disabled] { opacity: 0.55; cursor: default; }
.btn-blue small { font-weight: 500; font-size: max(15px, 0.94rem); opacity: 0.95; }
.chev { width: 0.7em; height: 0.7em; border-right: 0.16em solid currentColor; border-top: 0.16em solid currentColor; transform: rotate(45deg); display: inline-block; margin-left: 0.2em; }
.chev.left { transform: rotate(-135deg); margin: 0 0.1em 0 0.25em; }
.btn-line { background: #fff; border: 0.125rem solid var(--ink); border-radius: 0.6rem; font-weight: 700; font-size: 1.125rem; min-height: 3.1rem; padding: 0 1.1rem;
  display: inline-flex; align-items: center; gap: 0.35rem; }
.btn-text { background: none; border: 0; color: var(--blue); font-weight: 700; font-size: 1.125rem; text-decoration: underline; text-underline-offset: 0.25em;
  text-decoration-thickness: 0.12em; min-height: 2.75rem; padding: 0 0.4rem; }

/* ---------- top row (every lesson screen) ---------- */
.top { display: flex; align-items: center; gap: 1.4rem; height: 5.25rem; padding: 0 1.4rem 0 1.5rem; }
.top .grow { flex: 1; }
.top .who { font-family: var(--kai); font-size: 1.25rem; margin-right: -0.4rem; }
.steps { display: flex; align-items: center; gap: 0.6rem; font-size: 1.25rem; }
.step { display: inline-flex; align-items: center; gap: 0.55rem; font-weight: 700; color: var(--ink); background: none; border: 0.125rem solid transparent; border-radius: 0.6rem; padding: 0.35rem 0.7rem 0.35rem 0.4rem; }
.step.todo { color: var(--ink2); font-weight: 500; }
.step.framed { border-color: var(--ink); background: #fff; }
.step i { width: 1.75rem; height: 1.75rem; border-radius: 50%; display: inline-grid; place-items: center; font-style: normal; font-size: 1rem; font-weight: 700; background: var(--ink); color: #fff; }
.step.todo i { background: none; color: var(--ink2); border: 0.1rem solid var(--ink2); }
.step i.tick::after { content: ""; width: 0.45rem; height: 0.8rem; border: solid #fff; border-width: 0 0.18rem 0.18rem 0; transform: translateY(-0.1rem) rotate(45deg); }
.steps .dots { width: 3rem; border-top: 0.15rem dotted var(--ink2); }
.steps .line { width: 3rem; border-top: 0.15rem solid var(--ink); }

/* ---------- the textbook page ---------- */
.page { position: relative; background: var(--paper); border: 0.094rem solid var(--edge); border-radius: 0.2rem;
  box-shadow: 0.25rem 0.3rem 0 var(--desk-shadow), inset -0.6rem 0 0 -0.3rem #E3EADB; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.page-head { display: flex; align-items: center; gap: 2.2rem; padding: 1.2rem 1.4rem 0.4rem 5.8rem; position: relative; }
.ptitle { font-family: var(--round); color: var(--green); font-weight: 800; font-size: 2.1rem; margin: 0; letter-spacing: 0.05em; white-space: nowrap; }
.cliplabel { position: relative; background: var(--tab); font-weight: 700; white-space: nowrap; font-size: 1rem; padding: 0.55rem 1rem 0.55rem 1.4rem; transform: rotate(-0.4deg); }
.cliplabel::before { content: ""; position: absolute; left: -0.25rem; top: -0.9rem; width: 0.65rem; height: 2.4rem; border: 0.16rem solid #8C99A4; border-radius: 0.4rem; background: transparent; }
.ptext { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 1.8rem 1.6rem 0; margin-bottom: 5.6rem; position: relative; overscroll-behavior: contain; }
/* a paper band that stays at the top of the scrolling text, so no half line or stray underline peeks out under the title */
.ptext::before { content: ""; position: -webkit-sticky; position: sticky; top: 0; display: block; height: 1.1rem; background: var(--paper); z-index: 2; pointer-events: none; }
.para { display: flex; margin: 0 0 0.15rem; }
/* blank paper after the last paragraph, so any paragraph (even the last) can start at the top under the title */
.lesson.stage2 .ptext::after { content: ""; display: block; height: 45vh; }
.para.gap { margin-bottom: 1.4rem; }
.pn { flex: 0 0 6.1rem; text-align: right; padding-right: 1.5rem; font-size: 1.125rem; color: var(--ink2); line-height: 3.1rem; position: relative; }
.pbody { font-family: var(--kai); font-size: 1.375rem; line-height: 2.27em; text-indent: 2em; letter-spacing: 0.06em; flex: 1; color: var(--ink);
  -webkit-user-select: text; user-select: text; }
.g { white-space: nowrap; }
.sen { -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0.22em 0 0.86em; }
.sen.picked { background: var(--yellow); }
.sen.added { text-decoration: underline dashed var(--dash); text-decoration-thickness: 0.14rem; text-underline-offset: 0.42em; }
.c { position: relative; }
.c[data-py]::after { content: attr(data-py); position: absolute; left: 50%; top: 1.66em; transform: translateX(-50%); font-family: var(--ui); font-size: max(0.727em, 15px);
  color: var(--py); letter-spacing: 0; line-height: 1; text-indent: 0; white-space: nowrap; pointer-events: none; }
.w { cursor: pointer; border-radius: 0.25rem; }
.w.looked { text-decoration: underline solid var(--pink-line); text-decoration-thickness: 0.2rem; text-underline-offset: 0.16em; }
.w.open { background: var(--pink); box-shadow: 0 0 0 0.1rem var(--pink-edge); }
.stage2 .w:not(.looked) { cursor: inherit; }
.stage2 .pbody { cursor: pointer; }
.more { position: absolute; right: 2rem; bottom: 3.9rem; font-size: 1rem; color: var(--ink2); background: var(--paper); padding: 0.2rem 0.4rem; pointer-events: none; }
.veil { position: absolute; left: 0; right: 0; background: var(--paper); z-index: 1; }
.more .chev { transform: rotate(135deg); width: 0.55em; height: 0.55em; margin: 0 0.5rem 0.15rem 0; }
.track { position: absolute; left: 0; bottom: 0; width: 100%; height: 3.6rem; pointer-events: none; }
.bookmark { position: absolute; left: -0.6rem; width: 4.1rem; height: 5rem; z-index: 3; transition: top 0.4s ease; pointer-events: none; }
.lesson.stage2 .bookmark { left: -1.3rem; width: 3.5rem; height: 4.3rem; }
.page-wrap { position: relative; min-height: 0; display: flex; flex-direction: column; }

/* the yellow dock while a sentence is picked */
.dock { position: absolute; left: 0; right: 0; bottom: 0; background: var(--dock); border-top: 0.125rem dashed var(--dash); display: flex; align-items: center;
  gap: 2rem; padding: 0.9rem 1.5rem 0.9rem 2.4rem; z-index: 3; }

/* ---------- the word card (pink slip) ---------- */
.side { display: flex; flex-direction: column; gap: 1.2rem; min-height: 0; }
.card { background: var(--pink-soft); border: 0.094rem solid #E3A6C2; padding: 1.2rem 1.3rem 1.3rem; display: flex; flex-direction: column; position: relative; }
.card .cpy { color: var(--pink-py); font-weight: 700; font-size: 1.2rem; letter-spacing: 0.08em; min-height: 1.5rem; }
.card .cword { font-family: var(--kai); font-size: 3rem; line-height: 1.25; font-weight: 700; letter-spacing: 0.06em; }
.card .cx { position: absolute; right: 1rem; top: 0.9rem; width: 2.9rem; height: 2.9rem; border: 0.125rem solid var(--ink); border-radius: 0.5rem; background: #fff; display: grid; place-items: center; font-size: 1.6rem; line-height: 1; }
.card .en { position: absolute; right: 1.2rem; top: 5.3rem; }
/* EN is one boxed key everywhere; filled light blue while the English shows */
.en { text-decoration: none; background: #fff; border: 0.1rem solid var(--blue); border-radius: 0.4rem; min-height: 2.4rem; min-width: 2.9rem; padding: 0 0.5rem; font-size: 1.05rem; }
.en[aria-pressed="true"] { background: #E3ECFF; }
.card hr { border: 0; border-top: 0.125rem dashed #C7909F; margin: 0.6rem 0 1rem; width: 100%; }
.card .mean { font-weight: 700; font-size: 1.25rem; line-height: 1.5; }
.card .ex { margin-top: 0.8rem; font-size: 1.05rem; line-height: 1.6; }
.card .ex b { color: var(--pink-py); }
.card .eng { margin-top: 0.6rem; color: var(--ink2); font-size: 1rem; }
.card .note { font-size: 1rem; color: var(--ink2); line-height: 1.6; }
.card .grow { flex: 1; min-height: 1rem; }
.card .btn-blue { align-self: stretch; font-size: 1.12rem; padding: 0 0.6rem; white-space: nowrap; gap: 0.4rem; }
.card .saved { color: var(--pink-py); font-weight: 700; font-size: 1.05rem; text-align: center; padding: 0.6rem 0; }
.tally h3 { margin: 0 0 0.7rem; font-size: 1.125rem; }
.tally h3 b { color: var(--pink-edge); font-size: 1.4rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip { font-family: var(--kai); font-size: 1.2rem; background: var(--pink); border: 0.1rem solid var(--pink-edge); border-radius: 0.4rem; padding: 0.35rem 0.6rem; min-height: 2.9rem; }
.chip.on { box-shadow: 0 0 0 0.15rem var(--pink-edge) inset; }
.side .go { margin-top: auto; flex: 0 0 auto; }
.side > .card { flex: 0 1 auto; overflow-y: auto; min-height: 0; }
.side > .tally { flex: 0 1 auto; overflow-y: auto; min-height: 0; }

/* stage ② word card: docked over the passage page */
.card.docked { position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; border-width: 0.094rem 0 0; max-height: 75%; overflow: auto; }
.card.docked .cword { font-size: 2.4rem; }

/* ---------- the 作业本 ---------- */
.book-col { display: flex; flex-direction: column; min-height: 0; }
.tabs { display: flex; gap: 0.35rem; padding: 0 0.6rem 0 1.4rem; align-items: flex-end; height: 2.8rem; position: relative; z-index: 1; }
.tabs button { flex: 1 1 0; min-width: 0; height: 2.25rem; border: 0.094rem solid var(--tabline); border-bottom: 0; border-radius: 0.5rem 0.5rem 0 0; background: #F2F5F8;
  font-size: 1.05rem; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 0.15rem; padding: 0; color: var(--ink); }
.tabs button.cur { flex: 1.9 1 0; height: 2.8rem; background: var(--book); font-weight: 800; margin-bottom: -0.1rem; border-color: var(--edge); }
.tabs button.lock { color: #8A97A3; background: #E6EBEF; }
.tabs .tk { display: inline-block; width: 0.42rem; height: 0.75rem; border: solid var(--ink); border-width: 0 0.15rem 0.15rem 0; transform: rotate(45deg) translate(-0.05rem, -0.1rem); margin-left: 0.3rem; }
.book { flex: 1; min-height: 0; position: relative; background: var(--book); border: 0.094rem solid var(--edge); box-shadow: 0.25rem 0.3rem 0 var(--desk-shadow); display: flex; flex-direction: column; }
.book::before, .book::after { content: ""; position: absolute; top: 0; bottom: 0; border-left: 0.094rem solid var(--margin); pointer-events: none; }
.book::before { left: 4.4rem; } .book::after { left: 4.7rem; }
.book .qhead { position: relative; font-family: var(--kai); font-size: 1.2rem; line-height: 2.5rem; padding: 0.9rem 1.4rem 0.7rem 5.6rem; border-bottom: 0.094rem solid var(--margin); letter-spacing: 0.03em; }
.book .qhead .mk { font-family: var(--ui); font-size: 1rem; margin-left: 0.3rem; }
.lines { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; position: relative; padding: 0 1.4rem 0 5.6rem;
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--pitch) - 0.094rem), var(--rule) calc(var(--pitch) - 0.094rem), var(--rule) var(--pitch));
  background-attachment: local; }
.lines > * { line-height: var(--pitch); }
.ans { position: relative; }
.ans .back, .ans textarea { font-family: var(--kai); font-size: 1.3rem; line-height: var(--pitch); letter-spacing: 0.04em; padding: 0; margin: 0; border: 0;
  white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; width: 100%; }
.ans .back { position: absolute; inset: 0; color: transparent; pointer-events: none; }
.ans .back mark { background: var(--added); color: transparent; border-bottom: 0.2rem dashed var(--dash); padding: 0.25rem 0 0.1rem; }
.ans .back mark.fade { animation: fade 0.9s ease forwards; }
@keyframes fade { to { background: transparent; border-bottom-color: transparent; } }
.ans textarea { position: relative; background: transparent; color: var(--ink); resize: none; outline: none; display: block; min-height: calc(var(--pitch) * 2); overflow: hidden; caret-color: var(--blue); }
.ans textarea::placeholder { color: #8A97A3; font-family: var(--ui); font-size: 1.05rem; }
.ans .done { font-family: var(--kai); font-size: 1.3rem; letter-spacing: 0.04em; white-space: pre-wrap; }
.slipmark { text-decoration: underline wavy var(--red); text-decoration-thickness: 0.1rem; text-underline-offset: 0.3em; }
.pencil { font-family: var(--kai); color: var(--ink2); font-size: 1.2rem; letter-spacing: 0.03em; }
.pencil .mk { display: inline-block; width: 2rem; font-family: var(--ui); }
.pencil.in { padding-left: 2rem; }
.pencil.arrow { position: relative; padding-left: 2.6rem; }
.pencil.arrow::before { content: ""; position: absolute; left: 0.5rem; top: -1.6rem; height: 3.6rem; border-left: 0.12rem solid var(--ink2); }
.pencil.arrow::after { content: ""; position: absolute; left: 0.18rem; top: -1.6rem; width: 0.55rem; height: 0.55rem; border: solid var(--ink2); border-width: 0.12rem 0 0 0.12rem; transform: rotate(45deg); }
.red { color: var(--red-text); font-family: var(--kai); font-size: 1.2rem; }
.red .tick { display: inline-block; width: 0.6rem; height: 1.1rem; border: solid var(--red); border-width: 0 0.2rem 0.2rem 0; transform: rotate(45deg) translate(-0.1rem, -0.2rem); margin: 0 1rem 0 0.4rem; }
.red .dash { display: inline-block; width: 1rem; border-top: 0.18rem solid var(--ink2); margin: 0 0.8rem 0.35rem 0.2rem; }
.red.miss { color: var(--ink2); }
.red .pts { font-family: var(--ui); font-weight: 700; font-size: 1rem; margin-left: 0.6rem; }
.label { font-weight: 700; font-size: 1.05rem; }
.label small { font-weight: 400; color: var(--ink2); margin-left: 0.4rem; font-size: max(15px, 0.94rem); }
.model { font-family: var(--kai); font-size: 1.2rem; }
.score { position: absolute; left: 0.4rem; top: 0.7rem !important; width: 3.6rem; height: 3.6rem; border: 0.16rem solid var(--red); border-radius: 50% 46% 52% 48%; color: var(--red-text);
  font-family: var(--kai); font-size: 1.25rem; display: grid; place-items: center; transform: rotate(-8deg); line-height: 1; top: 0.2rem; background: transparent; }
.score sup { font-size: 0.8em; } .score sub { font-size: 0.8em; }
.stamp { display: inline-block; border: 0.18rem double var(--red); color: var(--red-text); font-family: var(--kai); font-size: 1.4rem; padding: 0 0.7rem; line-height: 2.3rem; transform: rotate(-6deg); margin: 0.3rem 0 0 0.6rem; letter-spacing: 0.2em; }
.ainote { font-size: max(15px, 0.95rem); color: var(--ink2); font-family: var(--ui); }
.foot { display: flex; align-items: center; gap: 1rem; padding: 0.8rem 1.4rem 1rem 5.6rem; min-height: 5.2rem; }
.foot .count { font-size: 1rem; color: var(--ink2); }
.foot .grow { flex: 1; }
.thinking { font-family: var(--kai); color: var(--ink2); font-size: 1.2rem; }
.thinking::after { content: "……"; animation: dots 1.2s steps(3) infinite; display: inline-block; width: 0; overflow: visible; }

/* ---------- screens ---------- */
.screen { position: fixed; inset: 0; display: flex; flex-direction: column; }
.lesson .body { flex: 1; min-height: 0; display: grid; gap: 1.1rem; padding: 0.3rem 1.4rem 0.9rem 3.3rem; }
.lesson.stage1 .body { grid-template-columns: minmax(0, 1fr) 15.6rem; }
.lesson.stage2 .body { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.lesson.stage2 .page-head { padding-left: 5.8rem; gap: 1.6rem; }
.lesson.stage2 .pbody { font-size: 1.32rem; }
.lesson.stage2 .pn { flex-basis: 5.6rem; padding-right: 1.3rem; }
.toast { position: fixed; left: 4.4rem; top: 5.7rem; pointer-events: none; max-width: 30rem; background: var(--ink); color: #fff; padding: 0.8rem 1.4rem; border-radius: 0.6rem; font-size: 1.05rem; z-index: 20; }

/* login */
.login .top { justify-content: space-between; }
.login .cls { font-size: 1.15rem; display: flex; gap: 1rem; align-items: center; }
.login .cls b { font-size: 1.2rem; }
.login h1 { font-size: 2rem; margin: 0.6rem 0 1.2rem 2rem; }
.codebox { display: flex; gap: 0.9rem; margin: 2rem 0 0 2rem; position: relative; }
.codebox input { position: absolute; inset: 0; opacity: 0; font-size: 16px; width: 100%; }
.codebox b { width: 4.4rem; height: 5.2rem; background: #fff; border: 0.1rem solid var(--edge); border-radius: 0.3rem; display: grid; place-items: center; font-size: 2.2rem; font-weight: 700; }
.codebox b.cur { border: 0.16rem solid var(--ink); }
.codebox.bad b { border-color: var(--red); }
.sub { margin: 1.2rem 0 0 2rem; color: var(--ink2); font-size: 1.1rem; min-height: 1.6rem; }
.sub.bad { color: var(--red-text); font-weight: 700; }
.names { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 0.9rem 0.8rem; padding: 0 1.6rem 1.4rem 2rem; overflow-y: auto; align-content: start; flex: 1; }
.nbook { position: relative; aspect-ratio: 98 / 134; background: #E8C08A; border: 0.094rem solid var(--edge); color: var(--ink); border-radius: 0.2rem; box-shadow: 0.2rem 0.25rem 0 var(--desk-shadow);
  padding: 0; display: flex; align-items: center; justify-content: center; border-left: 0.9rem solid rgba(0,0,0,0.13); }
/* light covers like the shelf spines (teacher: dark covers too heavy): tan, sage, sky in turn */
.nbook.c1 { background-color: #AFD8AE; } .nbook.c2 { background-color: #A6D3E0; }
.nbook span { background: #fff; width: 74%; padding: 0.2rem 0.3rem 0.35rem; text-align: left; line-height: 1.1; }
.nbook em { font-style: normal; font-size: max(15px, 0.95rem); display: block; }
.nbook strong { display: block; font-family: var(--kai); font-size: 1.45rem; font-weight: 700; white-space: nowrap; text-align: center; overflow: hidden; }
.nbook strong.latin { font-family: var(--ui); font-size: 1.05rem; font-weight: 600; }
.nbook.pick { transform: translate(-0.2rem, -0.3rem); box-shadow: 0.45rem 0.55rem 0 #AFBBC6; outline: 0.16rem solid var(--ink); }
.nbook.pick::after { content: ""; position: absolute; right: -0.9rem; top: -0.9rem; width: 2rem; height: 2rem; border-radius: 50%; background: var(--ink); border: 0.16rem solid #fff;
  background-image: linear-gradient(45deg, transparent 0 0); }
.nohelp { align-self: center; color: var(--ink2); font-size: 1.05rem; line-height: 1.6; grid-column: span 2; }
.pinwrap { flex: 1; display: grid; grid-template-columns: 1fr 1.15fr; padding: 1rem 2.4rem 2rem 4.3rem; gap: 2rem; min-height: 0; }
.pinleft { display: flex; flex-direction: column; justify-content: center; }
.bigbook { display: flex; align-items: center; gap: 2.2rem; }
.bigbook .nbook { width: 13.3rem; aspect-ratio: auto; height: 18.3rem; border-left-width: 0.9rem; }
.bigbook .nbook span { width: 78%; padding: 0.4rem 0.5rem 1rem; }
.bigbook .nbook strong { font-size: 2.6rem; }
.bigbook .nbook strong.latin { font-size: 1.8rem; }
.pinleft h1 { margin: 3.6rem 0 0; font-size: 2.1rem; }
.pinleft .sub { margin-left: 0; }
.pinright { display: flex; flex-direction: column; justify-content: center; align-items: center; }
.pinboxes { display: flex; gap: 1.6rem; margin-bottom: 2.4rem; }
.pinboxes b { width: 5.8rem; height: 5.8rem; background: #fff; border: 0.094rem solid var(--edge); border-radius: 0.2rem; display: grid; place-items: center; }
.pinboxes b.on::after { content: ""; width: 1.4rem; height: 1.4rem; border-radius: 50%; background: var(--ink); }
.pinboxes b.cur { border: 0.16rem solid var(--ink); }
.pinboxes b.cur::after { content: ""; width: 0.12rem; height: 2.6rem; background: var(--blue); animation: blink 1s steps(1) infinite; }
.pinboxes.shake { animation: shake 0.4s; }
@keyframes shake { 25% { transform: translateX(-0.6rem); } 75% { transform: translateX(0.6rem); } }
@keyframes blink { 50% { opacity: 0; } }
.pad { display: grid; grid-template-columns: repeat(3, 10rem); gap: 1.2rem; }
.pad button { height: 6.2rem; background: #fff; border: 0.094rem solid #8C99A4; border-radius: 0.5rem; box-shadow: 0 0.25rem 0 #A5B1BC; font-size: 2.1rem; font-weight: 600; }
.pad button:active { transform: translateY(0.15rem); box-shadow: 0 0.1rem 0 #A5B1BC; }
.pad .del { font-size: 1.15rem; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 0.6rem; }
.pad .del svg { width: 3.6rem; height: 2.2rem; }
.pad .blank { visibility: hidden; }

/* shelf */
.shelf .top h1 { font-size: 2rem; margin: 0; font-weight: 700; }
.shelf .top .cls { font-size: 1.1rem; color: var(--ink2); font-weight: 600; }
.shelfbody { flex: 1; position: relative; min-height: 0; overflow: visible; }
.shelf { overflow: hidden; }
.ledge { position: absolute; left: -20rem; right: -20rem; top: 32.25rem; height: 2rem; background: linear-gradient(#DDBB8D 0 35%, #C69A66 35% 100%); }
.ledge-shadow { position: absolute; left: -20rem; right: -20rem; top: 34.25rem; height: 0.5rem; background: #C3CED8; }
.cover { position: absolute; left: 6rem; top: 3rem; width: 21.3rem; height: 29.2rem; background: #D3E7F3; border: 0; padding: 0; overflow: hidden; text-align: left;
  box-shadow: inset 0.7rem 0 0 #C5D5DE, inset -0.6rem 0 0 #CBD5C3; }
.cover .lesson-l { position: absolute; left: 1.7rem; top: 1.6rem; font-size: 1.05rem; font-weight: 700; }
.cover .ctitle { position: absolute; left: 0; right: 0; top: 4.4rem; text-align: center; font-family: var(--round); font-weight: 900; font-size: 3.9rem; color: var(--green);
  -webkit-text-stroke: 0.08em #fff; paint-order: stroke fill; letter-spacing: 0.04em; }
.cover svg { position: absolute; left: 0; bottom: 0; width: 100%; height: 60%; }
.cover-stand { position: absolute; left: 5.3rem; top: 31.4rem; width: 22.8rem; height: 1rem; background: #C69A66; border-top: 0.25rem solid #DDBB8D; }
.spines { position: absolute; left: 32.4rem; top: 0; height: 32.25rem; display: flex; align-items: flex-end; gap: 0.25rem; }
.spine { border: 0.094rem solid var(--ink); background: var(--c, #E8C08A); width: var(--w, 3.6rem); height: var(--h, 23rem); position: relative; padding: 0;
  writing-mode: vertical-rl; font-family: var(--kai); font-size: 1.5rem; display: flex; align-items: center; justify-content: center; letter-spacing: 0.1em;
  box-shadow: inset -0.35rem 0 0 rgba(0,0,0,0.12), 0.35rem 0.3rem 0 #AFBBC6; color: #2B2B2B; }
.spine::before, .spine::after { content: ""; position: absolute; left: 0; right: 0; border-top: 0.3rem solid rgba(0,0,0,0.14); }
.spine::before { top: 1.4rem; } .spine::after { bottom: 1.6rem; }
.spine.next { background: #E7E9EE; border-color: #C9CED6; box-shadow: none; color: #5B6470; cursor: default; }
.under { position: absolute; top: 35.6rem; font-weight: 700; font-size: 1rem; text-align: center; width: 6rem; transform: translateX(-50%); }
.under.next { font-weight: 500; color: var(--ink2); line-height: 1.3; }
.shelfnote { position: absolute; left: 32.4rem; top: 38.4rem; color: var(--ink2); font-size: 1.05rem; }
.wordbook { position: absolute; left: 58rem; top: 17.45rem; width: 11.2rem; height: 14.8rem; background: var(--pink); border: 0.094rem solid var(--ink2); border-radius: 0.3rem;
  border-left: 1.3rem solid #EFA3C4; box-shadow: 0.45rem 0.45rem 0 #AFBBC6; padding: 0; display: flex; flex-direction: column; align-items: center; }
.wordbook .lab { margin-top: 2.5rem; background: #fff; width: 75%; padding: 0.6rem 0.4rem; text-align: center; }
.wordbook .lab b { display: block; font-family: var(--kai); font-size: 1.9rem; letter-spacing: 0.04em; white-space: nowrap; }
.wordbook .lab small { font-size: 1rem; }
.wordbook .n { margin-top: 1.6rem; font-weight: 700; font-size: 1.25rem; }
.answered { position: absolute; left: 6rem; top: 35.6rem; display: flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 1.2rem; }
.answered .lab2 { margin-right: 1rem; }
.qdot { width: 1.6rem; height: 1.6rem; border-radius: 50%; border: 0.094rem solid var(--ink2); display: inline-grid; place-items: center; }
.qdot.on { background: var(--ink); border-color: var(--ink); }
.qdot.on::after { content: ""; width: 0.35rem; height: 0.65rem; border: solid #fff; border-width: 0 0.15rem 0.15rem 0; transform: translateY(-0.08rem) rotate(45deg); }
.qdot.cur { border-width: 0.25rem; border-color: var(--ink); }
.shelf .go { position: absolute; left: 6rem; top: 39.2rem; width: 20.6rem; min-height: 4.6rem; font-size: 1.5rem; }
.shelf .empty { position: absolute; left: 6rem; top: 12rem; font-size: 1.3rem; color: var(--ink2); }

/* 生词本 */
.words .top h1 { font-size: 2rem; margin: 0; font-weight: 700; }
.wtabs { display: flex; gap: 0.35rem; padding: 0 1.4rem 0 4rem; height: 2.9rem; align-items: flex-end; }
.wtabs button { border: 0.094rem solid var(--tabline); border-bottom: 0; border-radius: 0.5rem 0.5rem 0 0; background: #fff; font-size: 1.05rem; padding: 0 1rem; height: 2.4rem; font-family: var(--kai); }
.wtabs button.cur { height: 2.9rem; font-family: var(--ui); font-weight: 800; font-size: 1.15rem; margin-bottom: -0.15rem; position: relative; z-index: 2; }
.wbook { flex: 1; min-height: 0; margin: 0 1.6rem 1rem 2.4rem; background: #EFA3C4; padding: 0.4rem; border-radius: 0.4rem; box-shadow: 0.3rem 0.35rem 0 #AFBBC6; display: flex; }
.wpages { flex: 1; background: #FDFCF8; overflow-y: auto; display: grid; grid-template-columns: 1fr 1fr; column-gap: 3rem; padding: 1rem 2rem 2rem; position: relative;
  background-image: linear-gradient(to right, transparent calc(50% - 0.7rem), #EEE8E2 calc(50% - 0.7rem), #EEE8E2 calc(50% + 0.7rem), transparent calc(50% + 0.7rem)); align-content: start; }
.went { display: grid; grid-template-columns: 7.4rem 1fr; gap: 0 1rem; padding: 1.4rem 0.8rem 1.4rem; border-bottom: 0.094rem dashed #C9C3BC; text-align: left; background: none; border-top: 0; border-left: 0; border-right: 0; min-height: 10rem; align-content: start; }
.went.on { background: var(--pink-soft); border-radius: 0.3rem; }
.went .wz { display: flex; gap: 0.5rem; justify-content: center; }
.went .wz span { display: flex; flex-direction: column; align-items: center; }
.went .wz small { color: var(--pink-py); font-weight: 700; font-size: 1rem; }
.went .wz b { font-family: var(--kai); font-size: 2.6rem; line-height: 1.2; }
.went .src { grid-column: 1; text-align: center; font-family: var(--kai); color: var(--ink2); font-size: 1rem; margin-top: 0.5rem; }
.went .wm { grid-column: 2; grid-row: 1 / span 2; }
.went .wm strong { display: block; font-size: 1.15rem; margin-top: 0.3rem; }
.went .wm p { margin: 0.6rem 0 0; font-size: 1rem; line-height: 1.55; }
.went .wm p b { color: var(--pink-py); }
.went .wact { display: flex; align-items: center; gap: 1rem; margin-top: 0.8rem; }
.went .wact .eng { color: var(--ink2); flex: 1; }
.wempty { grid-column: 1 / -1; color: var(--ink2); font-size: 1.2rem; padding: 3rem 1rem; }

/* ---------- other sizes ---------- */
/* Chromebook / laptop (wide and a bit short) */
@media (max-aspect-ratio: 1/1) { .names { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
/* phone held sideways and other short screens */
@media (max-height: 560px) {
  :root { --pitch: 2.4rem; }
  .top { height: 3.4rem; gap: 0.8rem; padding: 0 0.8rem 0 1rem; }
  .btn-line { min-height: 2.6rem; font-size: 1rem; padding: 0 0.7rem; }
  .steps { font-size: 1rem; gap: 0.3rem; } .steps .dots, .steps .line { width: 1.2rem; }
  .step i { width: 1.4rem; height: 1.4rem; font-size: max(15px, 0.85rem); }
  .lesson .body { padding: 0.2rem 0.8rem 0.5rem 1.6rem; gap: 0.7rem; }
  .lesson.stage1 .body { grid-template-columns: minmax(0, 1fr) 13rem; }
  .page-head { padding: 0.5rem 0.8rem 0.2rem 3.2rem; gap: 1rem; }
  .ptitle { font-size: 1.5rem; } .cliplabel { font-size: max(15px, 0.95rem); padding: 0.3rem 0.7rem 0.3rem 1rem; }
  .pn { flex-basis: 3rem; padding-right: 0.8rem; line-height: 2.6rem; }
  .lesson.stage2 .pn { flex-basis: 2.6rem; padding-right: 0.6rem; }
  .pbody, .lesson.stage2 .pbody { font-size: 1.2rem; line-height: 2.2em; }
  .ptext { padding: 0.2rem 1rem 2.6rem 0; }
  .track { height: 1.8rem; } .more { bottom: 1.9rem; right: 1rem; } .ptext { margin-bottom: 3.4rem; }
  .bookmark { width: 2.6rem; height: 3.2rem; left: -0.5rem; }
  .btn-blue { min-height: 2.9rem; font-size: 1.05rem; padding: 0 1rem; }
  .card { padding: 0.7rem 0.9rem; } .card .cword { font-size: 2.2rem; } .card .cx { width: 2.6rem; height: 2.6rem; top: 0.6rem; right: 0.6rem; }
  .card .en { top: 3.9rem; } .card .mean { font-size: 1.05rem; } .card hr { margin: 0.3rem 0 0.5rem; }
  .side { gap: 0.6rem; } .chip { min-height: 2.6rem; font-size: 1.05rem; }
  .tabs { height: 2.3rem; padding-left: 0.6rem; } .tabs button { height: 1.9rem; font-size: max(15px, 0.95rem); } .tabs button.cur { height: 2.3rem; }
  .book::before { left: 2.2rem; } .book::after { left: 2.45rem; }
  .book .qhead { padding: 0.3rem 0.8rem 0.3rem 3rem; font-size: 1.05rem; line-height: 1.9rem; }
  .lines { padding: 0 0.8rem 0 3rem; } .foot { padding: 0.4rem 0.8rem 0.5rem 3rem; min-height: 3.6rem; }
  .ans .back, .ans textarea, .ans .done { font-size: 1.15rem; } .pencil, .red, .model { font-size: 1.05rem; }
  .score { left: 0.05rem; width: 2.1rem; height: 2.1rem; font-size: 15px; top: 0.3rem !important; }
  .dock { padding: 0.4rem 0.8rem; gap: 1rem; }
  .login h1 { font-size: 1.5rem; margin: 0.2rem 0 0.6rem 1.4rem; }
  .names { grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 0.5rem; padding: 0 1rem 1rem 1.4rem; }
  .nbook strong { font-size: 1.1rem; } .nbook em { font-size: max(15px, 0.8rem); } .nbook { border-left-width: 0.5rem; }
  .pinwrap { padding: 0.3rem 1rem 0.6rem 1.6rem; gap: 1rem; }
  .bigbook .nbook { width: 7rem; height: 9.6rem; } .bigbook .nbook strong { font-size: 1.6rem; } .bigbook { gap: 1rem; }
  .pinleft h1 { margin-top: 1rem; font-size: 1.4rem; } .pinleft .sub { margin-top: 0.4rem; font-size: 1rem; }
  .pinboxes { gap: 0.7rem; margin-bottom: 0.7rem; } .pinboxes b { width: 3rem; height: 3rem; } .pinboxes b.on::after { width: 0.8rem; height: 0.8rem; }
  .pinboxes b.cur::after { height: 1.4rem; }
  .pad { grid-template-columns: repeat(3, 6.4rem); gap: 0.45rem; } .pad button { height: 3rem; font-size: 1.4rem; }
  .pad .del svg { width: 2rem; height: 1.3rem; }
  .codebox { margin: 0.6rem 0 0 1.4rem; } .codebox b { width: 3rem; height: 3.6rem; font-size: 1.6rem; } .sub { margin: 0.6rem 0 0 1.4rem; }
  .shelfbody { width: 100% !important; }
  .cover { left: 2.5rem; top: 0.6rem; width: 12.5rem; height: 16.4rem; } .cover .ctitle { font-size: 2.6rem; top: 2.6rem; } .cover .lesson-l { left: 1rem; top: 0.8rem; }
  .cover-stand { left: 2rem; top: 16.9rem; width: 13.5rem; } .ledge { top: 17.5rem; } .ledge-shadow { top: 19.5rem; }
  .answered { left: 17rem; top: 3rem; } .shelf .go { left: 17rem; top: 6.6rem; width: 15rem; min-height: 3.4rem; font-size: 1.2rem; }
  .spines { left: 34rem; height: 17.5rem; } .spine { height: calc(var(--h) * 0.62); font-size: 1.1rem; } .under { top: 20rem; } .shelfnote { display: none; }
  .wordbook { left: auto !important; right: 2rem; top: 7.4rem; width: 8.2rem; height: 10.1rem; border-left-width: 0.9rem; }
  .wordbook .lab { margin-top: 1.2rem; } .wordbook .lab b { font-size: 1.4rem; } .wordbook .n { margin-top: 0.7rem; font-size: 1rem; }
  .wtabs { padding-left: 1.4rem; height: 2.3rem; } .wtabs button { height: 2rem; font-size: max(15px, 0.95rem); } .wtabs button.cur { height: 2.3rem; }
  .wbook { margin: 0 0.8rem 0.5rem 1rem; } .wpages { padding: 0.4rem 1rem 1rem; column-gap: 1.4rem; }
  .went { min-height: 0; padding: 0.8rem 0.4rem; grid-template-columns: 5.6rem 1fr; } .went .wz b { font-size: 1.9rem; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
/* phone held upright: ask to turn it (the screens are made for landscape) */
.turn { display: none; }
@media (orientation: portrait) and (max-width: 600px) {
  .turn { display: grid; place-items: center; position: fixed; inset: 0; background: var(--desk); z-index: 50; font-size: 1.4rem; font-weight: 700; padding: 2rem; text-align: center; }
}
@media (max-height: 560px) { .lesson.stage2 .ptitle { display: none; } .lesson.stage2 .page-head { padding-left: 2.6rem; } }
.red .half { font-style: normal; font-family: var(--ui); font-weight: 800; color: var(--red-text); font-size: 1.15rem; display: inline-block; width: 1.4rem; margin: 0 0.85rem 0 0.25rem; text-align: center; }
.red.changed { font-family: var(--ui); font-weight: 700; font-size: 1rem; }
/* a key-point line: mark, the point (wraps on its own), the marks (never split from 分) */
.lines .red.pointline { display: flex; align-items: baseline; }
.red .pt { flex: 1 1 auto; min-width: 0; }
.red .pts { white-space: nowrap; flex: 0 0 auto; }
.red .tick, .red .dash, .red .half { flex: 0 0 auto; }
.score { white-space: nowrap; }
.score.long { width: 3.9rem; font-size: max(15px, 1rem); letter-spacing: -0.02em; }
@media (max-height: 560px) { .score.long { width: 2.6rem; font-size: 15px; letter-spacing: -0.06em; } }
