/* CLYVARN Lab — all styles. Tokens first; components use role tokens only (see DESIGN.md).
   Three brand colours (#0B0D10 ground, #F4F6F6 white, #39C5BB teal) and tints/shades mixed from them.
   On a full-teal stage every text and every meaningful line is the ground colour (black) only. */

@property --p {
  syntax: "<number>";
  inherits: true;
  initial-value: 1;
}

:root {
  /* brand */
  --c-ground: #0B0D10;
  --c-white: #F4F6F6;
  --c-teal: #39C5BB;
  /* derived (mix ratio; contrast measured against the ground it sits on) */
  --c-surface: #141619;      /* ground + 4% white: input fields on black */
  --c-surface-2: #1E2022;    /* ground + 8% white: hover surface on black */
  --c-rule: #353739;         /* ground + 18% white: decorative rules on black (never meaningful) */
  --c-line-strong: #747678;  /* ground + 45% white: control borders on black, 4.27:1 */
  --c-ink-2: #B3B5B6;        /* ground + 72% white: secondary text on black, 9.45:1 */
  --c-teal-hover: #5ECFC7;   /* teal + 20% white: hover of teal fills */
  --c-teal-cons: #226966;    /* ground + 50% teal: hero construction lines, 3.04:1 (drawn and at rest, never dimmed) */
  --c-teal-guide: #1B4D4C;   /* ground + 35% teal: hero guide lines (decorative; 2.05:1, 1.34:1 at rest) */

  --f-ja: "M PLUS 1p", "Hiragino Sans", "Yu Gothic", sans-serif;
  --f-lat: "Archivo", "M PLUS 1p", "Hiragino Sans", "Yu Gothic", sans-serif;
  --f-sys: "Hiragino Sans", "Yu Gothic", sans-serif;   /* typed text only (the name field): it cannot be subset */

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);

  --gutter: clamp(16px, 4.4vw, 64px);
  --rail: 0px;
  --pl: var(--gutter);
  --pr: calc(var(--gutter) + var(--rail));
  --pt: clamp(40px, 6vw, 88px);
  --pb: clamp(48px, 6vw, 96px);
  --colw: clamp(360px, 33vw, 500px);

  /* type scale. h1 is always the largest text (only the closing wordmark is bigger) */
  --fs-body: 17px;
  --fs-h1: clamp(36px, 12.2vw, 56px);
  --fs-h2: clamp(30px, calc(3.6vw + 12px), 64px);
  --fs-h2-end: clamp(30px, 5vw, 88px);
  --fs-figure: clamp(34px, 11vw, 52px);
  --fs-measure: clamp(32px, 3.4vw, 48px);
  --fs-desc: clamp(17px, calc(0.45vw + 14px), 21px);
  --fs-label: 16px;
  --fs-rail: 15px;

  color-scheme: dark;
}
@media (min-width: 720px) {
  :root {
    --fs-h1: clamp(56px, 6.8vw, 112px);
    --fs-figure: clamp(48px, 5.6vw, 96px);
  }
}
@media (min-width: 960px) { :root { --rail: 136px; } }
/* from 1200px the hero is two columns (7fr / 6fr) and h1 is capped by its column (14cqi: 68px at 1200);
   the big numerals step down to 5vw there so they stay below h1 (1200: 68 / 60px, 1440: 84.5 / 72px) */
@media (min-width: 1200px) { :root { --fs-figure: clamp(48px, 5vw, 96px); } }
@media (max-width: 599px) { :root { --fs-body: 16px; } }

/* ---------------- base ---------------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  background: var(--c-ground);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--c-ground);
  color: var(--c-white);
  font-family: var(--f-ja);
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: 1.8;
  overflow-wrap: anywhere;
  word-break: normal;
  line-break: strict;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; word-break: auto-phrase; text-wrap: balance; }
/* break Japanese at phrase boundaries everywhere text runs over lines (Chromium; others fall back to normal) */
p { margin: 0; max-inline-size: 38em; word-break: auto-phrase; }
.st-title, .ro-label, .story-count-t, .err-summary li { word-break: auto-phrase; }
ol, ul, dl, dd, figure { margin: 0; padding: 0; }
a { color: inherit; }
img, svg, canvas { display: block; }
button, input, select { font: inherit; color: inherit; }
.lat { font-family: var(--f-lat); }
.nb { white-space: nowrap; }
/* M PLUS 1p has no palt/halt, so mid-line brackets are tightened by hand (as in the brand DESIGN.md §3):
   .kl before an opening bracket, .kr after a closing one. Never on a bracket at the end of a line. */
