/* 英文之道 · Tao of ESL — created by deng studio

   The page is a copybook. Two papers, three inks:
     exercise paper  white, green ruling  — where English is practised (四线三格)
     practice paper  straw, red grid      — where the brush character lives (米字格)
     black ink       what you have learned
     vermilion       the model you trace, and the teacher's marks (描红 · 朱批)
     blue-black      English, the way it was first written with a fountain pen
*/
:root {
  --paper: #FBF9F3;
  --paper-2: #F3F0E5;
  --straw: #EBDCAD;
  --ink: #17181A;
  --ink-2: #45464B;
  --ink-3: #6F6F6C;
  --zhu: #CF3622;
  --zhu-trace: rgba(207, 54, 34, .28);
  --zhu-wash: rgba(207, 54, 34, .07);
  --blue: #1A2B5C;
  --rule: rgba(64, 146, 106, .46);
  --rule-soft: rgba(64, 146, 106, .24);
  --sans: "Tao Digits", "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  --serif: "Libre Caslon Text", "Iowan Old Style", "Palatino Linotype", Georgia, "Songti SC", serif;
  --display: "Libre Caslon Display", "Libre Caslon Text", "Iowan Old Style", Georgia, serif;
  --kai: "Ma Shan Zheng", "Kaiti SC", "STKaiti", "KaiTi", "BiauKai", "Songti SC", serif;
  --pad: 1.15rem;
  --st-cap: .61em; --st-x: .78em; --st-base: 1.28em; --st-desc: 1.44em;
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .32 0 0 0 0 .28 0 0 0 0 .16 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
  --fibre: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.02 .55' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .42 0 0 0 0 .3 0 0 0 0 .08 0 0 0 .2 -.02'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23f)'/%3E%3C/svg%3E");
  --cross: repeating-linear-gradient(90deg, var(--rule-soft) 0 3px, transparent 3px 6px) center / 100% 1px no-repeat,
           repeating-linear-gradient(0deg, var(--rule-soft) 0 3px, transparent 3px 6px) center / 1px 100% no-repeat;
}

