:root {
  --bg: #ffffff;
  --ink: #1b2333;
  --mute: #6a7386;
  --line: #e3e6ec;
  --panel: #f5f7fa;
  --tgt: #1f5fd6;      /* accent */
  --tgt-bg: #e4edff;
  --win: #f4b400;      /* highlight */
  --win-bg: #fff6d6;
  --ok: #157a3c;
  --ok-bg: #e0f4e7;
  --bad: #b42318;
  /* topic colours (Serrano: blue, green, red), then extras for larger K */
  --t0: #2563eb; --t0-bg: #dbe7ff;
  --t1: #16a34a; --t1-bg: #dcf5e4;
  --t2: #dc2626; --t2-bg: #fde2e2;
  --t3: #9333ea; --t3-bg: #f1e3ff;
  --t4: #d97706; --t4-bg: #fdf0d9;
  --t5: #0891b2; --t5-bg: #d8f3f9;
  --none: #b8bfcc;
  --latin: "Avenir Book", "Avenir", "Avenir Next", "Nunito Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --cjk: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", "Heiti TC", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #0f1218; overflow: hidden; }
body { font-family: var(--latin), var(--cjk); color: var(--ink); -webkit-font-smoothing: antialiased; }

/* fixed 1280x720 stage, scaled to fit the window */
#stage { position: absolute; left: 50%; top: 50%; width: 1280px; height: 720px; transform-origin: center; background: var(--bg); overflow: hidden; }

.slide { position: absolute; inset: 0; padding: 40px 100px 44px 72px; opacity: 0; visibility: hidden; transition: opacity .35s ease, visibility .35s; }
.slide.active { opacity: 1; visibility: visible; }
.slide.full { padding-right: 72px; }

/* bilingual text: Chinese large, English smaller */
.zh { font-family: var(--cjk), var(--latin); font-size: 1.22em; font-weight: 500; }
.en { font-family: var(--latin), var(--cjk); font-size: .8em; color: var(--mute); }
.bi > .zh, .bi > .en { display: block; }
.bi > .zh { font-size: 38px; line-height: 1.35; }
.bi > .en { font-size: 23px; line-height: 1.35; margin-top: 3px; }
.bi.sm > .zh { font-size: 30px; } .bi.sm > .en { font-size: 20px; }
.bi.xs > .zh { font-size: 24px; } .bi.xs > .en { font-size: 17px; }
.bi + .bi { margin-top: 18px; }

h2 { margin: 0 0 22px; }
h2.bi > .zh { font-size: 48px; font-weight: 600; letter-spacing: .01em; }
h2.bi > .en { font-size: 24px; }
.kicker { font-size: 14px; letter-spacing: .14em; text-transform: uppercase; color: var(--tgt); font-weight: 600; margin-bottom: 4px; height: 18px; }

.ok-c { color: var(--ok); font-weight: 600; }
.bad-c { color: var(--bad); font-weight: 600; }
.c0 { color: var(--t0); font-weight: 600; } .c1 { color: var(--t1); font-weight: 600; } .c2 { color: var(--t2); font-weight: 600; }
b, strong { font-weight: 600; }
.small { font-size: 18px; color: var(--mute); }
.src { font-size: 15px; color: var(--mute); }

/* step reveal */
[data-step] { opacity: 0; transform: translateY(10px); transition: opacity .4s ease, transform .4s ease; pointer-events: none; }
[data-step].on { opacity: 1; transform: none; pointer-events: auto; }
.swap { display: grid; }
.swap > * { grid-area: 1 / 1; }

/* title slide */
.title-slide { display: flex; flex-direction: column; justify-content: center; padding-left: 96px; }
.title-slide .big-zh { font-size: 110px; font-weight: 600; letter-spacing: .04em; line-height: 1.1; }
.title-slide .big-en { font-size: 46px; color: var(--mute); margin-top: 6px; letter-spacing: .01em; }
.title-slide .rule { width: 90px; height: 6px; border-radius: 3px; margin: 30px 0; background: linear-gradient(90deg, var(--t0) 0 33%, var(--t1) 33% 66%, var(--t2) 66%); }
.title-slide .quote { margin-top: 10px; max-width: 760px; }
.title-slide .quote .zh { font-size: 30px; } .title-slide .quote .en { font-size: 22px; font-style: italic; }
.hint { position: absolute; bottom: 30px; left: 96px; font-size: 16px; color: var(--mute); }
kbd { border: 1px solid var(--line); border-bottom-width: 3px; border-radius: 6px; padding: 0 7px; background: #fff; font-family: inherit; font-size: .9em; }

/* definition / callout */
.def { border-left: 5px solid var(--tgt); padding: 4px 0 4px 24px; margin: 8px 0 16px; }
.def .src { margin-top: 6px; }
.callout { background: var(--panel); border-left: 5px solid var(--win); border-radius: 10px; padding: 12px 24px; margin-top: 16px; }
.callout.key { border-left-color: var(--tgt); }
.eq { font-family: var(--latin), var(--cjk); font-size: 26px; background: var(--panel); border-radius: 10px; padding: 10px 20px; display: inline-block; margin: 6px 0; line-height: 1.5; }
.eq.big { font-size: 32px; }

/* cards */
.card { border: 1.5px solid var(--line); border-radius: 16px; background: #fff; padding: 14px 22px; box-shadow: 0 2px 10px rgba(20, 30, 60, .05); }
.cards { display: flex; gap: 20px; }
.cards .card { flex: 1; }
.card h3 { margin: 0; font-weight: 600; }

.two { display: flex; gap: 40px; align-items: flex-start; }
.two > .grow { flex: 1; min-width: 0; }

/* tables */
table.cmp { border-collapse: collapse; width: 100%; }
table.cmp th, table.cmp td { text-align: left; padding: 8px 12px; font-size: 24px; border-bottom: 1.5px solid var(--line); vertical-align: middle; }
table.cmp thead th { border-bottom: 2px solid var(--ink); }
table.cmp td.num, table.cmp th.num { text-align: center; font-size: 28px; font-variant-numeric: tabular-nums; }
sub { font-size: .6em; }

/* portraits / figures */
.portrait { position: absolute; margin: 0; text-align: center; font-size: 15px; line-height: 1.3; }
.portrait img { display: block; width: 100%; border-radius: 10px; box-shadow: 0 4px 18px rgba(20, 30, 60, .22); }
.portrait figcaption { margin-top: 8px; font-weight: 600; }
.portrait figcaption span { font-weight: 400; color: var(--mute); }
.title-portrait { right: 110px; top: 50%; width: 200px; margin-top: -170px; }
img.fig { display: block; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; max-width: 100%; }

/* sidebar: slim strip of section numbers, invisible until the mouse is over the right edge; name on hover */
#side { position: absolute; right: 0; top: 0; bottom: 0; width: 64px; background: var(--panel); border-left: 1px solid var(--line); z-index: 6; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 8px; opacity: 0; transition: opacity .25s; }
#side:hover, #stage:has(#nav:hover) #side { opacity: 1; }
#side.hide { opacity: 0 !important; pointer-events: none; }
#side .item { position: relative; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; font-size: 16px; font-weight: 600; color: var(--mute); border: 2px solid transparent; transition: background .2s, color .2s; }
#side .item:hover { background: #e4e9f2; color: var(--ink); }
#side .item.done { color: var(--ink); }
#side .item.cur { background: var(--tgt); color: #fff; }
#side .item .tip { display: none; position: absolute; right: 50px; top: 50%; transform: translateY(-50%); background: var(--ink); color: #fff; border-radius: 10px; padding: 8px 14px; white-space: nowrap; box-shadow: 0 4px 16px rgba(20, 30, 60, .25); text-align: left; font-weight: 400; pointer-events: none; }
#side .item:hover .tip { display: block; }
#side .item .tip .zh { display: block; font-size: 18px; color: #fff; font-weight: 500; }
#side .item .tip .en { display: block; font-size: 13px; color: #b9c2d3; margin-top: 1px; }

/* chrome */
#bar { position: absolute; left: 0; bottom: 0; height: 5px; background: var(--tgt); width: 0; transition: width .3s; z-index: 7; }
#nav { position: absolute; right: 4px; bottom: 14px; width: 56px; display: flex; gap: 4px; z-index: 8; }
#nav button { flex: 1; height: 30px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--mute); font: inherit; font-size: 20px; line-height: 1; cursor: pointer; padding: 0; }
#nav button:hover { background: #e4e9f2; color: var(--ink); }
#num { position: absolute; right: 68px; bottom: 14px; height: 30px; line-height: 30px; font-size: 13px; color: var(--mute); z-index: 5; }

/* KaTeX */
.tex .katex { font-size: 1.12em; }
.eq .tex .katex { font-size: 1.02em; }

/* recap */
.recap { margin-top: 12px; }
.rrow { display: flex; align-items: center; gap: 22px; margin: 22px 0; }
.rrow i { flex: none; width: 48px; height: 48px; border-radius: 50%; background: var(--tgt); color: #fff; font-style: normal; font-weight: 600; font-size: 20px; display: grid; place-items: center; }

/* ================= topic modeling ================= */

/* word chips; .k0 … .k5 = coloured by topic, .k- = no topic (grey) */
.w { display: inline-block; padding: 3px 12px; border-radius: 10px; font-family: var(--cjk), var(--latin); font-size: 32px; line-height: 1.35; background: #eef0f4; color: var(--ink); border: 2px solid transparent; transition: background .3s, color .3s, border-color .3s, opacity .3s, box-shadow .3s; white-space: nowrap; }
.w.k0 { background: var(--t0); color: #fff; } .w.k1 { background: var(--t1); color: #fff; } .w.k2 { background: var(--t2); color: #fff; }
.w.k3 { background: var(--t3); color: #fff; } .w.k4 { background: var(--t4); color: #fff; } .w.k5 { background: var(--t5); color: #fff; }
.w.kx { background: #fff; color: var(--mute); border: 2px dashed var(--none); }
.w.pick { box-shadow: 0 0 0 4px var(--win); }
.w.stop { opacity: .28; text-decoration: line-through; }
.w.dim { opacity: .3; }
.words { display: flex; flex-wrap: wrap; gap: 8px 6px; }

/* the four toy documents, as clipboards */
.docs { display: flex; gap: 22px; }
.doc { flex: 1; border: 3px solid var(--ink); border-radius: 12px; padding: 22px 10px 10px; position: relative; display: flex; flex-direction: column; align-items: center; gap: 5px; background: #fff; }
.doc::before { content: attr(data-name); position: absolute; top: -14px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; font-size: 16px; padding: 2px 12px; border-radius: 8px; white-space: nowrap; }
.doc .w { font-size: 28px; min-width: 104px; text-align: center; }
.doc .w.plain { background: none; }
.doc .w.plain.k0 { color: var(--t0); } .doc .w.plain.k1 { color: var(--t1); } .doc .w.plain.k2 { color: var(--t2); }
.mix { display: flex; height: 14px; border-radius: 7px; overflow: hidden; width: 100%; margin-top: 4px; background: #eef0f4; }
.mix > div { height: 100%; transition: width .3s; }
.mixlbl { font-size: 16px; color: var(--mute); text-align: center; line-height: 1.35; min-height: 38px; font-variant-numeric: tabular-nums; }

/* tags (emails) */
.mails { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px 22px; margin-top: 8px; }
.mail { border: 1.5px solid var(--line); border-radius: 12px; padding: 16px 20px; background: #fff; position: relative; min-height: 140px; box-shadow: 0 2px 10px rgba(20, 30, 60, .05); }
.mail .t { font-family: var(--cjk); font-size: 27px; line-height: 1.4; }
.mail .t .en { display: block; font-size: 17px; margin-top: 2px; }
.mail .tags { position: absolute; right: 10px; bottom: -12px; display: flex; gap: 6px; }
.tag { display: inline-block; font-size: 18px; font-weight: 600; padding: 3px 12px; border-radius: 999px; color: #fff; }
.tag.k0 { background: var(--t0); } .tag.k1 { background: var(--t1); } .tag.k2 { background: var(--t2); }

/* bag of words */
.bag { display: flex; flex-wrap: wrap; gap: 10px; }
.bag span { font-family: var(--cjk); font-size: 32px; padding: 4px 14px; border-radius: 10px; background: var(--win-bg); border: 2px solid var(--win); }
.bag span b { font-family: var(--latin); color: #8a6a00; margin-left: 6px; }

/* topic lists (a column per topic) */
.topics { display: flex; gap: 14px; }
.topic { flex: 1; border-radius: 12px; padding: 8px 12px; background: var(--panel); border-top: 6px solid var(--none); min-width: 0; }
.topic.k0 { border-top-color: var(--t0); } .topic.k1 { border-top-color: var(--t1); } .topic.k2 { border-top-color: var(--t2); }
.topic.k3 { border-top-color: var(--t3); } .topic.k4 { border-top-color: var(--t4); } .topic.k5 { border-top-color: var(--t5); }
.topic .row { display: flex; justify-content: space-between; font-size: 24px; line-height: 1.45; font-family: var(--cjk), var(--latin); }
.topic .row span:last-child { font-family: var(--latin); color: var(--mute); font-size: 17px; font-variant-numeric: tabular-nums; }
.topic h4 { margin: 0 0 4px; font-size: 18px; color: var(--mute); font-weight: 600; }

/* one Gibbs step: the questions and the rectangles */
.qgrid { display: grid; grid-template-columns: 250px repeat(3, 1fr); gap: 4px 14px; align-items: center; margin-top: 10px; }
.qgrid .q { font-size: 21px; line-height: 1.3; }
.qgrid .q .en { display: block; font-size: 15px; }
.qgrid .v { text-align: center; font-size: 32px; font-variant-numeric: tabular-nums; }
.qgrid .hd { text-align: center; font-size: 22px; font-weight: 600; }
.rects { display: grid; grid-template-columns: 250px repeat(3, 1fr); gap: 0 14px; align-items: end; height: 190px; }
.rects .r { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; position: relative; }
.rects .box { border-radius: 4px; transition: width .5s, height .5s; }
.rects .area { font-size: 19px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.rects .dart { position: absolute; font-size: 40px; transition: opacity .3s; }

/* the live sampler */
.sim { display: flex; gap: 26px; }
.sim .left { flex: 1; min-width: 0; }
.sim .right { width: 330px; flex: none; }
.panel { background: var(--panel); border-radius: 12px; padding: 10px 16px; }
.pbars .pb { display: flex; align-items: center; gap: 8px; margin: 7px 0; font-size: 17px; font-variant-numeric: tabular-nums; }
.pbars .pb .track { flex: 1; height: 20px; background: #e6e9ef; border-radius: 5px; overflow: hidden; }
.pbars .pb .fill { height: 100%; transition: width .25s; }
.pbars .pb.won .track { box-shadow: 0 0 0 3px var(--win); }
.pbars .pb span:first-child { width: 22px; height: 22px; border-radius: 50%; flex: none; }
.pbars .pb span:last-child { width: 44px; text-align: right; }
.stat { font-size: 17px; color: var(--mute); line-height: 1.6; }
.stat b { color: var(--ink); font-variant-numeric: tabular-nums; }
.keys { font-size: 17px; color: var(--mute); line-height: 1.9; }
svg.chart { width: 100%; height: auto; display: block; }
svg.chart text { font-family: var(--latin), var(--cjk); font-size: 15px; fill: var(--mute); }
.speed { display: inline-block; font-size: 13px; padding: 1px 10px; border-radius: 999px; background: var(--tgt-bg); color: var(--tgt); font-weight: 600; }

/* compact docs for the poetry corpus */
.cdocs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; }
.cdoc { display: flex; align-items: center; gap: 3px; }
.cdoc .id { width: 24px; font-size: 12px; color: var(--mute); flex: none; }
.cdoc .w { font-size: 20px; padding: 1px 6px; border-radius: 6px; }
.ksel { display: inline-flex; gap: 6px; vertical-align: middle; }
.ksel span { width: 34px; height: 30px; display: grid; place-items: center; border-radius: 8px; border: 1.5px solid var(--line); font-size: 17px; color: var(--mute); }
.ksel span.on { background: var(--tgt); border-color: var(--tgt); color: #fff; font-weight: 600; }

/* generative story */
.gen-doc { min-height: 120px; padding: 12px 14px; border: 2px dashed var(--line); border-radius: 12px; }
.die { display: inline-grid; place-items: center; width: 54px; height: 54px; border-radius: 12px; font-size: 26px; color: #fff; font-weight: 600; transition: background .2s; background: var(--none); }

/* timeline */
.tl { position: relative; margin: 26px 0 0 10px; }
.tl::before { content: ""; position: absolute; left: 92px; top: 6px; bottom: 6px; width: 3px; background: var(--line); }
.tl .ev { display: flex; gap: 30px; align-items: flex-start; margin: 0 0 26px; position: relative; }
.tl .yr { width: 70px; text-align: right; font-size: 26px; font-weight: 600; color: var(--tgt); flex: none; line-height: 1.4; }
.tl .ev::after { content: ""; position: absolute; left: 86px; top: 13px; width: 15px; height: 15px; border-radius: 50%; background: var(--tgt); }
.tl .ev .bi { margin: 0 0 0 10px; }

/* word intrusion */
.intr { display: flex; flex-direction: column; gap: 16px; margin-top: 10px; }
.intr .row { display: flex; gap: 10px; align-items: center; }
.intr .row .w { font-size: 38px; }
.intr .row .w.intruder.show { background: var(--t2); color: #fff; }

.case h3 .zh { font-size: 30px; }
.case .bi.xs > .zh { font-size: 26px; line-height: 1.5; }
.case .bi.xs > .en { font-size: 18px; }
.big-num { font-size: 34px; font-weight: 600; color: var(--tgt); font-family: var(--latin); }

/* dirichlet simplex */
svg.simplex { display: block; }
svg.simplex text { font-family: var(--latin), var(--cjk); font-size: 18px; fill: var(--ink); }
.ab { font-family: var(--latin); font-size: 22px; }
#step-docs .doc { flex: 1 1 40%; }
.rects .area { text-align: center; line-height: 1.3; }

/* reality vs. model */
svg.rm text { font-family: var(--latin), var(--cjk); }
#s-gen .topic .row { font-size: 21px; line-height: 1.35; }
#step-docs .w { font-size: 22px; min-width: 80px; padding: 1px 8px; }
#step-docs .doc { gap: 4px; padding-top: 20px; }
#s-step .qgrid, #s-step .rects { grid-template-columns: 280px repeat(3, 1fr); }
#gs-docs .w { font-size: 23px; min-width: 88px; padding: 1px 8px; }
#gs-docs .doc { gap: 4px; padding-top: 20px; }
#po-docs .w { font-size: 18px; }
#s-poems .topic .row { font-size: 20px; line-height: 1.3; }
#s-poems .topic h4 { margin-bottom: 2px; }
#s-step .rects { height: 175px; }
#po-docs { row-gap: 4px; }
#s-step .rects { height: 160px; }
#s-step .rects .area { font-size: 17px; }
#s-step .qgrid { margin-top: 4px; }

/* emails: a little mail window per message */
.mail { padding: 0; overflow: visible; min-height: 0; border-radius: 12px; }
.mail .mh { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: var(--panel); border-bottom: 1.5px solid var(--line); border-radius: 12px 12px 0 0; color: var(--mute); }
.mail .mh .from { font-family: var(--cjk); font-size: 19px; color: var(--ink); font-weight: 600; }
.mail .mh .time { margin-left: auto; font-size: 15px; }
.mail .subj { padding: 8px 16px 0; font-family: var(--cjk); font-size: 18px; color: var(--mute); }
.mail .subj::before { content: "主旨："; }
.mail .t { padding: 2px 16px 22px; }
.mail .t .en { font-size: 15px; }
.mails { gap: 26px 22px; }
/* bag of words before segmentation */
.words.raw { gap: 0; }
.words.raw .w { background: none; padding-left: 0; padding-right: 0; border-color: transparent; }
#s-bow .bi + .bi { margin-top: 10px; }

/* highlight boxes drawn over a figure */
.figbox { position: relative; }
.hlbox { position: absolute; border: 4px solid var(--t2); border-radius: 10px; box-shadow: 0 0 0 4px rgba(220, 38, 38, .18); }
/* tighter emails and bag of words so the callouts fit */
.mail .t { font-size: 23px; padding-bottom: 20px; }
.mail .mh { padding: 6px 14px; }
.mails { gap: 22px 22px; margin-top: 0; }
#s-bow .w { font-size: 28px; }
#s-bow .bag span { font-size: 27px; padding: 2px 12px; }
/* generative story: the document box has its final size from the start; rows never stretch */
#gen-doc { height: 124px; align-content: flex-start; align-items: flex-start; }
#gen-doc .w { font-size: 26px; }
#gen-doc { flex: 1; min-width: 0; }
.die { transition: none; }

/* one Gibbs step: documents in a row, calculations below */
#step-docs { flex-wrap: nowrap; gap: 16px; }
#step-docs .doc { flex: 1 1 0; }
#s-step .qgrid, #s-step .rects { grid-template-columns: 330px repeat(3, 1fr); }
#s-step .rects { height: 150px; }
#s-step .rects { height: 128px; }
#step-docs .w { font-size: 20px; padding: 0 8px; }
#step-docs .doc { gap: 3px; padding-top: 18px; }
#s-step .qgrid { margin-top: 10px !important; row-gap: 0; }

/* code snippet */
pre.code { margin: 10px 0 2px; font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 19px; line-height: 1.45; color: var(--ink); background: #fff; border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 16px; }
pre.code .cm { color: var(--mute); }
#s-tools table.cmp th, #s-tools table.cmp td { padding: 6px 12px; }
code { font-family: "SF Mono", Menlo, Consolas, monospace; font-size: .92em; }
#s-qhchina table.cmp td { font-size: 22px; }
/* poems: number the documents down the columns (1–8 left, 9–16 right) */
.cdocs { grid-auto-flow: column; grid-template-rows: repeat(8, auto); }

/* annotated code: an arrow from each parameter to its explanation */
.annot { display: flex; flex-direction: column; }
.annot .cl { display: flex; align-items: center; height: 40px; }
.annot .cl code { width: 560px; flex: none; font-size: 22px; background: var(--panel); padding: 4px 18px; height: 100%; display: flex; align-items: center; white-space: pre; }
.annot .cl:first-child code { border-radius: 10px 10px 0 0; padding-top: 10px; }
.annot .cl:last-child code { border-radius: 0 0 10px 10px; padding-bottom: 10px; }
.annot .ann { display: flex; align-items: center; gap: 14px; font-size: 26px; font-family: var(--cjk), var(--latin); }
.annot .arr { position: relative; width: 90px; height: 3px; background: var(--tgt); margin-left: -150px; }
.annot .arr::after { content: ""; position: absolute; right: -2px; top: -7px; border-left: 14px solid var(--tgt); border-top: 8.5px solid transparent; border-bottom: 8.5px solid transparent; }
.annot .arr { width: 250px; margin-left: -228px; }
.annot .cl code { width: 600px; }
.annot .arr { width: 240px; margin-left: -218px; }

/* arrows drawn over a slide, and labels placed next to the figure */
svg.arrows { position: absolute; left: 0; top: 0; width: 1280px; height: 720px; pointer-events: none; overflow: visible; }
.flab { position: absolute; margin: 0; }

/* generative story: the dartboard of topic proportions */
.board { position: relative; width: 300px; height: 190px; display: flex; border-radius: 10px; overflow: hidden; box-shadow: 0 2px 10px rgba(20, 30, 60, .12); }
.board .strip { height: 100%; display: grid; place-items: center; color: #fff; font-size: 18px; text-align: center; line-height: 1.3; font-weight: 600; transition: width .4s; }
.board .hit { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: #1b2333; box-shadow: 0 0 0 2px #fff; }
.board .hit.now { width: auto; height: auto; margin: -20px 0 0 -18px; background: none; box-shadow: none; font-size: 32px; line-height: 1; animation: hz-in .3s ease both; }
@keyframes hz-in { from { opacity: 0; transform: scale(1.8); } to { opacity: 1; transform: none; } }

/* AI labelling: topic → LLM → label */
.aiflow { display: flex; align-items: center; gap: 14px; margin-top: 18px; }
.aiflow .card { align-self: stretch; }
.aiflow .card.ai { border-color: var(--tgt); background: var(--tgt-bg); }
.aiflow .bubble { font-family: var(--cjk); font-size: 22px; line-height: 1.5; background: #fff; border-radius: 12px; padding: 10px 14px; }
.aiflow .farr { position: relative; flex: none; width: 54px; height: 4px; background: var(--tgt); }
.aiflow .farr::after { content: ""; position: absolute; right: -4px; top: -9px; border-left: 16px solid var(--tgt); border-top: 11px solid transparent; border-bottom: 11px solid transparent; }
.aiflow .words .w { font-size: 26px; }

/* keep summaries clear of the page number */
.board { height: 150px; }
#s-gen .topic .row { font-size: 19px; line-height: 1.3; }
#s-gen .topic h4 { font-size: 16px; margin-bottom: 2px; }
#s-gen .topic { padding: 6px 12px; }
#s-two table.cmp th, #s-two table.cmp td { padding-top: 5px; padding-bottom: 5px; }
#s-bow #bow-bag { margin-top: 8px !important; }
.title-slide .hint { bottom: 46px; }
/* the currently selected word: a thicker gold ring with a white gap and a glow */
.w.pick { box-shadow: 0 0 0 3px #fff, 0 0 0 7px #f59e0b, 0 0 14px 6px rgba(245, 158, 11, .55); position: relative; z-index: 2; }

/* the four toy documents look identical on the toy-problem, one-step and live-sampler slides */
#goal-docs, #step-docs, #gs-docs { width: 680px; flex: none; flex-wrap: nowrap; gap: 16px; margin-top: 6px; }
#goal-docs .doc, #step-docs .doc, #gs-docs .doc { flex: 1 1 0; gap: 3px; padding-top: 18px; }
#goal-docs .w, #step-docs .w, #gs-docs .w { font-size: 20px; min-width: 80px; padding: 0 8px; }

/* toy-problem slide: the text column is narrower now that the documents are 680px wide */
#s-goal .bi.sm > .zh { font-size: 26px; } #s-goal .bi.sm > .en { font-size: 17px; }
#s-goal .bi + .bi { margin-top: 10px; }
#s-goal .callout { margin-top: 14px !important; padding: 8px 18px; }
#s-goal .bi.xs[data-step="4"] { margin-top: 14px !important; }

/* perplexity: two small bar charts */
.pchart { display: flex; align-items: flex-end; gap: 12px; height: 230px; margin-top: 14px; padding-bottom: 34px; border-bottom: 2px solid var(--line); position: relative; }
.pbar { width: 64px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; position: relative; }
.pfill { background: var(--t4); border-radius: 6px 6px 0 0; position: relative; min-height: 4px; }
.pfill span { position: absolute; top: -26px; left: 0; right: 0; text-align: center; font-size: 18px; color: var(--mute); }
.plab { position: absolute; bottom: -32px; left: 0; right: 0; text-align: center; font-family: var(--cjk); font-size: 20px; }
.pval { margin-top: 14px; font-size: 26px; font-family: var(--cjk), var(--latin); }
.pval b { font-size: 34px; color: var(--t4); }
/* annotated code, v2: each arrow starts right after its own line; arrowheads and notes line up on the right */
.annot { position: relative; }
.annot::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 600px; background: var(--panel); border-radius: 10px; }
.annot .cl { position: relative; width: 100%; }
.annot .cl code { width: auto !important; background: none !important; padding: 0 0 0 18px !important; flex: none; }
.annot .cl:first-child { padding-top: 6px; } .annot .cl:last-child { padding-bottom: 6px; }
.annot .ann { flex: 1; display: flex; align-items: center; gap: 0; }
.annot .arr { flex: 1; width: auto !important; margin-left: 14px !important; }
.annot .ann > span { width: 440px; flex: none; padding-left: 22px; }

#num { pointer-events: auto; cursor: pointer; } #num:hover { color: var(--ink); }
#num input { width: 3.2ch; font: inherit; color: var(--ink); background: transparent; border: none; border-bottom: 1px solid var(--mute); padding: 0; text-align: right; outline: none; }

/* DHG 502: English first, Chinese as gloss */
.bi { display: flex; flex-direction: column; }
.bi > .en { order: 1; color: var(--ink); }
.bi > .zh { order: 2; color: var(--mute); font-weight: 400; }
.bi > .en { font-size: 38px; line-height: 1.3; margin-top: 0; }
.bi > .zh { font-size: 24px; line-height: 1.35; margin-top: 3px; }
.bi.sm > .en { font-size: 29px; } .bi.sm > .zh { font-size: 20px; }
.bi.xs > .en { font-size: 22px; } .bi.xs > .zh { font-size: 17px; }
h2.bi > .en { font-size: 46px; font-weight: 600; }
h2.bi > .zh { font-size: 24px; }
.bi b, .bi > .zh b { font-weight: 600; }
#s-goal .bi.sm > .en { font-size: 26px; } #s-goal .bi.sm > .zh { font-size: 18px; }
.case .bi.xs > .en { font-size: 22px; } .case .bi.xs > .zh { font-size: 18px; }
.title-slide .big-en { font-size: 96px; font-weight: 600; color: var(--ink); margin: 0; letter-spacing: 0; line-height: 1.1; }
.title-slide .big-zh { font-size: 46px; color: var(--mute); font-weight: 500; margin-top: 6px; letter-spacing: .04em; }
.title-slide .quote .en { font-size: 30px; font-style: italic; } .title-slide .quote .zh { font-size: 22px; }
#s-goal .bi.sm > .en { font-size: 23px; } #s-goal .bi.xs > .en { font-size: 19px; }
.zhn { display: block; font-family: var(--cjk), var(--latin); font-size: .78em; color: var(--mute); font-weight: 400; margin-top: 2px; }
.stat .zhn { display: inline; margin-left: 6px; }
.tag .tz { font-weight: 400; font-size: 14px; opacity: .9; margin-left: 2px; }
.mail .t { display: flex; flex-direction: column; font-family: var(--latin), var(--cjk); }
.mail .t .en { order: -1; font-size: 21px; line-height: 1.3; color: var(--ink); margin: 0 0 3px; }
.mail .t { font-size: 17px; color: var(--mute); }
.mail { min-height: 130px; }
.ann .zhn { display: inline; margin-left: 10px; font-size: .8em; }
.bubble .zhn { margin-top: 6px; }
.ann { font-size: 21px; white-space: nowrap; }
.ann .zhn { font-size: 16px; }
#s-step .qgrid, #s-step .rects { grid-template-columns: 400px repeat(3, 1fr); }
#s-step .qgrid .q { font-size: 19px; line-height: 1.25; }
#s-step .qgrid .q .en { font-size: 14px; }
.gobtn { font: inherit; font-size: 17px; padding: 4px 16px; border: 1.5px solid var(--tgt); color: var(--tgt); background: #fff; border-radius: 999px; cursor: pointer; }
.gobtn:hover { background: var(--tgt-bg); }
.board .hdl { position: absolute; top: 0; bottom: 0; width: 18px; margin-left: -9px; cursor: ew-resize; touch-action: none; z-index: 2; }
.board .hdl::after { content: ""; position: absolute; left: 7px; top: 0; bottom: 0; width: 4px; background: #fff; box-shadow: 0 0 4px rgba(0,0,0,.35); }
.board .hdl::before { content: "↔"; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 22px; height: 22px; line-height: 22px; text-align: center; border-radius: 50%; background: #fff; color: var(--ink); font-size: 14px; box-shadow: 0 1px 5px rgba(0,0,0,.4); z-index: 1; }
.board.drag .strip { transition: none; }
.board .hit { z-index: 1; pointer-events: none; }
svg.rm { overflow: visible; }
.fterms { display: flex; justify-content: center; align-items: flex-start; gap: 6px; margin: 2px 0 0; }
.fterms .ft { display: flex; flex-direction: column; align-items: center; width: 250px; text-align: center; }
.fterms .fx { font-size: 38px; line-height: 1.2; padding: 6px 16px; border-radius: 10px; }
.fterms .feq { font-size: 34px; padding-top: 12px; color: var(--mute); }
.fterms .farrow { position: relative; width: 3px; height: 30px; margin: 4px 0 6px; background: currentColor; }
.fterms .farrow::before { content: ""; position: absolute; left: -6px; top: -8px; border: 7px solid transparent; border-top: 0; border-bottom: 11px solid currentColor; }
.fterms .bi { align-items: center; }
.fterms .c-p { color: #475569; } .fterms .c-s { color: #7c3aed; } .fterms .c-t { color: #1f5fd6; } .fterms .c-f { color: #e0570f; }
.fterms .fx { background: color-mix(in srgb, currentColor 10%, #fff); }
.fterms .bi .en { color: var(--ink); } 
.fterms .c-p .en, .fterms .c-s .en, .fterms .c-t .en, .fterms .c-f .en { font-weight: 500; }
.pcmp .callout { margin-top: 0; padding: 10px 20px; }
.pcmp .callout.up { border-left-color: #16a34a; } .pcmp .callout.down { border-left-color: #dc2626; }
.pcmp .grow { flex: 1; }