.kl { margin-left: -.5em; }
.kr { margin-right: -.5em; }
html:not(.js) .js-only { display: none; }
/* the opposite: a sentence only for a visitor without JS (what would be drawn is not there) */
.nojs-only { display: none; }
html:not(.js) .nojs-only { display: inline; }
.vh {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
::selection { background: var(--c-teal); color: var(--c-ground); }
[data-tone="teal"] ::selection { background: var(--c-ground); color: var(--c-white); }
html { scrollbar-color: var(--c-line-strong) var(--c-ground); }

/* focus: 2px ring, teal on black grounds, black on teal grounds */
:focus-visible { outline: 2px solid var(--c-teal); outline-offset: 3px; }
[data-tone="teal"] :focus-visible { outline-color: var(--c-ground); }
main:focus { outline: none; }
[id] { scroll-margin-top: 16px; }

.skip {
  position: absolute; z-index: 100; left: 16px; top: -200px;
  min-height: 44px; display: inline-flex; align-items: center; padding: 0 16px;
  background: var(--c-teal); color: var(--c-ground); font-weight: 700; text-decoration: none;
}
.skip:focus { top: 16px; }
.skip:focus-visible { outline-color: var(--c-white); }

/* ---------------- header bar ---------------- */
.bar { background: var(--c-ground); border-bottom: 1px solid var(--c-rule); }
.bar-in {
  display: flex; align-items: center; flex-wrap: wrap; gap: 0 28px;
  min-height: 72px; padding: 10px var(--pr) 10px var(--pl);
}
.brand {
  display: inline-flex; align-items: center; gap: 14px; min-height: 44px;
  text-decoration: none; font-weight: 700; font-size: 17px; line-height: 1.4;
}
.brand img { width: 44px; height: auto; flex: none; }
.brand .lat { font-weight: 700; letter-spacing: .02em; }
.brand-role { color: var(--c-ink-2); font-size: 16px; line-height: 1.6; }
@media (max-width: 599px) {
  .bar-in { padding-block: 12px; }
  .brand-role { flex-basis: 100%; padding-left: 58px; }
}

/* ---------------- stage index (rail) ---------------- */
.rail-list { list-style: none; }
.rail a { text-decoration: none; }
@media (min-width: 960px) {
  .rail {
    position: fixed; z-index: 20; right: 0; top: 50%; transform: translateY(-50%);
    padding-right: clamp(16px, 1.6vw, 28px);
  }
  .rail-toggle { display: none; }
  .rail-list { display: flex; flex-direction: column; align-items: flex-end; }
  .rail a {
    display: flex; align-items: center; justify-content: flex-end; gap: 12px;
    min-height: 44px; min-width: 44px;
    font-size: var(--fs-rail); line-height: 1.4; font-weight: 700; color: var(--c-white);
  }
  .rail a::after { content: ""; flex: none; width: 16px; height: 2px; background: var(--c-ink-2); }
  /* the label sits on a backing of its own item's ground: while a stage edge passes behind it, the half on the
     other ground stays legible (black on a teal backing, or white on a black one) instead of black on black */
  .rail a span { opacity: 0; padding: 1px 6px; margin-right: -6px; background: var(--c-ground); }
  .rail a[aria-current="true"] span, .rail a:hover span, .rail a:focus-visible span { opacity: 1; }
  .rail a[aria-current="true"]::after { width: 40px; height: 3px; background: var(--c-teal); }
  /* each item takes the tone of the stage right under it (stages.js sets data-on per link) */
  .rail a[data-on="teal"] { color: var(--c-ground); }
  .rail a[data-on="teal"] span { background: var(--c-teal); }
  .rail a[data-on="teal"]::after { background: var(--c-ground); }
  .rail a[data-on="teal"]:focus-visible { outline-color: var(--c-ground); }
  /* no JS: no per-item tone and no current item, so the index sits on its own black plate with every name shown */
  html:not(.js) .rail-list { padding: 6px 0 6px 14px; background: var(--c-ground); }
  html:not(.js) .rail a span { opacity: 1; }
}
@media (max-width: 959px) {
  .rail { background: var(--c-ground); border-bottom: 1px solid var(--c-rule); padding: 0 var(--pr) 0 var(--pl); }
  /* with JS the list is folded behind one button from the very first frame: html.js is set by tokens.js in <head>
     before the body is painted (stages.js only wires the button). Folding it when stages.js ran pushed the hero
     up by 140px after the first paint (CLS 0.14 at 390x844). Without JS there is no button and the list stays
     open, so every stage can still be reached from the index */
  .rail-toggle {
    display: none; align-items: center; gap: 12px; min-height: 48px; padding: 0; border: 0;
    background: none; cursor: pointer; font-weight: 700; font-size: 16px;
  }
  html.js .rail-toggle { display: flex; }
  .chev { width: 9px; height: 9px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-3px) rotate(45deg); }
  .rail.is-open .chev { transform: translateY(2px) rotate(225deg); }
  html.js .rail:not(.is-open) .rail-list { display: none; }
  .rail-list { padding-bottom: 12px; columns: 2; column-gap: 24px; }
  .rail a { display: flex; align-items: center; min-height: 44px; font-size: 16px; break-inside: avoid; }
  .rail a[aria-current="true"] { text-decoration: underline 2px var(--c-teal); text-underline-offset: 6px; }
}

/* ---------------- shared ---------------- */
.stage { position: relative; padding: var(--pt) var(--pr) var(--pb) var(--pl); }
[data-tone="teal"] { background: var(--c-teal); color: var(--c-ground); }
.head h2 { font-weight: 800; font-size: var(--fs-h2); line-height: 1.25; letter-spacing: .01em; }
.desc {
  margin-top: 16px; max-width: 21em; font-size: var(--fs-desc); line-height: 1.75; font-weight: 700;
  word-break: auto-phrase; text-wrap: pretty;
}
.note { margin-top: 12px; max-width: 30em; font-size: 16px; line-height: 1.8; color: var(--c-ink-2); word-break: auto-phrase; }
[data-tone="teal"] .note { color: var(--c-ground); }
.br-lead { display: none; }
@media (min-width: 720px) { .br-lead { display: inline; } }

.ctas { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 32px; }
.btn {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 18px;
  min-height: 56px; padding: 0 22px 0 26px; border: 0; border-radius: 2px;
  background: var(--c-teal); color: var(--c-ground);
  font-weight: 700; font-size: 17px; line-height: 1.4; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--c-teal-hover); }
