/* SPDX-License-Identifier: GPL-3.0-or-later
   megulit.com. Grimoire palette from the app: wine-black ink, crimson, gold leaf. No framework, no external fonts. */

@font-face {
  font-family: "MeguLit Serif";
  src: url("/assets/fonts/megulit-serif.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
/* Same file without the curly quotes: the CJK font draws them full-width, which looks broken in English. */
@font-face {
  font-family: "MeguLit Serif Latin";
  src: url("/assets/fonts/megulit-serif.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
  unicode-range: U+0000-2017, U+2020-FFFF;
}

:root {
  --bg: #170f11;
  --bg-2: #1e1417;
  --surface: #241a1d;
  --text: #efe5da;
  --muted: #b7a69c;
  --faint: #a08e84;
  --crimson: #c8323f;
  --crimson-ink: #e35a63;
  --gold: #dcab55;
  --gold-soft: rgba(220, 171, 85, .16);
  --line: rgba(220, 171, 85, .2);
  --line-2: rgba(239, 229, 218, .09);
  --glow: rgba(200, 50, 63, .32);
  --shadow: 0 30px 80px -30px rgba(0, 0, 0, .7), 0 0 0 1px rgba(220, 171, 85, .14);
  --btn-text: #fff6ee;
  --page: var(--bg);
  --top-h: 4rem;

  --serif: "MeguLit Serif", "Noto Serif SC", "Source Han Serif SC", "Songti SC", "Noto Serif JP", "Yu Mincho", serif;
  --serif-ja: "Noto Serif JP", "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", "MeguLit Serif", serif;
  --sans: system-ui, "Segoe UI", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", "Hiragino Sans", "Noto Sans SC", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, monospace;

  --gutter: clamp(16px, 4vw, 48px);
  --maxw: 75rem;
  --r-lg: 18px;
  --r-md: 12px;
  --r-sm: 8px;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f8f1ee;
  --bg-2: #f2e8e4;
  --surface: #fffaf8;
  --text: #2a1518;
  --muted: #5b4542;
  --faint: #66524e;
  --crimson: #a51d2d;
  --crimson-ink: #a51d2d;
  --gold: #82540c;
  --gold-soft: rgba(130, 84, 12, .1);
  --line: rgba(122, 22, 38, .16);
  --line-2: rgba(42, 21, 24, .08);
  --glow: rgba(165, 29, 45, .16);
  --shadow: 0 30px 70px -34px rgba(74, 20, 28, .45), 0 0 0 1px rgba(122, 22, 38, .12);
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f8f1ee;
    --bg-2: #f2e8e4;
    --surface: #fffaf8;
    --text: #2a1518;
    --muted: #5b4542;
    --faint: #66524e;
    --crimson: #a51d2d;
    --crimson-ink: #a51d2d;
    --gold: #82540c;
    --gold-soft: rgba(130, 84, 12, .1);
    --line: rgba(122, 22, 38, .16);
    --line-2: rgba(42, 21, 24, .08);
    --glow: rgba(165, 29, 45, .16);
    --shadow: 0 30px 70px -34px rgba(74, 20, 28, .45), 0 0 0 1px rgba(122, 22, 38, .12);
    color-scheme: light;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; font-size: clamp(16px, .3vw + 12px, 20px); scroll-behavior: smooth; scroll-padding-top: 5rem; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.75 var(--sans);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
:lang(ja) body, html:lang(ja) body { font-family: system-ui, "Segoe UI", "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration-color: var(--line); text-underline-offset: .2em; }
a:hover { text-decoration-color: currentColor; }
code, kbd { font-family: var(--mono); font-size: .88em; }
code { background: var(--gold-soft); padding: .1em .35em; border-radius: 4px; }
kbd { font-weight: 600; padding: .1em .5em; border-radius: 6px; background: var(--gold-soft); color: var(--text); border: 1px solid var(--line); box-shadow: inset 0 -1px 0 var(--line); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--crimson); color: #fff; }
.mono { font-family: var(--mono); }
.small { font-size: .875rem; color: var(--muted); }
.wrap { width: 100%; max-width: calc(var(--maxw) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }
.narrow { max-width: calc(48rem + 2 * var(--gutter)); }
.skip-link { position: absolute; left: -999px; top: 0; }
.skip-link:focus { left: 1rem; top: 1rem; z-index: 50; background: var(--surface); padding: .5rem 1rem; }

/* ---- top bar ---------------------------------------------------------------------------------------------------- */
.top {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line-2);
}
.top-row { display: flex; align-items: center; gap: 1.5rem; height: 4rem; }
.brand img { height: 2.6rem; width: auto; }
.nav { display: flex; gap: 1.6rem; margin-right: auto; font-size: .9375rem; }
.nav a { text-decoration: none; color: var(--muted); transition: color .15s; white-space: nowrap; }
.nav a:hover { color: var(--text); }
.tools { display: flex; align-items: center; gap: .5rem; margin-left: auto; }
.lang { display: flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; }
.lang button, .seg button {
  font: inherit; font-size: .8125rem; color: var(--muted); background: none; border: 0; cursor: pointer;
  padding: .2rem .6rem; border-radius: 999px; min-height: 2rem; min-width: 2.2rem;
  transition: color .15s, background-color .15s;
}
.lang button[aria-pressed="true"], .seg button[aria-pressed="true"] { background: var(--gold-soft); color: var(--text); }
.icon-btn {
  display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 999px;
  color: var(--muted); background: none; border: 1px solid transparent; cursor: pointer;
}
.icon-btn:hover { color: var(--text); border-color: var(--line); }
.icon-btn svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
#theme .moon { display: none; }
:root[data-theme="light"] #theme .sun { display: none; }
:root[data-theme="light"] #theme .moon { display: block; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) #theme .sun { display: none; }
  :root:not([data-theme="dark"]) #theme .moon { display: block; }
}

/* ---- type ------------------------------------------------------------------------------------------------------- */
.display, .h2, .h3, .h4, .steps h3, .dl-version { font-family: var(--serif); font-weight: 600; letter-spacing: -.005em; text-wrap: balance; }
:lang(ja) .display, :lang(ja) .h2, :lang(ja) .h3, :lang(ja) .h4, :lang(ja) .steps h3 { font-family: var(--serif-ja); }
/* CJK headings break at punctuation and spaces, not inside a word; anywhere still prevents overflow */
:lang(zh) :is(.display, .h2, .h3), :lang(ja) .display { word-break: keep-all; overflow-wrap: anywhere; }
.display { font-size: clamp(2.3rem, 4.6vw + .4rem, 4.4rem); line-height: 1.12; margin: 0 0 1.4rem; }
:lang(ja) .display { font-size: clamp(1.6rem, 3.4vw + .3rem, 3.5rem); }
html:lang(en) { --serif: "MeguLit Serif Latin", Georgia, "Times New Roman", serif; }
.h2 { font-size: clamp(1.8rem, 2.4vw + .6rem, 2.75rem); line-height: 1.2; margin: 0 0 .8rem; }
.h3 { font-size: 1.3rem; line-height: 1.35; margin: 0 0 .6rem; }
.h4 { font-size: 1.05rem; margin: 0 0 .6rem; }
.lede { font-size: clamp(1.05rem, .5vw + .9rem, 1.25rem); color: var(--muted); max-width: 34em; margin: 0 0 2rem; text-wrap: pretty; }
.sec-lede { color: var(--muted); max-width: 40em; margin: 0 0 3rem; font-size: 1.0625rem; }
p { text-wrap: pretty; }

/* ---- buttons ---------------------------------------------------------------------------------------------------- */
.cta { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  min-height: 3rem; padding: .7rem 1.4rem; border-radius: 999px;
  font: 600 1rem/1.2 var(--sans); text-decoration: none; cursor: pointer;
  transition: transform .12s ease, background-color .15s, box-shadow .2s, border-color .15s;
}
.btn:active { transform: scale(.97); }
.btn svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
@property --ang { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
.btn-primary {
  position: relative; isolation: isolate; overflow: hidden; border: 0;
  color: #fff6ee; letter-spacing: .02em;
  background: linear-gradient(135deg, #cc3747, #a81c30 52%, #750e1e);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), inset 0 -2px 0 rgba(0, 0, 0, .28), 0 14px 34px -14px rgba(176, 31, 51, .85);
  font-size: 1.0625rem; min-height: 3.4rem; padding: .8rem 1.9rem;
}
/* a gold beam runs round the edge; a shine crosses on hover */
.btn-primary::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px; pointer-events: none;
  background: conic-gradient(from var(--ang), transparent 0 64%, rgba(255, 225, 160, .2) 72%, #ffe3a6 82%, #e8b85c 88%, transparent 96%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: beam 3.6s linear infinite;
}
.btn-primary::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -70%; width: 45%; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .38), transparent);
  transform: skewX(-20deg); transition: left .7s cubic-bezier(.2, .7, .2, 1);
}
.btn-primary:hover::after { left: 130%; }
.btn-primary:hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .32), inset 0 -2px 0 rgba(0, 0, 0, .28), 0 18px 44px -14px rgba(200, 40, 60, .95); }
@keyframes beam { to { --ang: 360deg; } }
.btn-xl { min-height: 3.9rem; padding: .95rem 2.3rem; font-size: 1.125rem; }
.btn-quiet {
  color: var(--text); border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 35%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.btn-quiet:hover { border-color: var(--gold); background: var(--gold-soft); }
.btn-wide { width: 100%; margin-top: 1.5rem; }
.cta-meta { display: flex; flex-wrap: wrap; gap: .35rem 1.1rem; margin: 1rem 0 0; color: var(--faint); font-size: .875rem; }
.cta-meta span + span::before { content: ""; display: inline-block; width: 3px; height: 3px; border-radius: 50%; background: var(--gold); opacity: .6; vertical-align: middle; margin: 0 1.1rem 0 -.55rem; transform: translateY(-2px); }

/* ---- hero ------------------------------------------------------------------------------------------------------- */
/* The hero is always dark: it sits on the video, in either theme. The same tokens dress the top bar over it. */
.hero, .top.over {
  --bg: #120a0c; --bg-2: #1a1013; --surface: #241619; --text: #f5ebe0; --muted: #d2c2b6; --faint: #ad9b90;
  --crimson: #d23a48; --crimson-ink: #ff6f78; --gold: #eabb5f; --gold-soft: rgba(234, 187, 95, .16);
  --line: rgba(234, 187, 95, .3); --line-2: rgba(245, 235, 224, .12);
  --shadow: 0 30px 80px -30px rgba(0, 0, 0, .8), 0 0 0 1px rgba(234, 187, 95, .16);
  color: var(--text);
}
.top.over { background: linear-gradient(180deg, rgba(12, 6, 8, .7), rgba(12, 6, 8, 0)); border-bottom-color: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }
.hero {
  position: relative; isolation: isolate; overflow: clip; background: #120a0c;
  margin-top: calc(-1 * var(--top-h)); padding: calc(var(--top-h) + clamp(2.5rem, 7vh, 6rem)) 0 1.5rem;
  min-height: min(100svh, 72rem); display: grid; grid-template-rows: 1fr auto; align-items: center; padding-bottom: 5.5rem;
}
.hero-media { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.hero-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: contrast(1.06) saturate(1.2) brightness(.86); transform: scale(1.06); }
.hero-scrim {
  position: absolute; inset: 0;
  background:
    linear-gradient(120deg, rgba(150, 20, 40, .28), transparent 50%),
    linear-gradient(90deg, rgba(18, 10, 12, .55) 0%, rgba(18, 10, 12, .25) 45%, rgba(18, 10, 12, 0) 75%),
    linear-gradient(180deg, rgba(18, 10, 12, .7) 0%, transparent 22%, transparent 70%, rgba(18, 10, 12, .85) 100%);
}
/* the dark hero melts into the page (light or dark) below the chips */
.hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4.5rem; z-index: -1; pointer-events: none; background: linear-gradient(180deg, transparent, var(--page)); }
.grain {
  position: absolute; inset: -50%; opacity: .07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1.2s steps(6) infinite;
}
@keyframes grain { 0%, 100% { transform: translate(0, 0); } 33% { transform: translate(-4%, 3%); } 66% { transform: translate(3%, -5%); } }

/* Megumin's magic circle, drawn in SVG and turning behind the copy */
.circle {
  position: absolute; z-index: 1; width: min(92vmin, 54rem); right: max(-12rem, -10vw); top: 50%;
  translate: var(--px, 0px) calc(-50% + var(--py, 0px)); opacity: .62; mix-blend-mode: screen; overflow: visible;
  transition: translate .6s cubic-bezier(.2, .7, .2, 1);
}
.kana-fx { position: absolute; inset: 0; width: 100%; height: 100%; }
.circle g { transform-box: fill-box; transform-origin: center; }
.c-core { display: none; }
.c-line { fill: none; stroke: var(--gold); stroke-width: 1.2; opacity: .75; }
.c-ticks { fill: none; stroke: var(--gold); stroke-width: 12; stroke-dasharray: 1.4 9; opacity: .5; }
.c-dash { fill: none; stroke: var(--crimson-ink); stroke-width: 1.6; stroke-dasharray: 16 9; }
.c-star { fill: none; stroke: var(--crimson-ink); stroke-width: 1.4; opacity: .5; }
.c-runes { fill: var(--gold); font: 600 15px var(--serif-ja); letter-spacing: 7px; opacity: .9; }
.c-dot { fill: var(--gold); }
@media (prefers-reduced-motion: no-preference) {
  .c-outer { animation: spin 90s linear infinite; }
  .c-inner { animation: spin 56s linear infinite reverse; }
  .c-core { animation: pulse 3.2s ease-in-out infinite; }
}
@keyframes spin { to { rotate: 360deg; } }
@keyframes pulse { 50% { scale: 1.18; opacity: .6; } }
@keyframes draw { to { stroke-dashoffset: 0; } }

.hero-grid { display: grid; grid-template-columns: minmax(0, 46rem); align-items: center; }
.spec-row { max-width: 44rem; margin: 0 0 clamp(4rem, 8vw, 6rem); }
.tilt { transform: perspective(1300px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .5s cubic-bezier(.2, .7, .2, 1); transform-style: preserve-3d; }

/* 3D type: a crimson extrusion under every glyph, a chromatic flash as it lands */
.hero .display {
  font-size: clamp(2.5rem, 5.4vw + .3rem, 5.4rem); line-height: 1.08; letter-spacing: -.01em;
  text-shadow: 0 1px 0 #8f1d2b, 0 2px 0 #7f1926, 0 3px 0 #6e1521, 0 4px 0 #5d111c, 0 5px 0 #4c0e17, 0 14px 26px rgba(0, 0, 0, .55);
}
:lang(ja) .hero .display { font-size: clamp(1.9rem, 3.5vw + .3rem, 4rem); }
.kinetic .wd { display: inline-block; white-space: nowrap; }
.kinetic .ch { display: inline-block; white-space: pre; }
@media (prefers-reduced-motion: no-preference) {
  .js .kinetic .ch { animation: flip-in 1s cubic-bezier(.16, .8, .2, 1) both; animation-delay: calc(var(--i) * 38ms + .15s); transform-origin: 50% 80%; }
  .js .kinetic.split { animation: chroma 1.4s calc(var(--n, 12) * 38ms + .5s) ease-out both; }
}
@keyframes flip-in {
  from { opacity: 0; transform: perspective(500px) translate3d(0, .4em, -1.2em) rotateX(-100deg); filter: blur(8px); }
  55% { filter: blur(0); }
  to { opacity: 1; transform: none; }
}
@keyframes chroma {
  0% { text-shadow: -4px 0 rgba(255, 40, 70, .9), 4px 0 rgba(70, 220, 255, .8), 0 14px 26px rgba(0, 0, 0, .55); }
  25% { text-shadow: 3px 0 rgba(255, 40, 70, .8), -3px 0 rgba(70, 220, 255, .7), 0 14px 26px rgba(0, 0, 0, .55); }
}
.hero .lede { color: var(--muted); }
.hero .page { background: rgba(30, 17, 20, .58); backdrop-filter: blur(18px) saturate(1.3); -webkit-backdrop-filter: blur(18px) saturate(1.3); }

.hero-bar { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: clamp(2rem, 6vh, 4rem); }
.chip {
  display: inline-flex; align-items: center; gap: .5rem; min-height: 2.5rem; padding: .4rem 1rem; border-radius: 999px;
  font: 500 .875rem/1 var(--sans); color: var(--text); text-decoration: none; cursor: pointer;
  border: 1px solid var(--line-2); background: rgba(255, 255, 255, .06);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); transition: border-color .15s, background-color .15s;
}
.chip:hover { border-color: var(--gold); background: var(--gold-soft); }
.chip svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.js-sound[aria-pressed="false"] .s-on, .js-sound[aria-pressed="true"] .s-off { display: none; }

/* GMV ticker: a crimson band and an outlined band running against each other */
.ticker { position: relative; overflow: clip; padding: 1.4rem 0 .6rem; }
.tk { white-space: nowrap; overflow: hidden; margin: 0 -3rem; }
.tk-a { background: linear-gradient(90deg, #8e1527, var(--crimson), #8e1527); color: #fff3ea; transform: rotate(-2.2deg); padding: .6rem 0; box-shadow: 0 16px 34px -16px rgba(0, 0, 0, .6); position: relative; z-index: 1; }
.tk-b { transform: rotate(1.4deg); margin-top: .9rem; padding: .5rem 0; background: var(--bg-2); border-block: 1px solid var(--line); }
.tk-track { display: inline-flex; align-items: center; gap: 2rem; padding-right: 2rem; }
.tk-a .tk-track { font: italic 800 clamp(1.15rem, 1.8vw, 1.7rem)/1.1 var(--sans); letter-spacing: .01em; }
.tk-b .tk-track { font: 700 clamp(1.3rem, 2.2vw, 2rem)/1.1 var(--serif-ja); color: transparent; -webkit-text-stroke: 1px var(--gold); }
.tk-track i { font-style: normal; color: var(--gold); -webkit-text-stroke: 0; font-size: .7em; }
.tk-a .tk-track i { color: #ffd98f; }
@media (prefers-reduced-motion: no-preference) {
  .tk-a .tk-track { animation: marquee 46s linear infinite; }
  .tk-b .tk-track { animation: marquee 62s linear infinite reverse; }
}
@keyframes marquee { to { transform: translateX(-50%); } }

/* The specimen: one line of a game, typeset like a page of the grimoire. */
.specimen { margin: 0; }
.page {
  position: relative; padding: clamp(1.6rem, 3vw, 2.6rem) clamp(1.4rem, 3vw, 2.6rem) 1.6rem;
  background: linear-gradient(160deg, color-mix(in srgb, var(--surface) 92%, var(--crimson) 8%), var(--surface));
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}
.page::before {
  content: ""; position: absolute; inset: 8px; border: 1px solid var(--line); border-radius: calc(var(--r-lg) - 6px); pointer-events: none;
}
.jp {
  font-family: var(--serif-ja); font-weight: 600; margin: .4em 0 .2em; line-height: 2.1;
  font-size: clamp(1.6rem, 1.2vw + .8rem, 2.3rem); letter-spacing: .02em;
}
.jp .b, .tb-line .b, :lang(zh) .display .b { white-space: nowrap; }
.jp rt { font-size: max(11px, .38em); color: var(--gold); letter-spacing: .08em; font-weight: 500; }
.jp .w { border-radius: 6px; cursor: help; transition: background-color .15s; padding: 0 .04em; }
.jp .w:hover, .jp .w:focus-visible, .jp .w.on { background: var(--gold-soft); outline: none; }
.tr { font-family: var(--serif); color: var(--crimson-ink); font-size: clamp(1.05rem, .8vw + .8rem, 1.35rem); margin: 0 0 1.4rem; }
.gloss {
  display: grid; grid-template-columns: auto 1fr; gap: .35rem 1.2rem; margin: 0; padding-top: 1.1rem;
  border-top: 1px solid var(--line); font-size: .9rem;
}
.gloss dt { font-family: var(--serif-ja); font-weight: 600; white-space: nowrap; transition: color .15s; }
.gloss dt span { font-family: var(--sans); font-weight: 400; color: var(--faint); font-size: .85em; margin-left: .3em; }
.gloss dd { margin: 0; color: var(--muted); transition: color .15s; }
.gloss.focus dt, .gloss.focus dd { color: var(--faint); }
.gloss.focus dt.on, .gloss.focus dd.on { color: var(--text); }
.specimen figcaption, .textbox figcaption { margin-top: .9rem; font-size: .8125rem; color: var(--faint); }

.shot-hero { margin-top: clamp(2rem, 5vw, 4rem); perspective: 1600px; }
.shot-hero img, .pane img, .care-update img {
  border-radius: var(--r-md); box-shadow: var(--shadow); background: #1a1214;
}
.shot-hero img { width: 100%; }

/* page-load: the ruby rises in, then the translation. The only unprompted motion on the page. */
@media (prefers-reduced-motion: no-preference) {
  .js .jp rt { opacity: 0; transform: translateY(.5em); animation: rise .6s cubic-bezier(.2, .7, .2, 1) forwards; }
  .js .jp [data-gloss="0"] rt { animation-delay: .35s; }
  .js .jp [data-gloss="1"] rt { animation-delay: .5s; }
  .js .jp [data-gloss="2"] rt { animation-delay: .65s; }
  .js .tr { opacity: 0; animation: fade .8s ease forwards 1s; }
  .js .gloss { opacity: 0; animation: fade .8s ease forwards 1.3s; }
}
@keyframes rise { to { opacity: 1; transform: none; } }
@keyframes fade { to { opacity: 1; } }

/* ---- sections --------------------------------------------------------------------------------------------------- */
.sec { padding: clamp(4.5rem, 10vw, 8rem) 0 0; }
#features { padding-top: clamp(5rem, 11vw, 9rem); }

.embed { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: clamp(2rem, 5vw, 4.5rem); align-items: center; }
.embed-copy p { color: var(--muted); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; margin-top: .6rem; }
.seg button { font-size: .875rem; padding: .3rem 1rem; }
.seg-sm button { font-size: .8125rem; padding: .15rem .7rem; min-height: 1.8rem; }

.textbox { margin: 0; position: relative; }
.tb-scene {
  aspect-ratio: 16 / 9; border-radius: var(--r-lg);
  background:
    radial-gradient(60% 50% at 70% 30%, rgba(220, 171, 85, .35), transparent 70%),
    radial-gradient(70% 60% at 20% 80%, rgba(200, 50, 63, .45), transparent 70%),
    linear-gradient(180deg, #3b2026, #1b1012);
  box-shadow: var(--shadow);
}
.tb-window {
  position: absolute; left: 4%; right: 4%; bottom: calc(4% + 2.2rem);
  padding: 1.5rem 1.5rem 1.1rem; border-radius: var(--r-md);
  background: rgba(16, 9, 11, .78); color: #f3e9de;
  border: 1px solid rgba(220, 171, 85, .3);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.tb-name {
  position: absolute; top: -.9rem; left: 1.2rem; padding: .1rem .9rem; border-radius: 999px;
  background: #5a1b25; border: 1px solid rgba(220, 171, 85, .5); font-size: .8rem; color: #f7e3c5;
}
.tb-line { font-family: var(--serif-ja); font-size: clamp(1rem, 1.3vw + .5rem, 1.45rem); line-height: 2; margin: 0; }
.tb-line rt { font-size: max(11px, .45em); color: #e6b866; transition: opacity .25s, transform .25s; }
.tb-tr { margin: .2rem 0 0; color: #f08d92; font-family: var(--serif); font-size: clamp(.9rem, .8vw + .55rem, 1.1rem); transition: opacity .25s, transform .25s; }
.textbox[data-state="before"] .tb-line rt { opacity: 0; transform: translateY(.3em); }
.textbox[data-state="before"] .tb-tr { opacity: 0; transform: translateY(-.3em); }

.trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1.5rem, 3vw, 3rem); margin-top: clamp(4rem, 8vw, 6rem); padding-top: 2.5rem; border-top: 1px solid var(--line); }
.trio p { color: var(--muted); margin: 0; }
.trio article { padding: 1.6rem 1.5rem; border-radius: var(--r-lg); border: 1px solid var(--line-2); background: color-mix(in srgb, var(--surface) 55%, transparent); }

.tabs { display: flex; gap: .25rem; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 1.6rem; }
.tabs button {
  font: 500 1rem/1 var(--sans); color: var(--muted); background: none; border: 0; cursor: pointer;
  padding: .9rem 1.1rem; position: relative; min-height: 2.75rem;
}
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--text); }
.tabs button[aria-selected="true"]::after { content: ""; position: absolute; left: .8rem; right: .8rem; bottom: -1px; height: 2px; background: var(--crimson); border-radius: 2px; }
.pane > p { color: var(--muted); margin: 0 0 1.4rem; max-width: 44em; }

.care { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: clamp(2rem, 5vw, 4.5rem); align-items: start; margin-top: 2.5rem; }
.care p { color: var(--muted); }
.care-update img { margin-top: 1.6rem; }
.ticks { list-style: none; padding: 0; margin: 1.4rem 0 0; display: grid; gap: .8rem; }
.ticks li { position: relative; padding-left: 1.6rem; }
.ticks li::before { content: ""; position: absolute; left: .15rem; top: .62em; width: .5rem; height: .5rem; transform: rotate(45deg); background: var(--gold); }

/* engines & games */
.adapters { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); border-top: 1px solid var(--line); }
.adapters li { padding: 1rem 1rem 1rem 0; border-bottom: 1px solid var(--line-2); display: flex; flex-direction: column; gap: .15rem; }
.adapters b { font-family: var(--serif); font-weight: 600; font-size: 1.1rem; }
.adapters span { color: var(--faint); font-size: .875rem; }
.games-h { margin-top: 3.5rem; }
.games { list-style: none; padding: 0; margin: 1rem 0 0; display: flex; flex-wrap: wrap; gap: .6rem; }
.games li { border: 1px solid var(--line); border-radius: 999px; padding: .45rem 1rem; display: flex; gap: .6rem; align-items: baseline; }
.games b { font-family: var(--serif-ja); font-weight: 600; }
.games span { color: var(--faint); font-size: .8125rem; }
.more { margin-top: 2.5rem; border-top: 1px solid var(--line-2); padding-top: 1rem; }
.more summary, .faq summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; align-items: center; gap: .6rem; min-height: 2.75rem; }
.more summary::-webkit-details-marker, .faq summary::-webkit-details-marker { display: none; }
.more summary::before, .faq summary::before {
  content: ""; flex: none; width: .5rem; height: .5rem; border-right: 2px solid var(--gold); border-bottom: 2px solid var(--gold);
  transform: rotate(-45deg); transition: transform .2s;
}
.more[open] summary::before, .faq details[open] summary::before { transform: rotate(45deg); }
.chips { list-style: none; padding: 0; margin: 1rem 0 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.chips li { font-size: .8125rem; color: var(--muted); background: var(--gold-soft); border-radius: 6px; padding: .2rem .6rem; }

/* steps: a real sequence, so numbered */
.steps { list-style: none; counter-reset: s; padding: 0; margin: 2.5rem 0 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1.5rem; }
.steps li { counter-increment: s; padding-top: 1.2rem; border-top: 1px solid var(--line); position: relative; }
.steps li::before { content: counter(s); font-family: var(--serif); font-size: 2.4rem; line-height: 1; color: var(--crimson-ink); display: block; margin-bottom: .9rem; }
.steps h3 { font-size: 1.1rem; margin: 0 0 .4rem; }
.steps p { margin: 0; color: var(--muted); font-size: .9375rem; }
.steps code { word-break: break-all; }

/* download */
.sec-dl .dl-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(2rem, 5vw, 4.5rem);
}
.dl-main {
  padding: clamp(1.5rem, 3vw, 2.5rem); border-radius: var(--r-lg);
  background: linear-gradient(170deg, color-mix(in srgb, var(--surface) 90%, var(--crimson) 10%), var(--surface));
  box-shadow: var(--shadow); align-self: start;
}
.dl-version { font-size: clamp(1.5rem, 1.5vw + 1rem, 2.1rem); margin: 0 0 1.4rem; color: var(--gold); }
.facts { margin: 0; display: grid; gap: .7rem; }
.facts > div { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: 1rem; align-items: baseline; border-bottom: 1px solid var(--line-2); padding-bottom: .7rem; }
.facts dt { color: var(--faint); font-size: .875rem; }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.facts .sha dd { display: flex; gap: .6rem; align-items: flex-start; }
.facts .sha code { background: none; padding: 0; font-size: .78rem; line-height: 1.6; word-break: break-all; color: var(--muted); }
.copy { flex: none; font: 500 .8125rem var(--sans); color: var(--text); background: var(--gold-soft); border: 1px solid var(--line); border-radius: 6px; padding: .2rem .6rem; cursor: pointer; min-height: 2rem; }
.copy:hover { border-color: var(--gold); }
.alt { margin-top: 1.6rem; }
.alt ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
.alt a { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem .9rem; border-radius: var(--r-sm); border: 1px solid var(--line-2); text-decoration: none; }
.alt a:hover { border-color: var(--line); background: var(--gold-soft); }
.alt a span:last-child { color: var(--faint); font-size: .875rem; overflow-wrap: anywhere; text-align: right; }
.dl-side { display: grid; gap: 2.2rem; align-content: start; }
.notes-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .6rem; }
.notes-head .seg { margin: 0; }
.notes-body { max-height: 22rem; overflow: auto; padding-right: .5rem; font-size: .9375rem; color: var(--muted); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding-top: .6rem; padding-bottom: .6rem; margin-bottom: .8rem; overscroll-behavior: contain; }
.notes-body h4, .rel h4 { font-family: var(--serif); color: var(--text); font-size: 1rem; margin: 1rem 0 .3rem; }
.notes-body ul, .rel ul { margin: 0; padding-left: 1.2rem; }
.notes-body li, .rel li { margin: .25rem 0; }
.link { color: var(--gold); }
.req ul { margin: 0; padding-left: 1.2rem; color: var(--muted); }
.req li { margin: .3rem 0; }
.smart { border-left: 2px solid var(--gold); padding-left: 1.2rem; }
.smart p { margin: 0; color: var(--muted); }

/* faq */
.faq { margin-top: 2rem; border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line-2); padding: .4rem 0; }
.faq summary { font-size: 1.0625rem; padding: .5rem 0; }
.faq p { margin: 0 0 1rem 1.1rem; color: var(--muted); }

