/* TypeMacX — top page, part 1 (loaded after style.css, before home.css).
   The first screen: a line you type into, above a Mac JIS keyboard whose keys
   light up; and the section after it, the same sentence typed two ways.
   Script: keyboard.js.
   The keyboard is a physical object, so its aluminium (--c-alu-*, --c-key-*)
   stays light in both colour schemes. Reading surfaces below the first screen
   use the shared, themed tokens. */

:root {
  --c-blue: var(--brand-blue);
  --c-indigo: var(--brand-indigo);
  --c-violet: var(--brand-violet);
  --c-magenta: var(--brand-magenta);
  --c-cyan: var(--brand-cyan);
  --c-cyan-rgb: 95 242 255;
  --c-white: #ffffff;
  --c-white-rgb: 255 255 255;
  --c-ink-rgb: 21 22 46;
  --c-deep-rgb: 30 12 104;
  --c-indigo-rgb: 106 92 246;
  --c-alu-1: #fbfcfe;
  --c-alu-2: #e6e9f1;
  --c-alu-3: #c9cedb;
  --c-alu-4: #a2a8ba;
  --c-alu-5: #666a86;
  --c-key-1: #ffffff;
  --c-key-2: #eff1f7;
  --c-key-edge: #cfd4e0;
  --c-legend: #2a2d45;
  --c-legend-2: #979cb1;
  --c-en-on-light: #3d37d6;
  --c-warn: #ff6a3c;
  --c-warn-2: #ff9d4d;
  --c-warn-rgb: 255 106 60;
  --gutter: clamp(16px, 4vw, 48px);
}

/* ============================================================ FIRST SCREEN */
.hero {
  position: relative;
  isolation: isolate;
  min-height: max(calc(100vh - var(--header-h)), 620px);
  min-height: max(calc(100svh - var(--header-h)), 620px);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  color: var(--on-field);
  overflow: clip;
  background:
    radial-gradient(90% 70% at 8% -8%, var(--c-blue) 0%, transparent 62%),
    radial-gradient(80% 70% at 104% 108%, var(--c-magenta) 0%, transparent 60%),
    linear-gradient(150deg, var(--c-indigo) 10%, var(--c-violet) 78%);
  --focus: var(--brand-cyan);
  /* one keyboard width for the whole first screen */
  --kw: min(94vw, 1240px, 88vh);
  --kw: min(94vw, 1240px, 88svh);
}
/* soft pool of light on the "table" under the keyboard */
.hero::before {
  content: "";
  position: absolute; z-index: -1;
  left: 50%; bottom: -22%;
  width: min(150vw, 1900px); height: 78%;
  transform: translateX(-50%);
  background: radial-gradient(50% 50% at 50% 50%, rgb(var(--c-white-rgb) / .2), transparent 70%);
  pointer-events: none;
}

/* ---------- headline and actions ---------- */
.hero-top {
  padding: clamp(12px, 2.3svh, 28px) var(--gutter) 0;
  text-align: center;
}
.hero-h {
  font-size: clamp(27px, min(3.4vw, 5.6svh), 52px);
  line-height: 1.22; letter-spacing: .01em;
  text-shadow: 0 2px 30px rgb(var(--c-deep-rgb) / .45), 0 1px 2px rgb(var(--c-deep-rgb) / .3);
}
.hero-h span { display: inline-block; }
.hero-sub {
  margin-top: clamp(2px, .6svh, 6px);
  font-size: clamp(13.5px, 1.2vw, 16.5px); font-weight: 600; line-height: 1.6;
  color: var(--on-field-2);
}
.hero-acts {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 10px;
  margin-top: clamp(10px, 1.9svh, 18px);
}
.hero-acts .btn-ghost::after {
  content: ""; width: 7px; height: 7px; margin-left: 2px;
  border-top: 2px solid currentColor; border-right: 2px solid currentColor;
  transform: translateY(-2px) rotate(135deg);
}

