/* Layout: one reading column of numbered lessons. The page's own motif is a "distance map":
   NOW sits at a fixed point, and every form is drawn by how far it moves away from it. */
:root {
  --bg: #f2f4f7;
  --surface: #ffffff;
  --ink: #172030;
  --muted: #545e70;
  --rule: #d6dbe3;
  --now: #1f4fd1;        /* the anchor: now, here, reality */
  --now-bg: #e5ecfb;
  --far: #7a4a9e;        /* distance: past, imagined, polite */
  --far-bg: #f1e9f7;
  --root: #2f6b55;       /* word history notes */
  --root-bg: #e4f1ea;
  --no: #a63a2f; --no-bg: #f8e5e2;
  --ok: #0b6b7a; --ok-bg: #e0f2f5;   /* correct answers only; kept apart from near/far */
  --font-display: "Gowun Batang", "AppleMyungjo", "Noto Serif KR", serif;
  --font-body: "IBM Plex Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  --font-en: "Source Serif 4", "Iowan Old Style", Georgia, "IBM Plex Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", serif;   /* Korean inside an English-styled run falls to the body face */
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11151c; --surface: #191f29; --ink: #e6eaf0; --muted: #9ba5b5; --rule: #2b3340;
    --now: #8fb0ff; --now-bg: #1b2742; --far: #cfa6ee; --far-bg: #2c2138;
    --root: #8fd3b4; --root-bg: #17302a; --no: #f2958b; --no-bg: #3b1d1a;
    --ok: #6fd6e6; --ok-bg: #12313a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #11151c; --surface: #191f29; --ink: #e6eaf0; --muted: #9ba5b5; --rule: #2b3340;
  --now: #8fb0ff; --now-bg: #1b2742; --far: #cfa6ee; --far-bg: #2c2138;
  --root: #8fd3b4; --root-bg: #17302a; --no: #f2958b; --no-bg: #3b1d1a;
  --ok: #6fd6e6; --ok-bg: #12313a;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 16.5px; line-height: 1.75;
  word-break: keep-all; overflow-wrap: break-word;   /* Korean breaks between words, not inside them */
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
main { max-width: 46rem; margin: 0 auto; padding-block: 56px 96px; display: flex; flex-direction: column; gap: 72px; }
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; line-height: 1.3; margin: 0; font-weight: 700; }
h1 { font-size: clamp(2rem, 6vw, 2.9rem); letter-spacing: -0.01em; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.12rem; }
p { margin: 0; }
ul, ol { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 6px; }
section { display: flex; flex-direction: column; gap: 20px; }
strong { font-weight: 600; }
.en { font-family: var(--font-en); font-size: 1.06em; }
em.en { font-style: italic; }
.lede { font-size: 1.1rem; color: var(--muted); max-width: 40rem; }
.eyebrow { word-break: keep-all; font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--now); }
a { color: var(--now); }
:focus-visible { outline: 2px solid var(--now); outline-offset: 3px; border-radius: 4px; }

/* Hero */
header.hero { display: flex; flex-direction: column; gap: 18px; }
.hero-map { margin-top: 8px; background: var(--surface); border: 1px solid var(--rule); border-radius: 14px; padding: 18px; }
.hero-map svg { width: 100%; height: auto; display: block; }
/* Phones get portrait versions of the diagrams: the wide ones shrink to ~half size and their labels drop to ~7px */
svg.narrow { display: none; }
@media (max-width: 560px) { .hero-map, main figure { padding: 10px; } }
@media (max-width: 720px) {
  svg.wide { display: none; }
  svg.narrow { display: block; max-width: 420px; margin: 0 auto; min-width: 0; }
}
/* Lesson head */
.lesson-head { display: flex; flex-direction: column; gap: 6px; border-top: 2px solid var(--ink); padding-top: 14px; }
.ko { letter-spacing: 0; }
.lesson-head .num { font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); letter-spacing: 0.06em; }

/* The one-sentence answer to the page's question, right under the lesson head */
.answer { font-weight: 500; font-size: 1.06rem; line-height: 1.7; }