/* support */
.sec-support { padding-bottom: clamp(4rem, 8vw, 7rem); }
.support { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(2rem, 5vw, 4rem); align-items: center; }
.support p { color: var(--muted); max-width: 30em; }
.support .cta { margin-top: 1.6rem; }
.btn-quiet svg { stroke: var(--crimson-ink); }
.support-card { border-radius: var(--r-md); box-shadow: var(--shadow); }

/* footer */
.foot { border-top: 1px solid var(--line); padding: 2.5rem 0 3rem; background: var(--bg-2); }
.foot-row { display: grid; grid-template-columns: auto 1fr; gap: 1rem 2.5rem; align-items: center; }
.foot-row img { height: 2.4rem; width: auto; }
.foot nav { display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; justify-content: flex-end; font-size: .9375rem; }
.foot nav a { text-decoration: none; color: var(--muted); }
.foot nav a:hover { color: var(--text); }
.foot .small { grid-column: 1 / -1; margin: 0; }

/* changelog page */
.page-head { padding: clamp(3rem, 7vw, 5rem) 0 1rem; }
.releases { list-style: none; padding: 0; margin: 2rem 0 5rem; }
.rel { display: grid; grid-template-columns: 12rem minmax(0, 1fr); gap: 1.5rem 3rem; padding: 2rem 0; border-top: 1px solid var(--line); }
.rel-meta h2 { font-family: var(--serif); font-size: 1.5rem; margin: 0; color: var(--gold); }
.rel-meta p { margin: .2rem 0; color: var(--faint); font-size: .875rem; }
.rel-body { color: var(--muted); font-size: .9375rem; min-width: 0; }
.rel-body h4:first-child { margin-top: 0; }
.rel-latest { font-size: .75rem; color: var(--btn-text); background: var(--crimson); border-radius: 999px; padding: .05rem .55rem; margin-left: .5rem; vertical-align: middle; font-family: var(--sans); }