/* ---------- the line ---------- */
.play {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: clamp(8px, 1.6svh, 18px) var(--gutter) 0;
  min-width: 0;
  text-align: center;
}
/* a hint that belongs to the line below it (the notch points at the line) */
.ask {
  position: relative; margin-bottom: 7px;
  display: inline-flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 0 12px;
  max-width: 100%;
  padding: 5px 16px 5px 14px; border-radius: 18px;
  background: var(--on-field-fill); box-shadow: inset 0 0 0 1px var(--on-field-line);
  line-height: 1.6;
}
.ask::after {
  content: ""; position: absolute; left: 50%; top: 100%; width: 14px; height: 7px;
  transform: translateX(-50%);
  background: var(--on-field-fill-2);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}
.ask__t { font-size: clamp(14.5px, 1.25vw, 17px); font-weight: 800; letter-spacing: .03em; }
.ask__s { font-size: clamp(12.5px, 1.05vw, 14.5px); font-weight: 600; color: var(--on-field-2); }
.ask__k { white-space: nowrap; }
.ask kbd {
  display: inline-block; min-width: 2.4em; padding: .05em .6em; margin-right: .1em;
  border-radius: .45em; background: var(--on-field-fill-2); box-shadow: inset 0 0 0 1px var(--on-field-line);
  font: 700 .86em/1.5 var(--f-ui); text-align: center; color: var(--on-field);
}
.hero.is-static .ask { display: none; }

.line {
  --fs: min(7.4vw, 10.2vh, 120px);
  --fs: min(7.4vw, 10.2svh, 120px);
  position: relative;
  width: 100%;
  height: calc(var(--fs) * 1.36);
  display: flex; justify-content: center; align-items: center;
  font-size: var(--fs);
}
.line__text {
  flex: none;
  white-space: nowrap;
  font-family: var(--f-jp);
  font-weight: 800;
  font-size: 1em;
  line-height: 1.3;
  letter-spacing: -.04em;
  transform: scale(var(--s, 1));
  transform-origin: 50% 55%;
  transition: transform .18s var(--ease);
  text-shadow: 0 .02em 0 rgb(var(--c-deep-rgb) / .18), 0 .16em .4em rgb(var(--c-deep-rgb) / .34);
}
.seg { display: inline-block; }
.seg--en {
  font-family: var(--f-mono);
  font-size: .82em; font-weight: 600; letter-spacing: -.05em;
  color: var(--c-cyan);
  padding: 0 .07em;
  text-shadow: 0 0 .5em rgb(var(--c-cyan-rgb) / .35), 0 .16em .4em rgb(var(--c-deep-rgb) / .34);
}
.seg--pend { font-family: var(--f-mono); font-size: .82em; font-weight: 500; letter-spacing: -.05em; opacity: .82; }
.comp {
  display: inline-block;
  background: linear-gradient(rgb(var(--c-white-rgb) / .62), rgb(var(--c-white-rgb) / .62)) 0 100% / 100% .045em no-repeat;
}
.seg.is-fresh { animation: settle .34s cubic-bezier(.2, 1.5, .4, 1) both; }
@keyframes settle {
  0% { transform: translateY(.1em) scale(.9); opacity: .2; }
  100% { transform: none; opacity: 1; }
}
.hero .caret {
  display: inline-block;
  width: .075em; min-width: 0; height: .98em;
  margin: 0 .07em;
  vertical-align: -.14em;
  border-radius: .05em;
  background: var(--c-cyan);
  box-shadow: 0 0 .1em var(--c-cyan), 0 0 .34em rgb(var(--c-cyan-rgb) / .9), 0 0 .9em rgb(var(--c-cyan-rgb) / .55);
  animation: blink 1.15s steps(1, end) infinite;
}
.hero.is-composing .caret { animation: none; }
@keyframes blink { 0%, 55% { opacity: 1; } 56%, 100% { opacity: .18; } }
.ghost {
  font-family: var(--f-mono);
  font-size: .82em; font-weight: 500; letter-spacing: -.05em;
  color: rgb(var(--c-white-rgb) / .34);
  text-shadow: none;
}
.ghost--key {
  display: inline-block;
  font-size: .3em; letter-spacing: 0; font-weight: 600;
  vertical-align: .5em;
  margin-left: .5em; padding: .3em .7em;
  border: 1.5px solid rgb(var(--c-white-rgb) / .45); border-radius: .5em;
  color: rgb(var(--c-white-rgb) / .7);
}
.tap-input {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  margin: 0; padding: 0; border: 0;
  opacity: 0;
  font-size: 16px;
  background: transparent; color: transparent; caret-color: transparent;
}
.hero.is-static .tap-input { display: none; }
@media (hover: hover) and (pointer: fine) { .tap-input { pointer-events: none; } }
.line.is-focus::after {
  content: ""; position: absolute; left: 50%; bottom: 0; width: 64px; height: 3px; border-radius: 3px;
  transform: translateX(-50%); background: var(--c-cyan);
}

