/* ==========================================================================
   The Morning Rip — app.css
   Palette: newsprint cream + ink black + one vermilion accent.
   Type: Inter Tight (UI) / Instrument Serif italic (one emphasis word) /
         Playfair Display + Source Serif 4 (the newspaper) / UnifrakturMaguntia (masthead).
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

:root {
  /* paper & ink */
  --bg: #f4efe3;
  --bg-deep: #ece5d5;
  --ink: #1d1a16;
  --ink-soft: #3d3830;
  --muted: #6f6759;
  --rule: #d8cfbb;
  --rule-soft: #e5dcc9;
  --paper: #fbf7ec;

  /* desk (the dark stage) */
  --desk: #1a1613;
  --desk-deep: #12100d;
  --desk-edge: #2b2521;

  /* one accent */
  --accent: #a8281b;
  --accent-soft: #c0412f;
  --accent-wash: rgb(168 40 27 / 0.09);

  /* type */
  --sans: "Inter Tight", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Instrument Serif", "Playfair Display", Georgia, serif;
  --news-display: "Playfair Display", "Times New Roman", serif;
  --news-body: "Source Serif 4", "Source Serif Pro", Georgia, serif;
  --black-letter: "UnifrakturMaguntia", "Playfair Display", serif;

  /* elevation */
  --lift:
    0 1px 1px rgb(60 45 30 / 0.06),
    0 2px 4px -1px rgb(60 45 30 / 0.05),
    0 18px 36px -18px rgb(52 38 24 / 0.22);
  --lift-hover:
    0 1px 1px rgb(60 45 30 / 0.07),
    0 4px 10px -2px rgb(60 45 30 / 0.08),
    0 30px 54px -22px rgb(52 38 24 / 0.30);

  --radius: 14px;
  --radius-lg: 24px;
  --radius-pill: 999px;

  /* motion — spring-ish, no linear cubic-bezier defaults */
  --spring: linear(0, 0.009 1%, 0.035 2.1%, 0.141 4.4%, 0.423 7.6%, 0.723 11%,
    0.938 15%, 1.017 18.4%, 1.077 22%, 1.121 25.6%, 1.149 29.4%, 1.161 33.4%,
    1.148 38%, 1.125 42.6%, 1.096 47.4%, 1.063 52.6%, 1.029 58.4%, 0.999 64.8%,
    0.977 71.8%, 0.965 79.4%, 0.973 87%, 0.992 94%, 1);
  --ease-out: linear(0, 0.009 5%, 0.06 10.4%, 0.32 22.6%, 0.62 35.4%,
    0.86 48.6%, 0.968 62%, 1.005 76%, 1 100%);

  --shell: 1240px;
  --pad: clamp(20px, 4vw, 48px);
}

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: clamp(1rem, 0.35vw + 0.92rem, 1.0625rem);
  line-height: 1.62;
  font-feature-settings: "kern" 1, "liga" 1;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* site-wide grain: the single biggest "printed matter" tell */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  opacity: 0.055;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3'/></filter><rect width='180' height='180' filter='url(%23n)'/></svg>");
}

