/* Topic Masterclass kit v2: layered on mc.css (same tokens, same question styles).
   Width: the page uses the dashboard's container (1440 px, 56 px sides: --page-max, --gutter),
   so the title, the top bar and the lesson line up with every other page. */

:root { --subj: #86868b; --paper: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif; }
body { background: var(--bg); }

.tk-top { padding-top: 26px; }
.tk-top-right { display: flex; gap: 12px; align-items: center; }
.tk-prog-mini { font-family: var(--mono); font-size: 12.5px; color: var(--faint); }

.tk { max-width: var(--page-max, 1440px); margin: 0 auto; padding: 8px var(--gutter) 160px; }
.tk-empty { padding: 48px var(--gutter); color: var(--muted); }

/* ---------- header ---------- */
.tk-head { padding: 30px 0 6px; position: relative; }
.tk-head::before {
  content: ''; position: absolute; inset: -40px 0 auto -10vw; height: 300px; z-index: -1; pointer-events: none; /* never past the right edge: no sideways scroll */
  background: radial-gradient(50% 70% at 18% 10%, color-mix(in srgb, var(--subj) 16%, transparent), transparent 70%);
}
.tk-eyebrow { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--muted); font-family: var(--mono); }
.tk-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--subj); box-shadow: 0 0 0 4px color-mix(in srgb, var(--subj) 22%, transparent); }
.tk-title { margin: 14px 0 0; font-size: clamp(38px, 4.6vw, 64px); line-height: 1; font-weight: 700; letter-spacing: -0.045em; text-wrap: balance; }
.tk-lede { margin: 18px 0 0; font-size: 18.5px; line-height: 1.6; color: var(--text-2); max-width: 62rem; }
.tk-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin-top: 18px; }
.tk-meta-item { font-size: 13px; color: var(--faint); }
.tk-level { font-size: 12.5px; padding: 3px 10px; }
.tk-flagbox { margin-top: 16px; padding: 12px 16px; border-radius: 12px; border: 1px solid rgba(255, 159, 10, 0.45); background: rgba(255, 159, 10, 0.06); max-width: 62rem; }
.tk-flagbox ul { margin: 6px 0 0; padding-left: 1.2em; font-size: 14.5px; color: var(--text-2); }
.tk-flagfix { margin: 8px 0 0; font-size: 14.5px; color: var(--text); }

.tk-bar { position: sticky; top: 0; z-index: 6; padding: 14px 0 12px; margin-top: 14px; background: linear-gradient(var(--bg) 72%, transparent); }
.tk-seg button { font-size: 14px; padding: 7px 16px; }