/* what was typed, as typed */
.echo {
  height: 26px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 14px;
  font-size: clamp(13px, 1.25vw, 16px);
}
.echo__raw { font-family: var(--f-mono); letter-spacing: .02em; color: var(--c-white); max-width: 100%; overflow-wrap: anywhere; }
.echo__raw.is-past { opacity: .6; }
.echo__raw:empty { display: none; }
.echo__hint { font-family: var(--f-jp); font-weight: 700; opacity: .9; }
.echo__hint:empty { display: none; }
.echo__tab {
  appearance: none; cursor: pointer;
  padding: 4px 12px; border-radius: 8px;
  border: 0; background: var(--c-white); color: var(--c-en-on-light);
  font-size: 13px; font-weight: 700;
  box-shadow: 0 2px 0 rgb(var(--c-deep-rgb) / .3), 0 6px 14px rgb(var(--c-deep-rgb) / .25);
}
.echo__tab[hidden] { display: none; }

.tries { margin-top: clamp(4px, 1svh, 12px); display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 100%; }
.chips { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 100%; }
.chip {
  appearance: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 13px; border-radius: 999px;
  border: 1px solid rgb(var(--c-white-rgb) / .3);
  background: rgb(var(--c-white-rgb) / .1);
  font-family: var(--f-mono); font-size: 13px; line-height: 1.5; letter-spacing: .01em; white-space: nowrap;
  color: var(--c-white);
  transition: background-color .15s, border-color .15s, transform .15s var(--ease);
}
.chip:hover { background: rgb(var(--c-white-rgb) / .2); border-color: rgb(var(--c-white-rgb) / .55); }
.chip:active { transform: translateY(1px) scale(.98); }
.chip:focus-visible { border-radius: 999px; }
.chip.is-on { background: var(--c-white); border-color: var(--c-white); color: var(--c-en-on-light); }
.chip kbd {
  font: inherit; font-size: 11px; font-family: var(--f-ui); font-weight: 700;
  padding: 1px 6px; border-radius: 5px;
  border: 1px solid currentColor; opacity: .85;
}
.taps { display: none; gap: 8px; }
.tap {
  appearance: none; cursor: pointer;
  padding: 9px 16px; border-radius: 12px; border: 0;
  background: var(--c-white); color: var(--c-en-on-light);
  font-family: var(--f-jp); font-size: 13px; font-weight: 700;
  box-shadow: 0 2px 0 rgb(var(--c-deep-rgb) / .3), 0 6px 14px rgb(var(--c-deep-rgb) / .22);
}
.tap:active { transform: translateY(2px); box-shadow: 0 0 0 rgb(var(--c-deep-rgb) / .3); }
.is-touch .taps { display: flex; }
.hero.is-static .chips, .hero.is-static .taps { display: none; }
.reveal { transition: opacity .5s ease, transform .5s var(--ease); }
.hero.is-intro .reveal { opacity: 0; transform: translateY(6px); pointer-events: none; }

/* the in-page-trial note: bottom-left corner, beside the counter */
.fine {
  position: absolute; left: var(--gutter); bottom: 18px;
  max-width: calc(50% - var(--kw) * .19 - var(--gutter));
  font-size: 11.5px; line-height: 1.6; letter-spacing: .02em; text-align: left;
  color: var(--on-field-3);
}