img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration-color: var(--rule); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--accent); }
p { margin: 0 0 1em; }
h1, h2, h3, h4 { margin: 0; font-weight: 800; letter-spacing: -0.025em; line-height: 1.04; }
ul, ol { margin: 0 0 1.2em; padding-left: 1.15em; }
li { margin-bottom: 0.45em; }
::selection { background: var(--accent); color: #fdf8ee; }
/* a class that sets display beats the UA's [hidden] rule, which quietly leaks
   hidden notes into the layout — keep the attribute in charge */
[hidden] { display: none !important; }

.shell { width: 100%; max-width: var(--shell); margin-inline: auto; padding-inline: var(--pad); }
.skip {
  position: absolute; left: 12px; top: -60px; z-index: 200;
  background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: var(--radius-pill);
  transition: top 180ms var(--ease-out);
}
.skip:focus-visible { top: 12px; }

:where(a, button, input, textarea, select, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ============================ TYPE PRIMITIVES ============================ */

.display-xl {
  font-size: clamp(2.6rem, 6.6vw, 5.1rem);
  letter-spacing: -0.045em;
  line-height: 0.94;
  font-weight: 800;
}
.display-xl em {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.012em;
  font-size: 1.06em;
  padding-right: 0.02em;
}
.display-l {
  font-size: clamp(2rem, 3.4vw + 0.6rem, 3.3rem);
  letter-spacing: -0.035em;
  line-height: 1;
  font-weight: 800;
}
.display-l em,
.display-m em {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.01em;
}
.display-m {
  font-size: clamp(1.5rem, 1.5vw + 1rem, 2.1rem);
  letter-spacing: -0.028em;
  line-height: 1.08;
}
.eyebrow {
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 14px;
}
.eyebrow-quiet { color: var(--muted); }
.lede {
  font-size: clamp(1.0625rem, 0.5vw + 0.98rem, 1.1875rem);
  line-height: 1.6;
  color: var(--ink-soft);
  max-width: 34ch;
}
.mono {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.rule { height: 1px; background: var(--rule); border: 0; margin: 0; }

/* ============================== BUTTONS =============================== */

.btn {
  --btn-bg: transparent;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 50px;
  padding: 0 22px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-pill);
  background: var(--btn-bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  cursor: pointer;
  overflow: hidden;
  transition:
    transform 220ms var(--spring),
    background-color 180ms var(--ease-out),
    border-color 180ms var(--ease-out),
    box-shadow 240ms var(--ease-out),
    color 180ms var(--ease-out);
}
.btn::after {
  content: "";
  position: absolute;
  inset: -40% -10%;
  background: linear-gradient(100deg, transparent 38%, rgb(255 255 255 / 0.42) 50%, transparent 62%);
  transform: translateX(-120%);
  transition: transform 620ms var(--ease-out);
  pointer-events: none;
}
.btn:hover::after { transform: translateX(120%); }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(1px) scale(0.994); transition-duration: 90ms; }

.btn-solid {
  background: var(--ink);
  border-color: var(--ink);
  color: #f8f3e7;
  box-shadow: 0 1px 1px rgb(0 0 0 / 0.14), 0 10px 24px -12px rgb(29 26 22 / 0.6);
}
.btn-solid:hover { background: #100e0b; border-color: #100e0b; }
.btn-ghost:hover { background: var(--bg-deep); border-color: var(--muted); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fdf6ea; }
.btn-accent:hover { background: var(--accent-soft); border-color: var(--accent-soft); }
.btn-sm { min-height: 40px; padding: 0 16px; font-size: 0.8125rem; }
.btn-sm::after { display: none; }
.btn-lg { min-height: 56px; padding: 0 28px; font-size: 1rem; }
.btn[disabled] { opacity: 0.55; pointer-events: none; }
.btn .btn-key {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.5;
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--ink);
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--rule);
  transition: border-color 180ms var(--ease-out), gap 220ms var(--spring);
}
.link-arrow:hover { border-color: var(--accent); gap: 12px; }

/* ============================== TOPBAR =============================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in oklab, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.1) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.topbar-inner {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding: 10px var(--pad);
  display: flex;
  align-items: center;
  gap: clamp(14px, 2.4vw, 34px);
}
.wordmark { display: flex; align-items: baseline; gap: 10px; text-decoration: none; }
.wordmark-text {
  font-family: var(--black-letter);
  font-size: clamp(1.35rem, 1.1vw + 1.1rem, 1.72rem);
  line-height: 1;
  letter-spacing: 0.01em;
  color: var(--ink);
  margin: 0;
}
.wordmark-sub {
  font-family: ui-monospace, monospace;
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 2px;
}
.nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav-link {
  position: relative;
  padding: 9px 12px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
  border-radius: var(--radius-pill);
  transition: color 160ms var(--ease-out), background-color 160ms var(--ease-out);
}
.nav-link:hover { color: var(--ink); background: rgb(29 26 22 / 0.05); }
.nav-link.is-active { color: var(--ink); }
.nav-link.is-active::after {
  content: "";
  position: absolute;
  left: 12px; right: 12px; bottom: 2px;
  height: 1.5px;
  background: var(--accent);
  border-radius: 2px;
}
.topbar-right { display: flex; align-items: center; gap: 12px; margin-left: 4px; }

/* 语言切换：两个小格子，当前语言用实底 */
.lang-switch {
  display: inline-flex;
  align-items: center;
  padding: 2px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-pill);
  background: rgb(255 255 255 / 0.34);
}
.lang-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  padding: 4px 9px;
  border-radius: var(--radius-pill);
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.2;
  color: var(--ink-soft);
  text-decoration: none;
  transition: color 160ms var(--ease-out), background 160ms var(--ease-out);
}
.lang-link:hover { color: var(--ink); }
.lang-link.is-active {
  color: var(--paper);
  background: var(--ink);
}