/* Big idea */
.idea { border-left: 3px solid var(--now); padding: 4px 0 4px 18px; font-family: var(--font-display); font-size: 1.22rem; line-height: 1.55; }
.idea small { display: block; font-family: var(--font-body); font-size: 0.92rem; color: var(--muted); margin-top: 6px; }

/* Example list: English line, Korean gloss below */
.ex { list-style: none; padding: 0; gap: 0; border-top: 1px solid var(--rule); }
.ex li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 4px 18px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.ex .s { font-family: var(--font-en); font-size: 1.06rem; }
.ex .g { color: var(--muted); font-size: 0.95rem; }
/* Tag colors carry meaning: blue = near/now, purple = distance, teal = correct, red = wrong; anything else is neutral */
.ex .tag { display: inline-block; font-family: var(--font-mono); font-size: 0.78rem; padding: 0 6px; border-radius: 4px; margin-right: 6px; vertical-align: 1px; background: var(--bg); color: var(--ink); box-shadow: inset 0 0 0 1px var(--rule); }
.ex .tag.near { background: var(--now-bg); color: var(--now); box-shadow: none; }
.ex .tag.far { background: var(--far-bg); color: var(--far); box-shadow: none; }
.ex .tag.ok { background: var(--ok-bg); color: var(--ok); box-shadow: none; }
.ex .tag.no { background: var(--no-bg); color: var(--no); box-shadow: none; }
.ex li.bad .s { text-decoration: line-through; text-decoration-color: var(--no); text-decoration-thickness: 1.5px; }
@media (max-width: 560px) { .ex li { grid-template-columns: 1fr; } }