/* ============================================================ KEYBOARD (the first-screen object and the small diagrams) */
.kb {
  --pad: calc(var(--kw) * .013);
  --u: calc((var(--kw) - 2 * var(--pad)) / 14.5);
  --g: calc(var(--u) * .085);
  position: relative;
  width: var(--kw);
  flex: none;
}
.kb__body {
  display: grid;
  grid-template-columns: repeat(58, calc(var(--u) / 4));
  grid-template-rows: calc(var(--u) * .6) repeat(5, var(--u));
  padding: var(--pad);
  border-radius: calc(var(--u) * .34);
  background: linear-gradient(172deg, var(--c-alu-1) 0%, var(--c-alu-2) 55%, var(--c-alu-3) 100%);
  box-shadow:
    inset 0 1.5px 0 var(--c-white),
    inset 0 0 0 1px rgb(var(--c-white-rgb) / .5),
    inset 0 -2px 2px rgb(var(--c-ink-rgb) / .12),
    0 calc(var(--u) * .1) 0 var(--c-alu-4),
    0 calc(var(--u) * .13) 0 rgb(var(--c-deep-rgb) / .5),
    0 calc(var(--u) * .22) calc(var(--u) * .16) rgb(var(--c-deep-rgb) / .45),
    calc(var(--u) * .1) calc(var(--u) * .5) calc(var(--u) * .5) rgb(var(--c-deep-rgb) / .42),
    calc(var(--u) * .5) calc(var(--u) * 1.5) calc(var(--u) * 1.9) rgb(var(--c-deep-rgb) / .5);
}
.kb .r0 { grid-row: 1; } .kb .r1 { grid-row: 2; } .kb .r2 { grid-row: 3; } .kb .r3 { grid-row: 4; } .kb .r4 { grid-row: 5; } .kb .r5 { grid-row: 6; }
.kb .w4 { grid-column: span 4; } .kb .w5 { grid-column: span 5; } .kb .w6 { grid-column: span 6; } .kb .w7 { grid-column: span 7; }
.kb .w9 { grid-column: span 9; } .kb .w14 { grid-column: span 14; }

.kb .key {
  --lit-a: var(--c-blue);
  --lit-b: var(--c-violet);
  appearance: none;
  position: relative;
  display: block;
  min-width: 0; height: auto;
  margin: calc(var(--g) / 2);
  padding: 0; border: 0;
  border-radius: calc(var(--u) * .12);
  background: linear-gradient(180deg, var(--c-key-1) 0%, var(--c-key-2) 100%);
  color: var(--c-legend);
  font: inherit; font-family: var(--f-ui);
  white-space: normal; vertical-align: baseline;
  box-shadow:
    inset 0 1px 0 var(--c-white),
    inset 0 calc(var(--u) * -.028) 0 var(--c-key-edge),
    0 calc(var(--u) * .014) calc(var(--u) * .014) rgb(var(--c-ink-rgb) / .34),
    calc(var(--u) * .014) calc(var(--u) * .05) calc(var(--u) * .07) rgb(var(--c-ink-rgb) / .16);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none; -webkit-user-select: none;
  transition: transform .16s var(--ease), color .5s ease-out;
}
/* the light inside the key: on at once, fades out like an afterglow */
.kb .key::before, .kb .ret::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  background: linear-gradient(155deg, var(--lit-a), var(--lit-b));
  box-shadow: inset 0 1px 0 rgb(var(--c-white-rgb) / .45), 0 0 calc(var(--u) * .34) rgb(var(--c-cyan-rgb) / .6);
  opacity: 0;
  transition: opacity .55s ease-out;
}
.kb .key > span { position: relative; z-index: 1; }
.kb .key.is-down { transform: translateY(calc(var(--u) * .028)) scale(.972); color: var(--c-white); transition: none; }
.kb .key.is-down::before, .kb .key.is-down .ret::before { opacity: 1; transition: none; }
.kb .key.is-down .k-kana { color: rgb(var(--c-white-rgb) / .75); }