.readout {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px 7px 10px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-pill);
  background: rgb(255 255 255 / 0.42);
  white-space: nowrap;
}
.readout-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgb(168 40 27 / 0.45);
  animation: pulse 2.6s var(--ease-out) infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgb(168 40 27 / 0.4); }
  55%  { box-shadow: 0 0 0 7px rgb(168 40 27 / 0); }
  100% { box-shadow: 0 0 0 0 rgb(168 40 27 / 0); }
}
.readout-label {
  font-family: ui-monospace, monospace;
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.readout-num {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 0.875rem;
  letter-spacing: -0.01em;
  min-width: 1.1em;
  text-align: right;
}
.readout[data-state="pending"] .readout-num { color: var(--muted); }

/* ================================ HERO =============================== */

.hero { padding: clamp(34px, 5vw, 64px) 0 clamp(18px, 2.4vw, 30px); }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(24px, 4vw, 64px);
  align-items: end;
}
.hero h1 { margin-bottom: 18px; }
.hero-side { padding-bottom: 6px; }
.hero-side .lede { max-width: 40ch; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0 16px; }
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-family: ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
}
.hero-meta span { display: inline-flex; align-items: center; gap: 6px; }
.hero-meta span::before {
  content: "";
  width: 3px; height: 3px; border-radius: 50%;
  background: var(--rule);
}

/* word reveal */
.word { display: inline-block; }
.reveal-words .word {
  animation: word-in 620ms var(--spring) both;
  animation-delay: calc(var(--i, 0) * 62ms + 80ms);
}
@keyframes word-in {
  from { opacity: 0; transform: translateY(0.34em) rotate(0.6deg); }
  to   { opacity: 1; transform: none; }
}

/* ================================ STAGE ============================== */

.stage-wrap { padding-bottom: clamp(30px, 5vw, 64px); }
.stage {
  position: relative;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(120% 80% at 30% 0%, #241f1b 0%, var(--desk) 42%, var(--desk-deep) 100%);
  border: 1px solid #0c0a08;
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.07),
    inset 0 -1px 0 rgb(0 0 0 / 0.5),
    0 2px 3px rgb(0 0 0 / 0.16),
    0 40px 80px -40px rgb(24 18 12 / 0.7);
  overflow: hidden;
  isolation: isolate;
  transition: box-shadow 400ms var(--ease-out);
  height: clamp(440px, 82dvh, 860px);
}
.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  border-radius: inherit;
  background: radial-gradient(125% 90% at 50% 42%, transparent 52%, rgb(0 0 0 / 0.42) 100%);
}
.stage.is-dragging { box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.07),
    inset 0 -1px 0 rgb(0 0 0 / 0.5),
    0 2px 3px rgb(0 0 0 / 0.16),
    0 40px 90px -40px rgb(24 18 12 / 0.8);
}
#stage-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
  z-index: 2;
}
#stage-canvas:active { cursor: grabbing; }
.stage:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

/* The sheet is a portrait page, so on a wide screen its size is capped by the
   height of the desk, not by the width: a 1144px stage leaves a 452px sheet
   marooned in black. Narrowing the desk to a little over 1.1 × its height puts
   the paper at roughly 60% of the frame, which is where it reads as an object
   lying on a surface rather than as a thumbnail. */