/* ---- responsive ------------------------------------------------------------------------------------------------- */
@media (max-width: 68rem) {
  .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 60rem) {
  .nav { display: none; }
  .hero-grid, .embed, .care, .sec-dl .dl-grid, .support { grid-template-columns: minmax(0, 1fr); }
  .trio { grid-template-columns: minmax(0, 1fr); }
  .rel { grid-template-columns: minmax(0, 1fr); gap: .8rem; }
}
@media (max-width: 40rem) {
  .top-row { gap: .6rem; height: 3.5rem; }
  .brand img { height: 2.1rem; }
  .tools { gap: .25rem; }
  .lang button { min-width: 2rem; padding: .2rem .45rem; }
  .icon-btn { width: 2.2rem; height: 2.2rem; }
  .steps { grid-template-columns: minmax(0, 1fr); }
  .btn-primary { width: 100%; }
  .facts > div { grid-template-columns: minmax(0, 1fr); gap: .2rem; }
  .tb-window { position: relative; left: auto; right: auto; bottom: auto; margin: -3.5rem .6rem 0; padding: 1.3rem 1rem .9rem; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tabs button { flex: none; padding: .9rem .8rem; }
  .foot-row { grid-template-columns: minmax(0, 1fr); }
  .foot nav { justify-content: flex-start; }
  .gloss { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .cta-meta { gap: .2rem 1rem; }
  .cta-meta span + span::before { display: none; }
  .gloss dd { margin-bottom: .5rem; }
}
@media (min-width: 120rem) {
  :root { --maxw: 84rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-delay: 0s !important; }
}

/* ---- motion layer ---------------------------------------------------------------------------------------------- */
/* big outlined kanji behind each section, drifting against the scroll */
section[data-kanji] { position: relative; isolation: isolate; overflow-x: clip; }
section[data-kanji]::before {
  content: attr(data-kanji); position: absolute; z-index: -1; pointer-events: none;
  right: max(var(--gutter), calc(50% - 42rem)); top: clamp(2rem, 7vw, 6rem);
  font: 700 clamp(5.5rem, 15vw, 15rem)/1 var(--serif-ja); writing-mode: vertical-rl; letter-spacing: .04em;
  color: transparent; -webkit-text-stroke: 1px var(--line);
}
/* spotlight cards: a soft glow follows the pointer */
.spot { position: relative; isolation: isolate; }
.spot::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1; opacity: 0; transition: opacity .3s;
  background: radial-gradient(22rem circle at var(--mx, 50%) var(--my, 50%), var(--gold-soft), transparent 65%);
}
.spot:hover::after { opacity: 1; }
.trio .spot { transition: border-color .2s; }
.trio .spot:hover { border-color: var(--line); }
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .rise3d { animation: rise3d linear both; animation-timeline: view(); animation-range: entry 0% cover 38%; transform-origin: 50% 100%; }
    section[data-kanji]::before { animation: drift linear both; animation-timeline: view(); }
    .card, .steps li, .adapters li, .fs { animation: pop linear both; animation-timeline: view(); animation-range: entry 0% cover 25%; }
  }
}
@keyframes rise3d { from { opacity: .15; transform: perspective(1400px) rotateX(28deg) translateY(5rem) scale(.92); } to { opacity: 1; transform: none; } }
@keyframes drift { from { transform: translateY(7rem); } to { transform: translateY(-7rem); } }
@keyframes pop { from { opacity: 0; transform: perspective(900px) translateY(2.5rem) rotateX(18deg); } to { opacity: 1; transform: none; } }

@media (max-width: 60rem) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); }
  .circle { width: 120vmin; right: -40vmin; top: 30%; }
  .circle { opacity: .4; }
  .hero-scrim { background: linear-gradient(120deg, rgba(150, 20, 40, .32), transparent 55%), linear-gradient(180deg, rgba(18, 10, 12, .55) 0%, rgba(18, 10, 12, .2) 40%, rgba(18, 10, 12, .7) 100%); }
  .hero-video { filter: brightness(.8) saturate(1.15); }
}
@media (max-width: 40rem) {
  :root { --top-h: 3.5rem; }
  .hero { min-height: auto; }
  .hero .display { font-size: clamp(2.2rem, 10vw, 3rem); }
  :lang(ja) .hero .display { font-size: clamp(1.6rem, 7.6vw, 2.4rem); }
  .chip { font-size: .8125rem; }
  section[data-kanji]::before { font-size: 5rem; opacity: .7; }
}
@media (prefers-reduced-motion: reduce) {
  .tk-track, .grain, .circle g, .js .kinetic, .js .kinetic .ch, .btn-primary::before { animation: none !important; }
}

/* ---- anime.js layer ---------------------------------------------------------------------------------------------- */
/* hidden until the intro timeline brings them in; a CSS fallback shows them if the script never runs */
@media (prefers-reduced-motion: no-preference) {
  .js .hero .lede, .js .foot-rule, .js .dl-box, .js .hud-dl, .js .hud-tl, .js .hero-vert, .js .sound-fab, .js .hero-type { opacity: 0; animation: fx-fallback 0s 8s forwards; }
}
@keyframes fx-fallback { to { opacity: 1; } }
.rays-fx { position: absolute; inset: 0; width: 100%; height: 100%; mix-blend-mode: screen; opacity: .7; }
.sparks { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 80; }