.kb .key > .k-main {
  position: absolute; left: 15%; top: 10%;
  font-size: calc(var(--u) * .3); font-weight: 500; line-height: 1.1; letter-spacing: -.01em;
}
.kb .key > .k-kana {
  position: absolute; right: 14%; bottom: 10%;
  font-family: var(--f-jp);
  font-size: calc(var(--u) * .2); font-weight: 600; line-height: 1.1;
  color: var(--c-legend-2);
  transition: color .5s ease-out;
}
.kb .key > .k-txt {
  position: absolute; left: calc(var(--u) * .13); bottom: calc(var(--u) * .1);
  font-size: calc(var(--u) * .165); font-weight: 500; line-height: 1; letter-spacing: .01em;
}
.kb .key > .k-sym {
  position: absolute; right: calc(var(--u) * .13); top: calc(var(--u) * .1);
  font-size: calc(var(--u) * .21); line-height: 1;
}
.kb .is-right > .k-txt { left: auto; right: calc(var(--u) * .13); }
.kb .is-right > .k-sym { right: auto; left: calc(var(--u) * .13); }
.kb .key--fn > .k-txt { font-size: calc(var(--u) * .15); bottom: calc(var(--u) * .09); }
.kb .key--lock::after {
  content: ""; position: absolute; left: 50%; top: 50%; z-index: 1;
  width: calc(var(--u) * .2); height: calc(var(--u) * .2); margin: calc(var(--u) * -.1);
  border-radius: 50%; border: calc(var(--u) * .022) solid var(--c-legend-2);
}
.kb .key > .k-lang {
  position: absolute; left: 0; right: 0; bottom: calc(var(--u) * .1);
  text-align: center;
  font-family: var(--f-jp); font-size: calc(var(--u) * .19); font-weight: 600; line-height: 1;
}

/* JIS return: an inverted L made of two overlapping plates */
.kb .key--return {
  grid-column: 56 / span 3; grid-row: 3 / span 2;
  background: none; box-shadow: none;
  filter: drop-shadow(0 calc(var(--u) * .014) calc(var(--u) * .014) rgb(var(--c-ink-rgb) / .34)) drop-shadow(calc(var(--u) * .014) calc(var(--u) * .05) calc(var(--u) * .05) rgb(var(--c-ink-rgb) / .16));
}
.kb .key--return::before { content: none; }
.kb .key > .ret { position: absolute; border-radius: calc(var(--u) * .12); background: var(--c-key-1); }
.kb .key > .ret--a { left: calc(var(--u) / -4); right: 0; top: 0; height: calc(var(--u) - var(--g)); box-shadow: inset 0 calc(var(--u) * -.028) 0 var(--c-key-edge); border-bottom-right-radius: 0; }
.kb .key > .ret--b { left: 0; right: 0; top: 0; bottom: 0; border-top-left-radius: 0; border-top-right-radius: calc(var(--u) * .12); background: linear-gradient(180deg, var(--c-key-1) 0%, var(--c-key-1) 46%, var(--c-key-2) 100%); box-shadow: inset 0 calc(var(--u) * -.028) 0 var(--c-key-edge); }
.kb .ret::before { background: var(--lit-b); box-shadow: none; }
.kb .ret--b::before { left: calc(var(--u) * -.03); }
.kb .key--return.is-down { filter: drop-shadow(0 0 calc(var(--u) * .16) rgb(var(--c-cyan-rgb) / .6)); }
.kb .key--return > .k-txt { z-index: 2; }

/* arrows */
.kb .key--half { align-self: end; height: calc((var(--u) - var(--g)) / 2); border-radius: calc(var(--u) * .1); }
.kb .key-stack { display: flex; flex-direction: column; justify-content: flex-end; gap: calc(var(--u) * .03); margin: calc(var(--g) / 2); min-width: 0; }
.kb .key--halfin { margin: 0; height: calc((var(--u) - var(--g)) / 2 - var(--u) * .015); border-radius: calc(var(--u) * .08); }
.kb .key > .tri {
  position: absolute; left: 50%; top: 50%;
  width: 0; height: 0;
  border: calc(var(--u) * .065) solid transparent;
}
.kb .key > .tri--l { border-right-color: currentColor; margin: calc(var(--u) * -.065) 0 0 calc(var(--u) * -.1); }
.kb .key > .tri--r { border-left-color: currentColor; margin: calc(var(--u) * -.065) 0 0 calc(var(--u) * -.03); }
.kb .key > .tri--u { border-bottom-color: currentColor; margin: calc(var(--u) * -.1) 0 0 calc(var(--u) * -.065); }
.kb .key > .tri--d { border-top-color: currentColor; margin: calc(var(--u) * -.03) 0 0 calc(var(--u) * -.065); }