/* Word-root note */
.root { background: var(--root-bg); border-radius: 12px; padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; }
.root .label { font-family: var(--font-mono); font-size: 0.76rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--root); }
.root .chain { font-family: var(--font-en); font-size: 1.05rem; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.root .chain .arrow { color: var(--root); font-family: var(--font-mono); }
.root .chain b { font-weight: 600; }

/* Why box */
.why { background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.why .label { font-family: var(--font-mono); font-size: 0.76rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 500; }

/* Trap box: a dashed red outline marks "watch out" without painting the whole paragraph as an error */
.trap { background: var(--surface); border: 1px dashed var(--no); border-radius: 12px; padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; }
.trap .label { font-family: var(--font-mono); font-size: 0.76rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--no); }

/* Distance switcher */
.switch { background: var(--surface); border: 1px solid var(--rule); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button { font: inherit; font-size: 0.92rem; border: 1px solid var(--rule); background: var(--bg); color: var(--ink); padding: 6px 16px; border-radius: 999px; cursor: pointer; min-height: 44px; }
.seg button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.pair { display: grid; grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); gap: 12px; align-items: center; }
.pair .side { border-radius: 10px; padding: 12px 14px; min-width: 0; }
.pair .near { background: var(--now-bg); }
.pair .farside { background: var(--far-bg); }
.pair .k { font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.06em; text-transform: uppercase; }
.pair .near .k { color: var(--now); }
.pair .farside .k { color: var(--far); }
.pair .s { font-family: var(--font-en); font-size: 1.1rem; display: block; margin: 2px 0; }
.pair .g { font-size: 0.92rem; color: var(--muted); }
.pair .mid { font-family: var(--font-mono); color: var(--far); }
.switch .note { font-size: 0.95rem; color: var(--muted); }
@media (max-width: 560px) { .pair { grid-template-columns: 1fr; } .pair .mid { transform: rotate(90deg); justify-self: center; } }

/* Figures */
figure { margin: 0; background: var(--surface); border: 1px solid var(--rule); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
figure .scroll { overflow-x: auto; }
@media (max-width: 560px) {
  /* small mono labels and tags: keep them at 13px or more on phones */
  .eyebrow, .lesson-head .num, .root .label, .why .label, .trap .label, .check .label, .pair .k, .world .k, .trio .pic, .map .r, .rhythm .lab, th, .ex .tag, .say { font-size: 13px; }
}
figure svg { display: block; width: 100%; min-width: 520px; height: auto; }
figcaption { font-size: 0.9rem; color: var(--muted); }
figure.illo img { display: block; width: 100%; height: auto; max-height: 560px; object-fit: contain; border-radius: 10px; background: #f6f2ee; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) figure.illo img { filter: brightness(.9); } }
:root[data-theme="dark"] figure.illo img { filter: brightness(.9); }
svg text { font-family: var(--font-body); fill: var(--ink); }
svg .mono { font-family: var(--font-mono); }
svg .muted { fill: var(--muted); }
svg .axis { stroke: var(--muted); stroke-width: 1.5; }
svg .grid { stroke: var(--rule); stroke-width: 1; }
svg .nowline { stroke: var(--now); stroke-width: 2; stroke-dasharray: 4 4; }
svg .nowtext { fill: var(--now); font-weight: 600; }
svg .band { fill: var(--now-bg); stroke: var(--now); stroke-width: 1.5; }
svg .dot-far { fill: var(--far); }
svg .line-far { stroke: var(--far); stroke-width: 3; fill: none; }
svg .line-now { stroke: var(--now); stroke-width: 3; fill: none; }
svg .dot-now { fill: var(--now); }
svg .ring { fill: none; stroke: var(--rule); stroke-width: 1.5; }
svg .core { fill: var(--now-bg); stroke: var(--now); stroke-width: 2; }
svg .spoke { stroke: var(--far); stroke-width: 2; }
svg .farfill { fill: var(--far); }
svg .farbg { fill: var(--far-bg); }

/* Table */
/* Wide tables scroll sideways on phones; the edge shadows and the hint line say that more is hidden */
.tablewrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: 12px;
  --edge: color-mix(in srgb, var(--ink) 22%, transparent);
  background:
    linear-gradient(to right, var(--surface) 40%, transparent) left / 36px 100% no-repeat local,
    linear-gradient(to left, var(--surface) 40%, transparent) right / 36px 100% no-repeat local,
    linear-gradient(to right, var(--edge), transparent) left / 14px 100% no-repeat scroll,
    linear-gradient(to left, var(--edge), transparent) right / 14px 100% no-repeat scroll,
    var(--surface); }
.swipe { display: none; font-size: 13px; color: var(--muted); margin-bottom: -12px; }
.swipe.on { display: block; }
table { border-collapse: collapse; width: 100%; min-width: 560px; font-size: 0.95rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-family: var(--font-mono); font-size: 0.76rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
tr:last-child > * { border-bottom: 0; }
td .s { font-family: var(--font-en); }
.real { display: inline-block; font-size: 0.82rem; padding: 1px 8px; border-radius: 999px; white-space: nowrap; }
.real.did { background: var(--now-bg); color: var(--now); }
.real.didnt { background: var(--far-bg); color: var(--far); }

/* Two worlds */
.worlds { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 12px; }
.world { border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.world.imag { background: var(--far-bg); }
.world.reality { background: var(--now-bg); }
.world .k { font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.06em; text-transform: uppercase; }
.world.imag .k { color: var(--far); }
.world.reality .k { color: var(--now); }
@media (max-width: 560px) { .worlds { grid-template-columns: 1fr; } }

/* Three-way comparison (be/get/have) */
.trio { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
.trio > div { background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.trio .k { font-family: var(--font-en); font-weight: 600; font-size: 1.1rem; }
.trio .pic { font-family: var(--font-mono); font-size: 0.78rem; color: var(--far); letter-spacing: 0.04em; }
@media (max-width: 620px) { .trio { grid-template-columns: 1fr; } }

/* Step-by-step tip (state vs action) */
.tip { word-break: keep-all; background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.tip .label { font-family: var(--font-mono); font-size: 0.76rem; letter-spacing: 0.08em; color: var(--muted); font-weight: 500; }
.steps { list-style: none; padding: 0; gap: 16px; counter-reset: st; }
.steps > li { counter-increment: st; display: grid; grid-template-columns: 1.9rem minmax(0,1fr); gap: 4px 10px; }
.steps > li::before { content: counter(st); grid-row: 1 / span 2; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--ink); color: var(--surface); font-family: var(--font-mono); font-size: 0.85rem; display: flex; align-items: center; justify-content: center; margin-top: 2px; }
.steps > li > * { grid-column: 2; min-width: 0; }
.steps .stq small { display: block; font-size: 0.9rem; color: var(--muted); }
.steps .s { font-family: var(--font-en); font-size: 1.04rem; }
.steps .g { color: var(--muted); font-size: 0.93rem; }
.split { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 8px; margin-top: 6px; }
.split > div { border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.split .st { background: var(--now-bg); }
.split .ac { background: var(--far-bg); }
.split .k { font-weight: 600; font-size: 0.92rem; }
.split .st .k { color: var(--now); }
.split .ac .k { color: var(--far); }
.vrows { list-style: none; padding: 0; gap: 0; margin-top: 6px; border-top: 1px solid var(--rule); }
.vrows li { display: grid; grid-template-columns: 2.6rem minmax(0,13rem) minmax(0,1fr); gap: 2px 12px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--rule); }
.vrows .mk { font-family: var(--font-mono); font-size: 0.78rem; padding: 0 6px; border-radius: 4px; box-shadow: inset 0 0 0 1px var(--rule); text-align: center; }
.vrows .mk.ok { background: var(--ok-bg); color: var(--ok); box-shadow: none; }
.vrows .mk.no { background: var(--no-bg); color: var(--no); box-shadow: none; }
.vrows .g b { color: var(--ink); font-weight: 600; }
@media (max-width: 560px) {
  .split { grid-template-columns: 1fr; }
  .vrows li { grid-template-columns: 2.6rem minmax(0,1fr); }
  .vrows .g { grid-column: 2; }
  .tip .label, .vrows .mk { font-size: 13px; }
}

/* Quiz */
.quiz { display: flex; flex-direction: column; gap: 14px; list-style: none; padding: 0; counter-reset: q; }
.q { background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; counter-increment: q; }
.q .prompt { display: flex; gap: 10px; }
.q .prompt::before { flex: none; content: counter(q); font-family: var(--font-mono); color: var(--muted); font-size: 0.85rem; padding-top: 3px; }
.q .opts { display: flex; flex-wrap: wrap; gap: 8px; }
.q .opts button { font: inherit; font-family: var(--font-en); font-size: 1rem; text-align: left; border: 1px solid var(--rule); background: var(--bg); color: var(--ink); padding: 8px 14px; border-radius: 10px; cursor: pointer; }
.q .opts button:hover { border-color: var(--now); }
.q .opts button.right { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.q .opts button.wrong { background: var(--no-bg); border-color: var(--no); color: var(--no); }
.q .opts button[aria-disabled="true"] { cursor: default; }
.q .opts button[aria-disabled="true"]:not(.right):not(.wrong) { color: var(--muted); background: transparent; }
.q .fb { font-size: 0.96rem; border-top: 1px dashed var(--rule); padding-top: 10px; }
.q .fb b { color: var(--ok); }
.q .fb b.miss { color: var(--no); }
.score { font-family: var(--font-mono); font-size: 0.9rem; color: var(--muted); }
.quiz-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.quiz-tools button { font: inherit; font-size: 0.9rem; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); padding: 6px 14px; border-radius: 999px; cursor: pointer; min-height: 44px; }
.quiz-tools button:hover { border-color: var(--ink); }

/* Check questions placed at the end of each lesson */
.check { border-top: 1px dashed var(--rule); padding-top: 16px; display: flex; flex-direction: column; gap: 12px; }
.check .label { font-family: var(--font-mono); font-size: 0.76rem; color: var(--ok); }

/* "In this lesson": a folded list of a long lesson's parts, built by script. The buttons scroll; they never touch the hash. */
.p-in { background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; word-break: keep-all; }
.p-in summary { list-style: none; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 16px; cursor: pointer; font-size: 14px; color: var(--muted); }
.p-in summary::-webkit-details-marker { display: none; }
.p-in summary b { color: var(--ink); font-weight: 600; }
.p-in summary .c { font-family: var(--font-mono); font-size: 13px; }
.p-in summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: translateY(-2px) rotate(45deg); }
.p-in[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.p-in summary:hover b { color: var(--now); }
.p-in ol { list-style: none; padding: 0 8px 8px; gap: 0; border-top: 1px solid var(--rule); }
.p-in button { font: inherit; font-size: 15px; line-height: 1.45; text-align: left; width: 100%; min-height: 44px; display: flex; align-items: center; gap: 10px; padding: 8px; border: 0; border-radius: 8px; background: none; color: var(--ink); cursor: pointer; }
.p-in button:hover { background: var(--bg); color: var(--now); }
.p-in .sub button { font-size: 14px; color: var(--muted); padding-left: 26px; }
.p-in .sub button:hover { color: var(--now); }
.p-in li:not([class]) button { font-weight: 600; }   /* h3 rows: the parts; boxes sit under them with a coloured bar */
.p-in li[class] button::before { content: ""; flex: none; width: 3px; align-self: stretch; margin: 4px 0; border-radius: 2px; }
.p-in .k-root button::before { background: var(--root); }
.p-in .k-trap button::before { background: var(--no); }
.p-in .k-why button::before, .p-in .k-tip button::before { background: var(--muted); }
.p-in .k-check button::before { background: var(--ok); }
body.v-lesson main section > :is(h3, .root, .why, .trap, .tip, .check) { scroll-margin-top: 72px; }

/* Views: home (grouped table of contents) or one lesson at a time; the URL hash picks the view. */
body.v-lesson header.hero { display: none; }
body.v-home main > section { display: none; }
body.v-lesson main > section:not(.p-on) { display: none; }
body.v-lesson main { padding-top: 72px; }
body.v-lesson main [id] { scroll-margin-top: 72px; }
.p-top { position: fixed; inset: 0 0 auto 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--rule); display: none; }
body.v-lesson .p-top { display: block; }
.p-top .in { max-width: 46rem; margin: 0 auto; padding: 4px max(16px, env(safe-area-inset-left, 0px)); display: flex; align-items: center; gap: 12px; min-height: 52px; }
.p-top a { color: var(--now); text-decoration: none; font-weight: 600; white-space: nowrap; padding: 8px 0; }
.p-top .t { flex: 1; min-width: 0; font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-top .t b { color: var(--ink); font-weight: 600; }
.p-top .bar { position: absolute; left: 0; bottom: -1px; height: 2px; background: var(--now); transform-origin: left; width: 100%; transform: scaleX(0); }
/* English variant (src/variant.js): the control (미국 · 영국 · 호주) in the lesson top bar and at the top of home,
   and the marked spellings, hidden until the chosen form is in so the American form is never drawn first. */
html[data-ev="uk"]:not(.ev-on) .ev, html[data-ev="au"]:not(.ev-on) .ev { visibility: hidden; }
.ev-slot { display: flex; justify-content: flex-end; min-height: 44px; }
.ev-pick { flex: none; display: flex; align-items: center; gap: 8px; word-break: keep-all; }
.ev-pick .k { font-size: 13px; color: var(--muted); }
.ev-pick .b { display: flex; border: 1px solid var(--rule); border-radius: 999px; background: var(--bg); }
.ev-pick button { font: inherit; font-size: 13px; min-width: 44px; min-height: 44px; padding: 0 10px; border: 0; border-radius: 999px; background: none; color: var(--muted); cursor: pointer; }
.ev-pick button:hover { color: var(--ink); }
.ev-pick button[aria-pressed="true"] { background: var(--ink); color: var(--surface); font-weight: 600; }
.ev-pick button:focus-visible { outline-offset: 1px; border-radius: 999px; }
@media (max-width: 560px) { .p-top .ev-pick .k, .p-top .t .g { display: none; } }
.p-home { display: flex; flex-direction: column; gap: 28px; word-break: keep-all; }
#resume-slot:empty { display: none; }
.p-reset { align-self: flex-start; font: inherit; font-size: 0.9rem; border: 1px solid var(--rule); background: var(--surface); color: var(--muted); padding: 6px 14px; border-radius: 999px; cursor: pointer; min-height: 44px; }
.p-reset:hover { border-color: var(--ink); color: var(--ink); }
.p-resume { word-break: keep-all; }
.check .redo { align-self: flex-start; font: inherit; font-size: 0.9rem; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); padding: 6px 14px; border-radius: 999px; cursor: pointer; min-height: 44px; }
.check .redo:hover { border-color: var(--ink); }
.p-resume { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; border-radius: 12px; background: var(--now-bg); color: var(--ink); text-decoration: none; border: 1px solid color-mix(in srgb, var(--now) 30%, transparent); }
.p-resume .k { font-size: 13px; color: var(--now); font-weight: 600; }
.p-resume .h { font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; text-wrap: balance; }
.p-resume .m { font-size: 14px; color: var(--muted); }
.p-group { display: flex; flex-direction: column; gap: 8px; }
.p-group header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; border-bottom: 2px solid var(--ink); padding-bottom: 6px; }
.p-group h2 { font-size: 1.25rem; }
.p-group .c { font-family: var(--font-mono); font-size: 13px; color: var(--muted); white-space: nowrap; }
.p-group .d { font-size: 14px; color: var(--muted); }
.p-list { list-style: none; padding: 0; gap: 0; }
.p-list a { display: grid; grid-template-columns: 2.2rem 1fr auto; gap: 10px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--rule); color: var(--ink); text-decoration: none; }
.p-list a:hover .n2 { color: var(--now); }
.p-list .n1 { font-family: var(--font-mono); font-size: 13px; color: var(--muted); }
.p-list .n3 { font-size: 13px; color: var(--muted); white-space: nowrap; }
.p-list .done .n1, .p-list .done .n3 { color: var(--ok); }
.p-list .n2 small { display: block; font-size: 13px; color: var(--muted); }
.p-end { display: flex; flex-direction: column; gap: 12px; border-top: 2px solid var(--ink); padding-top: 16px; }
.p-end .done-btn { font: inherit; font-weight: 600; min-height: 48px; padding: 10px 16px; border: 1px solid var(--ink); border-radius: 10px; background: var(--surface); color: var(--ink); cursor: pointer; }
.p-end .done-btn:hover { background: var(--bg); }
.p-end .done-btn[aria-pressed="true"] { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); }
.p-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.p-nav a { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--rule); border-radius: 10px; text-decoration: none; color: var(--ink); background: var(--surface); min-width: 0; }
.p-nav a.next { text-align: right; grid-column: 2; }
.p-nav a span { font-size: 13px; color: var(--muted); }
.p-nav a b { font-weight: 600; font-size: 15px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: normal; }
section[id] { scroll-margin-top: 56px; }

/* Summary map */
.map { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.map > div { background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.map .k { font-family: var(--font-en); font-weight: 600; font-size: 1.05rem; }
.map .r { font-family: var(--font-mono); font-size: 0.76rem; color: var(--root); }
@media (max-width: 560px) { .map { grid-template-columns: 1fr; } }


/* Pronunciation: stress marks, rhythm bars, listen buttons */
.stress b { color: var(--now); font-weight: 700; letter-spacing: 0.02em; }
.say { font: inherit; font-size: 0.8rem; font-family: var(--font-mono); border: 1px solid var(--rule); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 4px 12px; min-height: 32px; margin-left: 6px; cursor: pointer; vertical-align: 1px; position: relative; }
.say::after { content: ""; position: absolute; inset: -6px -2px; }   /* 44px-tall touch area around the 32px pill */
.say:hover { border-color: var(--now); }
.rhythm { display: flex; flex-direction: column; gap: 14px; }
.rhythm .row { display: flex; flex-direction: column; gap: 6px; }
.rhythm .lab { font-family: var(--font-mono); font-size: 0.76rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.bars { display: flex; align-items: flex-end; gap: 4px; min-width: 0; }
.bars span { display: flex; align-items: center; justify-content: center; border-radius: 6px; font-family: var(--font-en); font-size: 0.95rem; color: var(--ink); background: var(--far-bg); height: 34px; min-width: 0; padding: 0 2px; }
.bars span.peak { background: var(--now); color: var(--surface); height: 52px; font-weight: 600; }
.bars.ko span { background: var(--root-bg); font-family: var(--font-body); }
.sources { font-size: 0.9rem; color: var(--muted); }
.sources li { padding-left: 2px; }
@media (prefers-reduced-motion: no-preference) {
  .q .fb { animation: fade .15s ease-out; }
  @keyframes fade { from { opacity: .7; transform: translateY(-2px); } to { opacity: 1; transform: none; } }
}