/* ---------- learn layout ---------- */
.tk-learn { display: grid; grid-template-columns: 252px minmax(0, 1fr); gap: clamp(28px, 3.4vw, 56px); align-items: start; margin-top: 8px; }
.tk-side { position: sticky; top: 72px; max-height: calc(100vh - 92px); overflow: auto; padding-right: 6px; scrollbar-width: thin; }
.tk-side-in { display: grid; gap: 10px; }
.tk-toc { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.tk-toc a { display: grid; grid-template-columns: 16px 26px 1fr auto; gap: 6px; align-items: baseline; text-decoration: none; color: var(--muted); font-size: 13.5px; line-height: 1.35; padding: 6px 8px; border-radius: 8px; }
.tk-toc a:hover { background: var(--surface); color: var(--text); }
.tk-toc .is-here a { background: var(--surface-2); color: var(--text); }
.tk-toc-n { font-family: var(--mono); font-size: 11.5px; color: var(--faint); }
.tk-tick { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--line-3); transform: translateY(1px); }
.tk-toc .is-done .tk-tick { background: var(--ok); border-color: var(--ok); }
.tk-toc-part { font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); padding: 14px 8px 4px; }
.tk-toc-pips { display: inline-flex; gap: 3px; }
.pip { width: 7px; height: 7px; border-radius: 2px; background: var(--line-3); display: inline-block; }
.pip.is-good { background: var(--ok); } .pip.is-mid { background: #ffd60a; } .pip.is-low { background: var(--bad); }
.tk-read { min-width: 0; }

/* prose keeps a readable measure; figures, worked examples and questions use the whole column */
.tk-read .sec p, .tk-read .sec li { max-width: 74ch; }
.tk-read .sec .tk-split p, .tk-read .sec .tk-split li, .tk-read .sec .q p, .tk-read .sec .q li, .tk-read .sec .tk-eg p, .tk-read .sec .tk-w p { max-width: none; }

.tk-spec { border: 1px solid var(--line-2); border-radius: 14px; background: var(--surface); padding: 0 16px; margin-bottom: 8px; }
.tk-spec summary { cursor: pointer; padding: 13px 0; display: flex; justify-content: space-between; gap: 12px; font-size: 14.5px; color: var(--text-2); list-style: none; }
.tk-spec summary::-webkit-details-marker { display: none; }
.tk-spec summary::after { content: '+'; color: var(--faint); }
.tk-spec[open] summary::after { content: '–'; }
.tk-spec ul { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; }
.tk-spec li { font-size: 14px; color: var(--text-2); line-height: 1.5; display: grid; grid-template-columns: 74px 1fr; gap: 10px; }
.tk-spec-code { font-family: var(--mono); font-size: 12.5px; color: var(--subj); }

.tk-route { margin-top: 14px; padding: 16px 18px; border-radius: 14px; border: 1px solid var(--line-2); background: linear-gradient(120deg, color-mix(in srgb, var(--subj) 9%, var(--surface)), var(--surface)); }
.tk-route-list { margin: 8px 0 0; padding-left: 1.3em; display: grid; gap: 4px; }
.tk-route-list li { font-size: 15px; color: var(--text-2); line-height: 1.5; }

.tk-part { margin-top: 60px; padding-top: 30px; border-top: 1px solid var(--line-2); }
.tk-part:first-of-type { margin-top: 28px; }
.tk-part-k { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--subj); font-weight: 650; }
.tk-part h2 { margin: 6px 0 0; font-size: 36px; letter-spacing: -0.035em; line-height: 1.08; }
.tk-part-lede { margin: 10px 0 0; font-size: 17px; line-height: 1.6; color: var(--text-2); max-width: 70ch; }
.tk-sec { margin-top: 28px; padding-top: 34px; }
.tk-part + .tk-sec { border-top: 0; margin-top: 0; }
.tk-sec-top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.tk-sec h2 { font-size: 29px; }
.tk-sec h3.tk-h { margin: 32px 0 0; font-size: 20px; font-weight: 650; letter-spacing: -0.015em; color: var(--text); }
.tk-lead { font-size: 18.5px !important; color: var(--text) !important; line-height: 1.6 !important; }
.tk-goal { margin: 10px 0 0 !important; font-size: 15px !important; color: var(--muted) !important; }
.tk-goal .tk-box-label { color: var(--subj); margin-right: 4px; }
.tk-sec-foot { margin-top: 26px; display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.tk-sec-foot .tk-ask { color: var(--muted); }
.tk-sec-foot .tk-ask:hover { color: var(--text); }
.tk-tutor { display: inline-flex; align-items: center; gap: 10px; margin-top: 14px; padding: 10px 16px 10px 10px; border-radius: 14px; background: color-mix(in srgb, var(--subj, #2997ff) 14%, transparent); border: 1px solid color-mix(in srgb, var(--subj, #2997ff) 40%, transparent); color: var(--text); font-weight: 600; font-size: 15px; text-decoration: none; transition: background-color .2s, transform .2s; }
.tk-tutor:hover { background: color-mix(in srgb, var(--subj, #2997ff) 22%, transparent); transform: translateY(-1px); color: var(--text); }
.tk-tutor-z { width: 26px; height: 26px; border-radius: 8px; background: var(--text, #f5f5f7); color: var(--bg, #0b0b0c); font-weight: 800; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; }
.tk-done[aria-pressed='true'] { border-color: rgba(48, 209, 88, 0.55); color: var(--ok); background: var(--ok-bg); }
.tk-sec-qs { margin-top: 30px; padding-top: 4px; }
.tk-qs-label { color: var(--subj); }
.tk-sec-qs > .q:first-of-type { margin-top: 10px; }

.tk-hl { background: color-mix(in srgb, var(--subj) 26%, transparent); color: var(--text); padding: 0 3px; border-radius: 4px; }
.tk-code { font-family: var(--mono); font-size: 0.92em; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; color: var(--text); }
.tk-frac { display: inline-grid; vertical-align: middle; text-align: center; margin: 0 2px; font-size: 0.95em; line-height: 1.2; }
.tk-frac .n { border-bottom: 1.3px solid currentColor; padding: 0 4px 1px; }
.tk-frac .d { padding: 1px 4px 0; }
sup, sub { font-size: 0.72em; line-height: 0; }

.tk-box-label { font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); font-weight: 650; }

/* split: text beside its picture */
.tk-split { display: grid; gap: 28px; align-items: center; margin-top: 22px; }
.tk-split.is-top { align-items: start; }
.tk-split-col { min-width: 0; }
.tk-split-col > :first-child { margin-top: 0 !important; }
.tk-split .tk-fig { max-width: none; margin-top: 0; }
.tk-split-col > .tk-fig + .tk-fig { margin-top: 16px; }
/* a widget inside a split column stacks its picture above its controls */
.tk-split .tk-w { grid-template-columns: minmax(0, 1fr); }
.tk-split .tk-motion { grid-template-columns: minmax(0, 1fr); }

.tk-idea { margin: 22px 0 0; padding: 16px 20px; border-radius: 16px; background: linear-gradient(120deg, color-mix(in srgb, var(--subj) 14%, var(--surface)), var(--surface)); border: 1px solid color-mix(in srgb, var(--subj) 35%, var(--line-2)); }
.tk-idea .tk-box-label { color: var(--subj); }
.tk-idea p { margin: 6px 0 0 !important; font-size: 18px !important; line-height: 1.55 !important; color: var(--text) !important; max-width: none !important; }

.tk-def { margin: 20px 0 0; padding: 16px 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line-2); border-left: 3px solid var(--subj); }
.tk-def-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.tk-def-term { font-weight: 650; font-size: 16.5px; color: var(--text); }
.tk-def-tag { font-size: 11.5px; color: var(--faint); font-family: var(--mono); }
.tk-def p { margin: 6px 0 0 !important; font-size: 16px !important; color: var(--text-2); }
.tk-def-say { font-family: var(--paper); font-size: 16.5px !important; color: var(--text) !important; }
.tk-def-say .tk-box-label { font-family: var(--font); margin-right: 6px; }

.tk-key, .tk-eval { margin: 22px 0 0; padding: 14px 18px 16px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--surface); }
.tk-key ul, .tk-eval ul { margin: 8px 0 0 !important; padding-left: 1.2em !important; }
.tk-key li, .tk-eval li { font-size: 15.5px !important; }
.tk-eval { border-style: dashed; }

.tk-formula, .tk-formulas { margin: 22px 0 0; padding: 16px 18px; border-radius: 14px; border: 1px solid var(--line-2); background: linear-gradient(180deg, var(--surface-2), var(--surface)); }
.tk-f { font-size: 20px; color: var(--text); font-weight: 550; letter-spacing: 0.01em; display: block; margin-top: 4px; }
.tk-f-note { margin: 8px 0 0 !important; font-size: 14px !important; color: var(--muted) !important; }
.tk-frow { display: grid; grid-template-columns: minmax(110px, 170px) minmax(0, 1fr) minmax(0, 1.2fr); gap: 4px 16px; align-items: baseline; padding: 9px 0; border-top: 1px solid var(--line); }
.tk-frow:first-of-type { border-top: 0; }
.tk-frow .tk-f { font-size: 17px; margin: 0; }
.tk-fl { font-size: 13.5px; color: var(--muted); }
.tk-fn { font-size: 13px; color: var(--faint); }

.tk-table-wrap { margin-top: 18px; }
.tk-table caption { caption-side: top; text-align: left; font-size: 13px; color: var(--faint); padding-bottom: 8px; }
.tk-table th:first-child, .tk-table td:first-child { width: auto; }
.tk-table tr.is-on td, .tk-table tr.is-on th { background: var(--kz-soft); }

/* worked examples */
.tk-eg { margin: 24px 0 0; padding: 18px 20px; border-radius: 16px; border: 1px solid var(--line-2); background: var(--surface); }
.tk-eg-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.tk-eg-head .tk-box-label { color: var(--subj); }
.tk-eg-title { margin: 6px 0 0 !important; font-weight: 650; color: var(--text) !important; }
.tk-eg-q { color: var(--text) !important; font-size: 16.5px !important; margin-top: 8px !important; font-family: var(--paper); line-height: 1.6 !important; }
.tk-eg-lines { border-left: 2px solid color-mix(in srgb, var(--subj) 55%, var(--line-3)); padding-left: 16px; margin-top: 12px; display: grid; gap: 2px; }
.tk-eg-line { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px 12px; align-items: baseline; padding: 3px 0; }
.tk-eg-line.has-mark { grid-template-columns: minmax(0, 1fr) auto; }
.tk-eg-line p { font-size: 15.5px !important; margin: 4px 0 0 !important; font-family: var(--font); color: var(--text-2); }
.tk-eg-line.is-new { animation: tk-in 0.35s var(--ease) both; }
.tk-eg-note { grid-column: 1 / -1; font-size: 13.5px !important; color: var(--muted) !important; margin-top: 0 !important; }
.tk-eg-ans { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; margin-top: 12px !important; font-size: 16px !important; color: var(--text) !important; }
.tk-eg .btn { margin-top: 12px; }
.tk-eg-bar { margin-top: 12px; }
.tk-eg-bar .btn { margin-top: 0; }
.tk-eg-hint { font-size: 13px; color: var(--faint); }
@keyframes tk-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.tk-mk { font-family: var(--mono); font-size: 11.5px; font-weight: 650; padding: 2px 7px; border-radius: 6px; color: var(--text); background: color-mix(in srgb, var(--subj) 22%, transparent); border: 1px solid color-mix(in srgb, var(--subj) 45%, transparent); white-space: nowrap; align-self: center; cursor: help; }

.tk-callout { margin: 20px 0 0; padding: 12px 16px; border-radius: 12px; display: grid; gap: 4px; }
.tk-callout p { margin: 0 !important; font-size: 15.5px !important; }
.tk-callout ul { margin: 4px 0 0 !important; padding-left: 1.2em !important; display: grid; gap: 4px; }
.tk-callout li { font-size: 15px !important; line-height: 1.55 !important; }
.tk-callout-k { font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
.tk-tip { background: rgba(48, 209, 88, 0.07); border: 1px solid rgba(48, 209, 88, 0.3); }
.tk-tip .tk-callout-k { color: var(--ok); }
.tk-trap { background: rgba(255, 105, 97, 0.07); border: 1px solid rgba(255, 105, 97, 0.32); }
.tk-trap .tk-callout-k { color: var(--bad); }
.tk-note { margin-top: 16px !important; }

.tk-chain { margin: 22px 0 0; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line-2); display: grid; gap: 10px; }
.tk-chain-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tk-link { padding: 6px 11px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line-2); font-size: 14.5px; color: var(--text); line-height: 1.35; }
.tk-arrow { color: var(--subj); font-weight: 700; }

.tk-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-top: 20px; }
.tk-col { padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--surface); }
.tk-col h4 { margin: 0; font-size: 15px; font-weight: 650; color: var(--text); }
.tk-col p, .tk-col li { font-size: 15px !important; }
.tk-col > :first-child + * { margin-top: 6px !important; }

.tk-reveal { margin: 20px 0 0; padding: 14px 16px; border-radius: 14px; border: 1px dashed var(--line-3); }
.tk-reveal-q { margin: 0 0 10px !important; color: var(--text) !important; }
.tk-think { border-color: color-mix(in srgb, var(--subj) 50%, var(--line-3)); }
.tk-think .tk-box-label { color: var(--subj); }
.tk-think .tk-reveal-q { margin-top: 6px !important; }
.tk-reveal-a { margin-top: 8px; }

/* exam wording: what a question type looks like in the paper */
.tk-looks { margin: 0; padding: 16px 18px; border-radius: 14px; border: 1px solid var(--line-2); background: #0e0e10; display: grid; gap: 10px; }
.tk-look { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: baseline; padding-left: 12px; border-left: 2px solid var(--line-3); }
.tk-look-t { font-family: var(--paper); font-size: 16px; line-height: 1.5; color: var(--text); }
.tk-look-m { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }

.tk-fig { margin-top: 24px; max-width: 760px; }
.tk-fig.is-wide, .tk-fig.tk-widget { max-width: none; }
.tk-svg { width: 100%; height: auto; }
.tk-fig .figure-body { padding: 12px; }

/* ---------- questions ---------- */
.tk-q { scroll-margin-top: 90px; }
.tk-num-row { display: flex; gap: 8px; align-items: center; margin-top: 14px; }
.tk-num-row input { flex: 0 1 240px; min-width: 0; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--bg); font-family: var(--mono); font-size: 15px; }
.tk-num-row input:focus { outline: none; border-color: var(--muted); }
.tk-num-row .unit { font-family: var(--mono); color: var(--muted); font-size: 14px; }
.tk-q textarea { width: 100%; margin-top: 14px; min-height: 96px; padding: 12px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--bg); font-size: 15px; line-height: 1.5; resize: vertical; }
.tk-q textarea:focus { outline: none; border-color: var(--muted); }
.tk-tally { margin-left: auto; }
.tk-model p { margin: 8px 0 0 !important; font-size: 15px !important; }
.tk-marking { margin: 6px 0 0 !important; padding-left: 1.2em !important; }
.tk-marking li { font-size: 14.5px !important; }
.tk-rate { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.tk-rate button[aria-pressed='true'] { background: var(--text); color: var(--bg); }
.q-opt .key { flex: none; }
.q-opt[aria-pressed='true'] { border-color: var(--text); color: var(--text); background: var(--surface-2); }
.tk-why { margin: 8px 0 0 !important; font-size: 14.5px !important; color: var(--text-2) !important; }
.tk-q-fig:empty { display: none; }

/* exam-style questions: a paper on screen */
.tk-ex { padding: 20px 22px 16px; }
.tk-ex.is-worked { border-color: color-mix(in srgb, var(--subj) 45%, var(--line-2)); background: linear-gradient(180deg, color-mix(in srgb, var(--subj) 6%, var(--surface)), var(--surface) 140px); }
.tk-ex-kind { color: var(--subj) !important; font-weight: 650; }
.tk-ex-title { margin: 6px 0 0 !important; font-size: 17px !important; font-weight: 650; color: var(--text) !important; }
.tk-ex-stem { margin: 10px 0 0 !important; font-family: var(--paper); font-size: 17px !important; line-height: 1.6 !important; color: var(--text) !important; max-width: none !important; }
.tk-ex .tk-fig { margin-top: 14px; }
.tk-ex-try { margin: 10px 0 0 !important; font-size: 13.5px !important; color: var(--muted) !important; }
.tk-parts { list-style: none; margin: 14px 0 0 !important; padding: 0 !important; display: grid; gap: 0; max-width: none !important; }
.tk-part-q { padding: 14px 0; border-top: 1px solid var(--line); }
.tk-part-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 12px; align-items: baseline; }
.tk-part-n { font-family: var(--mono); font-size: 14px; font-weight: 650; color: var(--text); min-width: 3.2em; }
.tk-part-text { font-family: var(--paper); font-size: 16.5px; line-height: 1.6; color: var(--text); }
.tk-part-m { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.tk-part-got { font-size: 12.5px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line-3); }
.tk-part-got.is-full { color: var(--ok); border-color: rgba(48, 209, 88, 0.5); background: var(--ok-bg); }
.tk-part-got.is-part { color: #ffd60a; border-color: rgba(255, 214, 10, 0.45); }
.tk-part-got.is-zero { color: var(--bad); border-color: rgba(255, 105, 97, 0.45); }
.tk-part-ans, .tk-part-mark { padding-left: calc(3.2em + 12px); }
.tk-part-ans textarea { margin-top: 10px; min-height: 64px; }
.tk-ex-work { margin-top: 10px !important; min-height: 48px !important; font-family: var(--mono); font-size: 14px !important; }
.tk-ex-num { margin-top: 8px; }
.tk-ans-lbl { font-size: 13px; color: var(--muted); min-width: 4.5em; }
.tk-part-ans > .btn { margin-top: 10px; }
.tk-part-worked { margin-top: 10px; padding: 10px 14px 12px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); }
.tk-part-worked .tk-box-label { margin-bottom: 4px; }
.tk-verdict { margin-top: 10px; font-size: 15px; line-height: 1.5; color: var(--text-2); }
.tk-ms { margin-top: 10px; display: grid; gap: 4px; padding: 10px 14px 12px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); }
.tk-ms .tk-box-label { margin-bottom: 4px; }
.tk-ms-row { display: grid; grid-template-columns: 20px auto minmax(0, 1fr); gap: 10px; align-items: baseline; font-size: 14.5px; line-height: 1.5; color: var(--text-2); padding: 3px 0; cursor: pointer; }
.tk-ms.is-static .tk-ms-row { grid-template-columns: auto minmax(0, 1fr); cursor: default; }
.tk-ms-row input { width: 16px; height: 16px; accent-color: var(--ok); transform: translateY(2px); }
.tk-ms-row.is-locked { cursor: default; opacity: 0.85; }
.tk-levels { margin: 8px 0 0; padding-left: 1.2em; display: grid; gap: 4px; font-size: 14px; color: var(--text-2); }
.tk-lvl-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.tk-lvlseg button { min-width: 34px; }
.tk-ex-score { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); }
.tk-ex-score-big { font-size: 28px; font-weight: 700; color: var(--text); letter-spacing: -0.02em; }
.tk-ex-score-t { font-size: 14px; color: var(--muted); }
.tk-ex-actions { margin-top: 14px; }