/* 英数 / かな: the two keys that never light */
.kb .key--lang.is-down { transform: none; color: var(--c-legend); }
.kb .key--lang::before { content: none; }
.kb .key--lang.is-shrug { animation: shrug .5s var(--ease); }
@keyframes shrug {
  0% { transform: none; }
  22% { transform: translateY(calc(var(--u) * -.07)) rotate(-5deg); }
  50% { transform: translateY(calc(var(--u) * -.07)) rotate(5deg); }
  78% { transform: translateY(calc(var(--u) * -.02)) rotate(-2deg); }
  100% { transform: none; }
}
/* keyboard users reach the keys by typing; the ring still shows if one is focused */
.kb .key:focus-visible { outline: 3px solid var(--c-cyan); outline-offset: 2px; }

/* ---------- first-screen placement of the keyboard ---------- */
.deck {
  min-width: 0;
  display: flex; justify-content: center;
  perspective: 2000px;
  perspective-origin: 50% -20%;
  padding: 0 0 calc(var(--kw) * .036 + 64px);
}
.deck .kb {
  margin-top: calc(var(--kw) * -.018);
  transform: rotateX(24deg);
  transform-origin: 50% 100%;
}

.tally {
  position: absolute;
  top: calc(100% + var(--u) * .17);
  left: calc(var(--pad) + var(--u) * 3.875);
  width: calc(var(--u) * 4.75);
  text-align: center;
}
.tally__bracket {
  display: block;
  height: calc(var(--u) * .36);
  border: 1.5px solid rgb(var(--c-white-rgb) / .55);
  border-top: 0;
  border-radius: 0 0 10px 10px;
  transition: border-color .3s;
}
.tally__text {
  display: flex; justify-content: center; align-items: baseline; gap: 14px;
  margin-top: 10px;
  white-space: nowrap;
  font-family: var(--f-jp);
  line-height: 1;
}
.tally__keys { font-size: 13px; font-weight: 600; opacity: .72; font-variant-numeric: tabular-nums; }
.tally__keys b { font-family: var(--f-mono); font-weight: 600; }
.tally__sw { font-size: clamp(17px, 1.9vw, 26px); font-weight: 800; letter-spacing: .02em; }
.tally__sw b {
  font-family: var(--f-ui); font-size: 1.55em; font-weight: 800; letter-spacing: -.02em; margin: 0 .08em;
  font-variant-numeric: tabular-nums;
  color: var(--c-cyan);
  text-shadow: 0 0 .5em rgb(var(--c-cyan-rgb) / .5);
  transition: color .3s;
}
.tally.has-sw .tally__sw b { color: var(--c-warn-2); text-shadow: 0 0 .5em rgb(var(--c-warn-rgb) / .6); }
.tally.has-sw .tally__bracket { border-color: var(--c-warn-2); }
.tally__note {
  position: absolute; left: calc(100% + 16px); top: calc(var(--u) * .1);
  transform: translate(-6px, 0);
  white-space: nowrap;
  padding: 6px 12px; border-radius: 10px;
  background: var(--c-white); color: var(--c-legend);
  font-family: var(--f-jp); font-size: 12.5px; font-weight: 700;
  box-shadow: 0 8px 20px rgb(var(--c-deep-rgb) / .35);
  opacity: 0; visibility: hidden;
  transition: opacity .2s, transform .25s var(--ease), visibility 0s .25s;
}
.tally.is-noting .tally__note { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }

/* wide but short windows: headline and actions share one row */
@media (min-width: 960px) and (max-height: 790px) {
  .hero-top {
    display: flex; align-items: center; justify-content: space-between; gap: 24px;
    width: 100%; max-width: 1180px; margin-inline: auto;
    text-align: left;
  }
  .hero-acts { flex: none; margin-top: 0; flex-wrap: nowrap; }
}

/* ============================================================ SAME SENTENCE, TWO WAYS */
.versus { padding: clamp(72px, 10vw, 128px) var(--gutter) clamp(72px, 10vw, 128px); background: var(--bg); }
.versus__h {
  font-size: clamp(28px, 4.6vw, 54px); line-height: 1.16; letter-spacing: -.035em;
  text-align: center; color: var(--text);
}
.br-s { display: none; }
.versus__grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(14px, 2vw, 28px);
  max-width: 1240px; margin: clamp(32px, 5vw, 64px) auto 0;
}
.vs {
  --vs-pad: clamp(16px, 2.4vw, 32px);
  container-type: inline-size;
  padding: var(--vs-pad);
  border-radius: clamp(20px, 2.4vw, 32px);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}