.btn-ink { background: var(--c-ground); color: var(--c-white); }
.btn-ink:hover { background: var(--c-surface-2); }
.arw { position: relative; flex: none; width: 22px; height: 12px; }
.arw::before { content: ""; position: absolute; left: 0; right: 1px; top: 5px; height: 2px; background: currentColor; }
.arw::after {
  content: ""; position: absolute; right: 1px; top: 2px; width: 8px; height: 8px;
  border-top: 2px solid currentColor; border-right: 2px solid currentColor;
  transform: rotate(45deg); transform-origin: 75% 25%;
}
.link {
  display: inline-flex; align-items: center; min-height: 44px;
  font-weight: 700; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 7px;
}
.link:hover { text-decoration-thickness: 2px; }
.btn-line {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 20px;
  border: 1px solid var(--c-line-strong); border-radius: 2px; background: transparent; color: var(--c-white);
  font-weight: 700; font-size: 16px; line-height: 1.4; cursor: pointer;
}
.btn-line:hover { border-color: var(--c-white); background: var(--c-surface-2); }
.btn-line[hidden] { display: none; }
.link-btn {
  min-height: 44px; padding: 0; border: 0; background: none; cursor: pointer;
  font-weight: 700; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 6px;
}
.link-btn:hover { text-decoration-thickness: 2px; }
.link-btn[aria-disabled="true"] { cursor: progress; }

.readout { display: grid; gap: 4px; }
.ro-label { font-size: var(--fs-label); line-height: 1.6; font-weight: 700; }
.ro-value {
  display: flex; align-items: baseline; gap: .06em;
  font-family: var(--f-lat); font-weight: 800; font-size: var(--fs-figure); line-height: .95;
  letter-spacing: -.03em; font-variant-numeric: tabular-nums;
}
.ro-value .unit { font-size: .32em; font-weight: 700; letter-spacing: 0; }
.ro-value .unit-deg { align-self: flex-start; font-size: .45em; line-height: 1; }

/* small press feedback, only when motion is on */
@media (prefers-reduced-motion: no-preference) {
  html[data-motion="on"] .btn { transition: background-color 120ms var(--ease-out), transform 120ms var(--ease-out); }
  html[data-motion="on"] .btn:active { transform: scale(.98); }
  html[data-motion="on"] .btn .arw { transition: transform 160ms var(--ease-out); }
  html[data-motion="on"] .btn:hover .arw { transform: translateX(3px); }
  html[data-motion="on"] .rail a span { transition: opacity 140ms var(--ease-out); }
}

/* ---------------- 1. hero ---------------- */
.stage-hero {
  display: grid; align-items: center; gap: 40px;
  min-height: calc(100vh - 73px); min-height: calc(100svh - 73px);
  padding-top: clamp(36px, 7vh, 88px); padding-bottom: clamp(40px, 7vh, 88px);
}
.hero-copy { container-type: inline-size; }
/* the two authored lines are nowrap; the longer one (動く理由まで、) is 7em, so 14cqi keeps it at 98% of the column */
.stage-hero h1 { font-weight: 800; font-size: min(var(--fs-h1), 14cqi); line-height: 1.2; letter-spacing: 0; }
.lead { margin-top: 28px; max-width: 33em; font-size: clamp(17px, 1.25vw, 19px); line-height: 1.85; word-break: auto-phrase; }
.stage-hero .ctas { margin-top: 36px; }
.hero-svg { width: 100%; height: auto; aspect-ratio: 1.36; overflow: visible; }
.fig-note { margin-top: 12px; font-size: 16px; line-height: 1.75; color: var(--c-ink-2); max-width: 34em; word-break: auto-phrase; }
html.js .hero-svg:not(.is-built) { visibility: hidden; }
/* two columns only from 1200px: below that the drawing gets the full width under the text (at 1024 a
   two-column drawing was 201px wide, smaller than its own caption block) */
@media (min-width: 1200px) {
  .stage-hero { grid-template-columns: minmax(0, 7fr) minmax(0, 6fr); gap: 56px; }
}
@media (max-width: 1199px) {
  .stage-hero { min-height: 0; }
  .hero-svg { aspect-ratio: 1.45; }
}
@media (max-width: 599px) {
  .stage-hero .ctas { flex-direction: column; align-items: stretch; gap: 4px; }
  .stage-hero .link { justify-content: center; }
}