/* Atkinson draws zero with a slash. A learner will never see that on the test, so digits come from the system face. */
@font-face { font-family: "Tao Digits"; font-weight: 400; src: local("Helvetica Neue"), local("HelveticaNeue"), local("Roboto"), local("Segoe UI"), local("Arial"); unicode-range: U+30-39; }
@font-face { font-family: "Tao Digits"; font-weight: 600 700; src: local("Helvetica Neue Bold"), local("HelveticaNeue-Bold"), local("Roboto Bold"), local("Segoe UI Bold"), local("Arial Bold"); unicode-range: U+30-39; }

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 18px; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html[data-size="1"] { font-size: 20.5px; }
html[data-size="2"] { font-size: 23px; }
body {
  margin: 0; color: var(--ink); background: var(--paper) var(--noise);
  font: 400 1rem/1.6 var(--sans); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
body.noscroll { overflow: hidden; }
#app { max-width: 35rem; margin: 0 auto; padding: 0 var(--pad) calc(6.4rem + env(safe-area-inset-bottom)); }
body[data-chrome="off"] #app { padding-bottom: 2rem; }
body[data-chrome="off"] #tabs { display: none; }
h1, h2, h3, p { margin: 0; }
a { color: var(--blue); }
[hidden] { display: none !important; }
:focus-visible { outline: 2.5px solid var(--blue); outline-offset: 3px; }
button { -webkit-appearance: none; appearance: none; touch-action: manipulation; }

.kai { font-family: var(--kai); font-weight: 400; }
.num { font-family: var(--display); font-variant-numeric: lining-nums; }
.en { color: var(--blue); }
.muted { color: var(--ink-3); }
.small { font-size: .86rem; }
.lbl { font-size: .84rem; color: var(--ink-3); }
.bi { display: inline-flex; flex-wrap: wrap; align-items: baseline; column-gap: .55em; }
.bi-en { font-size: .82em; font-weight: 400; opacity: .72; }
.btn .bi { justify-content: center; }
.ic svg { display: block; width: 1.5rem; height: 1.5rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ───────── brush character ───────── */
.hz { display: block; width: 100%; height: auto; overflow: visible; }
.hz-trace { fill: var(--zhu-trace); }
.hz-ink { fill: none; stroke: var(--ink); stroke-width: 200; stroke-linecap: round; stroke-linejoin: round; }
.hz-grid rect { fill: none; stroke: var(--zhu); stroke-opacity: .62; stroke-width: 5; }
.hz-dash { fill: none; stroke: var(--zhu); stroke-opacity: .36; stroke-width: 3; stroke-dasharray: 14 14; }
.hz-big .hz-body { filter: url(#tao-rough); }
.hz .hz-ink { transition: opacity .9s; }
.hz.fading .hz-ink { opacity: 0; }

.sheet {
  position: relative; background: var(--straw) var(--fibre); padding: 1.05rem 1.05rem .75rem;
  box-shadow: 0 1px 0 rgba(96, 66, 0, .2), 0 22px 30px -24px rgba(70, 45, 0, .6); transform: rotate(-.7deg);
}
.sheet-cap { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-top: .55rem; }
.sheet-cap .kai { font-size: 1.3rem; }
.sheet-cap .num { font-size: 1.7rem; line-height: 1; }

.ring { position: absolute; pointer-events: none; overflow: visible; }
.ring path { fill: none; stroke: var(--zhu); stroke-width: 6; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 0; }

.brushbar { display: block; width: 100%; height: .62rem; overflow: visible; }
.bb-trace { fill: none; stroke: var(--zhu-trace); stroke-width: 4.2; stroke-linecap: round; }
.bb-ink { fill: none; stroke: var(--ink); stroke-width: 4.8; stroke-linecap: round; transition: stroke-dashoffset .5s cubic-bezier(.3, .1, .3, 1); }

.seal { display: block; width: 100%; height: auto; filter: url(#tao-rough-ui); }
.seal-bg { fill: var(--zhu); }
.seal-t { fill: #FFF6E6; }
.seal-latin { font-family: var(--serif); font-weight: 700; }

/* ───────── header and tabs ───────── */
.top { display: flex; align-items: center; justify-content: space-between; padding: 1rem 0 .6rem; }
.brand { display: flex; align-items: baseline; gap: .6rem; color: inherit; text-decoration: none; }
.lockup-zh { display: inline-flex; }
.lockup-zh .hz { width: 1.6rem; height: 1.6rem; }
.brand-en { font: italic 400 1rem var(--serif); color: var(--ink-2); white-space: nowrap; }
.sizebtn { display: inline-flex; align-items: baseline; gap: .1rem; border: 0; background: none; padding: .5rem .3rem; color: var(--ink-2); font-family: var(--serif); cursor: pointer; }
.sz-a { font-size: .95rem; } .sz-b { font-size: 1.45rem; }

#tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: center; gap: .2rem;
  padding: .45rem .6rem calc(.4rem + env(safe-area-inset-bottom));
  background: var(--paper) var(--noise); border-top: 1.5px solid var(--rule);
}
.tab { flex: 1; max-width: 7.5rem; display: grid; justify-items: center; gap: .1rem; padding: .15rem 0; color: var(--ink-2); text-decoration: none; }
.tab-g { display: grid; place-items: center; width: 2.3rem; height: 2.3rem; font-size: 1.55rem; line-height: 1; border-radius: 4px; }
.tab.on { color: var(--ink); }
.tab.on .tab-g { background: var(--zhu); color: #FFF6E6; transform: rotate(-3deg); }
.tab-l { font-size: .78rem; font-weight: 600; }
.tab-e { display: none; }

.ph { display: flex; align-items: center; gap: .5rem; padding: .9rem 0 .5rem; }
.ph-t { display: flex; flex-direction: column; font-weight: 400; }
.ph-t .kai { font-size: 1.7rem; line-height: 1.25; }
.ph-e { font: italic .95rem var(--serif); color: var(--ink-3); }
.iconbtn { display: grid; place-items: center; flex: none; width: 2.8rem; height: 2.8rem; margin-left: -.55rem; border: 0; border-radius: 50%; background: none; color: inherit; cursor: pointer; }

/* ───────── buttons and inputs ───────── */
.btn {
  position: relative; isolation: isolate; display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  width: 100%; min-height: 3.25rem; padding: .7rem 1.2rem; border: 0; border-radius: 3px; background: none;
  font: 600 1.05rem/1.25 var(--sans); color: var(--ink); text-decoration: none; text-align: center; cursor: pointer;
}
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-ink::before { content: ""; position: absolute; inset: -2px -3px; z-index: -1; border-radius: 4px; background: var(--ink); filter: url(#tao-rough-ui); }
.btn-line { box-shadow: inset 0 0 0 1.5px var(--ink); }
.btn:disabled { opacity: .32; cursor: default; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn-xl { flex-direction: column; gap: .2rem; min-height: 4.5rem; padding: .95rem 1.2rem; }
.btn-main { font-size: 1.15rem; }
.btn-sub { font-weight: 400; font-size: .86rem; opacity: .78; }
.linkbtn { border: 0; background: none; padding: .6rem 0; font: inherit; font-size: .9rem; color: var(--zhu); text-decoration: underline; cursor: pointer; }

.inp { width: 100%; min-height: 3rem; padding: .55rem .8rem; border: 0; border-radius: 3px; background: #fff; box-shadow: inset 0 0 0 1.5px var(--ink-3); font: inherit; color: var(--ink); }
.inp:focus { outline: none; box-shadow: inset 0 0 0 2.5px var(--ink); }
.inp-s { text-align: center; }
.field { display: grid; gap: .4rem; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.2rem; }
.chip, .pill { border: 0; border-radius: 99px; background: none; box-shadow: inset 0 0 0 1.2px var(--ink-3); font: inherit; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.chip { padding: .45rem .95rem; font-size: .9rem; }
.pill { padding: .32rem .7rem; font-size: .8rem; }
.chip.on, .pill.on { background: var(--ink); color: var(--paper); box-shadow: none; }

/* ───────── home ───────── */
.hero { display: grid; gap: 1.7rem; margin-top: .5rem; }
.hero .sheet { width: min(100%, 20.5rem); margin: 0 auto; }
.hero-h { font-size: clamp(2rem, 9.5vw, 2.75rem); line-height: 1.28; }
.hero-e { margin-top: .5rem; font: italic 1.05rem/1.4 var(--serif); color: var(--ink-2); }
.hero-p { margin: .9rem 0 1.3rem; color: var(--ink-2); }
.streak { margin-top: .9rem; font-size: .95rem; color: var(--ink-2); }
.streak .num { font-size: 1.35rem; color: var(--zhu); }
.hero-txt .note { margin-top: 1rem; }

.sec-h, .page-h { display: flex; flex-direction: column; gap: .1rem; font-weight: 400; }
.sec-h { margin: 2.6rem 0 .7rem; }
.sec-h .kai { font-size: 1.7rem; line-height: 1.25; }
.page-h { margin: .6rem 0 .2rem; }
.page-h .kai { font-size: 2.3rem; line-height: 1.2; }
.sec-e { font: italic .95rem var(--serif); color: var(--ink-3); }

.urows { border-top: 1.5px solid var(--rule); }
.urow { display: grid; grid-template-columns: 2.7rem 1fr 4.9rem; align-items: center; gap: .7rem; padding: .85rem .15rem; border-bottom: 1px solid var(--rule); color: inherit; text-decoration: none; }
.urow-n { position: relative; justify-self: center; padding: .15rem .2rem; font-size: 1.75rem; line-height: 1; }
.urow.new .urow-n { color: rgba(207, 54, 34, .5); }
.urow-t { display: block; font-weight: 600; font-size: 1.08rem; line-height: 1.3; }
.urow-e { display: block; font-size: .86rem; color: var(--ink-3); line-height: 1.3; }
.urow-p { display: grid; justify-items: end; gap: .2rem; }
.urow-c { font-size: .82rem; color: var(--ink-3); }
.urow.off { opacity: .42; }
.urow.cur { background: linear-gradient(90deg, var(--zhu-wash), transparent 75%); }

.quote { margin: 2.6rem 0 0; padding-left: 1rem; border-left: 3px solid var(--zhu); text-align: left; }
.quote .kai { font-size: 1.45rem; line-height: 1.5; }
.quote-en { margin: .3rem 0; font: italic 1rem/1.5 var(--serif); color: var(--ink-2); }
.quote cite { font-style: normal; font-size: .82rem; color: var(--ink-3); }
.foot { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem .9rem; margin-top: 2.6rem; font-size: .85rem; color: var(--ink-3); }
.foot [lang="en"] { font-family: var(--serif); font-style: italic; }

/* ───────── lesson page, rows, bank ───────── */
.lead { margin: .5rem 0 1.1rem; font-size: 1.04rem; color: var(--ink-2); }
.uprog { display: flex; align-items: center; gap: .8rem; margin-bottom: 1.3rem; }
.uprog .brushbar { flex: 1; }
.uprog .num { font-size: .95rem; color: var(--ink-2); white-space: nowrap; }
.stack { display: grid; gap: 1rem; }
.block { margin-top: .4rem; }
.block > .muted { margin-bottom: .8rem; }

.legend { display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; margin-bottom: .7rem; font-size: .84rem; color: var(--ink-3); }
.lg::before { content: "字"; margin-right: .3rem; font-family: var(--kai); font-size: 1.15rem; }
.lg.l0::before { color: rgba(207, 54, 34, .5); } .lg.l1::before { color: #A3A29C; } .lg.l2::before, .lg.l4::before { color: var(--ink); }
.lg.l4::before { box-shadow: 0 0 0 1.6px var(--zhu); border-radius: 50%; padding: 0 .12rem; }

.irows { border-top: 1.5px solid var(--rule); }
.irow { display: grid; grid-template-columns: 2.75rem 1fr; align-items: center; gap: .8rem; padding: .7rem 0; border-bottom: 1px solid var(--rule-soft); color: inherit; text-decoration: none; }
.cellno { position: relative; display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border: 1px solid var(--rule); background: var(--cross); font-size: 1.2rem; }
.irow-t { display: block; font-size: 1.03rem; line-height: 1.35; font-weight: 600; }
.irow-z { display: block; font-size: .88rem; color: var(--ink-3); line-height: 1.4; }
.l0 .cellno, .cell.l0 { color: rgba(207, 54, 34, .5); }
.l1 .cellno, .cell.l1 { color: #A3A29C; }
.l2 .cellno, .l4 .cellno, .cell.l2, .cell.l4 { color: var(--ink); font-weight: 700; }
.l4 .cellno::after { content: ""; position: absolute; inset: 3px; border: 1.8px solid var(--zhu); border-radius: 50%; transform: rotate(-12deg) scaleX(1.06); }
.stardot { position: absolute; top: 3px; right: 3px; width: 6px; height: 6px; border-radius: 50%; background: var(--zhu); }

.bsec-h { display: flex; flex-direction: column; margin: 1.7rem 0 .5rem; font-size: 1rem; font-weight: 700; }
.bsec-e { font: italic 400 .82rem/1.4 var(--serif); color: var(--ink-3); }
.cells { display: grid; grid-template-columns: repeat(8, 1fr); border-left: 1px solid var(--rule); border-top: 1px solid var(--rule); }
.cell { position: relative; aspect-ratio: 1; display: grid; place-items: center; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); background: var(--cross); font-size: 1.12rem; text-decoration: none; }
.cell.hide { opacity: .14; pointer-events: none; }
.cell.out .num { opacity: .3; }

.vocab, .fold, .allans { border-bottom: 1px solid var(--rule-soft); }
.vocab summary, .fold summary, .allans summary { padding: .75rem 0; font-weight: 600; cursor: pointer; }
.vgroup { margin-bottom: .9rem; }
.vwords { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .3rem; }
.vword { border: 0; border-bottom: 1.5px solid var(--rule); background: none; padding: .25rem .2rem; font: 600 1.05rem var(--sans); color: var(--blue); cursor: pointer; }

.oath { margin: 0 0 1.2rem; padding-left: 1.4rem; display: grid; gap: 1.1rem; }
.oath-en { font-size: 1.08rem; line-height: 1.5; font-weight: 600; }
.oath-zh { color: var(--ink-2); font-size: .95rem; }
.oath-plain { font-size: .95rem; color: var(--blue); }

.parts { margin: 0 0 1rem; padding-left: 1.4rem; display: grid; gap: .5rem; }
.parts b { margin-right: .6rem; }
.parts span { color: var(--ink-2); }
.hist { list-style: none; margin: 0; padding: 0; border-top: 1.5px solid var(--rule); }
.hist li { display: grid; grid-template-columns: 1fr 1fr auto; gap: .6rem; padding: .7rem 0; border-bottom: 1px solid var(--rule-soft); }
.good { color: var(--zhu); }
.page > .note, .page > .btn { margin-bottom: 1rem; }

/* ───────── cards ───────── */
.card { display: grid; gap: .9rem; align-content: start; }
.kicker { display: flex; align-items: center; gap: .6rem; font-size: .9rem; color: var(--ink-3); }
.qno { font-weight: 700; color: var(--zhu); }
.tag { display: inline-flex; align-items: center; gap: .2rem; padding: .05rem .45rem; border-radius: 3px; box-shadow: inset 0 0 0 1px var(--zhu); font-size: .78rem; color: var(--zhu); }
.tag .ic svg { width: .85rem; height: .85rem; }
.q-row { display: grid; grid-template-columns: 1fr auto; gap: .6rem; align-items: start; }
.q { font-size: 1.5rem; line-height: 1.36; font-weight: 600; }
.q-zh { color: var(--ink-2); font-size: 1.02rem; }
mark.kw { background: none; color: inherit; text-decoration: underline wavy var(--zhu); text-decoration-thickness: 1.5px; text-underline-offset: .24em; }
.kwrow, .stressrow { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; }
.kwchip { display: inline-flex; align-items: baseline; gap: .45rem; padding: .2rem .6rem; border-radius: 3px; background: var(--zhu-wash); font-size: .92rem; }
.kwchip b { color: var(--blue); }
.sec { margin-top: .7rem; font-size: .95rem; font-weight: 700; color: var(--ink-2); }

/* 四线三格: the four-line ruling Chinese students first met English on */
.staff {
  line-height: 1.9; font-size: 1.45rem; font-weight: 600; color: var(--blue);
  background-image: linear-gradient(to bottom,
    transparent calc(var(--st-cap) - .5px), var(--rule) 0, var(--rule) calc(var(--st-cap) + .5px), transparent 0,
    transparent calc(var(--st-x) - .5px), var(--rule-soft) 0, var(--rule-soft) calc(var(--st-x) + .5px), transparent 0,
    transparent calc(var(--st-base) - .75px), rgba(207, 54, 34, .5) 0, rgba(207, 54, 34, .5) calc(var(--st-base) + .75px), transparent 0,
    transparent calc(var(--st-desc) - .5px), var(--rule) 0, var(--rule) calc(var(--st-desc) + .5px), transparent 0);
  background-size: 100% 1.9em; background-repeat: repeat-y;
}
.lines { display: grid; gap: .3rem; }
.sayline { display: grid; grid-template-columns: 1fr auto; gap: .6rem; align-items: center; }
.sayline-t { display: grid; }
.say-t { font-size: 1.3rem; line-height: 1.4; font-weight: 600; }
.say-t.en { font-size: 1.45rem; line-height: 1.9; background-image: linear-gradient(to bottom,
    transparent calc(var(--st-cap) - .5px), var(--rule) 0, var(--rule) calc(var(--st-cap) + .5px), transparent 0,
    transparent calc(var(--st-x) - .5px), var(--rule-soft) 0, var(--rule-soft) calc(var(--st-x) + .5px), transparent 0,
    transparent calc(var(--st-base) - .75px), rgba(207, 54, 34, .5) 0, rgba(207, 54, 34, .5) calc(var(--st-base) + .75px), transparent 0,
    transparent calc(var(--st-desc) - .5px), var(--rule) 0, var(--rule) calc(var(--st-desc) + .5px), transparent 0);
  background-size: 100% 1.9em; background-repeat: repeat-y; }
.say-zh { font-size: .95rem; color: var(--ink-2); }
.frame { font-size: 1.25rem; font-weight: 600; }
.act { font-size: 1.35rem; font-weight: 700; }
.sit { font-size: 1.35rem; line-height: 1.4; font-weight: 600; }
.sit-ask { color: var(--ink-3); }

.note { padding: .05rem 0 .05rem .8rem; border-left: 2px solid var(--zhu); color: var(--ink-2); font-size: .95rem; }
.tip { font-size: .9rem; color: var(--ink-3); }
.stress { display: inline-grid; justify-items: start; border: 0; border-bottom: 1.5px solid var(--rule); background: none; padding: .2rem .3rem; font: inherit; cursor: pointer; }
.stress-w { font-size: 1.05rem; color: var(--blue); letter-spacing: .01em; }
.stress-w b { font-weight: 700; font-size: 1.2em; }
.stress-zh { font-size: .78rem; color: var(--ink-3); }

.anslist { display: grid; border-top: 1px solid var(--rule-soft); margin-bottom: .6rem; }
.ansrow { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .6rem; width: 100%; padding: .65rem .5rem; border: 0; border-bottom: 1px solid var(--rule-soft); background: none; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.ansrow-t { display: grid; }
.ansrow .en { font-weight: 600; }
.ansrow .en.big { font-size: 1.2rem; }
.ansrow .zh { font-size: .88rem; color: var(--ink-3); }
.ansrow.on { background: var(--zhu-wash); box-shadow: inset 3px 0 0 var(--zhu); }
.ansrow > .ic-check { color: var(--zhu); }
.ynnote { display: grid; gap: .35rem; }
.keyline { font-size: 1.2rem; }
.keyline b { color: var(--blue); margin-right: .4rem; }
.plain { color: var(--blue); }
.typ { color: var(--ink-2); font-size: .95rem; }

.spk { display: inline-grid; grid-auto-flow: column; place-items: center; gap: .4rem; flex: none; min-width: 2.8rem; height: 2.8rem; padding: 0 .65rem; border: 0; border-radius: 99px; background: none; box-shadow: inset 0 0 0 1.5px var(--ink); color: var(--ink); font: 600 .95rem var(--sans); cursor: pointer; }
.spk.on { background: var(--ink); color: var(--paper); }
.spk-big { width: 4.4rem; height: 4.4rem; background: var(--ink); color: var(--paper); box-shadow: none; }
.spk-big .ic svg { width: 2rem; height: 2rem; }
.spk-big.on { animation: ripple 1.1s ease-out infinite; }
.spk-wide { padding: 0 1.1rem; }
@keyframes ripple { from { box-shadow: 0 0 0 0 rgba(23, 24, 26, .38); } to { box-shadow: 0 0 0 1.2rem rgba(23, 24, 26, 0); } }

.officer { display: grid; gap: .9rem; }
.off-row { display: flex; align-items: center; gap: 1rem; }
.off-meta { display: grid; gap: .25rem; justify-items: start; }
.off-who { font-size: .9rem; color: var(--ink-3); }
.unveil, .repeat { display: inline-flex; align-items: center; gap: .4rem; border: 0; background: none; padding: .35rem 0; font: inherit; font-size: .98rem; color: var(--ink); text-align: left; text-decoration: underline; text-decoration-color: var(--zhu); text-underline-offset: .28em; cursor: pointer; }
.unveil .ic svg { width: 1.2rem; height: 1.2rem; }
.repeat { font: italic 1.05rem var(--serif); color: var(--blue); }
.prompt { font-size: 1.45rem; line-height: 1.38; font-weight: 600; }
.prompt-sub { margin-top: .3rem; color: var(--ink-2); font-size: 1rem; }
.ask { margin-top: .2rem; font-size: .95rem; color: var(--ink-3); }

.opts { display: grid; border-top: 1.5px solid var(--rule); }
.opt { display: grid; grid-template-columns: 2.2rem 1fr; gap: .75rem; align-items: start; width: 100%; padding: .95rem .2rem; border: 0; border-bottom: 1px solid var(--rule); background: none; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.opt-m { position: relative; display: grid; place-items: center; width: 2.1rem; height: 2.1rem; font: italic 1.4rem/1 var(--serif); color: var(--ink-3); }
.opt-t { display: block; font-size: 1.18rem; line-height: 1.38; font-weight: 600; }
.opt-s { display: block; margin-top: .12rem; font-size: .92rem; color: var(--ink-3); }
.opt.picked { background: var(--zhu-wash); }
.opt.picked .opt-m, .opt.right .opt-m { color: var(--zhu); }
.opt.wrong .opt-t { color: var(--ink-3); text-decoration: line-through; }
.opt.dim { opacity: .38; }
.opt:disabled { cursor: default; }

.fb-in { display: grid; gap: .8rem; margin-top: .3rem; animation: rise .22s ease-out; }
.fb-h { font-size: 1.08rem; font-weight: 700; }
.fb-h.good { color: var(--zhu); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.grade { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.turn { display: grid; gap: .8rem; justify-items: start; }
.turn-h { margin-top: .4rem; font-size: 1.15rem; font-weight: 700; }
.mic { display: inline-flex; align-items: center; gap: .6rem; border: 0; border-radius: 99px; padding: .75rem 1.25rem; background: var(--zhu); color: #fff; font: 600 1rem var(--sans); cursor: pointer; }
.mic.on { animation: ripple-z 1s ease-out infinite; }
@keyframes ripple-z { from { box-shadow: 0 0 0 0 rgba(207, 54, 34, .45); } to { box-shadow: 0 0 0 1rem rgba(207, 54, 34, 0); } }
.heard { font-size: .95rem; color: var(--ink-2); }
.heard q { color: var(--blue); font-weight: 600; }
.read-s .w.ok { color: var(--ink); }
.read-s .w.miss { color: var(--zhu); text-decoration: underline wavy; text-underline-offset: .2em; }
.dict { display: block; width: 100%; height: 1.9em; padding: 0 .2rem; border: 0; border-radius: 0; outline: none; font-family: var(--sans); background-color: transparent; }
.dict:focus { box-shadow: 0 2px 0 var(--ink); }
.dict::placeholder { color: var(--rule); }

/* ───────── session ───────── */
.sess { display: flex; flex-direction: column; min-height: 100dvh; }
.sess-top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: .55rem; padding: .6rem 0 .7rem; background: var(--paper) var(--noise); }
.sess-bar { flex: 1; min-width: 2rem; }
.sess-n { font-size: .85rem; color: var(--ink-3); white-space: nowrap; }
.stage { flex: 1; padding: .5rem 0 2rem; }
.inter { text-align: center; justify-items: center; padding-top: 3rem; }
.inter h2 { font-size: 2.1rem; font-weight: 400; }
.inter-e { font: italic 1.1rem var(--serif); color: var(--ink-3); }

.summary { display: grid; gap: 1rem; justify-items: center; text-align: center; }
.summary h2 { margin-top: .4rem; font-size: 2rem; font-weight: 400; }
.sheet-s { width: min(15rem, 72%); }
.sum-line { font-size: 1.05rem; }
.sum-line .num { font-size: 1.9rem; vertical-align: -.08em; }
.milestone { min-height: 0; font-size: 1.7rem; color: var(--zhu); opacity: 0; transform: scale(1.5); transition: transform .18s cubic-bezier(.3, 1.4, .6, 1), opacity .12s; }
.milestone.in { opacity: 1; transform: none; }
.milestone:empty { display: none; }
.sum-stats { display: flex; gap: 1.5rem; font-size: .92rem; color: var(--ink-2); }
.sum-stats b { margin-right: .25rem; font-size: 1.6rem; font-weight: 400; color: var(--ink); }
.summary .grade, .summary .quote { width: 100%; }
.summary .quote { margin-top: 1rem; }

.result { display: grid; gap: 1rem; text-align: center; }
.result h2 { font-size: 2.1rem; font-weight: 400; }
.result-line { font: italic 1.1rem/1.5 var(--serif); }
.stamp { width: 8.5rem; margin: 1rem auto 0; opacity: 0; transform: scale(1.7) rotate(-12deg); }
.stamp.in { opacity: 1; transform: rotate(-6deg); transition: transform .16s cubic-bezier(.3, 1.5, .6, 1), opacity .1s; }
.rows { list-style: none; margin: .3rem 0; padding: 0; border-top: 1.5px solid var(--rule); text-align: left; }
.rows li { display: grid; grid-template-columns: 4.6rem 1fr auto; gap: .6rem; padding: .75rem 0; border-bottom: 1px solid var(--rule); }
.r-d { color: var(--ink-2); }
.rows .no b { color: var(--zhu); }
.result .block { text-align: left; }

/* ───────── me ───────── */
.namefield { display: flex; align-items: center; gap: 1rem; margin: .8rem 0 1.4rem; }
.namefield-b { flex: 1; display: grid; gap: .4rem; }
.sealbox { flex: none; width: 5.2rem; transform: rotate(-4deg); }
.paths { display: grid; gap: .55rem; }
.path { display: grid; gap: .1rem; border: 0; border-radius: 4px; background: none; box-shadow: inset 0 0 0 1.2px var(--ink-3); padding: .8rem 1rem; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.path b { font-size: 1.08rem; }
.path span { font-size: .9rem; color: var(--ink-2); }
.path.on { background: var(--zhu-wash); box-shadow: inset 0 0 0 2.5px var(--zhu); }
.checker { display: grid; gap: .8rem; padding-bottom: 1rem; }
.checker-row { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.checker label { display: grid; gap: .3rem; font-size: .9rem; }
.advice { display: grid; gap: .5rem; }
.advice-t { font-weight: 700; color: var(--zhu); }
.myans { display: grid; gap: .25rem; padding: .8rem 0; border-bottom: 1px solid var(--rule-soft); }
.myans-q { font-weight: 600; }
.setrow { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem 0; border-bottom: 1px solid var(--rule-soft); }
.setrow-b { display: grid; }
.switch { position: relative; flex: none; width: 3.2rem; height: 1.9rem; border: 0; border-radius: 99px; background: #CDC9BC; cursor: pointer; }
.switch i { position: absolute; top: .2rem; left: .2rem; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch[aria-checked="true"] { background: var(--ink); }
.switch[aria-checked="true"] i { transform: translateX(1.3rem); }
.seg { display: flex; border-radius: 99px; box-shadow: inset 0 0 0 1.2px var(--ink-3); overflow: hidden; }
.seg button { border: 0; background: none; padding: .42rem .85rem; font: inherit; font-size: .9rem; color: var(--ink-2); cursor: pointer; }
.seg button.on { background: var(--ink); color: var(--paper); }
.about p { margin-bottom: .6rem; }

/* ───────── first run, modal, toast ───────── */
.ob { position: fixed; inset: 0; z-index: 50; overflow: auto; background: var(--paper) var(--noise); transition: opacity .35s; }
.ob.out { opacity: 0; }
.ob-in { display: grid; gap: 1rem; justify-items: center; align-content: start; max-width: 30rem; min-height: 100%; margin: 0 auto; padding: 1.5rem var(--pad) 2.5rem; text-align: center; }
.ob-in > * { width: 100%; }
.ob-brand { display: flex; justify-content: center; align-items: baseline; gap: .6rem; }
.ob-in .sheet-ob { width: min(19rem, 76%); margin-top: .4rem; }
.ob-line { font-size: 1.95rem; margin-top: .5rem; }
.ob-e { font: italic 1.05rem/1.4 var(--serif); color: var(--ink-2); }
.ob-p { color: var(--ink-2); }
.ob-in h2 { font-size: 2.1rem; font-weight: 400; margin-top: 1.5rem; }
.ob-in .namefield, .ob-in .paths, .ob-in .fold { text-align: left; }

.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: end center; overflow: auto; background: rgba(23, 24, 26, .5); }
.modal-in { position: relative; width: 100%; max-width: 35rem; max-height: 92dvh; overflow: auto; padding: 2.8rem var(--pad) 1.6rem; border-radius: 10px 10px 0 0; background: var(--paper); animation: sheetup .25s ease-out; }
.modal-x { position: absolute; top: .3rem; right: .4rem; margin: 0; }
@keyframes sheetup { from { transform: translateY(30px); opacity: 0; } }
.postermodal, .qrmodal { display: grid; gap: .9rem; justify-items: center; text-align: center; }
.postermodal h2, .qrmodal h2 { font-size: 1.8rem; font-weight: 400; }
.posterbox { display: grid; gap: .8rem; width: 100%; }
.poster { display: block; width: 100%; height: auto; box-shadow: 0 12px 30px -14px rgba(0, 0, 0, .5); }
.qrbox canvas { display: block; width: min(70vmin, 26rem); height: auto; }
.toast { position: fixed; left: 50%; bottom: calc(6.8rem + env(safe-area-inset-bottom)); z-index: 70; max-width: 88vw; transform: translateX(-50%); padding: .6rem 1rem; border-radius: 4px; background: var(--ink); color: var(--paper); font-size: .95rem; transition: opacity .4s; }
.toast.out { opacity: 0; }

/* ───────── classroom mode: built for a projector ───────── */
body[data-view="klass"] #app { max-width: none; padding: 0; }
.klass { display: grid; grid-template-rows: auto 1fr auto; min-height: 100dvh; }
.kl-top { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem 1rem; padding: .8rem 1.4rem; }
.kl-top .iconbtn { margin-left: -.4rem; }
.kl-brand { display: flex; align-items: baseline; gap: .6rem; }
.kl-scope { width: auto; max-width: 15rem; min-height: 2.7rem; }
.kl-top .btn, .kl-bar .btn { width: auto; }
.kl-top .btn { min-height: 2.7rem; }
.kl-clock { margin-left: auto; min-width: 3ch; font-size: 2.3rem; line-height: 1; text-align: right; }
.kl-main { display: grid; align-content: center; justify-items: start; gap: 1.2rem; width: 100%; max-width: 82rem; margin: 0 auto; padding: 1rem clamp(1.4rem, 6vw, 6rem); }
.kl-n { font-size: clamp(1.6rem, 3.4vw, 2.8rem); color: var(--zhu); }
.kl-hint { font-size: clamp(1.1rem, 2.2vw, 1.6rem); color: var(--ink-2); }
.kl-q { font-size: clamp(2rem, 5.4vw, 4.8rem); line-height: 1.2; font-weight: 700; }
.kl-zh { font-size: clamp(1.2rem, 2.7vw, 2.3rem); color: var(--ink-2); }
.kl-a { list-style: none; margin: 0; padding: 0 0 0 1.2rem; border-left: 4px solid var(--zhu); display: grid; gap: .35rem; font-size: clamp(1.3rem, 3vw, 2.6rem); }
.kl-a li { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem 1rem; }
.kl-a .en { font-weight: 600; }
.kl-a .zh { font-size: .6em; color: var(--ink-2); }
.kl-need { font-size: .6em; color: var(--zhu); }
.kl-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; padding: 1rem 1.4rem calc(1rem + env(safe-area-inset-bottom)); border-top: 1.5px solid var(--rule); }
.kl-draw { min-width: 9rem; }
.kl-score { display: flex; gap: 1.4rem; margin-left: auto; }
.kl-team { display: flex; align-items: center; gap: .45rem; }
.kl-team-n { font-size: 1.5rem; }
.kl-team.red .kl-team-n { color: var(--zhu); }
.kl-team.blue .kl-team-n { color: var(--blue); }
.kl-pts { min-width: 1.4ch; font-size: 2.4rem; line-height: 1; text-align: center; }
.kl-pm { width: 2.6rem; height: 2.6rem; border: 0; border-radius: 50%; background: none; box-shadow: inset 0 0 0 1.5px var(--ink); font-size: 1.4rem; line-height: 1; cursor: pointer; }

/* ───────── wide screens ───────── */
@media (min-width: 62rem) {
  body[data-view="home"] #app { max-width: 70rem; }
  .home { display: grid; grid-template-columns: minmax(0, 24rem) minmax(0, 1fr); grid-template-areas: "top top" "hero units" "quote units" "foot foot"; column-gap: 5.5rem; align-items: start; }
  .home .top { grid-area: top; }
  .home .hero { grid-area: hero; }
  .home .units { grid-area: units; }
  .home .units .sec-h { margin-top: .4rem; }
  .home .quote { grid-area: quote; }
  .home .foot { grid-area: foot; }
  #tabs { left: 50%; right: auto; bottom: 1rem; transform: translateX(-50%); gap: .6rem; padding: .45rem 1rem; border: 1.5px solid var(--rule); border-radius: 14px; box-shadow: 0 14px 30px -20px rgba(0, 0, 0, .5); }
  .tab { flex: none; width: 5.2rem; }
  .modal { place-items: center; }
  .modal-in { border-radius: 8px; }
  .modal-wide { max-width: 30rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