.vs--new {
  color: var(--c-white);
  background:
    radial-gradient(90% 80% at 0% 0%, var(--c-blue), transparent 60%),
    linear-gradient(150deg, var(--c-indigo), var(--c-magenta));
  box-shadow: 0 1px 0 rgb(var(--c-white-rgb) / .35) inset, 0 28px 56px -24px rgb(var(--c-indigo-rgb) / .7);
}
.vs__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: clamp(14px, 2vw, 24px); }
.vs__name { font-size: clamp(15px, 1.5vw, 18px); font-weight: 700; }
.vs--old .vs__name { color: var(--text-2); }
.vs__count { font-family: var(--f-jp); font-size: clamp(14px, 1.5vw, 18px); font-weight: 800; white-space: nowrap; }
.vs__n { font-family: var(--f-ui); font-size: clamp(40px, 5.4vw, 76px); font-weight: 800; line-height: .9; letter-spacing: -.04em; font-variant-numeric: tabular-nums; margin: 0 .06em; }
.vs--old .vs__n { color: var(--c-warn); }
.vs--new .vs__n { color: var(--c-cyan); text-shadow: 0 0 .4em rgb(var(--c-cyan-rgb) / .45); }

.kb--mini { --kw: 100cqw; }
.kb--mini .kb__body {
  grid-template-rows: 0 repeat(5, var(--u));
  box-shadow:
    inset 0 1px 0 var(--c-white),
    inset 0 -1px 1px rgb(var(--c-ink-rgb) / .12),
    0 calc(var(--u) * .08) 0 var(--c-alu-4),
    0 calc(var(--u) * .4) calc(var(--u) * .7) rgb(var(--c-ink-rgb) / .18);
}
.vs--new .kb--mini .kb__body { box-shadow: inset 0 1px 0 var(--c-white), 0 calc(var(--u) * .08) 0 var(--c-alu-4), 0 calc(var(--u) * .5) calc(var(--u) * .9) rgb(var(--c-deep-rgb) / .5); }
.kb--mini .key { cursor: default; transition: none; }
.kb--mini .key::before { box-shadow: none; transition: opacity .25s ease-out; }
.kb--mini .key > .k-main { left: 0; right: 0; top: 50%; text-align: center; transform: translateY(-50%); font-size: calc(var(--u) * .36); font-weight: 600; }
.kb--mini .key--mod > .k-txt { display: none; }
.kb--mini .key > .k-lang { bottom: 50%; transform: translateY(50%); font-size: calc(var(--u) * .27); font-weight: 700; }
.kb--mini .key--lang::before { content: ""; background: linear-gradient(155deg, var(--c-warn-2), var(--c-warn)); }
.kb--mini .key.is-used { color: var(--c-white); }
.kb--mini .key.is-used::before { opacity: 1; }
.vs--old .kb--mini .key--char { --lit-a: var(--c-alu-4); --lit-b: var(--c-alu-5); }
.kb--mini .key.is-now { transform: translateY(calc(var(--u) * .03)) scale(.95); }