/* Aceternity-style hero parallax: a wall of real screens tilted in 3D, straightening as you scroll */
.hp { position: relative; padding: clamp(4rem, 9vw, 7rem) 0 0; height: 230vh; overflow: clip; }
.hp-head { position: relative; z-index: 2; }
.hp-stage { position: sticky; top: 0; height: 100vh; perspective: 1000px; perspective-origin: 50% 0; overflow: visible; }
.hp-rows { display: grid; gap: clamp(1rem, 2.4vw, 2.2rem); padding-top: 6vh; transform-style: preserve-3d; transform-origin: 50% 0; will-change: transform, opacity; }
.hp-row { display: flex; gap: clamp(1rem, 2.4vw, 2.2rem); width: max-content; will-change: transform; }
.hp-row:nth-child(2) { margin-left: -14rem; }
.hp-card {
  margin: 0; position: relative; width: clamp(15rem, 30vw, 30rem); aspect-ratio: 16 / 9; border-radius: var(--r-md); overflow: hidden;
  box-shadow: var(--shadow); background: #1a1214; transition: transform .35s cubic-bezier(.2, .7, .2, 1);
}
.hp-card img { width: 100%; height: 100%; object-fit: cover; object-position: top left; }
.hp-card figcaption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 2.4rem 1rem .8rem; font: 600 .9375rem/1.2 var(--serif);
  color: #f5ebe0; background: linear-gradient(transparent, rgba(12, 6, 8, .88)); opacity: 0; transition: opacity .25s;
}
.hp-card:hover { transform: translateY(-.6rem) scale(1.02); }
.hp-card:hover figcaption, .hp-card:focus-within figcaption { opacity: 1; }
@media (hover: none) { .hp-card figcaption { opacity: 1; } }
@media (max-width: 40rem) {
  .hp { height: 170vh; }
  .hp-row:nth-child(2) { margin-left: -8rem; }
}
@media (prefers-reduced-motion: reduce) {
  .hp { height: auto; }
  .hp-stage { position: relative; height: auto; overflow-x: auto; padding-bottom: 2rem; }
  .hp-row:nth-child(2) { margin-left: 0; }
}