/* sketch pad */
.tk-pad-wrap { margin-top: 10px; max-width: 640px; }
.tk-pad { position: relative; border-radius: 12px; background: #08080a; border: 1px solid var(--line); overflow: hidden; }
.tk-pad-svg { display: block; touch-action: none; cursor: crosshair; }
.tk-pad-model { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.tk-ink polyline { fill: none; stroke: #ffd60a; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.tk-pad-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 6px; }
.tk-pad-hint { font-size: 12.5px; color: var(--faint); }

/* ---------- question types ---------- */
.tk-part-types h2 { font-size: 36px; }
.tk-tygrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin-top: 18px; }
.tk-tycard { text-align: left; display: grid; gap: 4px; align-content: start; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); transition: border-color 0.2s, transform 0.2s var(--ease); }
.tk-tycard:hover { border-color: color-mix(in srgb, var(--subj) 60%, var(--line-2)); transform: translateY(-2px); }
.tk-tycard-n { font-family: var(--mono); font-size: 12px; color: var(--subj); }
.tk-tycard-t { font-size: 14.5px; font-weight: 600; line-height: 1.35; }
.tk-tycard-m { font-size: 12px; color: var(--faint); }
.tk-tycard-s { font-size: 12px; color: var(--muted); }
.tk-type-k { color: var(--subj) !important; font-weight: 650; letter-spacing: 0.02em; }
.tk-chips-s { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tk-chip-s { font-size: 12px; color: var(--muted); padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); }
.tk-chip-s.is-seen { color: var(--text); border-color: color-mix(in srgb, var(--subj) 55%, var(--line-2)); background: color-mix(in srgb, var(--subj) 12%, var(--surface)); }
.tk-type .tk-split { margin-top: 18px; }
.tk-type .tk-split .tk-callout { margin-top: 12px; }
.tk-type .tk-steps-wrap { padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--surface); }
.tk-type .tk-steps-wrap .tk-box-label { color: var(--subj); }
.tk-type .steps { margin: 6px 0 0 !important; }
.tk-type .steps li { font-size: 15.5px; padding-top: 6px; padding-bottom: 6px; }
.tk-type .steps li::before { top: 7px; }
.tk-traps { margin-top: 22px; }