@media (min-width: 900px) {
  .stage,
  .stage-foot {
    width: min(100%, calc(clamp(440px, 82dvh, 860px) * 1.06));
    margin-inline: auto;
  }
}

.stage-hud {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(12px, 1.6vw, 20px);
}
.hud-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.hud-label {
  font-family: ui-monospace, monospace;
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgb(246 240 226 / 0.62);
  background: rgb(12 10 8 / 0.42);
  border: 1px solid rgb(255 255 255 / 0.07);
  border-radius: var(--radius-pill);
  padding: 6px 11px;
  backdrop-filter: blur(6px);
  white-space: nowrap;
}
.hud-tools { display: flex; gap: 8px; pointer-events: auto; }
.hud-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 12px;
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: rgb(246 240 226 / 0.86);
  background: rgb(28 23 19 / 0.62);
  border: 1px solid rgb(255 255 255 / 0.1);
  border-radius: var(--radius-pill);
  cursor: pointer;
  backdrop-filter: blur(8px);
  white-space: nowrap;
  transition: background-color 170ms var(--ease-out), transform 200ms var(--spring), color 170ms var(--ease-out);
}
.hud-btn:hover { background: rgb(44 36 30 / 0.9); color: #fdf8ec; }
.hud-btn:active { transform: scale(0.97); }
.hud-btn[aria-pressed="false"] .hud-icon-on { display: none; }
.hud-btn[aria-pressed="true"] .hud-icon-off { display: none; }
.hud-icon { width: 13px; height: 13px; flex: none; }
.hud-hint {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: rgb(246 240 226 / 0.55);
  letter-spacing: 0.01em;
}
.hud-hint kbd {
  font-family: ui-monospace, monospace;
  font-size: 10px;
  border: 1px solid rgb(255 255 255 / 0.16);
  border-radius: 5px;
  padding: 2px 5px;
  color: rgb(246 240 226 / 0.72);
}
.hud-tears {
  font-family: ui-monospace, monospace;
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgb(246 240 226 / 0.5);
}
.hud-tears b { color: rgb(246 240 226 / 0.9); font-weight: 600; }

/* stage footnote row under the desk */
.stage-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 20px;
  padding: 14px 4px 0;
  font-size: 0.8125rem;
  color: var(--muted);
}
.stage-foot .mono { color: var(--muted); }
.stage-foot-note { display: inline-flex; align-items: center; gap: 8px; }

/* ============================== SECTIONS ============================= */

.section { padding: clamp(56px, 8vw, 104px) 0; }
.section + .section { padding-top: 0; }
.section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.72fr);
  gap: clamp(18px, 3vw, 56px);
  align-items: end;
  margin-bottom: clamp(28px, 3.4vw, 46px);
  padding-bottom: 18px;
  border-bottom: 1px solid var(--rule);
}
.section-head p { margin: 0; color: var(--ink-soft); }
.section-head .eyebrow { margin-bottom: 12px; }

/* three-step: dense, numbered, hairline rules, no icon circles */
.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid var(--rule);
}
.step {
  padding: 26px clamp(16px, 2vw, 28px) 8px;
  border-bottom: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
  transition: background-color 260ms var(--ease-out);
}
.step:first-child { padding-left: 0; }
.step:last-child { border-right: 0; padding-right: 0; }
.step:hover { background: rgb(255 255 255 / 0.35); }
.step-num {
  font-family: ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--accent);
  display: block;
  margin-bottom: 18px;
}
.step h3 {
  font-size: 1.0625rem;
  letter-spacing: -0.018em;
  line-height: 1.25;
  margin-bottom: 10px;
}
.step p { font-size: 0.9375rem; color: var(--ink-soft); margin: 0; }
.step .mono { display: block; margin-top: 16px; font-size: 10px; }