/* ---- depth of field + glass --------------------------------------------------------------------------------------- */
/* The video stays sharp in a focal pocket and melts into blur toward the edges, like a shallow lens. */
.dof {
  position: absolute; inset: 0;
  backdrop-filter: blur(14px) saturate(1.15); -webkit-backdrop-filter: blur(14px) saturate(1.15);
  -webkit-mask-image: radial-gradient(ellipse 42% 58% at 66% 46%, transparent 35%, rgba(0, 0, 0, .55) 62%, #000 88%);
  mask-image: radial-gradient(ellipse 42% 58% at 66% 46%, transparent 35%, rgba(0, 0, 0, .55) 62%, #000 88%);
}
/* The copy sits on frosted glass with a lit edge, so the video can stay bright behind it. */
.hero-copy {
  position: relative; padding: clamp(1.4rem, 3vw, 2.6rem); border-radius: 28px;
  background: linear-gradient(145deg, rgba(40, 18, 24, .5), rgba(18, 10, 12, .34));
  backdrop-filter: blur(22px) saturate(1.5); -webkit-backdrop-filter: blur(22px) saturate(1.5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 40px 90px -40px rgba(0, 0, 0, .8);
}
.hero-copy::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(140deg, rgba(255, 236, 200, .55), rgba(234, 187, 95, .18) 30%, rgba(255, 255, 255, .05) 60%, rgba(210, 58, 72, .45));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.hero-copy .display { margin-bottom: 1.1rem; }
.hero-copy .lede { margin-bottom: 1.6rem; }
.hero .circle { opacity: .5; }
.hero-bar .chip { background: rgba(30, 14, 18, .38); backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4); }
@media (max-width: 60rem) {
  .dof { -webkit-mask-image: radial-gradient(ellipse 70% 40% at 50% 22%, transparent 30%, #000 85%); mask-image: radial-gradient(ellipse 70% 40% at 50% 22%, transparent 30%, #000 85%); }
}
@media (max-width: 40rem) {
  .hero-copy { padding: 1.3rem 1.1rem; border-radius: 22px; margin-inline: -.25rem; }
}

/* ---- entrance: the screen is a page of the grimoire, and it turns ---------------------------------------------- */
/* Two full-screen sheets hinged on the left edge: the leather cover turns first, a parchment page follows, and the
   site is underneath. Shading follows --turn (0 flat, 1 on edge), set by intro.js. */
.intro { display: none; }
.intro-on .intro {
  display: block; position: fixed; inset: 0; z-index: 100; cursor: pointer;
  perspective: 2600px; perspective-origin: 0% 50%;
  animation: intro-failsafe .5s 6s forwards; /* if the script never runs, the page gets out of the way */
}
@keyframes intro-failsafe { to { opacity: 0; visibility: hidden; } }
.under-shade { position: absolute; inset: 0; background: #0c0607; opacity: .55; pointer-events: none; }
.sheet { position: absolute; inset: 0; transform-origin: 0 50%; transform-style: preserve-3d; will-change: transform; --turn: 0; }
.sheet .face { position: absolute; inset: 0; overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.sheet .back { transform: rotateY(180deg); }
/* light falls off as the page lifts, darkest toward the hinge */
.sheet .face::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(0, 0, 0, calc(var(--turn) * .55)), rgba(0, 0, 0, calc(var(--turn) * .15)) 55%, rgba(255, 240, 210, calc(var(--turn) * .18)));
}
.sheet .back::after { background: linear-gradient(270deg, rgba(0, 0, 0, calc(var(--turn) * .5)), rgba(0, 0, 0, .05) 60%); }
/* the gutter: the page curves into the spine */
.sheet .front::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: min(9vw, 120px); z-index: 1; pointer-events: none;
  background: linear-gradient(90deg, rgba(0, 0, 0, .55), rgba(0, 0, 0, .18) 45%, transparent);
}

.leather {
  display: grid; place-items: center;
  background:
    radial-gradient(70% 60% at 30% 22%, rgba(255, 140, 140, .2), transparent 55%),
    radial-gradient(80% 70% at 85% 100%, rgba(0, 0, 0, .55), transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='3'/%3E%3CfeColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .32 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(160deg, #8a1b2c, #560c19 55%, #2a050b);
}
.leather::after { content: ""; }
.leather > .corner { z-index: 2; }
.leather .cover-art { position: relative; z-index: 2; display: grid; justify-items: center; gap: 1.2rem; }
.leather img { width: min(62vw, 46rem); height: auto; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, .55)) drop-shadow(0 0 24px rgba(234, 187, 95, .35)); }
.leather .tag { font: 600 clamp(1rem, 2.2vw, 1.8rem)/1 var(--serif-ja); color: #e7bf6a; letter-spacing: .6em; padding-left: .6em; text-shadow: 0 1px 0 rgba(0, 0, 0, .6); }
/* gold frame on the cover */
.leather { box-shadow: inset 0 0 0 clamp(14px, 2.4vmin, 28px) transparent; }
.leather .cover-art::before { content: none; }
.leather .frame {
  position: absolute; inset: clamp(16px, 3vmin, 36px) clamp(16px, 3vmin, 36px) clamp(16px, 3vmin, 36px) clamp(40px, 7vmin, 90px);
  border: 2px solid #d9a957; border-radius: 8px; z-index: 2; pointer-events: none;
  box-shadow: inset 0 0 0 7px transparent, inset 0 0 0 8px rgba(217, 169, 87, .5), 0 0 0 1px rgba(0, 0, 0, .35);
}
.leather .corner { position: absolute; width: clamp(40px, 7vmin, 90px); aspect-ratio: 1; border-top: 2px solid #e2b462; border-left: 2px solid #e2b462; border-top-left-radius: 40% 40%; }
.leather .corner::after { content: ""; position: absolute; left: 22%; top: 22%; width: 16%; aspect-ratio: 1; background: #e2b462; transform: rotate(45deg); box-shadow: 0 0 8px rgba(234, 187, 95, .6); }
.leather .c1 { top: clamp(26px, 4.6vmin, 56px); left: clamp(50px, 8.6vmin, 110px); }
.leather .c2 { top: clamp(26px, 4.6vmin, 56px); right: clamp(26px, 4.6vmin, 56px); transform: scaleX(-1); }
.leather .c3 { bottom: clamp(26px, 4.6vmin, 56px); left: clamp(50px, 8.6vmin, 110px); transform: scaleY(-1); }
.leather .c4 { bottom: clamp(26px, 4.6vmin, 56px); right: clamp(26px, 4.6vmin, 56px); transform: scale(-1); }
/* a sweep of light across the gilt */
.glint {
  position: absolute; top: -20%; bottom: -20%; left: 0; width: 22%; z-index: 3; pointer-events: none; transform: translateX(-120%) skewX(-18deg);
  background: linear-gradient(90deg, transparent, rgba(255, 236, 196, .28), transparent); mix-blend-mode: screen;
}

.parchment {
  background:
    radial-gradient(120% 100% at 0% 50%, rgba(80, 40, 20, .3), transparent 38%),
    radial-gradient(90% 70% at 70% 30%, #fbf1df, #ecdcbf 70%, #d6be95);
}
.parchment .page-ink { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 4vmin; }
.sigil { width: min(48vmin, 30rem); fill: none; stroke: #9e1b2d; stroke-width: 1.2; }
.sigil .t { stroke-dasharray: 1.5 4; stroke-width: 6; opacity: .6; }
.parchment p { margin: 0; font: 600 clamp(1.6rem, 4.4vmin, 3.4rem)/1.7 var(--serif-ja); color: #3a1418; letter-spacing: .1em; }
.parchment rt { font-size: max(11px, .4em); color: #7e1423; }
.endpaper { background: radial-gradient(80% 60% at 60% 40%, #6d1424, #3a0811); }
.endpaper::before { content: ""; position: absolute; inset: 4vmin; border: 1px solid rgba(217, 169, 87, .4); border-radius: 8px; }

.intro .skip {
  position: absolute; right: max(1rem, 3vw); bottom: max(1rem, 3vh); z-index: 4;
  font: 500 .875rem/1 var(--sans); color: rgba(245, 235, 224, .8); background: rgba(0, 0, 0, .25);
  border: 1px solid rgba(245, 235, 224, .22); border-radius: 999px; padding: .6rem 1.1rem; cursor: pointer;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.intro .skip:hover { color: #fff; border-color: rgba(234, 187, 95, .6); }
/* the headline waits behind the closed cover */
.intro-on .kinetic .ch, .intro-on .kinetic.split { animation-play-state: paused !important; }

/* ---- bento ------------------------------------------------------------------------------------------------------ */
.bento { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: clamp(1rem, 1.8vw, 1.5rem); }
.card {
  position: relative; isolation: isolate; border-radius: 26px; padding: clamp(1.4rem, 2.4vw, 2.2rem);
  background: linear-gradient(160deg, color-mix(in srgb, var(--surface) 82%, var(--crimson) 18%), color-mix(in srgb, var(--surface) 70%, transparent));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 30px 70px -40px rgba(0, 0, 0, .7);
  transform: perspective(1200px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .45s cubic-bezier(.2, .7, .2, 1);
  overflow: hidden;
}
.card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none; z-index: 1;
  background: linear-gradient(140deg, color-mix(in srgb, var(--gold) 70%, transparent), transparent 35%, transparent 65%, color-mix(in srgb, var(--crimson) 60%, transparent));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.card p { color: var(--muted); }
.card-spec { grid-column: span 5; }
.card-embed { grid-column: span 7; }
.card-sm { grid-column: span 4; padding-top: 5.6rem; }
.card-sm p { margin: 0; }
.glyph {
  position: absolute; top: .6rem; right: 1.2rem; font: 700 5.2rem/1 var(--serif-ja);
  background: linear-gradient(160deg, var(--gold), var(--crimson-ink)); -webkit-background-clip: text; background-clip: text; color: transparent;
  opacity: .9; filter: drop-shadow(0 6px 18px color-mix(in srgb, var(--crimson) 40%, transparent));
}
.card .specimen { margin-top: 1.2rem; }
.card .page { background: color-mix(in srgb, var(--bg) 55%, transparent); box-shadow: inset 0 0 0 1px var(--line-2); }
.card-embed .seg { margin: .4rem 0 1.4rem; }
.card-embed .textbox { margin: 0; }
.card-embed .tb-window { bottom: calc(4% + 2.2rem); }

/* ---- facts strip -------------------------------------------------------------------------------------------------- */
.facts-strip { padding: clamp(3rem, 7vw, 5rem) 0 0; }
.fs-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.5rem; border-block: 1px solid var(--line); padding: 2rem var(--gutter); }
.fs { display: grid; gap: .3rem; }
.fs b {
  font: 600 clamp(2.8rem, 5vw, 4.6rem)/1 var(--serif); font-variant-numeric: tabular-nums;
  background: linear-gradient(170deg, var(--text) 30%, var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.fs span { color: var(--muted); font-size: .9375rem; }

/* ---- steps: a line drawn as you scroll ------------------------------------------------------------------------------ */
.steps { position: relative; }
.steps::after {
  content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 2px; transform-origin: left; pointer-events: none;
  background: linear-gradient(90deg, var(--crimson), var(--gold)); box-shadow: 0 0 14px color-mix(in srgb, var(--crimson) 60%, transparent);
}
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .steps::after { animation: grow linear both; animation-timeline: view(); animation-range: entry 30% cover 55%; }
  }
}
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

@media (max-width: 68rem) {
  .card-spec, .card-embed { grid-column: span 12; }
  .card-sm { grid-column: span 4; }
}
@media (max-width: 60rem) {
  .card-sm { grid-column: span 12; }
  .fs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 40rem) {
  .card-embed .tb-window { position: relative; bottom: auto; }
  .glyph { font-size: 4rem; }
  .card-sm { padding-top: 4.6rem; }
}
.card-sm { padding-top: 6.6rem; }
.glyph { font-size: 4.4rem; top: 1rem; }
.card-spec { display: flex; flex-direction: column; }
.card-spec .specimen { flex: 1; display: flex; flex-direction: column; justify-content: center; }
@media (max-width: 40rem) { .card-sm { padding-top: 5.4rem; } .glyph { font-size: 3.6rem; } }
/* the specimen inside its card is type on the card, not a second card */
.card .page { background: none; box-shadow: none; padding: .4rem 0 0; }
.card .page::before { display: none; }

/* ---- sound toggle: a round glass button in the hero's corner, like a video player ------------------------------- */
.sound-fab {
  position: absolute; z-index: 3; right: max(var(--gutter), calc(50% - 37.5rem)); bottom: 6.5rem;
  display: inline-flex; align-items: center; gap: .6rem; height: 3.2rem; min-width: 3.2rem; padding: 0 1.05rem;
  border-radius: 999px; border: 1px solid rgba(245, 235, 224, .22); color: #f5ebe0; cursor: pointer;
  background: rgba(24, 12, 15, .42); backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 14px 34px -16px rgba(0, 0, 0, .8);
  font: 500 .875rem/1 var(--sans); transition: border-color .2s, background-color .2s;
}
.sound-fab:hover { border-color: #eabb5f; background: rgba(60, 22, 30, .5); }
.sound-fab svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sound-fab .label { max-width: 0; overflow: hidden; white-space: nowrap; opacity: 0; transition: max-width .35s cubic-bezier(.2, .7, .2, 1), opacity .25s; }
.sound-fab:hover .label, .sound-fab:focus-visible .label { max-width: 10rem; opacity: 1; }
.sound-fab .eq { display: none; align-items: flex-end; gap: 3px; height: 16px; }
.sound-fab .eq i { width: 3px; height: 100%; border-radius: 2px; background: linear-gradient(#ffd98f, #ff6f78); transform-origin: bottom; animation: eq 1s ease-in-out infinite; }
.sound-fab .eq i:nth-child(2) { animation-delay: -.35s; } .sound-fab .eq i:nth-child(3) { animation-delay: -.7s; } .sound-fab .eq i:nth-child(4) { animation-delay: -.15s; }
@keyframes eq { 0%, 100% { transform: scaleY(.3); } 50% { transform: scaleY(1); } }
.sound-fab[aria-pressed="true"] .eq { display: inline-flex; }
.sound-fab[aria-pressed="true"] svg { display: none; }
.sound-fab[aria-pressed="true"] { border-color: rgba(234, 187, 95, .6); }
@media (hover: none) { .sound-fab .label { max-width: none; opacity: 1; } }
@media (max-width: 40rem) { .sound-fab { position: relative; right: auto; bottom: auto; justify-self: end; margin: 1.2rem var(--gutter) 0 0; height: 2.8rem; } }
@media (prefers-reduced-motion: reduce) { .sound-fab .eq i { animation: none; } }

/* ---- chapters: real footage, one feature at a time -------------------------------------------------------------- */
.chapters .sec-lede { margin-bottom: clamp(3rem, 7vw, 6rem); }
.chap {
  display: grid; grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr); gap: clamp(2rem, 5vw, 5.5rem); align-items: center;
  margin-bottom: clamp(5rem, 11vw, 9rem);
}
.chap:nth-of-type(even) { grid-template-columns: minmax(0, 1.18fr) minmax(0, .82fr); }
.chap:nth-of-type(even) .chap-copy { order: 2; }
.chap-copy { position: relative; isolation: isolate; }
.chap-copy::before {
  content: attr(data-k); position: absolute; z-index: -1; left: -.1em; top: -.55em; pointer-events: none; white-space: nowrap;
  font: 700 clamp(4.5rem, 9vw, 8.5rem)/1 var(--serif-ja); color: transparent; -webkit-text-stroke: 1px var(--line); opacity: .9;
}
.chap-n { display: flex; align-items: baseline; gap: .8rem; margin: 0 0 .9rem; color: var(--crimson-ink); }
.chap-n b { font: 600 2.2rem/1 var(--serif); }
.chap-n span { font: 500 .9375rem/1 var(--serif-ja); color: var(--gold); letter-spacing: .2em; }
.chap-t { font-size: clamp(1.9rem, 2.8vw + .5rem, 3.1rem); margin-bottom: 1rem; }
.chap-copy p:last-child { color: var(--muted); font-size: 1.0625rem; max-width: 30em; }
.chap-media {
  position: relative; margin: 0; border-radius: 20px; padding: 10px; isolation: isolate;
  background: linear-gradient(150deg, color-mix(in srgb, var(--surface) 80%, var(--crimson) 20%), color-mix(in srgb, var(--surface) 70%, transparent));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 50px 100px -40px rgba(0, 0, 0, .75), 0 30px 80px -50px color-mix(in srgb, var(--crimson) 70%, transparent);
  transform: perspective(1400px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .45s cubic-bezier(.2, .7, .2, 1);
}
.chap-media::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(140deg, color-mix(in srgb, var(--gold) 75%, transparent), transparent 40%, transparent 60%, color-mix(in srgb, var(--crimson) 65%, transparent));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.clip { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; border-radius: 12px; background: #1a1214; object-fit: cover; }
.chap-duo .chap-media { padding-bottom: 18%; }
.chap-duo .clip:first-child { width: 88%; }
.chap-duo .clip-2 { position: absolute; width: 62%; right: -4%; bottom: -6%; box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .8), 0 0 0 1px var(--line); }
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .chap-media { animation: chap-in linear both; animation-timeline: view(); animation-range: entry 0% cover 40%; }
    .chap:nth-of-type(even) .chap-media { animation-name: chap-in-r; }
    .chap-copy::before { animation: drift linear both; animation-timeline: view(); }
  }
}
@keyframes chap-in { from { opacity: .2; transform: perspective(1400px) rotateY(-24deg) rotateX(10deg) translateX(4rem) scale(.9); } to { opacity: 1; transform: perspective(1400px); } }
@keyframes chap-in-r { from { opacity: .2; transform: perspective(1400px) rotateY(24deg) rotateX(10deg) translateX(-4rem) scale(.9); } to { opacity: 1; transform: perspective(1400px); } }
@media (max-width: 60rem) {
  .chap, .chap:nth-of-type(even) { grid-template-columns: minmax(0, 1fr); gap: 1.8rem; }
  .chap:nth-of-type(even) .chap-copy { order: 0; }
}
/* the bento is now 2 x 2 */
.card-spec { grid-column: span 6; }
.card-sm { grid-column: span 6; }
@media (max-width: 60rem) { .card-spec, .card-sm { grid-column: span 12; } }
.hp-card img { aspect-ratio: 16 / 9; }

/* ---- statement: sharpens word by word with the scroll ------------------------------------------------------------- */
.statement { padding: clamp(5rem, 12vw, 10rem) 0 clamp(2rem, 5vw, 4rem); }
.reveal-words {
  margin: 0; max-width: 22em; font: 600 clamp(1.7rem, 3.4vw + .4rem, 3.6rem)/1.35 var(--serif); letter-spacing: -.005em; text-wrap: pretty;
}
:lang(ja) .reveal-words { font-family: var(--serif-ja); }
.reveal-words .rw { transition: color .4s; }
.reveal-words .rw.hot { color: var(--gold); }

/* ---- chapters: sticky stage + tracing beam on wide screens; stacked on phones ------------------------------------- */
.chap-flow { position: relative; }
.chap-stage, .chap-rail { display: none; }
@media (min-width: 60.01rem) {
  .chap-flow { display: grid; grid-template-columns: 2.5rem minmax(0, .78fr) minmax(0, 1.22fr); gap: 0 clamp(2rem, 4vw, 4rem); }
  .chap-rail { display: block; position: relative; }
  .chap-rail::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--line); }
  .chap-rail .beam {
    position: absolute; left: calc(50% - 1px); top: 0; width: 3px; height: calc(var(--p, 0) * 100%); border-radius: 3px;
    background: linear-gradient(180deg, transparent, var(--gold) 30%, var(--crimson-ink));
    box-shadow: 0 0 14px color-mix(in srgb, var(--crimson) 70%, transparent);
  }
  .chap-rail .beam::after {
    content: ""; position: absolute; left: 50%; bottom: -7px; width: 14px; height: 14px; translate: -50% 0; border-radius: 50%;
    background: radial-gradient(circle, #fff3d6 0 30%, var(--gold) 45%, transparent 72%); box-shadow: 0 0 18px var(--gold);
  }
  .chap-list .chap { display: flex; align-items: center; min-height: 82vh; margin: 0; grid-template-columns: none; }
  .chap-list .chap:nth-of-type(even) .chap-copy { order: 0; }
  .chap-list .chap-copy { opacity: .28; transition: opacity .5s; }
  .chap-list .chap.is-on .chap-copy { opacity: 1; }
  .chap-inline { display: none; }
  .chap-stage { display: block; position: relative; }
  .stage-sticky { position: sticky; top: calc(50vh - min(19vw, 17rem) - 2rem); height: calc(min(38vw, 34rem) + 4rem); perspective: 1600px; }
  .stage-item {
    position: absolute; inset: 0 0 auto; opacity: 0; pointer-events: none; animation: none !important;
    transform: perspective(1600px) rotateY(-18deg) rotateX(8deg) translate3d(2rem, 2rem, -6rem) scale(.92);
    transition: opacity .6s cubic-bezier(.2, .7, .2, 1), transform .9s cubic-bezier(.2, .7, .2, 1);
  }
  .stage-item.on { opacity: 1; pointer-events: auto; transform: none; }
}

/* ---- Anki deck ------------------------------------------------------------------------------------------------------ */
.deck-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: clamp(2rem, 5vw, 5rem); align-items: center; }
.deck { position: relative; height: clamp(22rem, 34vw, 27rem); touch-action: pan-y; outline: none; }
.deck:focus-visible { outline: 2px solid var(--gold); outline-offset: 8px; border-radius: 24px; }
.dcard { position: absolute; left: 6%; top: 8%; width: min(26rem, 82%); aspect-ratio: 5 / 6.2; cursor: grab; perspective: 1400px; user-select: none; -webkit-user-select: none; }
.dcard[data-top] { cursor: grab; }
.dcard:active { cursor: grabbing; }
.dc-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .7s cubic-bezier(.2, .8, .2, 1); }
.dc-inner.flipped { transform: rotateY(180deg); }
.dc-face {
  position: absolute; inset: 0; border-radius: 24px; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden;
  display: grid; align-content: center; justify-items: center; gap: .8rem; padding: 2rem 1.6rem; text-align: center;
  background: linear-gradient(160deg, color-mix(in srgb, var(--surface) 78%, var(--crimson) 22%), var(--surface));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 30px 60px -24px rgba(0, 0, 0, .7), 0 0 0 1px var(--line);
}
.dc-back { transform: rotateY(180deg); align-content: start; padding: 0 0 1.4rem; }
.dc-back img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
.dc-tag { position: absolute; top: 1rem; left: 1rem; font: 600 .75rem/1 var(--sans); color: #fff; background: var(--crimson); padding: .3rem .6rem; border-radius: 999px; }
.dc-word { margin: 0; font: 700 clamp(2.2rem, 4vw, 3rem)/1.6 var(--serif-ja); }
.dc-word rt { font-size: max(11px, .36em); color: var(--crimson-ink); }
.dc-ex { margin: 0; color: var(--muted); font: 500 .9375rem/1.7 var(--serif-ja); max-width: 18em; }
.dc-flip { position: absolute; bottom: 1rem; font-size: .8125rem; color: var(--faint); }
.dc-mean { margin: .4rem 1.4rem 0; font: 600 1.25rem/1.5 var(--serif); }
@media (max-width: 60rem) { .deck-grid { grid-template-columns: minmax(0, 1fr); } .deck { height: 26rem; } .dcard { left: 4%; } }

/* ---- lamp over the download section -------------------------------------------------------------------------------- */
.sec-dl { isolation: isolate; }
.lamp { position: absolute; z-index: -1; left: 50%; top: 0; width: min(64rem, 100vw); height: 30rem; translate: -50% 0; pointer-events: none; }
.lamp::before {
  content: ""; position: absolute; inset: 0;
  background: conic-gradient(from 148deg at 50% 0%, transparent 0deg, color-mix(in srgb, var(--crimson) 55%, transparent) 18deg, color-mix(in srgb, var(--gold) 35%, transparent) 32deg, color-mix(in srgb, var(--crimson) 55%, transparent) 46deg, transparent 64deg);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 85%); mask-image: linear-gradient(180deg, #000 0%, transparent 85%);
  filter: blur(6px); transform-origin: 50% 0;
}
.lamp::after {
  content: ""; position: absolute; left: 32%; right: 32%; top: 0; height: 3px; border-radius: 3px;
  background: linear-gradient(90deg, transparent, #ffe3a6, transparent); box-shadow: 0 0 24px 6px color-mix(in srgb, var(--gold) 60%, transparent), 0 0 80px 20px color-mix(in srgb, var(--crimson) 40%, transparent);
}
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .lamp::before { animation: lamp-open linear both; animation-timeline: view(); animation-range: entry 0% cover 35%; }
    .lamp::after { animation: lamp-bar linear both; animation-timeline: view(); animation-range: entry 0% cover 35%; }
  }
}
@keyframes lamp-open { from { transform: scaleX(.35); opacity: .3; } to { transform: none; opacity: 1; } }
@keyframes lamp-bar { from { left: 44%; right: 44%; } to { left: 30%; right: 30%; } }

/* ---- glowing edge following the pointer ------------------------------------------------------------------------------ */
.glow-edge {
  position: absolute; inset: 0; border-radius: inherit; padding: 1.5px; pointer-events: none; z-index: 2;
  background: conic-gradient(from calc(var(--glow-a, 0deg) - 50deg), transparent 0deg, var(--gold) 30deg, var(--crimson-ink) 50deg, var(--gold) 70deg, transparent 100deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: var(--glow-o, 0); transition: opacity .35s;
}

/* ---- ticker: driven by script when motion is on; soft edges ---------------------------------------------------------- */
.fx-vel .tk-track { animation: none !important; will-change: transform; }
.ticker { cursor: grab; user-select: none; -webkit-user-select: none; touch-action: pan-y; }
.ticker:active { cursor: grabbing; }
.tk { -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }

/* ---- hero as a poster: type as the artwork, a download seal, no panel ---------------------------------------------- */
.hero-stage { position: relative; display: grid; grid-template-rows: 1fr auto; gap: 2rem; min-height: calc(100svh - var(--top-h) - 7rem); padding: 0 var(--gutter); }
/* the headline inverts against the video (difference blend), so it reads on bright and dark frames alike */
.hero-type { margin: 0; align-self: center; color: #fff; mix-blend-mode: difference; font-family: var(--serif); font-weight: 700; line-height: .86; }
.ht-pre { display: block; margin: 0 0 1.2vw .5vw; font: italic 500 clamp(1.4rem, 3vw, 2.9rem)/1.1 var(--serif); letter-spacing: .01em; }
.ht-big { display: block; font-size: clamp(5.6rem, 21vw, 23rem); letter-spacing: -.045em; white-space: nowrap; }
.ht-big ruby { ruby-position: over; }
.ht-big rt { font: 600 .11em/1 var(--sans); letter-spacing: .32em; text-indent: .32em; opacity: .9; }
.ht-big small { font-size: .28em; letter-spacing: 0; margin-left: .1em; }
:lang(ja) .ht-big { font-size: clamp(4.4rem, 16vw, 17rem); font-family: var(--serif-ja); letter-spacing: -.02em; }
:lang(en) .ht-big { font-size: clamp(3.4rem, 11vw, 12rem); white-space: normal; line-height: .88; letter-spacing: -.035em; }
.hero-type .wd { white-space: nowrap; }
.hero-vert {
  position: absolute; right: var(--gutter); top: 0; margin: 0; writing-mode: vertical-rl; pointer-events: none;
  font: 700 clamp(1.6rem, 3.4vw, 3.3rem)/1 var(--serif-ja); letter-spacing: .3em;
  color: transparent; -webkit-text-stroke: 1px var(--gold); filter: drop-shadow(0 0 18px rgba(234, 187, 95, .25));
}
.hero-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 2rem 3rem; flex-wrap: wrap; }
.hero .lede { max-width: 25em; margin: 0; color: var(--text); font-size: clamp(1rem, .4vw + .85rem, 1.15rem); text-shadow: 0 1px 14px rgba(0, 0, 0, .65); }
.hero .lede::before { content: ""; display: block; width: 3.2rem; height: 2px; margin-bottom: 1rem; background: linear-gradient(90deg, var(--gold), var(--crimson-ink)); }

/* download seal: a crimson core inside a ring of turning rune text */
.hero-dl { display: flex; align-items: center; gap: 1.4rem; }
.dl-orb { position: relative; display: grid; place-items: center; width: clamp(8.5rem, 11.5vw, 11.5rem); aspect-ratio: 1; border-radius: 50%; color: #fff; text-decoration: none; }
.orb-ring { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.orb-ring text { fill: var(--gold); font: 600 13px var(--sans); }
:lang(zh) .orb-ring text, :lang(ja) .orb-ring text { font-size: 14px; }
@media (prefers-reduced-motion: no-preference) {
  .orb-ring { animation: spin 16s linear infinite; }
  .dl-orb:hover .orb-ring, .dl-orb:focus-visible .orb-ring { animation-duration: 4s; }
  .dl-orb::after { content: ""; position: absolute; inset: 19%; border-radius: 50%; border: 1px solid rgba(255, 200, 150, .7); animation: orb-pulse 2.6s cubic-bezier(.2, .7, .2, 1) infinite; pointer-events: none; }
}
@keyframes orb-pulse { from { transform: scale(1); opacity: .9; } to { transform: scale(1.75); opacity: 0; } }
.orb-core {
  position: relative; width: 62%; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; align-content: center; gap: .15rem;
  background: radial-gradient(circle at 34% 28%, #e4485a, #b8243a 46%, #6a0d1b);
  box-shadow: inset 0 0 0 1px rgba(255, 222, 176, .55), inset 0 -8px 16px rgba(0, 0, 0, .35), 0 20px 44px -12px rgba(200, 30, 50, .8), 0 0 0 9px rgba(210, 58, 72, .14);
  transition: transform .45s cubic-bezier(.2, .8, .2, 1), box-shadow .3s;
}
.orb-core svg { fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.orb-core b { font: 700 .95rem/1 var(--sans); text-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
:lang(ja) .orb-core b { font-size: .85rem; }
.dl-orb:hover .orb-core { transform: scale(1.08); box-shadow: inset 0 0 0 1px rgba(255, 222, 176, .8), inset 0 -8px 16px rgba(0, 0, 0, .35), 0 26px 56px -12px rgba(220, 40, 60, .95), 0 0 0 12px rgba(234, 187, 95, .2); }
.dl-orb:focus-visible { outline: 2px solid var(--gold); outline-offset: 6px; }
.hero-dl-meta { display: grid; gap: .6rem; }
.hero-dl-meta .cta-meta { display: grid; gap: .25rem; margin: 0; color: var(--muted); }
.hero-dl-meta .cta-meta span + span::before { display: none; }
.alt-link { color: var(--gold); font-size: .9375rem; text-underline-offset: .3em; text-decoration-color: color-mix(in srgb, var(--gold) 50%, transparent); }
.alt-link:hover { text-decoration-color: var(--gold); }

@media (max-width: 60rem) {
  .hero-stage { min-height: auto; padding-top: 4vh; }
  .hero-vert { top: -1rem; font-size: 1.5rem; }
}
@media (max-width: 40rem) {
  .ht-big { font-size: 27vw; }
  :lang(ja) .ht-big { font-size: 20vw; }
  :lang(en) .ht-big { font-size: 15vw; }
  .ht-pre { font-size: 1.35rem; margin-bottom: .6rem; }
  .hero-vert { font-size: 1.2rem; right: .4rem; }
  .hero-foot { flex-direction: column; align-items: stretch; }
  .hero-dl { justify-content: space-between; }
  .dl-orb { width: 8.5rem; }
}

/* ---- hero, round 2: crimson duotone video, solid type, sound toggle up top ---------------------------------------- */
.hero-video { filter: grayscale(1) contrast(1.3) brightness(.78) !important; }
.hero-tint { position: absolute; inset: 0; background: linear-gradient(135deg, #d9374a, #a3182c 55%, #5c0b18); mix-blend-mode: multiply; }
.hero-scrim { background: radial-gradient(120% 90% at 70% 40%, transparent 30%, rgba(14, 6, 8, .55) 100%), linear-gradient(180deg, rgba(14, 6, 8, .55), transparent 25%, transparent 70%, rgba(14, 6, 8, .8)) !important; }
.dof { -webkit-mask-image: radial-gradient(ellipse 60% 70% at 62% 45%, transparent 40%, #000 90%); mask-image: radial-gradient(ellipse 60% 70% at 62% 45%, transparent 40%, #000 90%); }
.hero-type { mix-blend-mode: normal; color: #fbeedd; }
.ht-big { padding-top: .14em; text-shadow: 0 .02em 0 #7a1424, 0 .04em 0 #5e0f1c, 0 .08em .18em rgba(0, 0, 0, .45); }
.ht-big rt { color: var(--gold); text-shadow: none; }
.ht-pre { color: #f3d9b8; }
.hero-type .ch:has(ruby) { display: inline-block; }
.sound-fab { top: calc(var(--top-h) + 1.4rem); bottom: auto; left: var(--gutter); right: auto; }
@media (max-width: 40rem) { .sound-fab { position: absolute; top: calc(var(--top-h) + .8rem); left: auto; right: 3.2rem; margin: 0; } }
.ht-big ruby, .ht-big rt { ruby-align: center; }
.ht-big rt { letter-spacing: .12em; text-indent: 0; }
.ticker { overflow: hidden; }
html { overflow-x: clip; }

/* ---- feature switcher (replaces the long chapter scroll) ------------------------------------------------------------ */
.feat { display: grid; grid-template-columns: minmax(0, .78fr) minmax(0, 1.22fr); gap: clamp(1.5rem, 4vw, 4rem); align-items: start; }
.feat-tabs { display: grid; gap: .25rem; }
.ft {
  position: relative; display: grid; gap: .35rem; text-align: left; padding: 1rem 1.1rem 1.1rem; border: 0; border-radius: 16px; cursor: pointer;
  background: transparent; color: var(--muted); font: inherit; transition: background-color .25s, color .25s;
}
.ft:hover { color: var(--text); background: color-mix(in srgb, var(--surface) 50%, transparent); }
.ft[aria-selected="true"] { color: var(--text); background: color-mix(in srgb, var(--surface) 80%, var(--crimson) 8%); box-shadow: inset 0 0 0 1px var(--line-2); }
.ft-head { display: flex; align-items: baseline; gap: .6rem; }
.ft-n { font: 600 1.05rem/1 var(--serif); color: var(--crimson-ink); min-width: 1.6rem; }
.ft-k { font: 500 .8125rem/1 var(--serif-ja); color: var(--gold); letter-spacing: .18em; }
.ft-t { font: 600 clamp(1.1rem, .6vw + .9rem, 1.35rem)/1.35 var(--serif); }
:lang(ja) .ft-t { font-family: var(--serif-ja); }
.ft-d { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .45s cubic-bezier(.2, .7, .2, 1); }
.ft-d > span { overflow: hidden; font-size: .9375rem; line-height: 1.7; color: var(--muted); }
.ft[aria-selected="true"] .ft-d { grid-template-rows: 1fr; }
.ft-bar { position: absolute; left: 1.1rem; right: 1.1rem; bottom: .45rem; height: 2px; border-radius: 2px; background: var(--line-2); opacity: 0; transition: opacity .3s; }
.ft-bar i { position: absolute; inset: 0; transform-origin: left; transform: scaleX(var(--p, 0)); background: linear-gradient(90deg, var(--crimson-ink), var(--gold)); border-radius: inherit; }
.ft[aria-selected="true"] .ft-bar { opacity: 1; }
.feat-stage {
  position: sticky; top: calc(var(--top-h) + 2rem); aspect-ratio: 16 / 9.4; border-radius: 22px; padding: 10px; isolation: isolate;
  background: linear-gradient(150deg, color-mix(in srgb, var(--surface) 80%, var(--crimson) 20%), color-mix(in srgb, var(--surface) 70%, transparent));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 50px 100px -40px rgba(0, 0, 0, .75), 0 30px 80px -50px color-mix(in srgb, var(--crimson) 70%, transparent);
}
.feat-stage::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(140deg, color-mix(in srgb, var(--gold) 75%, transparent), transparent 40%, transparent 60%, color-mix(in srgb, var(--crimson) 65%, transparent));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.feat-item { position: absolute; inset: 10px; margin: 0; opacity: 0; transform: scale(.97); transition: opacity .55s ease, transform .7s cubic-bezier(.2, .7, .2, 1); }
.feat-item.on { opacity: 1; transform: none; }
.feat-item .clip { width: 100%; height: 100%; border-radius: 13px; }
.feat-item.duo .clip:first-child { width: 86%; height: auto; }
.feat-item.duo .clip-2 { position: absolute; width: 58%; height: auto; right: -2%; bottom: -4%; box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .8), 0 0 0 1px var(--line); }
@media (max-width: 60rem) {
  .feat { grid-template-columns: minmax(0, 1fr); }
  .feat-stage { order: -1; position: relative; top: auto; }
}

/* ---- entrance, round 3: one parchment page that curls as it turns -------------------------------------------------- */
.intro-on .intro { perspective: 2200px; perspective-origin: 0% 50%; }
.intro .curl { position: absolute; inset: 0; transform-style: preserve-3d; }
.intro .strip { position: absolute; top: 0; height: 100%; transform-origin: 0 50%; transform-style: preserve-3d; --d: 0; }
.intro .sf { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; background-repeat: no-repeat; }
.intro .sf::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, rgba(40, 18, 10, var(--d0, 0)), rgba(40, 18, 10, var(--d1, 0))); }
.intro .back { transform: rotateY(180deg); }
.intro .back::after { background: linear-gradient(270deg, rgba(40, 18, 10, calc(var(--d0, 0) * .8 + .06)), rgba(40, 18, 10, calc(var(--d1, 0) * .8 + .06))); }
/* fibres and a soft grain, so it reads as paper and not as a board */
.intro .front::before, .intro .back::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.012 .9' numOctaves='3' seed='4'/%3E%3CfeColorMatrix values='0 0 0 0 .45  0 0 0 0 .32  0 0 0 0 .2  0 0 0 .22 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23p)'/%3E%3C/svg%3E");
}
/* skip sits on light parchment now */
.intro .skip { color: #3a1418; background: rgba(255, 248, 236, .55); border-color: rgba(58, 20, 24, .35); }
.intro .skip:hover { color: #1a0a0c; border-color: #9e1b2d; }

/* ---- hero, round 3: the megu-edit look -------------------------------------------------------------------------------
   two poles (black #000 / paper #f4f4f2), mono footage, one accent (#c8323c), lowercase tracked mono micro-text,
   a roman/han serif headline with a soft glow, dashed rules, a running number, barcode stripes, focus pull to open. */
@font-face { font-family: "MeguLit Mono"; src: url("/assets/fonts/plex-mono.woff2") format("woff2"); font-weight: 300; font-display: swap; }
@font-face { font-family: "MeguLit Cormorant"; src: url("/assets/fonts/cormorant-italic.woff2") format("woff2"); font-style: italic; font-display: swap; }
@font-face { font-family: "MeguLit Han"; src: url("/assets/fonts/han-serif-hero.woff2") format("woff2"); font-weight: 600; font-display: swap; }
.hero { --paper: #f4f4f2; --accent: #c8323c; --dim: #8a8a8a; background: #000; }
.hero-tint, .rays-fx { display: none; }
.hero-video {
  filter: grayscale(1) contrast(1.12) brightness(.5) blur(14px) !important; scale: 1.12;
  transition: filter 1.8s cubic-bezier(.16, 1, .3, 1), scale 2.6s cubic-bezier(.16, 1, .3, 1);
  animation: vdrift 38s ease-in-out infinite alternate;
}
.hero.focused .hero-video { filter: grayscale(1) contrast(1.12) brightness(.5) !important; scale: 1.04; }
@keyframes vdrift { to { translate: -1.6% -1.2%; } }
.hero-scrim { background: radial-gradient(ellipse 85% 75% at 55% 45%, transparent 35%, rgba(0, 0, 0, .78) 100%), linear-gradient(180deg, rgba(0, 0, 0, .5), transparent 22%, transparent 70%, rgba(0, 0, 0, .85)) !important; }
.hero::before { content: ""; position: absolute; inset: 0; z-index: 5; background: var(--paper); opacity: 0; pointer-events: none; }
.hero.flash::before { opacity: .9; }

.hud { display: flex; flex-wrap: wrap; gap: .4rem 1.6em; margin: 0; font: 300 .75rem/1.6 "MeguLit Mono", var(--mono); letter-spacing: .35em; color: var(--dim); text-transform: lowercase; }
.hud-tl { position: absolute; top: .2rem; right: calc(var(--gutter) + 3.6rem); }
.typed { margin: 0 0 2.4rem; font: 300 .8125rem/1 "MeguLit Mono", var(--mono); letter-spacing: .5em; color: #bdbdbd; text-transform: lowercase; }
.caret { color: var(--accent); font-weight: 400; margin-left: .2em; animation: caret 1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }

.hero-type { color: var(--paper) !important; font-family: "MeguLit Han", var(--serif); }
.ht-big { font-family: "MeguLit Han", var(--serif); font-weight: 600; text-shadow: 0 0 .22em rgba(255, 255, 255, .16), 0 0 1.1em rgba(255, 255, 255, .07) !important; letter-spacing: -.02em; }
:lang(ja) .ht-big { font-family: "MeguLit Han", var(--serif-ja); }
:lang(en) .ht-big { font-family: "MeguLit Cormorant", "Cormorant Garamond", Georgia, serif; font-style: italic; font-weight: 500; letter-spacing: -.01em; }
.ht-big rt { color: var(--dim) !important; font: 300 .09em/1 "MeguLit Mono", var(--mono) !important; letter-spacing: .4em !important; text-shadow: none; }
.ht-pre { font: italic 500 clamp(1.3rem, 2.4vw, 2.3rem)/1.1 "MeguLit Cormorant", "MeguLit Han", var(--serif); color: #bdbdbd !important; letter-spacing: .02em; }
.hero-vert {
  color: #bdbdbd; -webkit-text-stroke: 0; filter: none; font: 600 clamp(1rem, 1.3vw, 1.25rem)/1 "MeguLit Han", var(--serif-ja);
  letter-spacing: .45em; top: 3rem;
}
.hero-vert::after { content: "▮"; color: var(--accent); margin-top: .3em; }

.hero-foot { flex-wrap: wrap; row-gap: 1.6rem; }
.foot-rule {
  flex: 1 0 100%; display: flex; align-items: center; gap: 1.6rem; padding-top: .9rem; border-top: 1px dashed rgba(244, 244, 242, .28);
  font: 300 .75rem/1 "MeguLit Mono", var(--mono); letter-spacing: .35em; color: var(--dim); text-transform: lowercase;
}
.barcode {
  margin-left: auto; width: 7.5rem; height: .85rem; opacity: .7;
  background: repeating-linear-gradient(90deg, var(--paper) 0 2px, transparent 2px 4px, var(--paper) 4px 5px, transparent 5px 8px, var(--paper) 8px 11px, transparent 11px 12px, var(--paper) 12px 13px, transparent 13px 17px);
}
.hero .lede { color: #c9c9c6; font-size: .9375rem; letter-spacing: .04em; text-shadow: none; max-width: 28em; }
.hero .lede::before { display: none; }

.hero-dl { align-items: flex-end; gap: 1.6rem; }
.dl-box {
  position: relative; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .55rem 2rem; min-width: 19rem;
  padding: 1rem 1.3rem 1.1rem; border: 1px solid var(--paper); background: rgba(0, 0, 0, .35); color: var(--paper); text-decoration: none;
}
.db-hud { grid-column: 1 / -1; display: flex; align-items: center; gap: .7rem; font: 300 .75rem/1 "MeguLit Mono", var(--mono); letter-spacing: .45em; color: var(--dim); }
.db-hud::before { content: ""; width: .5rem; height: .5rem; background: var(--accent); }
.db-main { font: 600 1.2rem/1.2 "MeguLit Han", var(--serif); letter-spacing: .04em; }
.db-arrow { font: 300 1.4rem/1 "MeguLit Mono", var(--mono); }
/* hover: a hard invert to paper, the way the user cuts on accents */
.dl-box:hover, .dl-box:focus-visible { background: var(--paper); color: #000; outline: none; }
.dl-box:hover .db-hud, .dl-box:focus-visible .db-hud { color: #111; }
.dl-box:active { scale: .98; }
.hud-dl { display: grid; gap: .25rem; }
.hud-dl .alt-link { color: var(--paper); letter-spacing: .1em; text-decoration: underline dashed rgba(244, 244, 242, .5); text-underline-offset: .35em; margin-top: .4rem; }
.sound-fab { background: rgba(0, 0, 0, .5); border-color: rgba(244, 244, 242, .25); border-radius: 0; }
.sound-fab .eq i { background: var(--accent); }
.sound-fab[aria-pressed="true"] { border-color: var(--accent); }
@media (max-width: 40rem) {
  .hud-tl { display: none; }
  .typed { letter-spacing: .3em; margin-bottom: 1.6rem; font-size: .75rem; }
  .dl-box { min-width: 0; width: 100%; }
  .hero-dl { flex-direction: column; align-items: stretch; }
  .foot-rule span:nth-child(2) { display: none; }
}
@media (prefers-reduced-motion: reduce) { .hero-video { filter: grayscale(1) contrast(1.12) brightness(.5) !important; scale: 1.04; } }
/* hero round 3 fixes: sound toggle top-right beside the hud; phone stacks the foot */
.hero .sound-fab { top: calc(var(--top-h) + .9rem); left: auto; right: var(--gutter); bottom: auto; }
.hud-tl { top: .9rem; right: calc(var(--gutter) + 4.6rem); }
.hero-vert { top: 4.8rem; }
@media (max-width: 40rem) {
  .hero-foot { display: grid; gap: 1.4rem; }
  .foot-rule { flex: none; }
  .hero-vert { display: none; }
  .hero .sound-fab { position: absolute; top: calc(var(--top-h) + .6rem); right: var(--gutter); margin: 0; }
  .typed { margin-top: 3.4rem; }
}
/* download, round 4: a solid paper slab (the paper pole), black type, the arrow on a black block */
.dl-box {
  grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: .5rem 1.4rem; min-width: min(24rem, 100%);
  padding: 1.05rem .9rem 1.05rem 1.4rem; border: 0; background: var(--paper); color: #0b0b0b;
  box-shadow: 0 0 0 1px var(--paper), 0 24px 60px -28px rgba(0, 0, 0, .9);
  transition: background-color 0s, color 0s;
}
.db-hud { grid-column: 1; grid-row: 1; gap: 1.1rem; color: #6b6b6b; }
.db-hud > span + span { position: relative; }
.db-hud::before { background: var(--accent); }
.db-main { grid-column: 1; grid-row: 2; font-size: clamp(1.35rem, 1.2vw + .9rem, 1.7rem); letter-spacing: .02em; }
.db-arrow { grid-column: 2; grid-row: 1 / 3; align-self: stretch; display: grid; place-items: center; width: 3.6rem; background: #0b0b0b; color: var(--paper); }
.db-arrow svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: square; transition: transform .35s cubic-bezier(.16, 1, .3, 1); }
.dl-box:hover, .dl-box:focus-visible { background: #0b0b0b; color: var(--paper); box-shadow: 0 0 0 1px var(--paper); }
.dl-box:hover .db-hud, .dl-box:focus-visible .db-hud { color: #9a9a9a; }
.dl-box:hover .db-arrow, .dl-box:focus-visible .db-arrow { background: var(--accent); }
.dl-box:hover .db-arrow svg, .dl-box:focus-visible .db-arrow svg { transform: translateY(4px); }
.hud-dl .js-size { display: none; }

/* download slab: arrow block flush to the edge; phones let the small line wrap */
.dl-box { padding: 0 0 0 1.4rem; }
.db-hud { padding-top: 1.05rem; flex-wrap: wrap; row-gap: .2rem; }
.db-main { padding-bottom: 1.1rem; }
.hero-foot > * { min-width: 0; }
@media (max-width: 40rem) { .dl-box { min-width: 0; } .db-hud { letter-spacing: .3em; } }

/* sound toggle + volume, together in the hero's top-right corner */
.sound-ctl { position: absolute; z-index: 3; top: calc(var(--top-h) + .9rem); right: var(--gutter); display: flex; align-items: center; gap: .6rem; flex-direction: row-reverse; }
.hero .sound-ctl .sound-fab { position: static; margin: 0; }
.vol {
  display: flex; align-items: center; gap: .7rem; height: 3.2rem; padding: 0 1rem; color: var(--paper);
  background: rgba(0, 0, 0, .5); border: 1px solid rgba(244, 244, 242, .25);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  font: 300 .75rem/1 "MeguLit Mono", var(--mono); letter-spacing: .3em; text-transform: lowercase;
}
.vol-k { color: var(--dim); }
.vol-v { min-width: 3.2em; text-align: right; font-variant-numeric: tabular-nums; letter-spacing: .1em; }
#hero-volume { --fill: 5%; -webkit-appearance: none; appearance: none; width: 8.5rem; height: 2px; margin: 0; cursor: pointer; background: linear-gradient(90deg, var(--accent) var(--fill), rgba(244, 244, 242, .25) var(--fill)); }
#hero-volume::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; background: var(--paper); border: 0; }
#hero-volume::-moz-range-thumb { width: 12px; height: 12px; background: var(--paper); border: 0; border-radius: 0; }
#hero-volume:focus-visible { outline: 1px solid var(--paper); outline-offset: 6px; }
@media (max-width: 40rem) {
  .sound-ctl { top: calc(var(--top-h) + .6rem); flex-direction: column; align-items: flex-end; }
  .vol { height: 2.6rem; }
  #hero-volume { width: 6.5rem; }
}
/* nothing highlights on double-click or drag; copyable things stay selectable */
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
code, .js-sha, .facts dd, .notes-body, .rel-body, .faq details p, input, textarea { -webkit-user-select: text; user-select: text; }
img, video, canvas, svg { -webkit-user-drag: none; user-drag: none; }

/* floating kana with depth of field over the whole page; the hero copy stays above it */
.kana-sky { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 1; pointer-events: none; }
.hero-stage { position: relative; z-index: 2; }
.top { z-index: 20; }
.vol[hidden] { display: none; }
/* Chinese hero title in a brush hand (Zhi Mang Xing, OFL); Japanese and English keep their serif faces */
@font-face { font-family: "MeguLit Black"; src: url("/assets/fonts/hero-black.woff2") format("woff2"); font-weight: 900; font-display: swap; }
:lang(zh) .ht-big { font-family: "MeguLit Black", "MeguLit Han", var(--serif); font-weight: 900; letter-spacing: .01em; font-size: clamp(5.5rem, 21vw, 23rem); line-height: 1; text-shadow: 0 0 .25em rgba(244, 244, 242, .22); }
:lang(zh) .ht-big rt { font-size: .08em !important; }
@media (max-width: 40rem) { :lang(zh) .ht-big { font-size: 30vw; } }
/* round: no lamp, a shorter screen wall, less air around the deck */
.lamp { display: none; }
.hp { height: 150vh; }
@media (max-width: 40rem) { .hp { height: 120vh; } }
.deck-sec { padding-top: clamp(2rem, 5vw, 4rem); }

/* ---- entrance, round 4: glitch (photosensitive-safe: displacement and colour fringes, no flashing) ------------------ */
.intro-on .intro { background: transparent; perspective: none; }
.intro .gl-tear { position: absolute; inset: 0; overflow: hidden; }
.intro .gl-tear i { position: absolute; left: 0; width: 100%; background: #000; }
.intro .gl-tear i:nth-child(3n) { background: #050505; }
.intro .gl-stage { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 2.2rem; }
.intro .gl-logo { position: relative; width: min(32vw, 23rem); aspect-ratio: 720 / 279; }
.intro .gl-band { position: absolute; inset: 0; --fx: 2px; }
.intro .gl-band img { position: absolute; inset: 0; width: 100%; height: 100%; }
.intro .gl-band .ch-r { transform: translateX(calc(var(--fx) * -1)); filter: grayscale(1) brightness(1.1) sepia(1) hue-rotate(-50deg) saturate(6); mix-blend-mode: screen; opacity: .55; }
.intro .gl-band .ch-b { transform: translateX(var(--fx)); filter: grayscale(1) brightness(1.1) sepia(1) hue-rotate(150deg) saturate(5); mix-blend-mode: screen; opacity: .45; }
.intro .gl-line { margin: 0; font: 300 .8125rem/1 "MeguLit Mono", var(--mono); letter-spacing: .5em; color: #9a9a9a; text-transform: lowercase; min-height: 1em; }
.intro .gl-scan {
  position: absolute; inset: 0; pointer-events: none; opacity: .35;
  background: repeating-linear-gradient(180deg, rgba(255, 255, 255, .035) 0 1px, transparent 1px 3px);
}
.intro .skip { color: rgba(244, 244, 242, .75); background: rgba(255, 255, 255, .05); border-color: rgba(244, 244, 242, .22); }
.intro .skip:hover { color: #fff; border-color: rgba(244, 244, 242, .6); }

.intro .gl-tear i:nth-child(3n) { background: #000; }
/* the screen wall eases in instead of poking into the section above: lower start, softer tilt, faded top edge */
.hp { padding-top: clamp(5rem, 10vw, 8rem); }
.hp-stage { -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 22%); mask-image: linear-gradient(180deg, transparent 0, #000 22%); }

/* ---- entrance, beat 1: the cape unfurls before the glitch -------------------------------------------------------- */
.intro .gl-logo.gl-hold .gl-band { visibility: hidden; }
.intro .gl-cape { position: absolute; left: -10%; top: -60%; width: 120%; height: 220%; pointer-events: none; }
.intro .gl-rest { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; will-change: transform, filter, opacity; }
.intro .gl-line { color: #c8323c; }
/* channel fringes only on the bands that jump, so the logo keeps its own colours between hits */
.intro .gl-band { --fa: 0; }
.intro .gl-band .ch-r { opacity: calc(var(--fa) * .55); }
.intro .gl-band .ch-b { opacity: calc(var(--fa) * .45); }
.intro .gl-line { white-space: nowrap; }
@media (max-width: 600px) { .intro .gl-line { letter-spacing: .28em; font-size: .6875rem; } }

/* ---- Anki deck, round 2: index cards in the two poles. Paper front (word, the line it came from), black back
   (the scene, reading, numbered meanings, the line with the game's own translation) ----------------------------------- */
.deck { height: clamp(32rem, 44vw, 36rem); }
.dcard { top: 6%; width: min(25rem, 84%); aspect-ratio: 5 / 7; }
.dc-face {
  border-radius: 2px; padding: 0; gap: 0; text-align: left; justify-items: stretch; align-content: stretch;
  box-shadow: 0 0 0 1px rgba(244, 244, 242, .14), 0 34px 70px -30px rgba(0, 0, 0, .95);
}
.dc-front { background: #f4f4f2; color: #0b0b0b; display: flex; flex-direction: column; padding: 1.3rem 1.4rem; }
.dc-front::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background: repeating-linear-gradient(180deg, transparent 0 2.3rem, rgba(11, 11, 11, .06) 2.3rem calc(2.3rem + 1px));
}
.dc-top { position: relative; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.dc-deck { font: 300 .6875rem/1 "MeguLit Mono", var(--mono); letter-spacing: .3em; color: #6b6b6b; text-transform: lowercase; }
.dc-pos { font: 300 .6875rem/1.2 "MeguLit Mono", var(--mono); letter-spacing: .12em; color: #c8323c; border: 1px solid currentColor; padding: .25rem .45rem; white-space: nowrap; }
.dc-front .dc-word { position: relative; margin: auto 0 0; font: 600 clamp(2.4rem, 4.2vw, 3.3rem)/1.5 var(--serif-ja); color: #0b0b0b; text-align: left; }
.dc-front .dc-word rt { color: #c8323c; font-size: max(11px, .32em); letter-spacing: .1em; }
.dc-front .dc-ex { position: relative; margin: .6rem 0 auto; max-width: none; color: #3a3a3a; font: 500 1rem/1.75 var(--serif-ja); }
.dc-ex mark { background: linear-gradient(transparent 62%, rgba(200, 50, 60, .28) 62%); color: inherit; padding: 0 .05em; }
.dc-flip { position: relative; bottom: auto; align-self: flex-start; font: 300 .6875rem/1 "MeguLit Mono", var(--mono); letter-spacing: .3em; color: #5e5e5e; text-transform: lowercase; }
.dc-flip::before { content: "↻  "; color: #c8323c; }
.dc-back { background: #0b0b0b; color: #f4f4f2; display: flex; flex-direction: column; padding: 0; }
.dc-back img { flex: none; display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-bottom: 1px solid rgba(244, 244, 242, .12); }
.dc-body { display: flex; flex-direction: column; gap: .75rem; padding: 1rem 1.2rem 1.1rem; min-height: 0; flex: 1; }
.dc-head { margin: 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: .3rem .7rem; font: 600 1.5rem/1.2 var(--serif-ja); }
.dc-kana { font: 500 .9375rem/1 var(--serif-ja); color: #c8323c; letter-spacing: .08em; }
.dc-head .dc-pos { margin-left: auto; align-self: center; }
.dc-means { margin: 0; padding: 0; list-style: none; counter-reset: m; display: grid; gap: .35rem; font: 500 .9375rem/1.45 var(--sans); }
.dc-means li { counter-increment: m; display: grid; grid-template-columns: 1.4rem 1fr; }
.dc-means li::before { content: counter(m); font: 300 .75rem/1.9 "MeguLit Mono", var(--mono); color: #c8323c; }
.dc-means li + li { color: #a8a8a8; }
.dc-src { margin: auto 0 0; padding-top: .7rem; border-top: 1px dashed rgba(244, 244, 242, .18); display: grid; gap: .2rem; font-size: .8125rem; line-height: 1.55; color: #8a8a8a; }
.dc-src [lang="ja"] { font-family: var(--serif-ja); color: #cfcfcf; }
@media (max-width: 60rem) { .deck { height: 34rem; } .dcard { left: 3%; width: min(23rem, 86%); } }
@media (max-width: 400px) { .dc-means { font-size: .875rem; } .dc-body { gap: .55rem; padding: .85rem 1rem .9rem; } .dc-head { font-size: 1.3rem; } }

/* download slab: the colour change on hover / focus / tap wipes in instead of switching at once */
.dl-box {
  background: linear-gradient(#0b0b0b, #0b0b0b) no-repeat left / 0% 100%, var(--paper);
  transition: background-size .5s cubic-bezier(.65, 0, .35, 1), color .3s ease .2s, box-shadow .4s ease, scale .2s ease;
}
.dl-box .db-hud { transition: color .35s ease .08s; }
.dl-box .db-arrow { transition: background-color .4s ease; }
.dl-box:hover, .dl-box:focus-visible { background: linear-gradient(#0b0b0b, #0b0b0b) no-repeat left / 100% 100%, var(--paper); }

/* sound control: while the sound is on it follows the reader down the page */
.sound-ctl.floating { position: fixed; z-index: 60; top: auto; bottom: calc(1rem + env(safe-area-inset-bottom, 0px)); right: max(1rem, env(safe-area-inset-right, 0px)); flex-direction: row-reverse; align-items: center; animation: sound-in .35s cubic-bezier(.2, .7, .2, 1); }
@keyframes sound-in { from { opacity: 0; translate: 0 .6rem; } }
@media (max-width: 40rem) { .sound-ctl.floating .vol { display: none; } }
.sound-ctl { --paper: #f4f4f2; --accent: #c8323c; --dim: #8a8a8a; }
.sound-ctl.floating .sound-fab { position: static; margin: 0; }
/* text turns once the black is past it, never white on paper mid-wipe */
.dl-box, .dl-box .db-hud { transition-delay: 0s, .2s, 0s, 0s; }
.dl-box .db-hud { transition: color .3s ease .2s; }
.dcard { aspect-ratio: 5 / 6.4; }
.deck:focus-visible { outline: 1px solid rgba(244, 244, 242, .5); outline-offset: 10px; border-radius: 0; }

/* entrance, round 5: no glitch. The overlay is black from the first paint so the page never shows first; the strips
   take over the black when it parts */
.intro-on .intro { background: #000; }
.intro-on .intro.parting { background: transparent; }
.intro .gl-scan, .intro .gl-band { display: none; }

/* foreground kana: a few large, out-of-focus glyphs drifting over everything on the page (under the top bar and the
   floating sound control), never catching the pointer */
.kana-top { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 15; pointer-events: none; }

/* ---- the two bands, round 2: the two poles instead of crimson + gold. A paper slab with black Japanese and small
   lowercase glosses, a black strip with hairlines carrying the game's own lines, numbered like a script ------------- */
.ticker { padding: 2.4rem 0 1.6rem; --tk-paper: #f4f4f2; --tk-red: #c8323c; }
.tk-a, .tk-b { box-shadow: none; }
.tk-a { background: var(--tk-paper); color: #0b0b0b; transform: rotate(-1.6deg); padding: .85rem 0; box-shadow: 0 22px 50px -26px rgba(0, 0, 0, .9); }
.tk-b { background: #050505; color: var(--tk-paper); transform: rotate(.8deg); margin-top: 1.1rem; padding: .7rem 0; border-block: 1px solid rgba(244, 244, 242, .16); }
.tk-track { gap: 1.6rem; padding-right: 1.6rem; }
.tk-a .tk-track, .tk-b .tk-track { font: 600 clamp(1.05rem, 1.5vw, 1.45rem)/1.2 var(--serif-ja); letter-spacing: .06em; color: inherit; -webkit-text-stroke: 0; }
.tk-b .tk-track { font-weight: 500; font-size: clamp(.95rem, 1.25vw, 1.2rem); letter-spacing: .12em; }
.tk-item { display: inline-flex; align-items: baseline; gap: .7rem; white-space: nowrap; }
.tk-sub { font: 300 .6875rem/1 "MeguLit Mono", var(--mono); letter-spacing: .32em; color: #6b6b6b; text-transform: lowercase; }
.tk-no { font: 300 .6875rem/1 "MeguLit Mono", var(--mono); letter-spacing: .2em; color: var(--tk-red); }
.tk-sep { width: .42rem; height: .42rem; background: var(--tk-red); align-self: center; font-size: 0; }
.tk-b .tk-sep { width: 1px; height: 1.1rem; background: rgba(244, 244, 242, .28); }
.tk-track i.tk-sep { color: transparent; }
