/* ManoTL site. Black, white and greys only. One face (M PLUS Rounded 1c, the face the extension's own
   "Rounded" subtitle option names), flat fields that flip between chapters, and squishy motion. */

/* ---------- tokens ---------- */
:root {
  --paper: #ffffff;
  --ink: #0a0a0a;
  --fog: #ebebeb;
  --silver: #c9c9c9;
  /* every field sets these three: its ground, its ink, and a quieter ink that still passes 7:1 */
  --bg: var(--paper);
  --fg: var(--ink);
  --soft: #555555;

  --font: "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", "Arial Rounded MT Bold", ui-rounded, system-ui, sans-serif;
  --step-small: clamp(0.8125rem, 0.79rem + 0.1vw, 0.875rem);
  --step-body: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  --step-lead: clamp(1.25rem, 1.1rem + 0.7vw, 1.625rem);
  --step-sub: clamp(1.5rem, 1rem + 1.6vw, 2.25rem);
  --step-display: clamp(2rem, 1.15rem + 5vw, 5rem);
  --step-poster: clamp(3rem, 10vw, 9.5rem);

  --margin: clamp(1.25rem, 2.2vw, 2rem);
  --edge: max(var(--margin), calc((100vw - 110rem) / 2)); /* fields stay full-bleed; their content stops at 1760px */
  --gutter: clamp(0.75rem, 1.4vw, 1.5rem);
  --radius: clamp(1.25rem, 2.4vw, 2.25rem);

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.76, 0, 0.24, 1);
  --ease-soft: cubic-bezier(0.33, 1, 0.68, 1);
  --boing: cubic-bezier(0.34, 1.56, 0.64, 1); /* the page's squish: a small overshoot, then rest */
  --t-press: 140ms;
  --t-hover: 180ms;

  /* manga screentone: real dots, drawn as an SVG tile */
  --tone: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12'%3E%3Ccircle cx='3' cy='3' r='1.7'/%3E%3Ccircle cx='9' cy='9' r='1.7'/%3E%3C/svg%3E");
  --tone-wide: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20'%3E%3Ccircle cx='5' cy='5' r='2.1'/%3E%3Ccircle cx='15' cy='15' r='2.1'/%3E%3C/svg%3E");
}
@supports (transition-timing-function: linear(0, 1)) {
  :root { --boing: linear(0, 0.33 9%, 0.7 18%, 0.98 28%, 1.1 36%, 1.13 43%, 1.09 52%, 1.02 63%, 0.99 74%, 1); }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font); font-weight: 500; font-size: var(--step-body); line-height: 1.55; font-kerning: normal; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow-x: clip; }
h1, h2, h3, p, figure, ul, ol, dl, dd, pre { margin: 0; }
ul, ol { padding: 0; list-style: none; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
svg { display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3 { font-weight: 800; text-wrap: balance; hyphens: none; }
p { max-width: 60ch; text-wrap: pretty; }
:focus-visible { outline: 3px solid var(--fg); outline-offset: 4px; border-radius: 6px; }
::selection { background: var(--ink); color: var(--paper); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: var(--edge); top: -4rem; z-index: 10; padding: 0.7rem 1.1rem; border-radius: 999px; background: var(--ink); color: var(--paper); font-weight: 800; }
.skip:focus { top: 0.75rem; }

.display { font-size: var(--step-display); line-height: 1.02; letter-spacing: -0.03em; }
.poster-size { font-size: var(--step-poster); font-weight: 800; line-height: 0.98; letter-spacing: -0.045em; }
.sub { font-size: var(--step-sub); font-weight: 800; line-height: 1.16; letter-spacing: -0.015em; }
.lead { font-size: var(--step-lead); line-height: 1.4; max-width: 34ch; }
.small { font-size: var(--step-small); line-height: 1.5; }

.link { text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 0.22em; text-decoration-thickness: 0.09em; transition: text-decoration-color var(--t-hover) ease; }
.link--on { text-decoration-color: currentColor; }
.hero__actions .link, .steps__actions .link, .foot__nav .link, .foot__url { display: inline-flex; align-items: center; min-height: 2.75rem; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 3.25rem; padding: 0 1.6rem; border-radius: 999px; background: var(--fg); color: var(--bg); font-weight: 800; text-decoration: none; white-space: nowrap; transition: transform var(--t-press) var(--ease-out); }
.button:active { transform: scale(0.94, 0.9); }
@media (hover: hover) and (pointer: fine) {
  .link:hover { text-decoration-color: currentColor; }
  .button:hover { animation: jelly 520ms var(--ease-out); }
}
@keyframes jelly { 25% { transform: scale(1.08, 0.92); } 50% { transform: scale(0.96, 1.05); } 75% { transform: scale(1.02, 0.98); } }

/* ---------- navigation ---------- */
.nav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.25rem var(--edge) 0; }
.wordmark { display: inline-flex; align-items: center; gap: 0.55rem; min-height: 2.75rem; font-size: var(--step-lead); font-weight: 800; letter-spacing: -0.02em; text-decoration: none; }
.mark { display: grid; place-items: center; width: 1.85em; height: 1.85em; border-radius: 0.55em; background: var(--ink); color: var(--paper); font-size: 0.8em; line-height: 1; }
.nav ul { display: flex; gap: clamp(1rem, 2.6vw, 2.5rem); }
.nav li a { display: inline-flex; align-items: center; min-height: 2.75rem; }
.nav__wide { display: none; }
@media (min-width: 46em) { .nav__wide { display: block; } }

/* ---------- hero: headline, sentence, action, and the stream on its black stage ---------- */
.hero { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-template-rows: auto 1fr; column-gap: var(--gutter); padding-inline: var(--edge); min-height: min(calc(100svh - 4rem), 60rem); }
.hero h1 { grid-column: 1 / span 9; margin-left: -0.04em; padding-top: clamp(2rem, 8vh, 4.75rem); }
.lines .line { display: block; overflow: hidden; padding: 0.1em 0 0.14em; margin: -0.1em 0 -0.14em; }
.lines [data-line] { display: block; }
.hero__copy { grid-column: 1 / span 4; grid-row: 2; display: flex; flex-direction: column; padding: clamp(1.25rem, 3.2vh, 2.25rem) 0 clamp(1.5rem, 2.8vw, 2.5rem); }
.hero__fact { margin-top: auto; padding-top: 2rem; max-width: 30ch; }
.hero__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.5rem; margin-top: 1.75rem; max-width: none; }