.tk-next { margin-top: 56px; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 20px 22px; border-radius: 18px; border: 1px solid var(--line-2); background: linear-gradient(120deg, color-mix(in srgb, var(--subj) 10%, var(--surface)), var(--surface)); }
.tk-next-t { margin: 6px 0 0; font-size: 17px; color: var(--text); }

/* ---------- widgets ---------- */
.tk-widget .figure-body { padding: 16px; }
.tk-w { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(260px, 1fr); gap: 18px; align-items: start; }
.tk-w-stack { grid-template-columns: minmax(0, 1fr); }
.tk-w-canvas { border-radius: 14px; background: #08080a; border: 1px solid var(--line); padding: 6px; min-width: 0; }
.tk-w-side { display: grid; gap: 14px; min-width: 0; }
.tk-w-read { display: grid; gap: 6px; }
.tk-w-stat { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; color: var(--muted); border-bottom: 1px solid var(--line); padding: 6px 0; }
.tk-w-stat b { color: var(--text); font-family: var(--mono); font-weight: 550; font-size: 13.5px; text-align: right; }
.tk-w-stat.is-comp b { color: #30d158; }
.tk-w-stat.is-comp2 b { color: #bf5af2; }
.tk-w-why, .tk-w-verdict { margin: 0; font-size: 14.5px; line-height: 1.55; color: var(--text-2); }
.tk-w-line { margin: 0; font-size: 14.5px; line-height: 1.6; color: var(--text-2); }
.tk-w-big { margin: 4px 0; font-size: 18px; color: var(--text); }
.tk-w-toggles { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.tk-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tk-chip { border: 1px solid var(--line-2); background: var(--surface-2); border-radius: 999px; padding: 6px 11px; font-size: 13px; color: var(--text-2); }
.tk-chip:hover { border-color: var(--line-3); color: var(--text); }
.tk-chip[aria-pressed='true'] { background: var(--text); color: var(--bg); border-color: var(--text); }
.tk-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.tk-fields-5 { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
.tk-field { display: grid; gap: 5px; font-size: 13px; color: var(--muted); }
.tk-field input, .tk-cell { width: 100%; padding: 9px 11px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg); font-family: var(--mono); font-size: 14px; }
.tk-cell { width: 110px; padding: 6px 8px; }
.tk-field input:focus, .tk-cell:focus { outline: none; border-color: var(--muted); }
.tk-wseg { flex-wrap: wrap; border-radius: 14px; justify-self: start; }
.tk-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--muted); }
.tk-bars { display: grid; gap: 6px; }
.tk-bar-row { display: grid; grid-template-columns: 80px 1fr 90px; gap: 10px; align-items: center; font-size: 12.5px; color: var(--muted); }
.tk-bar-row i { display: block; height: 10px; border-radius: 6px; background: var(--subj); opacity: 0.8; }
.tk-motion-w { display: grid; gap: 14px; }
.tk-motion-top { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(200px, 280px); gap: 14px; align-items: center; }
.tk-motion { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: 18px; align-items: start; }
.tk-motion-left { display: grid; gap: 10px; }
.tk-motion-right { display: grid; gap: 8px; }
.tk-motion-graphs { display: grid; gap: 6px; }
.tk-motion-g { border-radius: 12px; background: #08080a; border: 1px solid var(--line); padding: 2px 4px; }

/* ---------- flashcards ---------- */
.tk-cards { max-width: 52rem; margin: 18px auto 0; display: grid; gap: 16px; }
.tk-cards-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.tk-cards-area { display: grid; gap: 14px; }
.tk-flash {
  min-height: 300px; border-radius: 22px; border: 1px solid var(--line-2); padding: 28px;
  background: radial-gradient(120% 100% at 0% 0%, color-mix(in srgb, var(--subj) 14%, var(--surface)), var(--surface));
  display: grid; align-content: center; justify-items: center; gap: 14px; text-align: center; transition: transform 0.25s var(--ease), border-color 0.2s;
}
.tk-flash:hover { border-color: var(--line-3); }
.tk-flash:active { transform: scale(0.995); }
.tk-flash-k { font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); }
.tk-flash-t { font-size: clamp(22px, 3vw, 30px); font-weight: 650; letter-spacing: -0.02em; line-height: 1.25; color: var(--text); max-width: 38rem; }
.tk-flash-t.is-back { font-size: clamp(17px, 2.2vw, 20px); font-weight: 450; letter-spacing: 0; line-height: 1.55; color: var(--text-2); }
.tk-flash-hint { font-size: 12.5px; color: var(--faint); }
.tk-flash-actions { justify-content: center; }
.tk-yes { border-color: rgba(48, 209, 88, 0.5); }
.tk-no { border-color: rgba(255, 159, 10, 0.45); }
.tk-meter { height: 6px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.tk-meter i { display: block; height: 100%; background: var(--subj); border-radius: 6px; transition: width 0.3s var(--ease); }
.tk-search { width: 100%; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); font-size: 15px; }
.tk-search:focus { outline: none; border-color: var(--muted); }
.tk-words { margin: 0; display: grid; gap: 0; }
.tk-words > div { display: grid; grid-template-columns: minmax(140px, 240px) 1fr; gap: 6px 18px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.tk-words dt { font-weight: 650; color: var(--text); font-size: 15px; }
.tk-words dd { margin: 0; color: var(--text-2); font-size: 15px; line-height: 1.55; }

/* ---------- exam practice ---------- */
.tk-practice { margin-top: 18px; display: grid; gap: 18px; }
.tk-practice-head h2 { margin: 0; font-size: 32px; letter-spacing: -0.03em; }
.tk-practice-head p { margin: 8px 0 0; color: var(--text-2); font-size: 16px; line-height: 1.6; max-width: 70ch; }
.tk-modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.tk-mode { padding: 18px; border-radius: 18px; border: 1px solid var(--line-2); background: var(--surface); display: grid; gap: 8px; align-content: start; }
.tk-mode:first-child { background: linear-gradient(150deg, color-mix(in srgb, var(--subj) 12%, var(--surface)), var(--surface)); border-color: color-mix(in srgb, var(--subj) 35%, var(--line-2)); }
.tk-mode h3 { margin: 0; font-size: 19px; letter-spacing: -0.015em; }
.tk-mode-sub { margin: 0; font-size: 13px; color: var(--muted); font-family: var(--mono); }
.tk-mode-t { margin: 0; font-size: 14.5px; color: var(--text-2); line-height: 1.55; }
.tk-mode-ctl { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 6px; }
.tk-mode.is-off { opacity: 0.6; }
.tk-practice-stage { scroll-margin-top: 70px; }
.tk-practice-stage:empty { display: none; }
.tk-run-head h3 { margin: 0; font-size: 22px; }
.tk-run-head p { margin: 6px 0 0; color: var(--muted); font-size: 14.5px; }
.tk-paper-bar { position: sticky; top: 62px; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-radius: 14px; border: 1px solid var(--line-2); background: color-mix(in srgb, var(--surface-2) 94%, transparent); backdrop-filter: blur(10px); }
.tk-paper-bar-l { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.tk-paper-bar-r { display: flex; gap: 12px; align-items: center; }
.tk-timer { font-size: 15px; color: var(--text); padding: 4px 10px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line-2); }
.tk-timer.is-low { color: #ffd60a; border-color: rgba(255, 214, 10, 0.45); }
.tk-timer.is-over { color: var(--bad); border-color: rgba(255, 105, 97, 0.5); }
.tk-rubric { margin-top: 14px; padding: 12px 16px; border-radius: 12px; border: 1px dashed var(--line-3); }
.tk-rubric p { margin: 0; font-size: 14.5px; color: var(--text-2); line-height: 1.55; }
.tk-paper-sum { margin-top: 14px; padding: 20px 22px; border-radius: 18px; border: 1px solid var(--line-2); background: var(--surface); scroll-margin-top: 130px; }
.tk-sum-hint { margin: 8px 0 0; font-size: 13px; color: var(--faint); }
.tk-paper-foot { justify-content: flex-end; margin-top: 18px; }
.tk-tybars { display: grid; gap: 6px; margin-top: 8px; }
.tk-tybar { display: grid; grid-template-columns: 64px minmax(0, 1fr) minmax(80px, 200px) 92px; gap: 12px; align-items: center; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); text-decoration: none; text-align: left; font-size: 14px; }
.tk-tybar:hover { border-color: var(--line-3); color: var(--text); }
.tk-tybar-n { font-family: var(--mono); font-size: 12px; color: var(--subj); }
.tk-tybar-t { line-height: 1.35; }
.tk-tybar-bar { height: 8px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.tk-tybar-bar i { display: block; height: 100%; border-radius: 6px; }
.tk-tybar-bar i.is-good { background: var(--ok); } .tk-tybar-bar i.is-mid { background: #ffd60a; } .tk-tybar-bar i.is-low { background: var(--bad); }
.tk-tybar-v { font-size: 12.5px; color: var(--muted); text-align: right; }
.tk-history { padding: 18px; border-radius: 18px; border: 1px solid var(--line-2); background: var(--surface); }
.tk-history:empty { display: none; }
.tk-history h3 { margin: 0; font-size: 18px; }
.tk-runs { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; }
.tk-runs li { display: grid; grid-template-columns: 70px 1fr auto; gap: 12px; font-size: 14px; color: var(--text-2); padding: 6px 0; border-bottom: 1px solid var(--line); }
.tk-runs .mono { color: var(--text); }

/* quick test */
.tk-test { display: grid; gap: 6px; margin-top: 10px; }
.tk-test-bar { display: grid; gap: 8px; }
.tk-test-bar-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.tk-test-actions { justify-content: flex-end; }
.tk-result { margin-top: 8px; padding: 22px; border-radius: 20px; border: 1px solid var(--line-2); background: var(--surface); }
.tk-result-score { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; color: var(--text-2); font-size: 15.5px; }
.tk-result-score .big { font-size: 46px; font-weight: 750; letter-spacing: -0.04em; color: var(--text); font-family: var(--mono); }
.tk-miss { margin: 8px 0 0; padding-left: 1.2em; display: grid; gap: 8px; color: var(--text-2); font-size: 14.5px; line-height: 1.5; }
.tk-sources { max-width: 80ch; }
.tk-testwrap { max-width: 56rem; margin: 18px auto 0; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .tk-learn { grid-template-columns: 220px minmax(0, 1fr); }
  .tk-split { grid-template-columns: minmax(0, 1fr) !important; }
  .tk-modes { grid-template-columns: minmax(0, 1fr); }
  .tk-motion-top { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 960px) {
  .tk-learn { grid-template-columns: minmax(0, 1fr); }
  .tk-side { position: static; max-height: none; border: 1px solid var(--line-2); border-radius: 14px; padding: 10px; background: var(--surface); }
  .tk-toc { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
  .tk-w { grid-template-columns: minmax(0, 1fr); }
  .tk-motion { grid-template-columns: minmax(0, 1fr); }
  .tk-frow { grid-template-columns: minmax(100px, 150px) minmax(0, 1fr); }
  .tk-fn { grid-column: 2; }
  .tk-paper-bar { top: 56px; }
}
@media (max-width: 640px) {
  .tk-words > div { grid-template-columns: 1fr; }
  .tk-frow { grid-template-columns: 1fr; }
  .tk-fn { grid-column: 1; }
  .tk-spec li { grid-template-columns: 1fr; gap: 2px; }
  .tk-part h2, .tk-part-types h2 { font-size: 28px; }
  .tk-sec h2 { font-size: 24px; }
  .tk-flash { min-height: 240px; padding: 20px; }
  .tk-top-right .tk-prog-mini { display: none; }
  .tk-part-ans, .tk-part-mark { padding-left: 0; }
  .tk-part-head { grid-template-columns: auto minmax(0, 1fr) auto; }
  .tk-part-got { grid-column: 2 / -1; justify-self: start; }
  .tk-ex { padding: 16px 14px 12px; }
  .tk-tybar { grid-template-columns: 48px minmax(0, 1fr) 70px; }
  .tk-tybar-bar { display: none; }
  .tk-look { grid-template-columns: 1fr; }
  .tk-seg button { padding: 6px 11px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) { .tk-flash, .tk-meter i { transition: none; } .tk-eg-line.is-new { animation: none; } .tk-tycard { transition: none; } }
@media print {
  .tk-bar, .tk-side, .tk-top, .tk-sec-foot, .tk-widget, .tk-next { display: none !important; }
  .tk-learn { display: block; }
  body { background: #fff; color: #000; }
}

/* widgets inside a lesson section: beat `.sec p` */
.sec .tk-w p { margin: 0; max-width: none; }
.sec .tk-w-why, .sec .tk-w-verdict, .sec .tk-w-line { font-size: 14.5px; line-height: 1.6; color: var(--text-2); }
.sec .tk-w-big { font-size: 18px; color: var(--text); margin: 4px 0; }
.sec .tk-w .q-provenance { font-size: 12px; color: var(--faint); }
.sec .tk-col p { font-size: 15px; }
.sec .tk-fig .figure-foot { font-size: 12.5px; }
.sec .tk-motion-w p { margin: 0; max-width: none; }

/* ---------- Library ---------- */
.lib-head .tk-title { font-size: clamp(40px, 5vw, 64px); }
.lib-block { margin-top: 28px; }
.lib-search { font-size: 17px; padding: 15px 18px; border-radius: 16px; }
.lib-results { display: grid; gap: 8px; margin-top: 12px; }
.lib-hit { display: grid; grid-template-columns: 150px minmax(0, 260px) 1fr; gap: 6px 16px; align-items: baseline; text-decoration: none; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.lib-hit:hover { border-color: var(--line-3); }
.lib-hit-tag { font-family: var(--mono); font-size: 12px; color: var(--subj); }
.lib-hit-a { font-weight: 650; color: var(--text); font-size: 15px; }
.lib-hit-b { color: var(--text-2); font-size: 14.5px; line-height: 1.5; }
.lib-continue { margin-top: 18px; }
.lib-cont-card { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: baseline; padding: 16px 18px; border-radius: 16px; border: 1px solid var(--line-2); background: linear-gradient(90deg, var(--surface-2), var(--surface)); text-decoration: none; }
.lib-cont-t { font-weight: 650; font-size: 16px; color: var(--text); }
.lib-cont-go { margin-left: auto; color: #2997ff; font-size: 14.5px; }
.lib-sec-head h2 { margin: 0; font-size: 26px; letter-spacing: -0.025em; }
.lib-sec-head p { margin: 6px 0 0; color: var(--muted); font-size: 15px; max-width: 70ch; line-height: 1.55; }
.lib-practice { padding: 22px; border-radius: 22px; border: 1px solid var(--line-2); background: var(--surface); margin-top: 32px; }
.lib-practice-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 16px; }
.lib-test { max-width: 64rem; }
.lib-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-top: 32px; }
.lib-subj { padding: 18px; border-radius: 20px; border: 1px solid var(--line-2); background: var(--surface); display: grid; gap: 8px; align-content: start; position: relative; overflow: hidden; }
.lib-subj::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--subj); opacity: 0.85; }
.lib-subj-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; flex-wrap: wrap; }
.lib-subj-head h2 { margin: 0; font-size: 20px; letter-spacing: -0.02em; flex: 1; }
.lib-row { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px; margin: 0 -10px; border-radius: 12px; text-decoration: none; }
.lib-row:hover { background: var(--surface-2); }
.lib-code { font-family: var(--mono); font-size: 12.5px; color: var(--subj); }
.lib-mid { display: grid; gap: 5px; min-width: 0; }
.lib-name { font-size: 14.5px; font-weight: 600; color: var(--text); line-height: 1.3; }
.lib-bar { height: 4px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.lib-bar i { display: block; height: 100%; background: var(--subj); }
.lib-sub { font-size: 12px; color: var(--faint); }
.lib-new { font-size: 10.5px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--subj); border: 1px solid color-mix(in srgb, var(--subj) 50%, transparent); border-radius: 999px; padding: 1px 7px; margin-left: 6px; white-space: nowrap; }
.lib-level { font-size: 11px; white-space: nowrap; }
.lib-sheet { margin-top: 12px; }
.lib-sheet .tk-spec-code { color: var(--subj); }
.lib-formulas { margin: 0 0 16px; }
.lib-sheet-t { margin-top: 14px; color: var(--subj); }
@media (max-width: 1180px) { .lib-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .lib-hit { grid-template-columns: 1fr; } .lib-grid { grid-template-columns: minmax(0, 1fr); } }
@media print { .lib-search, .lib-practice, .lib-continue, .lib-grid { display: none !important; } .lib-sheet { break-inside: avoid; } }

/* ---------- trial banner and off-scope sections (Economics trials, Nov 2026) ---------- */
.tk-banner { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px 14px; align-items: center; margin-top: 16px; max-width: 62rem; padding: 12px 16px; border-radius: 14px; text-decoration: none; color: var(--text); background: color-mix(in srgb, var(--subj) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--subj) 40%, transparent); }
.tk-banner:hover { background: color-mix(in srgb, var(--subj) 16%, var(--surface)); }
.tk-banner .tk-box-label { color: color-mix(in srgb, var(--subj) 70%, white); }
.tk-banner-t { font-size: 14.5px; line-height: 1.45; color: var(--text-2); }
.tk-banner-go { font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.tk-off { font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em; padding: 2px 9px; border-radius: 999px; color: #ffd60a; background: rgba(255, 214, 10, 0.1); border: 1px solid rgba(255, 214, 10, 0.35); }
.tk-toc .is-off a { opacity: 0.5; }
.tk-sec.is-off > h2 { color: var(--muted); }
@media (max-width: 720px) { .tk-banner { grid-template-columns: minmax(0, 1fr); } }