/* editions strip */
.editions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.edition-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 18px 16px;
  text-align: left;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: rgb(255 255 255 / 0.34);
  cursor: pointer;
  box-shadow: 0 1px 1px rgb(60 45 30 / 0.03);
  transition:
    transform 280ms var(--spring),
    box-shadow 280ms var(--ease-out),
    border-color 200ms var(--ease-out),
    background-color 200ms var(--ease-out);
}
.edition-card:hover { transform: translateY(-3px); box-shadow: var(--lift); border-color: #c9bda3; }
.edition-card[aria-pressed="true"] {
  background: var(--paper);
  border-color: var(--ink);
  box-shadow: var(--lift);
}
.edition-card[aria-pressed="true"]::before {
  content: "";
  position: absolute;
  top: 10px; right: 10px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
}
.edition-name {
  font-family: var(--black-letter);
  font-size: 1.28rem;
  line-height: 1;
}
.edition-meta {
  font-family: ui-monospace, monospace;
  font-size: 9.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
}
.edition-line {
  font-family: var(--news-body);
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--ink-soft);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* prose / editorial body */
.prose { max-width: 68ch; }
.prose h2 {
  font-size: clamp(1.5rem, 1.2vw + 1.2rem, 2rem);
  letter-spacing: -0.03em;
  margin: 2.2em 0 0.7em;
}
.prose h2:first-child { margin-top: 0; }
.prose h3 {
  font-size: 1.125rem;
  letter-spacing: -0.02em;
  margin: 1.9em 0 0.5em;
}
.prose p, .prose li { color: var(--ink-soft); }
.prose > p:first-of-type { font-size: 1.1875rem; line-height: 1.6; color: var(--ink); }
.prose strong { color: var(--ink); font-weight: 600; }
.prose a { color: var(--ink); text-decoration-color: var(--accent); }
.prose a:hover { color: var(--accent); }
.prose blockquote {
  margin: 2em 0;
  padding-left: 22px;
  border-left: 2px solid var(--accent);
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.5rem;
  line-height: 1.32;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.prose blockquote p { color: inherit; margin: 0; }
.prose figure { margin: 2em 0; }
.prose figcaption {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--rule);
}

/* quick answer block — GEO: machine- and human-readable summary */
.quick-answer {
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: rgb(255 255 255 / 0.4);
  padding: 20px 22px;
  margin: 0 0 34px;
}
.quick-answer p:last-child { margin-bottom: 0; }
.quick-answer .eyebrow { margin-bottom: 8px; }
.quick-answer strong { color: var(--ink); }

/* data table */
.table-wrap { overflow-x: auto; margin: 1.8em 0; border: 1px solid var(--rule); border-radius: var(--radius); background: rgb(255 255 255 / 0.36); }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; min-width: 480px; }
th, td { text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--rule-soft); vertical-align: top; }
th {
  font-family: ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  border-bottom-color: var(--rule);
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgb(255 255 255 / 0.5); }
td.num { font-variant-numeric: tabular-nums; }

/* two column editorial layout with sticky aside */
.split {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.65fr);
  gap: clamp(24px, 4vw, 64px);
  align-items: start;
}
/* the generator: the proof is the point of the page, so it gets half the width */
.split-proof { grid-template-columns: minmax(0, 1.06fr) minmax(0, 0.94fr); }
.aside-card {
  position: sticky;
  top: 92px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 20px;
  box-shadow: var(--lift);
}
.aside-card .eyebrow { margin-bottom: 10px; }
.aside-card ul { padding-left: 16px; margin-bottom: 14px; }
.aside-card li { font-size: 0.875rem; color: var(--ink-soft); }
.aside-card .btn { width: 100%; }

/* FAQ pill rows */
.faq-list { border-top: 1px solid var(--rule); }
.faq-item { border-bottom: 1px solid var(--rule); }
.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 4px;
  cursor: pointer;
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.018em;
  list-style: none;
  transition: color 160ms var(--ease-out), padding-left 240ms var(--spring);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary:hover { color: var(--accent); padding-left: 10px; }