.stage { --bg: var(--ink); --fg: var(--paper); grid-column: 5 / -1; grid-row: 2; position: relative; margin: 4.5rem calc(var(--margin) * -1) 0 0; padding: clamp(1.5rem, 3.9vw, 3.5rem) clamp(5.5rem, 7.4vw, 7rem) clamp(1.5rem, 2.8vw, 2.5rem) clamp(1.5rem, 3.9vw, 3.5rem); background: var(--ink); color: var(--paper); }
.stage__tab { position: absolute; left: 0; bottom: calc(100% - 1px); display: flex; align-items: center; gap: 0.55rem; min-width: 25%; height: 2.75rem; padding: 0 1.1rem; border-radius: 1.1rem 1.1rem 0 0; background: var(--ink); font-size: var(--step-small); font-weight: 800; white-space: nowrap; }
.stage__foot { position: absolute; left: calc(100% - 1px); bottom: 0; fill: var(--ink); }
.stage__sound { flex: none; fill: currentColor; }
.stage__wave { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

/* sized from the viewport height as well as the width, so the subtitle line is on the first screen of a 768px-tall laptop */
.stage__screen { position: relative; width: min(100%, max(24rem, calc((92svh - 24.75rem) * 16 / 9))); }
[data-ui] .player { position: relative; container-type: inline-size; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 6px; background: #fff var(--tone); }
[data-ui] .player__scene { position: absolute; inset: 0; }
[data-ui] .player .mano { position: absolute; left: 2%; bottom: -6%; width: auto; height: 94%; aspect-ratio: 400 / 440; }
[data-ui] .player__spark { position: absolute; width: 6.5%; fill: var(--ink); opacity: 0; }
[data-ui] .player__spark--a { left: 43%; top: 12%; }
[data-ui] .player__spark--b { left: 82%; top: 58%; width: 4.5%; }
/* the extension's own overlay: status chip top left, the line on its plate at the bottom */
[data-ui] .tl { position: absolute; inset: 0; pointer-events: none; font-size: 13px; line-height: 1.4; }
[data-ui] .tl__status { position: absolute; top: clamp(8px, 2cqw, 14px); left: clamp(8px, 2cqw, 14px); display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 6px; border: 1px solid #333; border-radius: 6px; background: #0b0b0b; color: #f5f5f5; pointer-events: auto; }
[data-ui] .tl__seal { display: grid; place-items: center; flex: none; width: 20px; height: 20px; border: 1px solid #fff; border-radius: 4px; color: #f5f5f5; font-size: 13px; font-weight: 800; line-height: 1; }
[data-ui] .tl__dot { flex: none; width: 6px; height: 6px; border-radius: 50%; background: #fff; }
[data-ui] .tl__label { white-space: nowrap; }
[data-ui] .tl__stop { min-width: 3.4em; min-height: 28px; padding: 2px 10px; border-radius: 4px; background: #262626; color: #f5f5f5; font-weight: 800; text-align: center; }
[data-ui] .tl__stop:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
[data-ui] .tl__caption { position: absolute; left: 50%; bottom: 7%; width: 88%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
[data-ui] .tl__line { display: inline; padding: 0.16em 0.5em; border-radius: 4px; background: #000000d9; color: #fff; -webkit-box-decoration-break: clone; box-decoration-break: clone; font-weight: 800; font-size: clamp(13px, 3.3cqw, 26px); line-height: 1.45; -webkit-text-stroke: 0.16em #000; paint-order: stroke fill; }
[data-ui] .tl__previous .tl__line { font-size: clamp(13px, 2.3cqw, 18px); font-weight: 500; opacity: 0.72; }
@media (pointer: coarse) { [data-ui] .tl__stop { min-width: 44px; min-height: 44px; padding-inline: 14px; } }
/* on a small player the chip keeps its seal, its dot and Stop, and she moves out from under it */
@container (max-width: 30rem) {
  [data-ui] .tl__label { display: none; }
  [data-ui] .player .mano { left: 30%; }
}

/* what she says: a manga bubble that crosses the edge of the video, set top to bottom */
[data-ui] .bubble { position: absolute; z-index: 2; top: calc(clamp(0.6rem, 1.5vw, 1.4rem) - clamp(1.5rem, 3.9vw, 3.5rem)); right: calc(clamp(0.6rem, 1.6vw, 1.5rem) - clamp(5.5rem, 7.4vw, 7rem)); padding: 1.2em 0.85em 1.3em; border: 4px solid var(--ink); border-radius: 48% 52% 50% 50% / 42% 44% 56% 58%; background: #fff; color: var(--ink); font-size: clamp(0.9375rem, 1.45vw, 1.3125rem); font-weight: 800; line-height: 1.5; transform-origin: 0% 100%; opacity: 0; transform: scale(0.6) rotate(8deg); transition: transform 180ms var(--ease-out), opacity 160ms ease; }
[data-ui] .bubble.is-on { opacity: 1; transform: none; transition: transform 460ms var(--boing), opacity 120ms ease; }
[data-ui] .bubble p { writing-mode: vertical-rl; max-width: none; white-space: nowrap; letter-spacing: 0.04em; }
[data-ui] .bubble__tail { position: absolute; left: calc(15% - 22px); top: 82%; fill: #fff; stroke: var(--ink); stroke-width: 4; stroke-linejoin: round; stroke-linecap: round; }

/* ---------- the mascot (one drawing, reused; see the sprite in index.html) ---------- */
.mano { overflow: visible; }
.m-ink { fill: #0a0a0a; stroke: #0a0a0a; stroke-width: 7; stroke-linejoin: round; stroke-linecap: round; }
.m-skin { fill: #fff; stroke: #0a0a0a; stroke-width: 7; stroke-linejoin: round; stroke-linecap: round; }
.m-line { fill: none; stroke: #0a0a0a; stroke-width: 7; stroke-linejoin: round; stroke-linecap: round; }
.m-lash { fill: none; stroke: #0a0a0a; stroke-width: 10; stroke-linejoin: round; stroke-linecap: round; }
.m-white { fill: #fff; }
.m-blush { stroke-width: 4.5; }
.m-shine { fill: none; stroke: #fff; stroke-width: 9; stroke-linecap: round; }
.m-cup-slot { fill: none; stroke: #0a0a0a; stroke-width: 10; stroke-linecap: round; }
.m-back use { fill: #fff; stroke: #fff; stroke-width: 26; stroke-linejoin: round; stroke-linecap: round; } /* white sticker edge, so she reads on black */
.m-back .m-back-band { fill: none; stroke-width: 44; }
.m-band-out { fill: none; stroke: #0a0a0a; stroke-width: 26; stroke-linecap: round; }
.m-band-in { fill: none; stroke: #fff; stroke-width: 12; stroke-linecap: round; }
.m-boom-out { fill: none; stroke: #fff; stroke-width: 15; stroke-linecap: round; }
.m-arm { opacity: var(--arm, 0); transform-origin: 270px 356px; }
.m-arm-out { fill: none; stroke: #0a0a0a; stroke-width: 44; stroke-linecap: round; }
.m-arm-in { fill: none; stroke: #fff; stroke-width: 30; stroke-linecap: round; }
.m-clip { fill: #0a0a0a; font-family: var(--font); font-size: 30px; font-weight: 800; }
.m-eyes-open { opacity: var(--eyes-open, 1); transform-box: fill-box; transform-origin: 50% 62%; }
.m-eyes-happy { opacity: var(--eyes-happy, 0); }
.m-eyes-squeeze { opacity: var(--eyes-squeeze, 0); }
.m-mouth-smile { opacity: var(--mouth-smile, 1); }
.m-mouth-cat { opacity: var(--mouth-cat, 0); }
.m-mouth-open { opacity: var(--mouth-open, 0); }
.m-ahoge { transform-origin: 200px 104px; }
.mano.is-happy, .mano--wave { --eyes-open: 0; --eyes-happy: 1; --mouth-smile: 0; --mouth-open: 1; }
.mano--wave { --arm: 1; }
@media (hover: hover) and (pointer: fine) {
  .mano:hover { --eyes-open: 0; --eyes-happy: 0; --eyes-squeeze: 1; --mouth-smile: 0; --mouth-open: 0; --mouth-cat: 1; }
}

/* ---------- speed: three stopwatches on stepped tiles ---------- */
.stats { --bg: var(--fog); --soft: #4a4a4a; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-template-rows: minmax(5.5rem, 14vh) 12vh 32vh 2vh minmax(5.5rem, 10vh); column-gap: 8px; align-content: center; min-height: 90svh; padding: 10vh var(--edge); background: var(--bg); }
.tile { display: flex; flex-direction: column; justify-content: space-between; gap: 1rem; padding: clamp(1.1rem, 2vw, 1.75rem); border-radius: var(--radius); }
.tile--a { --bg: var(--ink); --fg: var(--paper); grid-column: 1 / span 6; grid-row: 1 / -1; background: var(--ink); color: var(--paper); }
.tile--a .figure { font-size: var(--step-poster); letter-spacing: -0.045em; }
.tile--b { --bg: var(--paper); grid-column: 7 / span 3; grid-row: 2 / span 2; background: var(--paper); }
.tile--c { --bg: var(--silver); grid-column: 10 / span 3; grid-row: 3 / span 2; background: var(--silver); }
.figure { max-width: none; font-size: var(--step-display); font-weight: 800; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tile__bar { display: block; height: 10px; margin: auto 0 0; overflow: hidden; border-radius: 5px; background: color-mix(in srgb, var(--fg) 22%, transparent); }
.tile__bar i { display: block; height: 100%; border-radius: 5px; background: var(--fg); transform-origin: 0 50%; }
.tile__cap { max-width: 27ch; }
.stats__title { grid-column: 7 / -1; grid-row: 1; align-self: start; }
.stats__note { grid-column: 7 / -1; grid-row: 5; align-self: end; max-width: 46ch; }

/* ---------- how it works: one slider, two fields ---------- */
.how { --bg: var(--ink); --fg: var(--paper); position: relative; display: grid; grid-template-columns: 1fr 1fr; min-height: 88svh; }
.how__left { padding: clamp(3rem, 11vh, 6.5rem) var(--margin) 12rem var(--edge); background: var(--ink); color: var(--paper); }
.how__right { --bg: var(--paper); --fg: var(--ink); display: grid; place-items: center; padding: 3rem var(--edge) 12rem var(--margin); background: var(--paper); color: var(--ink); }
.stages h3 { max-width: 9.5em; margin-left: -0.04em; }
.stages p { margin-top: 1.25rem; max-width: 32ch; }
.stages li + li { margin-top: 3rem; }
.js .stages li + li { margin-top: 0; }
.js .stages li:not(.is-active) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.how__slider { display: none; }
.js .how__slider { display: block; position: absolute; left: var(--edge); right: var(--edge); bottom: clamp(1.75rem, 5vh, 3rem); height: 6.25rem; container-type: inline-size; }
.how__track { position: absolute; left: 0; right: 0; top: 18px; height: 8px; overflow: hidden; border-radius: 4px; background: #777; mix-blend-mode: difference; }
.how__fill { display: block; height: 100%; background: #fff; transform-origin: 0 50%; transform: scaleX(var(--p, 0)); transition: transform 380ms var(--ease-out); }
.how__thumb { position: absolute; left: 0; top: -6px; width: 56px; height: 56px; overflow: hidden; border: 4px solid var(--ink); border-radius: 50%; background: #fff; pointer-events: none; transform: translateX(calc(var(--p, 0) * (100cqw - 56px))); transition: transform 380ms var(--boing); }
.how__thumb svg { width: 100%; height: 100%; }
.how__slider input { position: absolute; left: 0; top: -6px; width: 100%; height: 56px; margin: 0; opacity: 0; cursor: pointer; }
.how__slider:has(input:focus-visible) .how__thumb { outline: 4px solid #767676; outline-offset: 3px; }
/* her face on the thumb follows the stage: listening, concentrating, pleased, done */
.how[data-stage="1"] .how__thumb { --eyes-open: 0; --eyes-squeeze: 1; }
.how[data-stage="2"] .how__thumb { --mouth-smile: 0; --mouth-cat: 1; }
.how[data-stage="3"] .how__thumb { --eyes-open: 0; --eyes-happy: 1; --mouth-smile: 0; --mouth-open: 1; }
.how__names { position: absolute; left: 0; right: 0; top: 56px; display: flex; justify-content: space-between; }
.how__names li { display: flex; justify-content: center; width: 56px; }
.how__names button { min-height: 2.75rem; padding: 0 0.25rem; color: #bdbdbd; white-space: nowrap; }
.how__names li:nth-child(n+3) button { color: #555; }
.how__names button[aria-current="true"] { color: var(--paper); font-weight: 800; }
.how__names li:nth-child(n+3) button[aria-current="true"] { color: var(--ink); }

[data-ui].devlog { width: min(100%, 36rem); padding: 16px 18px 6px; border-radius: 12px; background: #111; color: #f2f2f2; font-size: 15px; line-height: 1.45; }
[data-ui] .devlog__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 8px; }
[data-ui] .devlog__head strong { font-size: 17px; font-weight: 800; }
[data-ui] .devlog__head span { color: #a8a8a8; font-size: 13px; }
[data-ui].devlog table { width: 100%; border-collapse: collapse; table-layout: fixed; }
[data-ui].devlog th { padding: 6px 8px 6px 0; border-bottom: 1px solid #333; color: #a8a8a8; font-size: 13px; font-weight: 500; text-align: left; }
[data-ui].devlog td { height: 3.9em; padding: 9px 8px 9px 0; border-bottom: 1px solid #262626; vertical-align: top; }
[data-ui].devlog tr:last-child td { border-bottom: 0; }
[data-ui].devlog th:nth-child(1) { width: 11%; }
[data-ui].devlog th:nth-child(2) { width: 17%; }
[data-ui].devlog th:nth-child(5) { width: 13%; }
[data-ui].devlog td:nth-child(-n+2), [data-ui].devlog td:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
[data-ui].devlog td[lang="ja"], [data-ui].devlog [lang="ja"] { font-weight: 800; }
[data-ui].devlog .muted, [data-ui].devlog td:nth-child(2) { color: #a8a8a8; }
[data-ui] .devlog__now td { color: #fff; }
/* the newest row fills in stage by stage; without script it is simply complete */
.js .how .s1, .js .how .s2, .js .how .s3 { display: none; }
.how .s0 { display: none; }
.js .how[data-stage="0"] .s0 { display: inline; }
.js .how[data-stage="1"] .s-until3, .js .how[data-stage="2"] .s-until3 { display: inline; }
.js .how[data-stage="1"] .s1, .js .how[data-stage="2"] .s1, .js .how[data-stage="3"] .s1,
.js .how[data-stage="2"] .s2, .js .how[data-stage="3"] .s2,
.js .how[data-stage="3"] .s3 { display: inline-block; }

/* ---------- sites: one per poster line ---------- */
/* a page of screentone: the names are the poster, and each fact sits on a subtitle plate */
.sites { display: flex; flex-direction: column; justify-content: center; min-height: 90svh; padding: clamp(4rem, 11vh, 6.5rem) var(--edge); background: var(--paper) var(--tone-wide); }
.sites h2 { margin-bottom: clamp(1.25rem, 4vh, 2.5rem); }
.sites h2 span { padding: 0.1em 0.5em 0.16em; margin-left: -0.5em; border-radius: 0.3em; background: var(--paper); }
.poster li { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.poster__name { margin-left: -0.05em; font-size: var(--step-poster); font-weight: 800; line-height: 1; letter-spacing: -0.03em; -webkit-text-stroke: 0.1em var(--paper); paint-order: stroke fill; transition: transform 420ms var(--boing); transform-origin: 0 80%; } /* the paper edge is the extension's own subtitle border: a stroke painted behind the fill, so the letters stay clean on the dots */
.poster__fact { padding: 0.18em 0.6em 0.22em; border-radius: 0.3em; background: var(--ink); color: var(--paper); font-size: var(--step-lead); font-weight: 800; white-space: nowrap; }
@media (hover: hover) and (pointer: fine) { .poster li:hover .poster__name { transform: translateX(0.12em) skewX(-6deg); } }

/* ---------- languages: the switch, blown up; it flips the field ---------- */
.lang { --bg: var(--ink); --fg: var(--paper); position: relative; overflow: clip; /* clip, not hidden: focusing the cropped switch must not scroll the field */ min-height: 92svh; padding: clamp(4rem, 11vh, 6.5rem) var(--edge); background: var(--ink); color: var(--paper); transition: color 0s 200ms; }
.lang::before { content: ""; position: absolute; inset: 0; background: var(--paper); clip-path: circle(0% at 74% 72%); transition: clip-path 560ms var(--ease-in-out); }
.lang:has(input[value="th"]:checked) { --bg: var(--paper); --fg: var(--ink); color: var(--ink); }
.lang:has(input[value="th"]:checked)::before { clip-path: circle(150% at 74% 72%); }
.lang:not(:has(input[value="th"]:checked)) .lang__th, .lang:has(input[value="th"]:checked) .lang__en { display: none; }
.lang__text { position: relative; max-width: 36rem; }
.lang__text p { margin-top: 1.1rem; }
.lang__text .lang__sample { display: flex; flex-direction: column; align-items: flex-start; gap: 0.6rem; margin-top: 2.25rem; }
.lang__heard { font-weight: 800; }
[data-ui] .lang__heard + .tl__line, [data-ui].lang__sample .tl__line { background: var(--fg); color: var(--bg); font-size: var(--step-lead); -webkit-text-stroke: 0; transition: background-color 0s 200ms, color 0s 200ms; }

[data-ui].switch { --f: clamp(4.5rem, 9.6vw, 9.25rem); position: absolute; right: calc(var(--f) * -0.34); bottom: calc(var(--f) * -0.3); display: flex; gap: 0.06em; padding: 0.14em; border-radius: 999px; background: var(--fg); font-size: var(--f); transition: background-color 0s 200ms; }
[data-ui].switch label { position: relative; display: block; border-radius: 999px; cursor: pointer; }
[data-ui].switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
[data-ui].switch span { display: flex; align-items: flex-start; justify-content: center; gap: 0.1em; padding: 0.4em 0.5em 0.46em; border-radius: 999px; color: var(--bg); font-weight: 800; line-height: 1; letter-spacing: -0.045em; white-space: nowrap; transition: color 0s 200ms, background-color 0s 200ms; }
[data-ui].switch small { margin-top: 0.3em; font-size: 0.32em; letter-spacing: 0; }
[data-ui].switch input:checked + span { background: var(--bg); color: var(--fg); }
[data-ui].switch input:focus-visible + span { outline: 6px solid #767676; outline-offset: 5px; }

/* ---------- features: capabilities at poster scale ---------- */
.features { --bg: var(--fog); --soft: #4a4a4a; padding: clamp(5rem, 18vh, 11rem) var(--edge); background: var(--bg); }
.features__title { margin-left: -0.04em; color: var(--soft); }
.caps li { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); align-items: first baseline; margin-top: calc(var(--step-display) * 0.35); transition: color var(--t-hover) ease; }
.caps__name { grid-column: 1 / span 8; position: relative; justify-self: start; margin-left: -0.04em; }
.caps p { grid-column: 9 / -1; }
.kao { position: absolute; left: calc(100% + 0.5em); bottom: 0.3em; font-size: var(--step-lead); font-weight: 500; letter-spacing: 0; line-height: 1; white-space: nowrap; opacity: 0; transform: translateX(-0.6em) rotate(-8deg); transition: transform 420ms var(--boing), opacity 140ms ease; }
@media (hover: hover) and (pointer: fine) {
  .caps:hover li { color: var(--soft); }
  .caps:hover li:hover { color: var(--fg); }
  .caps li:hover .kao { opacity: 1; transform: none; }
}

/* ---------- TL notes: a band per question ---------- */
.band { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); padding: 3.5rem var(--edge); background: var(--paper); }
.band--alt { --bg: var(--fog); background: var(--fog); }
.band h3 { grid-column: 1 / span 5; }
.band > p { grid-column: 7 / -1; }
.band--head { --bg: var(--ink); --fg: var(--paper); position: relative; overflow: clip; align-items: end; min-height: 40svh; padding-bottom: 2.5rem; background: var(--ink); color: var(--paper); }
.band--head h2 { grid-column: 1 / span 6; margin-left: -0.05em; }
.band--head .band__intro { grid-column: 7 / span 3; padding-bottom: 0.9rem; max-width: 26ch; }
.kao-inline { white-space: nowrap; }
.peek { position: absolute; right: calc(var(--edge) + 1rem); bottom: 0; width: clamp(9rem, 17vw, 15rem); aspect-ratio: 400 / 290; overflow: hidden; }
.mano--peek { width: 100%; height: auto; aspect-ratio: 400 / 440; transform: translateY(3%); }

/* ---------- install: the first screen, already open, and the steps to get there ---------- */
.install { --bg: var(--ink); --fg: var(--paper); display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); min-height: 90svh; padding: clamp(4rem, 11vh, 6.5rem) var(--edge); background: var(--ink); color: var(--paper); }
.install ::selection { background: var(--paper); color: var(--ink); }
.install__lead { grid-column: 1 / span 5; display: flex; flex-direction: column; gap: 1.1rem; }
.install__lead h2 { margin-top: auto; margin-left: -0.04em; padding-top: 3rem; max-width: 7em; }
.install__lead p { max-width: 36ch; }
.install__steps { grid-column: 7 / -1; align-self: center; min-width: 0; }
.steps { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.5rem; margin-top: 1.5rem; padding-left: 1.4em; list-style: decimal; }
.steps li::marker { font-weight: 800; }
.steps li { padding-left: 0.35em; }
pre { max-width: 100%; margin-top: 0.9rem; padding: 1.1rem 1.25rem; overflow-x: auto; border-radius: 1.1rem; background: #1e1e1e; color: #fff; font-size: 0.9375rem; line-height: 1.75; }
pre, code { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-weight: 400; }
p code { padding: 0.12em 0.4em; border-radius: 0.4em; background: #262626; font-size: 0.9em; overflow-wrap: anywhere; }
.steps__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.5rem; margin-top: 1rem; max-width: none; }

[data-ui].popup { display: flex; flex-direction: column; gap: 12px; width: min(100%, 22.5rem); padding: 14px 16px 16px; border: 1px solid #3a3a3a; border-radius: 12px; background: #141414; color: #f5f5f5; font-size: 14px; line-height: 1.5; }
[data-ui] .popup__head { display: flex; align-items: center; gap: 10px; }
[data-ui] .popup__head strong { font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }
[data-ui] .popup__head .tl__seal { width: 26px; height: 26px; border-radius: 6px; font-size: 14px; }
[data-ui] .popup__chip { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; color: #b4b4b4; font-size: 13px; white-space: nowrap; }
[data-ui].popup i { flex: none; width: 6px; height: 6px; border-radius: 50%; background: #fff; }
[data-ui] .popup__now { display: flex; flex-direction: column; gap: 12px; padding: 14px; border: 1px solid #333; border-radius: 8px; background: #1f1f1f; }
[data-ui] .popup__lead { display: flex; align-items: flex-end; gap: 16px; }
[data-ui] .popup__lead > div { display: flex; flex-direction: column; }
[data-ui] .popup__lead span, [data-ui].popup dt { color: #b4b4b4; font-size: 13px; }
[data-ui] .popup__lead b { font-size: 34px; font-weight: 800; line-height: 1.05; letter-spacing: -0.02em; }
[data-ui].popup small { color: #b4b4b4; font-size: 14px; font-weight: 500; letter-spacing: 0; }
[data-ui].popup dl { display: grid; grid-template-columns: repeat(3, auto); gap: 14px; margin: 0 0 3px auto; }
[data-ui].popup dd { font-size: 18px; font-weight: 500; }
[data-ui] .popup__now p { display: flex; align-items: center; gap: 8px; color: #b4b4b4; font-size: 13px; }
[data-ui] .popup__start { display: grid; place-items: center; height: 38px; border-radius: 6px; background: #fff; color: #0a0a0a; font-weight: 800; }
[data-ui] .popup__row { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border: 1px solid #333; border-radius: 8px; background: #1f1f1f; }
[data-ui] .popup__row b { font-weight: 800; }
[data-ui] .popup__row span, [data-ui] .popup__foot { color: #b4b4b4; font-size: 13px; }
[data-ui] .popup__foot { display: flex; gap: 14px; }
[data-ui] .popup__foot span:first-child { margin-right: auto; }

/* ---------- footer: the last rows of a board ---------- */
.foot { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 8px; padding: var(--margin) var(--edge); }
.foot__tile { min-height: 13.75rem; padding: clamp(1.1rem, 1.8vw, 1.6rem); border-radius: var(--radius); text-decoration: none; }
.foot__say { --bg: var(--fog); grid-column: 1 / span 4; display: flex; flex-direction: column; justify-content: space-between; gap: 1.5rem; background: var(--fog); }
.foot__nav { --bg: var(--silver); grid-column: 5 / span 3; background: var(--silver); }
.foot__bye { grid-column: 8 / span 2; position: relative; overflow: hidden; background: #fff var(--tone); }
.foot__bye .mano { position: absolute; left: 2%; bottom: -14%; width: 96%; height: auto; }
.foot__bubble { position: absolute; z-index: 1; top: 0.9rem; right: 0.9rem; padding: 0.35em 0.8em; border-radius: 999px; background: var(--ink); color: var(--paper); font-size: var(--step-small); font-weight: 800; }
.foot__repo { --bg: var(--fog); grid-column: 10 / span 3; display: flex; flex-direction: column; justify-content: flex-end; gap: 0.25rem; background: var(--fog); }
.foot__url { font-size: var(--step-lead); font-weight: 800; }
.foot__name { --bg: var(--ink); --fg: var(--paper); grid-column: 1 / span 8; display: grid; place-items: center; min-height: 20rem; background: var(--ink); color: var(--paper); }
.foot__go { --bg: var(--silver); grid-column: 9 / span 4; display: flex; flex-direction: column; justify-content: space-between; min-height: 20rem; background: var(--silver); }
.foot__go svg { align-self: flex-end; fill: none; stroke: currentColor; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; transition: transform 420ms var(--boing); }
.foot__name:focus-visible, .foot__go:focus-visible { outline-offset: -8px; border-radius: var(--radius); }
@media (hover: hover) and (pointer: fine) {
  .foot__go:hover svg { transform: translate(6px, -6px) scale(1.08); }
  .foot__name:hover span { animation: jelly 520ms var(--ease-out); }
}
.foot__name span { display: block; }

/* ---------- the seam between chapters: a row of domes that pops along the edge, then lies flat ---------- */
.seam { position: relative; z-index: 1; height: 0; pointer-events: none; }
.seam__clip { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: flex-end; height: calc(100vw / var(--n, 12)); overflow: hidden; }
.seam i { flex: 1; aspect-ratio: 1; border-radius: 50%; background: var(--seam, var(--ink)); transform: translateY(101%); }
.seam--fog { --seam: var(--fog); }
.seam--paper { --seam: var(--paper); }
.seam--split i:nth-child(n+7) { --seam: var(--paper); }

/* ---------- motion: everything here adds arrival; the page is complete without it ---------- */
@media (prefers-reduced-motion: no-preference) {
  /* load, settled inside 1.2s: the two lines hop up, the copy rises, the stage opens */
  .js .hero [data-line] { transform: translateY(112%); animation: line-hop 720ms var(--boing) forwards; animation-delay: calc(60ms + var(--i) * 90ms); }
  .js .hero [data-load] { opacity: 0; transform: translateY(14px); animation: rise 520ms var(--ease-out) 340ms forwards; }
  .js .hero [data-open] { clip-path: inset(100% 0 0 0); animation: stage-open 1000ms var(--ease-in-out) 120ms forwards; }
  .js .hero [data-open] .player { transform: scale(1.12); animation: settle 1150ms var(--ease-soft) 100ms forwards; }
  .js .stage:not(.is-started) .bubble.is-on { animation: bubble-in 460ms var(--boing) 900ms backwards; } /* her greeting, once */

  /* chapters: the seam ripples, then the parts pop in reading order */
  .seam.is-in i { animation: seam-pop 820ms var(--ease-out) both; animation-delay: calc(var(--k, 0) * 34ms); }
  .js [data-chapter] [data-pop] { opacity: 0; transform: translateY(26px) scale(0.96); }
  .js [data-chapter].is-in [data-pop] { animation: pop-in 480ms var(--boing) both; animation-delay: calc(var(--i, 0) * 55ms); }
  .js .band--head .mano--peek { transform: translateY(70%); transition: transform 700ms var(--boing) 260ms; }
  .js .band--head.is-in .mano--peek { transform: translateY(3%); }

  /* the stream, alive only while the demo plays */
  /* inside the shared drawing, loops are switched per copy through --alive (a custom property reaches into <use>) */
  .m-eyes-open { animation: blink 4.6s linear var(--loops, infinite); animation-play-state: var(--alive, paused); }
  .m-ahoge { animation: ahoge 5.2s var(--ease-out) var(--loops, infinite); animation-play-state: var(--alive, paused); }
  .m-arm { animation: arm-wave 620ms ease-in-out var(--waves, infinite) alternate; animation-play-state: var(--alive, paused); }
  .is-playing .mano, .is-in .mano--wave, .is-in .mano--peek { --alive: running; }
  /* only the demo loops, and it has a Stop button; the other two move for under five seconds */
  .mano--wave, .mano--peek { --loops: 1; --waves: 8; }
  .is-playing .mano { animation: bob 3.2s ease-in-out infinite; }
  .is-playing .mano.is-talking { animation: bob 3.2s ease-in-out infinite, talk 300ms linear infinite; }
  .is-playing .stage__wave { animation: wave 1.2s linear infinite; }
  .is-playing .stage__wave--far { animation-delay: 0.3s; }
  .tl__current.is-land { animation: land 520ms var(--boing); }
  .player.is-landed .player__spark { animation: twinkle 760ms var(--ease-out); }
  .player.is-landed .player__spark--b { animation-delay: 90ms; }

  /* the three bars fill in real time: 2.5 s, the last 0.6 s of it, and 3.8 s */
  .js .stats .tile__bar i { transform: scaleX(0); }
  .js .stats.is-in .tile__bar i { animation: bar-fill var(--dur) linear var(--wait) both; }
  .js .stats.is-in .figure { transform-origin: 0 100%; animation: jelly 520ms var(--ease-out) calc(var(--dur-end, 2.5s)); }
  .js .stats.is-in .tile--c .figure { --dur-end: 3.8s; }
  .js .stages li.is-active { animation: fade 200ms ease; }
  .js .how .s1, .js .how .s2, .js .how .s3 { animation: cell-in 360ms var(--boing); }
  [data-ui].switch input:checked + span { animation: plop 480ms var(--boing); }
}
@keyframes line-hop { to { transform: none; } }
@keyframes rise { to { opacity: 1; transform: none; } }
@keyframes stage-open { to { clip-path: inset(-4rem 0 0 0); } }
@keyframes settle { to { transform: none; } }
@keyframes bubble-in { from { opacity: 0; transform: scale(0.6) rotate(8deg); } }
@keyframes seam-pop { 0% { transform: translateY(101%); } 34% { transform: translateY(46%); } 58% { transform: translateY(60%); } 100% { transform: translateY(101%); } }
@keyframes pop-in { from { opacity: 0; transform: translateY(26px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes bob { 50% { transform: translateY(-1.4%); } }
@keyframes talk { 0%, 45% { --mouth-open: 1; --mouth-smile: 0; } 50%, 100% { --mouth-open: 0; --mouth-smile: 1; } }
@keyframes blink { 0%, 93%, 100% { transform: scaleY(1); } 96% { transform: scaleY(0.08); } }
@keyframes ahoge { 0%, 78%, 100% { transform: rotate(0); } 83% { transform: rotate(-10deg); } 88% { transform: rotate(7deg); } 93% { transform: rotate(-3deg); } }
@keyframes wave { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
@keyframes land { from { opacity: 0; transform: translateY(60%) scale(0.9, 0.6); } to { opacity: 1; transform: none; } }
@keyframes twinkle { 0% { opacity: 0; transform: scale(0.3) rotate(-25deg); } 40% { opacity: 1; transform: scale(1.15) rotate(0); } 100% { opacity: 0; transform: scale(0.75) rotate(25deg); } }
@keyframes arm-wave { from { transform: rotate(0deg); } to { transform: rotate(18deg); } }
@keyframes bar-fill { from { transform: scaleX(0); } to { transform: none; } }
@keyframes fade { from { opacity: 0; } }
@keyframes cell-in { from { opacity: 0; transform: translateY(6px) scale(0.92); } }
@keyframes plop { from { transform: scale(0.9, 0.82); } }

@media (min-width: 114rem) { .stage { margin-right: 0; } }

/* ---------- phone and tablet: each chapter recomposed ---------- */
@media (max-width: 61.99em) {
  .hero { display: block; min-height: 0; }
  .hero h1 { padding-top: clamp(1.5rem, 5vh, 3rem); }
  .hero__copy { padding-bottom: 0; }
  .lead { max-width: 38ch; }
  .stage { margin: 5rem calc(var(--margin) * -1) 0; padding: clamp(3.25rem, 9vw, 4.5rem) var(--margin) 1.75rem; }
  .stage__tab { min-width: 4.5rem; }
  .stage { padding-top: 4.9rem; }
  .stage__screen { width: 100%; }
  [data-ui] .bubble { top: auto; bottom: calc(100% + 0.8rem); right: 0; padding: 0.5em 1.1em 0.55em; border-radius: 1.6em; transform-origin: 46% 100%; }
  [data-ui] .bubble p { writing-mode: horizontal-tb; letter-spacing: 0; }
  [data-ui] .bubble br { display: none; }
  [data-ui] .bubble__tail { left: 46%; top: calc(100% - 9px); }
  .hero__fact { display: none; } /* it has its own chapter below; here the player must reach the first screen */

  .stats { grid-template-columns: 1fr 1fr; grid-template-rows: auto auto 2rem auto auto; gap: 6px; min-height: 0; padding-block: 4.5rem; }
  .stats__title { grid-column: 1 / -1; grid-row: 1; margin-bottom: 1.25rem; }
  .tile--a { grid-column: 1 / -1; grid-row: 2; min-height: 56vw; }
  .tile--b { grid-column: 1; grid-row: 3 / span 2; min-height: 15rem; margin-bottom: 2rem; }
  .tile--c { grid-column: 2; grid-row: 4; min-height: 15rem; }
  .stats__note { grid-column: 1 / -1; grid-row: 5; margin-top: 1.5rem; }

  .how { display: flex; flex-direction: column; min-height: 0; }
  .how__right { order: 1; min-height: 46svh; padding: 3rem var(--margin) 4rem; }
  .how__left { order: 3; padding: 5.5rem var(--margin) 4.5rem; }
  .js .how__left { padding-top: 7rem; min-height: 25rem; }
  .js .how__slider { order: 2; z-index: 1; position: relative; left: auto; right: auto; bottom: auto; height: 0; margin: -22px var(--margin) 0; }
  .how__names { top: 54px; }
  .how__names button, .how__names li:nth-child(n+3) button { color: #bdbdbd; }
  .how__names li:nth-child(n+3) button[aria-current="true"] { color: var(--paper); }
  [data-ui].devlog th:first-child, [data-ui].devlog td:first-child { display: none; }
  [data-ui].devlog th:nth-child(2) { width: 21%; }
  [data-ui].devlog th:nth-child(5) { width: 17%; }
  .seam--split i:nth-child(n) { --seam: var(--paper); }

  .sites { min-height: 0; background-image: var(--tone); }
  .poster__name { -webkit-text-stroke-width: 0.18em; }
  .poster li { display: block; }
  .poster__name { display: block; }
  .poster__fact { display: inline-block; margin: 0.45rem 0 1.5rem; }

  .lang { min-height: 0; padding-bottom: var(--margin); }
  [data-ui].switch { --f: clamp(2.75rem, 14vw, 5.5rem); position: relative; right: auto; bottom: auto; flex-direction: column; margin-top: 3rem; border-radius: calc(var(--f) * 0.95); }

  .features { padding-block: 5rem; }
  .caps li { display: block; margin-top: 1.75rem; }
  .caps p { margin-top: 0.4rem; padding-left: var(--margin); }
  .kao { display: none; }

  .band { display: block; padding-block: 2.25rem; }
  .band > p { margin-top: 0.8rem; }
  .band--head { display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end; min-height: 30svh; padding-right: 9.5rem; }
  .band--head .band__intro { padding-bottom: 0; }
  .peek { right: var(--margin); width: 8.5rem; }

  .install { display: block; min-height: 0; }
  .install__lead h2 { padding-top: 2.5rem; }
  .install__steps { margin-top: 2.5rem; }

  .foot { grid-template-columns: 1fr 1fr; gap: 6px; }
  .foot__name { grid-column: 1 / -1; order: -2; min-height: 10rem; }
  .foot__go { grid-column: 1 / -1; order: -1; min-height: 11rem; }
  .foot__nav, .foot__bye, .foot__repo, .foot__say { grid-column: auto; min-height: 12rem; }
  .foot__say, .foot__repo { grid-column: 1 / -1; }
  .foot__repo { min-height: 8.5rem; }
}
@media (min-width: 40em) and (max-width: 61.99em) {
  .band--head { padding-right: 12rem; }
}
/* reduced motion: the finished page, with no travel and no loops */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; transition-delay: 0s !important; animation-duration: 0.01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; }
}