/* hero drawing parts */
.h-guide { fill: none; stroke: var(--c-teal-guide); stroke-width: 1; }
.h-cons { fill: none; stroke: var(--c-teal-cons); stroke-width: 1; }
/* at rest only the decorative guides step back; the construction lines keep 3.04:1 (they are what the caption names) */
.h-g-guide.is-rest { opacity: .5; }
.h-out { fill: none; stroke: var(--c-white); stroke-width: 1.5; stroke-linejoin: miter; stroke-miterlimit: 12; }
.h-dim { fill: none; stroke: var(--c-teal); stroke-width: 1; }
.h-tick { fill: none; stroke: var(--c-teal); stroke-width: 1.4; }
.h-fill-c { fill: var(--c-white); stroke: none; }
.h-fill-v { fill: var(--c-teal); stroke: none; }
.h-label { fill: var(--c-teal); font-family: var(--f-lat); font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.hero-svg.is-small .h-label { font-size: 13px; }

/* ---------------- 2. data (teal) ---------------- */
.stage-data { min-height: 100vh; min-height: 100svh; }
.data-col { display: flex; flex-direction: column; gap: 32px; }
.spec-wrap { display: grid; gap: 14px; justify-items: start; }
.spec { width: 100%; max-width: 460px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.spec caption { caption-side: top; text-align: left; font-size: 16px; line-height: 1.75; padding-bottom: 10px; word-break: auto-phrase; }
.spec th, .spec td { padding: 4px 6px; text-align: right; border-bottom: 1px solid var(--c-ground); }
.spec thead th { font-size: 16px; font-weight: 700; line-height: 1.4; padding-bottom: 8px; border-bottom: 2px solid var(--c-ground); white-space: nowrap; }
.spec thead th:first-child, .spec th[scope="row"] { text-align: left; padding-left: 0; }
.spec th[scope="row"] { white-space: nowrap; }
.pick {
  display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 8px 0 0;
  border: 0; background: none; cursor: pointer; white-space: nowrap;
  font-weight: 700; font-size: 16px; line-height: 1.4; text-align: left;
}
.pick::before { content: ""; flex: none; width: 14px; height: 14px; border: 2px solid currentColor; }
.pick[aria-pressed="true"]::before { background: currentColor; }
.pick[aria-pressed="true"] { text-decoration: underline 2px; text-underline-offset: 6px; }
.spec input {
  width: 3.4em; min-height: 44px; padding: 4px 4px; border: 0; border-bottom: 2px solid var(--c-ground); border-radius: 0;
  background: transparent; color: var(--c-ground); text-align: right;
  font-family: var(--f-lat); font-weight: 700; font-size: 20px; line-height: 1.2; font-variant-numeric: tabular-nums;
  appearance: textfield; -moz-appearance: textfield;
}
.spec input::-webkit-inner-spin-button, .spec input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.spec input:hover { background: var(--c-teal-hover); }
.spec input[aria-invalid="true"] { border-bottom-style: dashed; border-bottom-width: 3px; }
/* a value outside the range: said in words under the table (data-stage.js; the input points to it with aria-describedby) */
.spec-err { display: flex; gap: 10px; align-items: baseline; max-width: 28em; font-weight: 700; font-size: 16px; line-height: 1.6; word-break: auto-phrase; }
.spec-err[hidden] { display: none; }
.spec-err::before {
  content: "!"; flex: none; display: inline-flex; align-items: center; justify-content: center; align-self: flex-start; margin-top: 3px;
  width: 20px; height: 20px; background: var(--c-ground); color: var(--c-teal);
  font-family: var(--f-lat); font-weight: 800; font-size: 14px; line-height: 1;
}
.spec input:focus-visible { outline-offset: 1px; }
.ranges { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 20px; font-size: 16px; line-height: 1.6; }
.ranges-h { font-weight: 700; }
.ranges dl { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.ranges dl div { display: flex; gap: 8px; }
.ranges dt { font-weight: 700; }
.ranges dd { font-family: var(--f-lat); font-weight: 700; font-variant-numeric: tabular-nums; }
/* right under the drawing: first that the corner squares can be dragged, then what the dashed outlines are */
.fig-notes { display: grid; gap: 4px; margin-top: 6px; }
.fig-legend, .spec-hint { font-size: 16px; line-height: 1.75; max-width: 34em; word-break: auto-phrase; }
.reset {
  min-height: 44px; padding: 0; border: 0; background: none; cursor: pointer; font-weight: 700;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 6px;
}
.reset:hover { text-decoration-thickness: 2px; }
.data-fig { display: flex; flex-direction: column; gap: 8px; }
.draw { position: relative; }
.draw canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: pan-y; }
html:not(.js) .draw { display: none; }
@media (min-width: 960px) {
  /* the heading stays on one line in its column (7 characters at letter-spacing .01em = 7.07em): at 1100 the
     column is 363px and the stage size 51.6px wrapped it as データから／描く */
  .stage-data .head h2, .stage-touch .head h2 { font-size: min(var(--fs-h2), calc(var(--colw) / 7.3)); }
  html:not(.js) .data-fig { min-height: 0; }
  .stage-data { display: grid; grid-template-columns: var(--colw) minmax(0, 1fr); column-gap: clamp(32px, 3.5vw, 56px); align-items: stretch; }
  /* both columns start at the stage's top padding (centring the left one left them ~90px apart at 1920x1080) */
  .data-col { justify-content: flex-start; }
  .data-fig { min-height: 560px; }
  .draw { flex: 1 1 auto; min-height: 420px; }
}
@media (max-width: 959px) {
  .stage-data { display: flex; flex-direction: column; gap: 28px; min-height: 0; }
  .data-col { display: contents; }
  .data-col .head { order: 1; }
  .data-fig { order: 2; }
  .spec-wrap { order: 3; }
  .draw { height: clamp(280px, 78vw, 460px); margin: 0 calc(-1 * var(--pl)); }
}
@media (max-width: 400px) {
  .spec th, .spec td { padding: 4px 3px; }
  .spec input { width: 2.9em; font-size: 18px; }
  .pick { gap: 8px; padding-right: 4px; }
}

/* ---------------- 3. touch (WebGL) ---------------- */
/* ≥960px the vessel is on the left and the text column on the right (the hero and the data stage put the text
   on the left; this and the form stage mirror it, so the same arrangement is never used more than twice) */
.stage-touch { min-height: 100vh; min-height: 100svh; overflow: clip; }
.gl-wrap { background: var(--c-ground); }
.gl-wrap canvas { width: 100%; height: 100%; cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.gl-wrap canvas.is-drag { cursor: grabbing; }
.gl-wrap canvas:focus-visible { outline: 2px solid var(--c-teal); outline-offset: -8px; }
/* ≥960px the canvas covers the whole stage, so its own outline would frame the heading and the controls too:
   vessel-gl.js places this ring around the vessel instead (.has-ring) */
.gl-ring { display: none; position: absolute; pointer-events: none; border: 2px solid var(--c-teal); }
.gl-wrap.has-ring canvas:focus-visible { outline: none; }
.gl-wrap.has-ring canvas:focus-visible + .gl-ring { display: block; }
.gl-fallback[hidden] { display: none; }
/* no 3D (vessel-gl.js adds .no-gl) or no JS at all: the stage shrinks to its text, the message stands in
   for the vessel, and the controls that cannot do anything are not shown */
.stage-touch.no-gl, html:not(.js) .stage-touch { min-height: 0; }
.stage-touch.no-gl .gl-wrap, .stage-touch.no-gl .controls, .stage-touch.no-gl .readout, .stage-touch.no-gl #gl-help,
html:not(.js) .stage-touch .gl-wrap, html:not(.js) .stage-touch .controls, html:not(.js) .stage-touch .readout, html:not(.js) #gl-help,
html:not(.js) #spec-reset, html:not(.js) .spec-hint { display: none; }
.touch-col { display: flex; flex-direction: column; gap: 32px; }
.controls { display: grid; gap: 20px; max-width: 440px; justify-items: start; }
.seg { display: flex; width: 100%; border: 1px solid var(--c-line-strong); }
.seg button {
  flex: 1 1 0; min-height: 48px; padding: 0 12px; border: 0; border-right: 1px solid var(--c-line-strong);
  background: none; cursor: pointer; font-weight: 700; font-size: 16px; line-height: 1.4; white-space: nowrap;
}
.seg button:last-child { border-right: 0; }
.seg button:hover:not([aria-pressed="true"]) { background: var(--c-surface-2); }
.seg button[aria-pressed="true"] { background: var(--c-white); color: var(--c-ground); }
.seg button:focus-visible { outline-offset: 2px; position: relative; z-index: 1; }
.slider { display: grid; grid-template-columns: auto minmax(0, 1fr) 3.4em; align-items: center; gap: 16px; width: 100%; }
.slider label { font-weight: 700; font-size: 16px; }
.slider output { font-family: var(--f-lat); font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 44px; margin: 0; background: transparent; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 2px; background: var(--c-ink-2); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -9px; border: 0; border-radius: 0; background: var(--c-teal); }
input[type="range"]::-moz-range-track { height: 2px; background: var(--c-ink-2); }
input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; border: 0; border-radius: 0; background: var(--c-teal); }
@media (min-width: 960px) {
  .stage-touch { display: flex; }
  .gl-wrap { position: absolute; inset: 0; }
  .touch-col { position: relative; z-index: 1; width: var(--colw); flex: none; margin-left: auto; justify-content: space-between; pointer-events: none; }
  .touch-col > * { pointer-events: auto; }
  .stage-touch.no-gl .touch-col, html:not(.js) .stage-touch .touch-col { margin-left: 0; }
}
@media (max-width: 959px) {
  .stage-touch { display: flex; flex-direction: column; gap: 28px; min-height: 0; }
  .touch-col { display: contents; }
  .touch-col .head { order: 1; }
  .gl-wrap { order: 2; position: relative; height: clamp(320px, 100vw, 560px); margin: 0 calc(-1 * var(--pl)); }
  .touch-col .readout { order: 3; }
  .controls { order: 4; }
}

/* ---------------- 4. story (teal, scroll-driven) ---------------- */
.stage-story { position: relative; }
/* as tall as its content when it is not pinned (reduced motion, 「動きを止める」, short screens): a forced 100svh
   left 245px of empty teal above and below the diagram at 768x1024 and 393px at 1024x1366 */
.story-pin {
  display: flex; align-items: center;
  padding: var(--pt) var(--pr) var(--pb) var(--pl);
}
.story-in { width: 100%; max-width: 1200px; display: grid; gap: 28px; }
.story-head { display: grid; gap: 16px; }
.story-count { display: flex; align-items: baseline; gap: 14px; font-weight: 800; font-size: 18px; line-height: 1.4; }
.story-count[hidden] { display: none; }
.story-count .lat { font-weight: 800; font-size: 28px; font-variant-numeric: tabular-nums; }
.story-fig svg { width: 100%; height: auto; overflow: visible; }
.story-tall { display: none; }
.story-steps { list-style: none; display: grid; gap: 14px; }
.story-steps li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: start; }
.st-n {
  display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; margin-top: 1px;
  border: 2px solid var(--c-ground); font-family: var(--f-lat); font-weight: 800; font-size: 16px; line-height: 1;
}
.story-steps li[aria-current="step"] .st-n, .story-steps li.is-done .st-n { background: var(--c-ground); color: var(--c-teal); }
.st-body { display: grid; gap: 2px; min-width: 0; }
.st-title { font-weight: 800; font-size: 18px; line-height: 1.5; text-wrap: balance; }
.st-sub { font-size: 16px; line-height: 1.7; word-break: auto-phrase; }
.story-steps li[aria-current="step"] .st-title { text-decoration: underline 3px; text-underline-offset: 7px; }
@media (min-width: 720px) {
  .story-head { grid-template-columns: minmax(0, 1fr) auto; align-items: end; column-gap: 40px; }
  .story-steps { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
  .story-steps li { grid-template-columns: minmax(0, 1fr); gap: 8px; padding-top: 12px; border-top: 2px solid var(--c-ground); }
  .story-steps li[aria-current="step"] { border-top-width: 6px; padding-top: 8px; }
  .story-steps .st-n { display: none; }
}
/* narrow four-column captions (720–1023px): the step names at 16px, each on one line from 768px (the longest is
   10 characters, 160px). At 720–767px only that one wraps, as 前日に／お知らせが届く */
@media (min-width: 720px) and (max-width: 1023px) {
  .st-title { font-size: 16px; }
}
@media (min-width: 768px) and (max-width: 1023px) {
  .st-title { white-space: nowrap; }
}
@media (max-width: 719px) {
  .story-wide { display: none; }
  .story-tall { display: block; width: 100%; max-width: 420px; margin: 0 auto; }
}
/* pinned only when there is room, motion is on and JS is running */
/* story.js adds .no-pin when the pinned content would not fit the viewport; then the complete diagram is shown */
@media (min-height: 620px) and (prefers-reduced-motion: no-preference) {
  html[data-motion="on"] .story-track:not(.no-pin) { height: 200vh; height: 200svh; }
  html[data-motion="on"] .story-track:not(.no-pin) .story-pin {
    position: sticky; top: 0; height: 100vh; height: 100svh; min-height: 0;
    padding-top: clamp(24px, 4vh, 48px); padding-bottom: clamp(24px, 4vh, 48px);
  }
  @media (max-width: 719px) {
    html[data-motion="on"] .story-track:not(.no-pin) .note,
    html[data-motion="on"] .story-track:not(.no-pin) .story-steps li:not([aria-current]) { position: absolute; display: block; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    /* the indicator shows only 「2／4」 here, but the step name stays in its text for screen readers (visually hidden) */
    html[data-motion="on"] .story-track:not(.no-pin) .story-count-t { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
    html[data-motion="on"] .story-track:not(.no-pin) .story-tall { max-height: calc(100svh - 330px); width: auto; max-width: 100%; }
    html[data-motion="on"] .story-track:not(.no-pin) .story-in { gap: 18px; }
    /* the current caption always takes two lines of room, so the pinned picture does not jump at step 4 */
    html[data-motion="on"] .story-track:not(.no-pin) .st-sub { min-height: calc(2 * 1.7em); }
  }
  /* tall portrait screens from 720px (at most 4:5, e.g. 768x1024, 820x1180, 1024x1366): the wide 980x270 diagram
     was only 193–220px high in the 100svh box, leaving 244–393px of empty teal above and below it for the whole
     200svh. Here the 2x2 diagram (400x530) takes the height left by the heading and the four-column captions
     (at most about 480px with the box's padding: 768x1024 gives a 544px diagram) */
  @media (min-width: 720px) and (max-aspect-ratio: 4/5) {
    html[data-motion="on"] .story-track:not(.no-pin) .story-wide { display: none; }
    html[data-motion="on"] .story-track:not(.no-pin) .story-tall {
      display: block; width: auto; max-width: 100%; margin: 0 auto;
      max-height: calc(100vh - 480px); max-height: calc(100svh - 480px);
    }
  }
}
@supports (animation-timeline: view()) {
  @media (min-height: 620px) and (prefers-reduced-motion: no-preference) {
    html[data-motion="on"] .story-track:not(.no-pin) { view-timeline-name: --story; }
    html[data-motion="on"] .story-track:not(.no-pin) .story-pin { animation: story-p linear both; animation-timeline: --story; animation-range: contain 0% contain 100%; }
  }
}
@keyframes story-p { from { --p: 0; } to { --p: 1; } }

/* diagram parts: black only on teal; teal marks only on top of black fills */
.story-svg .sv-line { fill: none; stroke: var(--c-ground); stroke-width: 2; }
.story-svg .sv-thin { stroke-width: 1.5; }
.story-svg .sv-thick { stroke-width: 3; }
.story-svg .sv-draw { fill: none; stroke: var(--c-ground); stroke-width: 2.5; stroke-dasharray: 100px 100px; stroke-dashoffset: calc((1 - var(--t, 1)) * 100px); opacity: clamp(0, calc(var(--t, 1) * 100000), 1); }
/* a connector starts in empty space, where the first fraction of a line (shorter than the line is thick) reads
   as a stray speck: it appears only once a tenth of it is drawn (at least about 3px at 390, 7px at 1440) */
.story-svg .sv-draw:is(.sv-c1, .sv-c2, .sv-c3) { opacity: clamp(0, calc((var(--t, 1) - 0.1) * 100000), 1); }
.story-svg .sv-type { stroke-width: 3; }
.story-svg .sv-fill { fill: var(--c-ground); stroke: none; opacity: var(--t, 1); }
.story-svg .sv-on { fill: none; stroke: var(--c-teal); stroke-width: 2.5; opacity: var(--t, 1); }
.story-svg .sv-fade { fill: none; stroke: var(--c-ground); stroke-width: 2.5; opacity: var(--t, 1); }
.story-svg .sv-num { fill: var(--c-ground); font-family: var(--f-lat); font-weight: 800; font-size: 22px; }
.story-svg .sv-num-on { fill: var(--c-teal); opacity: var(--t, 1); }
/* windows on the 0..1 timeline: node 1 → line → node 2 → line → node 3 → line → node 4.
   Lines (sv-d, sv-c) are scrubbed with stroke-dashoffset: a half-drawn black line is still pure black.
   Fills, teal marks and arrowheads (sv-f, sv-a) switch at one point (×100000 = a 0.00001 ramp, about 0.01px of scroll),
   so every resting frame is pure black or pure teal, never a see-through black. */
.sv-d1 { --t: clamp(0, calc((var(--p) - 0.02) / 0.08), 1); }
.sv-f1 { --t: clamp(0, calc((var(--p) - 0.10) * 100000), 1); }
.sv-c1 { --t: clamp(0, calc((var(--p) - 0.14) / 0.12), 1); }
.sv-a1 { --t: clamp(0, calc((var(--p) - 0.255) * 100000), 1); }
.sv-d2 { --t: clamp(0, calc((var(--p) - 0.28) / 0.08), 1); }
.sv-f2 { --t: clamp(0, calc((var(--p) - 0.36) * 100000), 1); }
.sv-c2 { --t: clamp(0, calc((var(--p) - 0.40) / 0.12), 1); }
.sv-a2 { --t: clamp(0, calc((var(--p) - 0.515) * 100000), 1); }
.sv-d3 { --t: clamp(0, calc((var(--p) - 0.54) / 0.08), 1); }
.sv-f3 { --t: clamp(0, calc((var(--p) - 0.62) * 100000), 1); }
.sv-c3 { --t: clamp(0, calc((var(--p) - 0.66) / 0.12), 1); }
.sv-a3 { --t: clamp(0, calc((var(--p) - 0.775) * 100000), 1); }
.sv-d4 { --t: clamp(0, calc((var(--p) - 0.80) / 0.08), 1); }
.sv-f4 { --t: clamp(0, calc((var(--p) - 0.88) * 100000), 1); }

/* ---------------- 5. form demo (black) ---------------- */
/* align-content: start, so a growing form (errors, summary) only pushes what is below it, never the text above or beside it */
.stage-form { display: grid; gap: 40px; align-content: start; border-top: 1px solid var(--c-rule); }
.form-col { display: grid; gap: 32px; align-content: start; }
.states-h { font-weight: 700; font-size: 16px; margin-bottom: 10px; }
.states { list-style: none; display: flex; flex-wrap: wrap; align-items: center; row-gap: 4px; }
.states li { display: inline-flex; align-items: center; min-height: 40px; font-weight: 700; font-size: 16px; line-height: 1.4; color: var(--c-ink-2); }
/* a short rule between the words (decorative). Not arrows: 間違えた comes straight after 押した, without 待つ */
.states li + li::before {
  content: ""; flex: none; width: 1px; height: 18px; margin: 0 16px; background: var(--c-line-strong);
}
.states li[aria-current="true"] { color: var(--c-white); text-decoration: underline 3px var(--c-teal); text-underline-offset: 6px; }
.form-box { width: 100%; max-width: 520px; }
.demo-form { display: grid; gap: 22px; padding: clamp(24px, 3vw, 36px); background: var(--c-surface); border: 1px solid var(--c-rule); }
.demo-form[hidden] { display: none; }
.field { display: grid; gap: 8px; }
.field label { font-weight: 700; font-size: 16px; display: flex; align-items: baseline; gap: 10px; }
.req { font-size: 14px; font-weight: 700; color: var(--c-ink-2); }
.field input, .select select {
  width: 100%; min-height: 48px; padding: 8px 12px; border: 1px solid var(--c-line-strong); border-radius: 2px;
  background: var(--c-ground); color: var(--c-white); font-size: 16px; line-height: 1.5;
  caret-color: var(--c-teal);
}
/* the name is typed by the visitor, so its kanji and kana cannot be in the page's subset: the name field uses the
   system stack for all of it, so one field never mixes M PLUS 1p Latin with system-font kanji */
.field input[type="text"] { font-family: var(--f-sys); }
.field input:hover, .select select:hover { border-color: var(--c-ink-2); }
.field input:focus-visible, .select select:focus-visible { border-color: var(--c-teal); outline-offset: 2px; }
.field input[aria-invalid="true"], .select select[aria-invalid="true"] { border: 2px solid var(--c-white); }
.select { position: relative; }
.select select { appearance: none; -webkit-appearance: none; padding-right: 44px; cursor: pointer; }
.select::after {
  content: ""; position: absolute; right: 18px; top: 50%; width: 8px; height: 8px; margin-top: -6px;
  border-right: 2px solid var(--c-white); border-bottom: 2px solid var(--c-white); transform: rotate(45deg); pointer-events: none;
}
.select option { background: var(--c-ground); color: var(--c-white); }
.err { display: flex; gap: 10px; align-items: baseline; font-weight: 700; font-size: 16px; line-height: 1.6; color: var(--c-white); }
.err[hidden] { display: none; }
.err::before {
  content: "!"; flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; background: var(--c-white); color: var(--c-ground);
  font-family: var(--f-lat); font-weight: 800; font-size: 14px; line-height: 1;
}
.err-summary { padding: 16px 18px; border: 2px solid var(--c-white); }
.err-summary[hidden] { display: none; }
.err-title { font-weight: 800; font-size: 17px; }
.err-summary ul { margin-top: 6px; padding-left: 1.2em; }
.err-summary a { display: inline-flex; min-height: 44px; align-items: center; font-weight: 700; text-underline-offset: 5px; }
.btn-submit { position: relative; overflow: hidden; justify-content: center; width: 100%; }
.btn-submit .btn-label { position: relative; z-index: 1; }
.btn-bar { position: absolute; left: 0; bottom: 0; height: 4px; width: 100%; background: var(--c-ground); transform: scaleX(0); transform-origin: left center; }
.btn-submit.is-wait { background: var(--c-teal-hover); cursor: progress; }
.btn-submit.is-wait .btn-bar { transform: scaleX(0); }
.btn-submit.is-wait.is-run .btn-bar { transform: scaleX(1); }
html[data-motion="on"] .btn-submit.is-run .btn-bar { transition: transform 1200ms linear; }
html[data-motion="still"] .btn-bar { display: none; }
.form-note { font-size: 16px; line-height: 1.7; color: var(--c-ink-2); }
.done { display: grid; gap: 14px; justify-items: start; padding: clamp(24px, 3vw, 36px); border: 2px solid var(--c-teal); }
.done[hidden] { display: none; }
.done-title { font-weight: 800; font-size: 24px; line-height: 1.4; }
.done:focus-visible { outline-offset: 4px; }
@media (min-width: 960px) {
  /* the form is on the left, the text on the right (mirrors the hero and the data stage).
     The form column gives way below 1445px so the text column keeps a readable measure and the heading stays
     on one line (960: 346px, 1024: 378px).
     Both columns start at the top of the stage, so the heading and the text never move when the form changes
     state (the error state is about 860px tall: reserving it would leave ~330px empty under the form) */
  .stage-form { grid-template-columns: clamp(340px, 36vw, 520px) minmax(0, 1fr); column-gap: clamp(40px, 5vw, 96px); align-items: start; }
  .form-box { order: -1; }
}

/* ---------------- 6. speed (black, compact) ---------------- */
.stage-speed { padding: clamp(64px, 8vw, 120px) var(--pr) clamp(64px, 8vw, 120px) var(--pl); border-top: 1px solid var(--c-rule); display: grid; gap: 40px; }
.speed-grid { display: grid; gap: 32px; }
.speed-item { display: grid; gap: 10px; align-content: start; padding-top: 16px; border-top: 1px solid var(--c-line-strong); }
.speed-motion { gap: 14px; justify-items: start; }
.btn-toggle[aria-pressed="true"] { background: var(--c-white); color: var(--c-ground); border-color: var(--c-white); }
/* the OS setting already stops everything: pressing would change nothing (motion.js sets aria-disabled) */
.btn-toggle[aria-disabled="true"], .btn-toggle[aria-disabled="true"]:hover { color: var(--c-ink-2); background: transparent; border-color: var(--c-line-strong); border-style: dashed; cursor: not-allowed; }
.speed-status { color: var(--c-ink-2); font-size: 16px; }
.speed-status:empty { display: none; }
.os-on { display: none; }
@media (prefers-reduced-motion: reduce) { .os-on { display: inline; } .os-off { display: none; } }
.m-label { font-weight: 700; font-size: 16px; }
.m-value {
  min-height: calc(var(--fs-measure) * 1.1);
  font-family: var(--f-lat); font-weight: 800; font-size: var(--fs-measure); line-height: 1.1; font-variant-numeric: tabular-nums;
}
/* not a measured number (まだ測っていません／測っています／測れませんでした): a sentence at reading size, on one line.
   The box keeps the numbers' height, so the section does not move when a value arrives */
.m-value.is-na { font-family: var(--f-ja); font-size: var(--fs-body); font-weight: 700; line-height: 1.6; white-space: nowrap; }
.m-note { font-size: 16px; line-height: 1.7; color: var(--c-ink-2); }
.m-at { display: block; font-variant-numeric: tabular-nums; }
.m-at [data-frame-at], .m-at [data-bytes-at] { white-space: nowrap; }
.m-note[hidden] { display: none; }
.link-btn[hidden] { display: none; }
#measure-again { justify-self: start; }
@media (min-width: 720px) {
  .stage-speed .head { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 40px; }
  .stage-speed .desc { margin-top: 8px; max-width: none; }
  .speed-grid { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr); column-gap: clamp(24px, 3vw, 48px); }
  /* 測り直す belongs to the two measurements, so it sits right under them, not under the motion column:
     the motion column spans both rows and its extra height goes to the flexible second row */
  .speed-grid { grid-template-rows: auto 1fr; }
  .speed-motion { grid-row: 1 / 3; }
  #measure-again { grid-column: 2 / 4; grid-row: 2; align-self: start; margin-top: -16px; }
}

/* ---------------- 7. closing (teal) ---------------- */
/* as tall as its content on every screen: a forced 100svh left empty teal between the price and the wordmark
   (595px at 768x1024 before round 3, still 278px at 1440x900 and 342px at 1920x1080 on landscape screens) */
.stage-end { display: flex; flex-direction: column; padding-bottom: 0; overflow: clip; }
.end-body { display: grid; gap: 32px; align-content: start; padding-top: clamp(8px, 4vh, 48px); }
.end-body h2 { font-weight: 800; font-size: var(--fs-h2-end); line-height: 1.3; letter-spacing: .01em; }
.price { font-size: var(--fs-body); line-height: 1.8; }
/* line-height .67 puts the bottom of the line box on the baseline (Archivo 800: ascent − descent = .67em),
   so the letters stand on the footer's top edge (.8 left a 16px band at 1440). The baseline is not exactly there:
   Blink rounds the font's ascent and descent per size, which leaves it 0–1.5px above the line box bottom, and the
   footer's top often falls on a fraction of a pixel. margin-bottom -2px lets the line box run 2px past the stage,
   where the stage's overflow clip cuts it, so the footer always starts at or above the letters' bottoms: no 1px teal
   line under them (-1px still left one at 1366 wide). The 2px lost are black on the footer's black. Letter-spacing +.02em: at -.01em the tops of the Y's right arm and the V's left arm
   touched (2.5px at 1440), and at 0 their first antialiased row still met at 320–1024 (1.2px apart at 390 now).
   stages.js fits the width either way */
.giant {
  margin-top: auto; margin-bottom: -2px; padding-top: clamp(72px, 8vw, 128px); max-inline-size: none; width: 100%;
  font-family: var(--f-lat); font-weight: 800; font-size: 17vw; line-height: .67; letter-spacing: .02em;
  white-space: nowrap; overflow: clip;
}
.giant span { display: inline-block; }
@media (max-width: 599px) {
  .end-body h2 { font-size: min(30px, 7.4vw); letter-spacing: 0; }
  .stage-end .ctas { flex-direction: column; align-items: stretch; gap: 4px; }
  .stage-end .link { justify-content: center; }
}

/* ---------------- footer ---------------- */
.foot { background: var(--c-ground); color: var(--c-white); }
.foot-in { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; padding: 24px var(--pr) 28px var(--pl); }
.foot img { width: 40px; height: auto; }
.foot p { font-size: 16px; line-height: 1.6; }
.foot .lat { font-weight: 700; }
.copy { margin-left: auto; color: var(--c-ink-2); }
.copy small { font-size: 16px; }