.faq-item summary .plus {
  flex: none;
  width: 13px; height: 13px;
  position: relative;
  color: var(--accent);
}
.faq-item summary .plus::before,
.faq-item summary .plus::after {
  content: "";
  position: absolute;
  background: currentColor;
  transition: transform 260ms var(--spring), opacity 200ms var(--ease-out);
}
.faq-item summary .plus::before { left: 0; right: 0; top: 6px; height: 1.5px; }
.faq-item summary .plus::after { top: 0; bottom: 0; left: 6px; width: 1.5px; }
.faq-item[open] summary .plus::after { transform: scaleY(0); opacity: 0; }
.faq-body {
  padding: 0 4px 22px;
  max-width: 66ch;
  color: var(--ink-soft);
  font-size: 0.9375rem;
  animation: faq-in 320ms var(--spring) both;
}
@keyframes faq-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.faq-body p:last-child { margin-bottom: 0; }

/* link cards */
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px 20px 20px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: rgb(255 255 255 / 0.34);
  text-decoration: none;
  overflow: hidden;
  transition:
    transform 300ms var(--spring),
    box-shadow 300ms var(--ease-out),
    border-color 200ms var(--ease-out);
}
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(240px 120px at var(--mx, 50%) var(--my, 0%), rgb(168 40 27 / 0.07), transparent 70%);
  opacity: 0;
  transition: opacity 300ms var(--ease-out);
  pointer-events: none;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--lift-hover); border-color: #cdc1a7; }
.card:hover::after { opacity: 1; }
.card-kicker {
  font-family: ui-monospace, monospace;
  font-size: 9.5px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
}
.card h3 { font-size: 1.0625rem; letter-spacing: -0.02em; line-height: 1.24; }
.card p { margin: 0; font-size: 0.9rem; color: var(--ink-soft); }
.card .card-go {
  margin-top: auto;
  padding-top: 12px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.card:hover .card-go { color: var(--accent); }

/* demo / inline controls */
.inline-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 26px 0 0; }
.wave-box {
  position: relative;
  margin: 22px 0 0;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 14px 16px;
  overflow: hidden;
}
.wave-box canvas { width: 100%; height: 74px; }
.wave-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin-top: 8px;
  font-family: ui-monospace, monospace;
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* form (generator) */
.form-grid { display: grid; gap: 16px; }
.field { display: grid; gap: 7px; }
.field label {
  font-family: ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.field input, .field select, .field textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  font-family: var(--sans);
  font-size: 0.9375rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 10px;
  transition: border-color 160ms var(--ease-out), box-shadow 160ms var(--ease-out);
}
.field textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
.field input:hover, .field textarea:hover, .field select:hover { border-color: #c9bda3; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px var(--accent-wash);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field-hint { font-size: 0.78rem; color: var(--muted); }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 6px; }

/* breadcrumb + page header */
.page-head { padding: clamp(30px, 4vw, 54px) 0 clamp(20px, 2.4vw, 30px); }
.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-family: ui-monospace, monospace;
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 20px;
}
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); }
.crumbs span[aria-hidden] { opacity: 0.4; }
.page-head h1 { max-width: 22ch; }
.page-head .lede { margin-top: 18px; max-width: 56ch; }
.byline {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
  font-family: ui-monospace, monospace;
  font-size: 9.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
}

/* callout */
.callout {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--bg-deep);
  padding: 18px 20px;
  margin: 1.8em 0;
}
.callout p:last-child { margin-bottom: 0; }
.callout .eyebrow { margin-bottom: 8px; }

/* steps list (how-to) */
.howto-steps { counter-reset: howto; display: grid; gap: 0; border-top: 1px solid var(--rule); margin: 2em 0; }
.howto-step {
  counter-increment: howto;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 18px;
  padding: 22px 4px;
  border-bottom: 1px solid var(--rule);
}
.howto-step::before {
  content: counter(howto, decimal-leading-zero);
  font-family: ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--accent);
  padding-top: 4px;
}
.howto-step h3 { font-size: 1.0625rem; margin-bottom: 6px; letter-spacing: -0.018em; }
.howto-step p { margin: 0; font-size: 0.9375rem; color: var(--ink-soft); }