/* the keys in the order they are pressed */
.seq { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; margin-top: clamp(16px, 2vw, 24px); }
.kc {
  min-width: 2em; height: 2em; padding: 0 .5em;
  display: grid; place-items: center;
  border-radius: 7px;
  font-family: var(--f-mono); font-size: clamp(11px, 1.05vw, 14px); font-weight: 600; line-height: 1;
  background: var(--surface-2); color: var(--text-3);
  box-shadow: inset 0 -2px 0 var(--line);
  transition: background-color .2s, color .2s, transform .2s var(--ease);
}
.kc.is-on { background: var(--accent-soft-2); color: var(--text); }
.vs--new .kc { background: rgb(var(--c-white-rgb) / .14); color: rgb(var(--c-white-rgb) / .5); box-shadow: none; }
.vs--new .kc.is-on { background: var(--c-white); color: var(--c-en-on-light); }
.kc--sw { font-family: var(--f-jp); font-weight: 800; }
.kc--sw.is-on { background: linear-gradient(155deg, var(--c-warn-2), var(--c-warn)); color: var(--c-white); box-shadow: 0 4px 12px rgb(var(--c-warn-rgb) / .4); }
@container (min-width: 440px) {
  .seq { gap: .6cqw; }
  .vs--new .seq { max-width: 65cqw; }
  .kc { flex: none; min-width: 0; width: 3.3cqw; height: 4.6cqw; padding: 0; font-size: 2.2cqw; border-radius: 1cqw; }
  .kc--sw { width: 8.75cqw; font-size: 1.9cqw; }
}
.vs__out { margin-top: clamp(14px, 1.8vw, 22px); font-family: var(--f-jp); font-size: clamp(20px, 2.6vw, 34px); font-weight: 800; letter-spacing: -.03em; }
.vs__out .en { font-family: var(--f-mono); font-size: 1em; font-weight: 600; letter-spacing: -.02em; background: none; padding: 0; border-radius: 0; }
.vs--old .vs__out .en { color: var(--en); }
.vs--new .vs__out .en { color: var(--c-cyan); }

/* ============================================================ SMALLER SCREENS */
@media (max-width: 900px) {
  .versus__grid { grid-template-columns: minmax(0, 1fr); max-width: 620px; }
  .hero { grid-template-rows: auto minmax(0, 1fr) auto auto; }
  .fine { position: static; max-width: none; padding: 0 var(--gutter) 16px; text-align: center; }
}

/* phones: a cropped shot of the keyboard — letters, 英数, space and かな stay in frame, big enough to tap */
@media (max-width: 720px) {
  .hero { min-height: 0; grid-template-rows: auto auto auto auto; }
  .hero-top { padding-top: 18px; }
  .hero-h { font-size: clamp(27px, 8.2vw, 36px); }
  .hero-acts { flex-wrap: nowrap; gap: 8px; margin-top: 14px; }
  .hero-acts .btn { flex: 1 1 0; min-width: 0; max-width: 220px; min-height: 44px; padding: 6px 10px; font-size: 14px; white-space: nowrap; }
  .play { padding-top: 16px; padding-bottom: 6px; }
  .ask { padding: 6px 14px; }
  .line { --fs: min(11.5vw, 11svh); }
  .tries { width: calc(100% + 2 * var(--gutter)); max-width: none; margin-inline: calc(var(--gutter) * -1); }
  .chips {
    flex-wrap: nowrap; justify-content: flex-start; width: 100%;
    padding: 2px var(--gutter); overflow-x: auto; scrollbar-width: none;
  }
  .chips::-webkit-scrollbar { display: none; }
  .chips li { flex: none; }
  .chip { font-size: 12px; padding: 6px 11px; }
  .deck {
    justify-content: flex-start; perspective: 1100px; padding-bottom: 92px;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, rgb(var(--c-ink-rgb)) 12%, rgb(var(--c-ink-rgb)) 88%, transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, rgb(var(--c-ink-rgb)) 12%, rgb(var(--c-ink-rgb)) 88%, transparent 100%);
  }
  .deck .kb {
    --u: calc(100vw / 10.5);
    --pad: calc(var(--u) * .18);
    --g: calc(var(--u) * .1);
    --kw: calc(var(--u) * 14.5 + 2 * var(--pad));
    margin-top: 0;
    margin-left: calc(50vw - var(--u) * 6.25 - var(--pad));
    transform: rotateX(14deg);
  }
  .deck .kb__body { grid-template-rows: 0 repeat(5, var(--u)); }
  .deck .key--fn { display: none; }
  .deck .key > .k-main { font-size: calc(var(--u) * .36); }
  .deck .key > .k-kana { font-size: calc(var(--u) * .22); }
  .tally__text { gap: 10px; }
  .tally__note { left: 50%; top: 100%; margin-top: 8px; transform: translate(-50%, -4px); }
  .tally.is-noting .tally__note { transform: translate(-50%, 0); }
  .br-s { display: inline; }
}

/* ============================================================ REDUCED MOTION */
@media (prefers-reduced-motion: reduce) {
  .hero *, .hero *::before, .hero *::after,
  .versus *, .versus *::before, .versus *::after { animation: none !important; transition: none !important; }
  .kb .key.is-down { transform: none; }
}