/* game list */
.game-list { display: grid; gap: 0; border-top: 1px solid var(--rule); }
.game-row {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.4fr) auto;
  gap: 18px 24px;
  align-items: baseline;
  padding: 20px 4px;
  border-bottom: 1px solid var(--rule);
  transition: background-color 220ms var(--ease-out), padding-left 240ms var(--spring);
}
.game-row:hover { background: rgb(255 255 255 / 0.4); padding-left: 12px; }
.game-row h3 { font-size: 1.0625rem; letter-spacing: -0.02em; }
.game-row p { margin: 0; font-size: 0.9375rem; color: var(--ink-soft); }
.game-row .mono { font-size: 9.5px; white-space: nowrap; }
.game-row.is-ours { background: var(--accent-wash); }
.game-row.is-ours:hover { background: rgb(168 40 27 / 0.13); }

/* =============================== FOOTER ============================== */

.footer {
  position: relative;
  margin-top: clamp(40px, 6vw, 80px);
  border-top: 1px solid var(--rule);
  background: var(--bg-deep);
  overflow: hidden;
}
.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) repeat(3, minmax(0, 0.75fr));
  gap: clamp(22px, 3vw, 48px);
  padding-block: clamp(36px, 5vw, 60px) clamp(20px, 2vw, 28px);
}
.footer-brand .wordmark-text { font-size: 1.5rem; margin-bottom: 12px; }
.footer-note { max-width: 34ch; font-size: 0.875rem; color: var(--ink-soft); }
.footer-stat {
  font-family: ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}
.footer-stat span { color: var(--accent); font-weight: 700; }
.footer-col { display: flex; flex-direction: column; gap: 9px; }
.footer-head {
  font-family: ui-monospace, monospace;
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 3px;
}
.footer-col a {
  font-size: 0.875rem;
  color: var(--ink-soft);
  text-decoration: none;
  width: fit-content;
  transition: color 160ms var(--ease-out), transform 240ms var(--spring);
}
.footer-col a:hover { color: var(--accent); transform: translateX(3px); }
.footer-small { font-size: 0.78rem; color: var(--muted); margin: 6px 0 0; }
.footer-ghost {
  font-family: var(--black-letter);
  font-size: clamp(4rem, 15vw, 12rem);
  line-height: 0.78;
  letter-spacing: -0.02em;
  color: var(--ink);
  opacity: 0.055;
  text-align: center;
  pointer-events: none;
  user-select: none;
  margin-bottom: -0.12em;
}
.footer-legal {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 24px;
  padding-block: 18px 26px;
  border-top: 1px solid var(--rule);
}
.footer-legal p {
  margin: 0;
  font-family: ui-monospace, monospace;
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ============================== 404 PAGE ============================= */
.notfound { padding: clamp(60px, 14vh, 140px) var(--pad); max-width: 720px; }
.notfound .lede { margin: 20px 0 28px; max-width: 44ch; }
.notfound-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--rule); }
.notfound-list li { border-bottom: 1px solid var(--rule); margin: 0; }
.notfound-list a {
  display: block;
  padding: 13px 2px;
  font-size: 0.9375rem;
  text-decoration: none;
  transition: color 170ms var(--ease-out), padding-left 200ms var(--spring);
}
.notfound-list a:hover { color: var(--accent); padding-left: 8px; }

/* ============================== MOTION =============================== */

.js [data-reveal] { opacity: 0; transform: translateY(18px); }
.js [data-reveal].is-in {
  opacity: 1;
  transform: none;
  transition: opacity 620ms var(--ease-out), transform 720ms var(--spring);
}
.js [data-reveal][data-delay="1"].is-in { transition-delay: 80ms; }
.js [data-reveal][data-delay="2"].is-in { transition-delay: 160ms; }
.js [data-reveal][data-delay="3"].is-in { transition-delay: 240ms; }

.count-up { font-variant-numeric: tabular-nums; }
.is-disabled { opacity: 0.45; pointer-events: none; }
@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] { opacity: 1; transform: none; }
}

/* ============================ RESPONSIVE ============================= */

@media (max-width: 1024px) {
  .hero-grid { grid-template-columns: 1fr; align-items: start; gap: 22px; }
  .hero-side .lede { max-width: 52ch; }
  .section-head { grid-template-columns: 1fr; align-items: start; }
  .split { grid-template-columns: 1fr; }
  .aside-card { position: static; }
  .footer-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 860px) {
  .nav { display: none; }
  .topbar-inner { gap: 12px; }
  .topbar-right { margin-left: auto; }
  .topbar-cta { display: none; }
  .steps { grid-template-columns: 1fr; }
  .step { border-right: 0; padding: 22px 0 20px; }
  .editions { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; }
  .game-row { grid-template-columns: 1fr auto; }
  .game-row p { grid-column: 1 / -1; }
  .stage { height: clamp(400px, 66dvh, 620px); }
}

@media (max-width: 560px) {
  body { line-height: 1.58; }
  .readout-label { display: none; }
  .readout { padding: 7px 10px; }
  .wordmark-sub { display: none; }
  .hero-cta .btn { width: 100%; }
  .field-row { grid-template-columns: 1fr; }
  .game-row { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
  .footer-brand { grid-column: 1 / -1; }
  .footer-legal { flex-direction: column; }
  .hud-hint { display: none; }
  /* the edition name is written on the sheet itself; the pills need the room */
  .hud-label { display: none; }
  .hud-btn { min-height: 32px; padding: 0 11px; }
  .howto-step { grid-template-columns: 32px minmax(0, 1fr); gap: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .js-reveal { opacity: 1; transform: none; }
  .reveal-words .word { animation: none; }
}

/* ==========================================================================
   中文版（/zh/）— 只调整排版，配色与组件完全共用
   ========================================================================== */

html[lang="zh-Hans"] {
  --sans: "Inter Tight", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC",
    "Microsoft YaHei", system-ui, sans-serif;
  --serif: "Instrument Serif", "PingFang SC", "Songti SC", "Noto Serif SC",
    "Microsoft YaHei", serif;
}

/* 中文没有斜体强调：改成同字体的强调色，避免浏览器伪斜 */
html[lang="zh-Hans"] em {
  font-style: normal;
  font-weight: inherit;
}

/* 负字距与 1.04 行高只适合拉丁字母 */
html[lang="zh-Hans"] h1,
html[lang="zh-Hans"] h2,
html[lang="zh-Hans"] h3,
html[lang="zh-Hans"] h4 {
  letter-spacing: 0;
  line-height: 1.18;
}
html[lang="zh-Hans"] .display-xl {
  letter-spacing: 0;
  line-height: 1.08;
}
html[lang="zh-Hans"] .display-xl em,
html[lang="zh-Hans"] .display-l em,
html[lang="zh-Hans"] .display-m em {
  font-family: var(--sans);
  font-weight: 800;
  font-size: 1em;
  letter-spacing: 0;
  color: var(--accent);
}

/* 大写字距在中文里会散开成字缝，收窄 */
html[lang="zh-Hans"] .eyebrow,
html[lang="zh-Hans"] .nav-link,
html[lang="zh-Hans"] .readout-label,
html[lang="zh-Hans"] .card-kicker,
html[lang="zh-Hans"] .footer-head,
html[lang="zh-Hans"] .byline span,
html[lang="zh-Hans"] .step-num,
html[lang="zh-Hans"] .mono {
  letter-spacing: 0.04em;
}

/* 中文正文行高略松，段落与列表的断行更舒服 */
html[lang="zh-Hans"] .prose p,
html[lang="zh-Hans"] .prose li,
html[lang="zh-Hans"] .lede,
html[lang="zh-Hans"] .faq-body p,
html[lang="zh-Hans"] .quick-answer p {
  line-height: 1.85;
}
html[lang="zh-Hans"] .game-row p,
html[lang="zh-Hans"] .card p {
  line-height: 1.8;
}

/* 中文标点不参与字母间距，也不要在词中间断裂 */
html[lang="zh-Hans"] body {
  word-break: break-word;
  line-break: strict;
}
