/* Gridline – Landingpage
   Farben, Proportionen und Schrift wie in der App (Gridline/Views/Theme.swift, Game/BoardView.swift). */

:root {
  --bg: #F1F1EF;
  --grid: #D1D5DB;
  --ink: #1E1E1E;
  --label: #555555;
  --muted: #9A9A9A;
  /* Kleine Texte: --muted erreicht auf --bg nur 2,5 : 1, --faint 4,7 : 1 (dunkel 5,0 : 1). */
  --faint: #6B6B6B;
  --success: #5C8F77;
  --warning: #E75A3C;
  --pin-red: #E75A3C;
  --pin-green: #7FA894;
  --pin-blue: #70A2D8;
  --pin-pink: #EFA5BC;
  --pin-yellow: #F6C83B;
  --pin-black: #262626;
  --pin-label: rgba(255, 255, 255, .95);
  --pin-label-light: rgba(30, 30, 30, .75);
  --device-shadow: 0 40px 80px -40px rgba(30, 30, 30, .28);
  --icon-edge: rgba(30, 30, 30, .14);
  --icon-shadow: rgba(30, 30, 30, .12);

  /* system-ui zuerst: Firefox kennt -apple-system nicht und griff sonst auf lokal installierte SF-Pro-Dateien zurück. */
  --sans: system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  /* Rasterweite: Hintergrund-Punkte, roter Faden und Abstände bauen darauf auf. */
  --g: 32px;
  --pad: 24px;
  /* Linker Rand; ab Tablet läuft dort der rote Faden (auf --g / 2), auf dem Smartphone gibt es ihn nicht. */
  --pad-start: 24px;
  --max: 1056px;

  color-scheme: light;
}

/* Dunkel: eigene ruhige Palette, keine Invertierung. Rosa und Gelb bleiben gleich. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151514; --grid: #2E2F31; --ink: #ECECE8; --label: #A6A6A1; --muted: #6E6E6A; --faint: #86867F;
    --success: #7DB397; --warning: #F06C4F;
    --pin-red: #EE6A4D; --pin-green: #86B19C; --pin-blue: #79AAE0; --pin-black: #E4E4E0;
    --pin-label: rgba(21, 21, 20, .95);
    --device-shadow: 0 40px 80px -40px rgba(0, 0, 0, .7);
    --icon-edge: rgba(255, 255, 255, .06); --icon-shadow: transparent;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #151514; --grid: #2E2F31; --ink: #ECECE8; --label: #A6A6A1; --muted: #6E6E6A; --faint: #86867F;
  --success: #7DB397; --warning: #F06C4F;
  --pin-red: #EE6A4D; --pin-green: #86B19C; --pin-blue: #79AAE0; --pin-black: #E4E4E0;
  --pin-label: rgba(21, 21, 20, .95);
  --device-shadow: 0 40px 80px -40px rgba(0, 0, 0, .7);
  --icon-edge: rgba(255, 255, 255, .06); --icon-shadow: transparent;
  color-scheme: dark;
}

@media (min-width: 720px) { :root { --g: 48px; --pad: 48px; --pad-start: 48px; } }
@media (min-width: 1100px) { :root { --pad: 144px; --pad-start: 144px; } }

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 24px; }

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  /* Gitterpunkte auf Vielfachen der Rasterweite, deckungsgleich mit dem roten Faden. */
  background-image: radial-gradient(circle, var(--grid) 1.4px, transparent 1.6px);
  background-size: var(--g) var(--g);
  background-position: calc(var(--g) / -2) calc(var(--g) / -2);
  color: var(--ink);
  font: 400 18px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
/* Schmal liegt der Faden auf --g / 2 statt auf einem Vielfachen von --g: Punkte um eine halbe Rasterweite versetzt. */
@media (min-width: 720px) and (max-width: 1099px) { body { background-position: 0 0; } }

img { display: block; max-width: 100%; height: auto; }
/* picture nur als Hülle für die WebP-Quelle: das Layout bestimmt das img. */
picture { display: contents; }

/* Screenshots und Icon gibt es hell und dunkel. Gezeigt wird die Variante zum aktiven Modus (System oder Schalter);
   die versteckte lädt dank loading="lazy" erst, wenn sie gebraucht wird. */
img.theme-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) img.theme-light { display: none; }
  :root:not([data-theme="light"]) img.theme-dark { display: block; }
}
:root[data-theme="dark"] img.theme-light { display: none; }
:root[data-theme="dark"] img.theme-dark { display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; border-radius: 6px; }

.skip {
  position: absolute; left: 16px; top: -100px; z-index: 50;
  background: var(--ink); color: var(--bg); padding: 10px 16px;
  font: 500 13px var(--mono); letter-spacing: .2em; text-transform: uppercase; text-decoration: none;
}
.skip:focus { top: 16px; }

.wrap {
  width: min(var(--max), 100% - var(--pad) - var(--pad-start));
  margin-left: max(var(--pad-start), (100% - var(--max)) / 2); margin-right: auto;
  position: relative;
}

.mono {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .26em;
  text-transform: uppercase;
}
.dot-sep { color: var(--muted); padding-inline: .35em; }
.tabular { font-variant-numeric: tabular-nums; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Ebenen: Parallax-Punkte und roter Faden ---------- */

.far-dots {
  position: fixed; inset: -200px 0; z-index: 0; pointer-events: none;
  background-image: radial-gradient(circle, var(--grid) 1px, transparent 1.2px);
  background-size: calc(var(--g) * 2) calc(var(--g) * 2);
  background-position: 0 0;
  opacity: .55;
  will-change: transform;
}

.thread {
  position: absolute; left: 0; top: 0; z-index: 1;
  width: 100%; pointer-events: none; overflow: visible;
}
.thread[hidden] { display: none; }
/* Fest im Fenster: bewegt sich beim Scrollen ohne JavaScript mit, deshalb wackelt das Linienende nicht. */
.thread-veil { position: fixed; z-index: 1; top: 62vh; top: 62dvh; bottom: 0; width: 8px; left: var(--veil-x, -100px); background: var(--bg); pointer-events: none;
  /* Nur am Seitenende ändert sich top: dann zeichnet sich das letzte senkrechte Stück bis zum Button. */
  transition: top .45s cubic-bezier(.25, .7, .25, 1); }
.thread-veil[hidden] { display: none; }
.thread__route { fill: none; stroke: var(--ink); stroke-opacity: .2; stroke-width: 1.5; stroke-dasharray: 5 7; stroke-linecap: round; }
.thread__strip { fill: var(--bg); }
.thread__line { fill: none; stroke: var(--ink); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: miter; }
/* Endstück in den Button: zieht sich in 0,7 s wie ein Ladebalken, zurück doppelt so schnell. */
.thread__end {
  fill: none; stroke: var(--ink); stroke-width: 2.6; stroke-linecap: round;
  stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset .35s ease-in;
}
.thread__end.is-drawn { stroke-dashoffset: 0; transition: stroke-dashoffset .7s cubic-bezier(.25, .7, .25, 1) var(--arrive-delay, 0s); }
.thread__node circle { transition: fill .25s ease, stroke .25s ease, r .25s ease; }
.thread__node .halo { fill: none; stroke-width: 1; stroke-opacity: .5; }
.thread__node .core { stroke: none; }
.thread__node:not(.is-on) .core { fill: var(--bg); stroke: var(--muted); stroke-width: 1.5; }

main, .topbar, footer { position: relative; z-index: 2; }

/* ---------- Kopfzeile ---------- */

.topbar { padding-top: 22px; }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.wordmark {
  font: 400 15px var(--sans); letter-spacing: .5em; text-transform: uppercase; text-decoration: none;
  display: inline-flex; align-items: center; gap: 12px;
}
.wordmark img {
  width: 28px; height: 28px; border-radius: 7px;
  /* Helles Icon auf hellem Grund: feine Kontur plus kaum sichtbarer Schatten, wie iOS es zeigt. */
  box-shadow: 0 0 0 1px var(--icon-edge), 0 1px 3px var(--icon-shadow);
}
.topbar nav { display: flex; align-items: center; gap: 18px; }
.lang a { text-decoration: none; color: var(--faint); }
.lang a[aria-current] { color: var(--ink); }
.lang a:hover { color: var(--ink); }
.theme-toggle, .sound-toggle {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--ink);
  background: transparent; cursor: pointer; display: grid; place-items: center; padding: 0;
}
.theme-toggle svg, .sound-toggle svg { width: 16px; height: 16px; }
/* Ton: aus zeigt ein Kreuz, an die Schallwellen und einen gefüllten Knopf. */
.sound-toggle .sound-on, .sound-toggle[aria-pressed="true"] .sound-off { display: none; }
.sound-toggle[aria-pressed="true"] .sound-on { display: inline; }
.sound-toggle[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
/* An, aber noch gesperrt (der Browser wartet auf ein Tippen): Hinweis unter dem Knopf, ohne Bewegung. */
.sound-toggle { position: relative; }
.sound-hint {
  position: absolute; top: calc(100% + 10px); right: 0; white-space: nowrap; pointer-events: none;
  font-size: 10px; letter-spacing: .18em; color: var(--label);
  opacity: 0; visibility: hidden; transition: opacity .3s ease, visibility 0s linear .3s;
}
.sound-toggle.is-waiting .sound-hint { opacity: 1; visibility: visible; transition: opacity .3s ease; }
.sound-toggle.is-waiting { background: transparent; color: var(--ink); }
@media (max-width: 719px) {
  .topbar nav { gap: 10px; }
  .wordmark { letter-spacing: .4em; gap: 10px; }
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; gap: 12px;
  height: 52px; padding: 0 28px; border-radius: 26px;
  background: var(--ink); color: var(--bg);
  font: 500 13px var(--mono); letter-spacing: .22em; text-transform: uppercase; text-decoration: none;
  transition: transform .2s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn[aria-disabled="true"] { cursor: default; }
.btn[aria-disabled="true"]:hover { transform: none; }
.btn--ghost { background: transparent; color: var(--ink); border: 1px solid var(--ink); }

/* ---------- Hero ---------- */

.hero { position: relative; padding: calc(var(--g) * 2) 0 calc(var(--g) * 2); min-height: min(100svh, 980px); }
.hero .wrap { display: grid; gap: calc(var(--g) * 1.5); align-items: center; }
@media (min-width: 900px) {
  .hero .wrap { grid-template-columns: 1.15fr .85fr; }
}
.hero__eyebrow { color: var(--label); margin: 0 0 24px; }
/* Die Zeile über der Headline gehört zur H1 (Suchbegriffe), sieht aber aus wie bisher. */
.hero h1 .hero__eyebrow { display: block; font: 500 12px/1.4 var(--mono); letter-spacing: .26em; text-transform: uppercase; }
.hero h1 {
  font: 700 clamp(44px, 5.9vw, 84px)/.98 var(--sans);
  letter-spacing: -.04em; margin: 0;
}
.hero__tags { margin: 24px 0 0; color: var(--label); letter-spacing: .32em; }
.hero__lead { max-width: 30em; color: var(--label); margin: 28px 0 0; font-size: clamp(18px, 1.6vw, 20px); }
.hero__cta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 36px; }
.hero__meta { margin-top: 22px; color: var(--faint); font-size: 11px; }
.hero__visual { position: relative; justify-self: center; width: min(68vw, 320px); }
@media (min-width: 900px) { .hero__visual { width: min(100%, 360px); } }

.float-pin {
  position: absolute; z-index: 3; width: var(--s, 44px); height: var(--s, 44px); border-radius: 50%;
  display: grid; place-items: center;
  font: 500 calc(var(--s, 44px) * .36) var(--mono); color: var(--pin-label);
}
.float-pin::after {
  content: ""; position: absolute; inset: -7px; border-radius: 50%;
  border: 1px solid currentColor; opacity: .45; color: var(--c);
}
.float-pin { background: var(--c); }
.float-pin--light { color: var(--pin-label-light); }

.scroll-hint {
  position: absolute; left: 50%; bottom: calc(var(--g) * .5); transform: translateX(-50%);
  color: var(--faint); display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.scroll-hint svg { width: 14px; height: 22px; animation: nudge 2.4s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateY(5px); } }

/* ---------- Geräte-Rahmen ---------- */

.device {
  position: relative; border-radius: 15% / 7%; padding: 3.2%;
  background: var(--bg); border: 1px solid var(--grid);
  box-shadow: var(--device-shadow);
}
.device img { border-radius: 12.5% / 5.8%; width: 100%; aspect-ratio: 1320 / 2868; object-fit: cover; background: var(--grid); }
.device--ipad { border-radius: 4.5% / 3.4%; padding: 2.2%; }
.device--ipad img { border-radius: 3% / 2.3%; aspect-ratio: 2064 / 2752; }

/* ---------- Abschnitte ---------- */

.section { position: relative; padding: calc(var(--g) * 3) 0; }
.section-label { color: var(--faint); margin: 0 0 18px; }
.section h2, .scrolly h2, .gallery h2 {
  font: 700 clamp(34px, 4.6vw, 60px)/1.02 var(--sans); letter-spacing: -.035em; margin: 0;
}
.section .intro { color: var(--label); max-width: 34em; margin: 20px 0 0; }

/* Marken für den roten Faden: unsichtbar, nur Position. */
.thread-mark { position: absolute; left: 0; top: calc(var(--g) * 1); width: 1px; height: 1px; }

/* ---------- Gepinnte Bühnen (Scrollytelling) ---------- */

.scrolly { position: relative; height: 340vh; }
.scrolly--short { height: 280vh; }
.scrolly__pin {
  position: sticky; top: 0; height: 100vh; height: 100svh;
  display: flex; align-items: center;
}
.scrolly__pin > .wrap {
  display: grid; gap: 20px; align-content: center; height: 100%;
  grid-template-rows: auto auto;
  padding-block: 20px;
}
@media (min-width: 900px) {
  .scrolly__pin > .wrap {
    grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr);
    grid-template-rows: none;
    gap: calc(var(--g) * 1.5);
    align-items: center;
  }
}
.scrolly__text { order: 2; }
.scrolly__stage { order: 1; display: grid; place-items: center; min-height: 0; position: relative; }
@media (min-width: 900px) {
  .scrolly__text { order: 1; }
  .scrolly__stage { order: 2; }
}
@media (max-width: 899px) {
  .scrolly .section h2, .scrolly h2 { font-size: clamp(28px, 8vw, 40px); }
  .scrolly__text .section-label { margin-bottom: 10px; }
}

.steps { list-style: none; margin: 22px 0 0; padding: 0; display: grid; gap: 14px; }
.steps li {
  display: grid; grid-template-columns: 34px 1fr; align-items: baseline;
  color: var(--label); transition: color .3s ease;
}
.steps li::before { content: "01"; font: 500 11px var(--mono); letter-spacing: .1em; }
/* Feste Nummern statt CSS-Zähler: mobil sind die inaktiven Schritte ausgeblendet und würden nicht mitzählen. */
.steps li:nth-child(2)::before { content: "02"; }
.steps li:nth-child(3)::before { content: "03"; }
.steps li.is-active { color: var(--ink); }
.steps li:not(.is-active)::before { color: var(--faint); }
/* Pin-Chips bei den Schritten gibt es nur schmal; breit steht die Legende darunter. */
.step-chips { display: none; }

.board-box { width: min(100%, 540px); display: grid; gap: 14px; justify-items: center; }
@media (max-width: 899px) { .board-box { width: min(100%, 52svh, 460px); } }
.board { width: 100%; height: auto; overflow: visible; }
.board-status {
  font: 400 13px var(--mono); color: var(--label); letter-spacing: .04em; text-align: center;
  font-variant-numeric: tabular-nums; min-height: 1.5em;
}
.board-status .ok { color: var(--success); }
.readout {
  font: 500 15px var(--mono); letter-spacing: .06em; color: var(--ink);
  min-height: 1.6em; font-variant-numeric: tabular-nums; text-align: center;
  transition: opacity .2s ease;
}
.readout .eq { color: var(--muted); }

/* Board-SVG */
.b-gridline { stroke: var(--grid); stroke-width: 1.6; fill: none; }
.b-dot { fill: var(--muted); }
.b-target { font-family: var(--mono); fill: var(--label); text-anchor: middle; dominant-baseline: central; }
.b-target .main { font-size: 34px; }
.b-target .sub { font-size: 15px; fill: var(--muted); }
.b-target.is-ok .main { fill: var(--success); }
.b-target.is-over .main { fill: var(--warning); }
.b-check { fill: none; stroke: var(--success); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.b-line { fill: none; stroke: var(--ink); stroke-width: 6; stroke-linecap: round; stroke-linejoin: miter; stroke-miterlimit: 4; }
.b-line--blocked { stroke: var(--warning); }
.b-line--ghost { stroke-opacity: .28; stroke-width: 3; stroke-dasharray: 8 12; }
.b-tip { fill: var(--ink); fill-opacity: .1; }
.b-pin-label { font: 500 20px var(--mono); text-anchor: middle; dominant-baseline: central; }
.b-halo { fill: none; stroke-width: 1.5; }
.b-void-hatch { stroke: var(--ink); stroke-opacity: .32; stroke-width: 1.6; }
.b-void-flash { fill: var(--warning); }
.b-blocked-ring { fill: none; stroke: var(--warning); stroke-width: 2.4; }

/* Werte-Legende */
.legend { display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 24px 0 0; padding: 0; list-style: none; }
.legend li { display: inline-flex; align-items: center; gap: 10px; color: var(--label); }
.legend .mono { letter-spacing: .14em; font-size: 11px; }
.pin-chip {
  width: 26px; height: 26px; border-radius: 50%; background: var(--c);
  display: grid; place-items: center; font: 500 11px var(--mono); color: var(--pin-label); letter-spacing: 0;
  flex: none;
}
.pin-chip--light { color: var(--pin-label-light); }
.pin-chip--anchor { background: var(--pin-black); position: relative; }
.pin-chip--anchor::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--bg); }
@media (max-width: 899px) {
  .legend { gap: 6px 14px; margin-top: 14px; }
  .pin-chip { width: 20px; height: 20px; font-size: 9px; }
}

/* Gelöst: Wechsel vom Spielfeld zur echten App */
.solved-stage { position: relative; width: 100%; display: grid; place-items: center; }
.solved-stage .board-box { transition: none; will-change: transform, opacity; }
.solved-phone {
  position: absolute; width: min(56%, 250px); left: 50%; top: 50%;
  transform: translate(-50%, -40%); opacity: 0; will-change: transform, opacity;
}
.score-line {
  font: 400 13px var(--mono); color: var(--success); letter-spacing: .18em; text-transform: uppercase;
  min-height: 1.5em; opacity: 0; transition: opacity .25s ease;
}

/* ---------- Punkte und Tipps ---------- */

.points { display: grid; gap: calc(var(--g) * 1); margin-top: calc(var(--g) * 1.5); align-items: start; }
@media (min-width: 900px) { .points { grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: calc(var(--g) * 1.5); } }
/* Wie die Punktezeile im Ergebnis-Bildschirm der App: Mono, rechtsbündige Zahlen, Linie vor der Summe. */
.score { margin: 0; max-width: 420px; padding: 28px 32px; border: 1px solid var(--grid); background: var(--bg); }
.score__title { margin: 0 0 20px; color: var(--faint); }
.score dl { margin: 0; display: grid; gap: 10px; }
.score dl div { display: flex; justify-content: space-between; gap: 16px; font: 400 15px/1.4 var(--mono); color: var(--label); }
.score dd { margin: 0; font-variant-numeric: tabular-nums; }
.score__total {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  margin: 18px 0 0; padding-top: 16px; border-top: 1px solid var(--grid);
  font: 400 34px var(--mono); font-variant-numeric: tabular-nums;
}
.score__best { color: var(--success); font-size: 11px; letter-spacing: .2em; }
.rules { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.rules li { display: grid; grid-template-columns: 1fr; gap: 4px; color: var(--label); }
@media (min-width: 600px) { .rules li { grid-template-columns: 140px 1fr; gap: 16px; } }
.rules .mono { color: var(--ink); font-size: 11px; padding-top: 5px; }
.hint { display: flex; gap: 20px; align-items: flex-start; margin-top: calc(var(--g) * 1.5); max-width: 46em; color: var(--label); }
.hint p { margin: 0; }
.hint strong { color: var(--ink); font-weight: 600; }
.hint__icon { flex: none; width: 54px; height: 54px; border-radius: 50%; border: 1px solid var(--ink); display: grid; place-items: center; color: var(--ink); }
.hint__icon svg { width: 22px; height: 22px; }

/* ---------- Galerie ---------- */

.gallery { position: relative; }
.gallery__pin { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; display: flex; flex-direction: column; justify-content: center; }
.gallery__head { margin-bottom: calc(var(--g) * 1); }
.gallery__track {
  display: flex; gap: calc(var(--g) * 1.5); padding-inline: max(var(--pad-start), (100vw - var(--max)) / 2) max(var(--pad), (100vw - var(--max)) / 2);
  will-change: transform; width: max-content;
}
.shot { width: clamp(170px, min(22vw, (100svh - 330px) * .46), 290px); flex: none; margin: 0; }
.shot figcaption { margin-top: 22px; color: var(--label); font-size: 15px; line-height: 1.45; max-width: 18em; }
.shot figcaption .mono { display: block; color: var(--ink); margin-bottom: 6px; font-size: 11px; }
.shot:nth-child(even) { transform: translateY(var(--lift, 0px)); }
@media (max-width: 899px) {
  .gallery__head { margin-bottom: calc(var(--g) * .75); }
  .shot { width: clamp(150px, min(56vw, (100svh - 340px) * .46), 260px); }
  .shot figcaption { margin-top: 14px; font-size: 14px; }
}

.gallery--native { height: auto !important; }
.gallery--native .gallery__pin { position: relative; height: auto; overflow: visible; padding: calc(var(--g) * 3) 0 calc(var(--g) * 2); }
.gallery--native .gallery__scroller {
  overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
  scrollbar-width: none; padding-bottom: 24px;
}
.gallery--native .gallery__scroller::-webkit-scrollbar { display: none; }
.gallery--native .gallery__track { transform: none !important; }
.gallery--native .shot { scroll-snap-align: center; width: min(58vw, 260px, (100svh - 300px) * .46); }
.gallery--native .shot:nth-child(even) { transform: none; }

.ipad { padding-top: calc(var(--g) * 2); }
.ipad .wrap { display: grid; gap: calc(var(--g) * 1.5); align-items: center; }
@media (min-width: 900px) { .ipad .wrap { grid-template-columns: .8fr 1.2fr; } }
.ipad .device { width: min(100%, 640px); justify-self: center; }

/* ---------- Spielmodi ---------- */

.modes { list-style: none; margin: calc(var(--g) * 1.5) 0 0; padding: 0; border-top: 1px solid var(--grid); }
.mode {
  display: grid; gap: 14px 32px; padding: 30px 0; border-bottom: 1px solid var(--grid);
  grid-template-columns: 1fr; align-items: center;
}
@media (min-width: 900px) {
  .mode { grid-template-columns: 200px 1fr 300px; padding: 36px 0; }
}
.mode__name { margin: 0; font-size: 15px; letter-spacing: .3em; }
.mode__name small { display: block; margin-top: 8px; font-size: 10px; letter-spacing: .2em; color: var(--faint); }
.mode p { margin: 0; color: var(--label); max-width: 32em; }
.mode__visual { display: flex; align-items: center; justify-content: flex-start; min-height: 96px; }
@media (min-width: 900px) { .mode__visual { justify-content: flex-end; } }
.mode__visual .board { width: 160px; }
.clock { font: 400 30px var(--mono); letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.clock .of { color: var(--faint); }
.week { display: flex; gap: 8px; align-items: flex-end; }
.week__day { display: grid; gap: 8px; justify-items: center; }
.week__day svg { display: block; }
.week__day .mono { font-size: 9px; letter-spacing: .12em; color: var(--faint); }
.week__day.is-on .mono { color: var(--ink); }
.mode--rift { border-bottom: none; }

/* ---------- Versprechen ---------- */

.promises { list-style: none; margin: calc(var(--g) * 1.5) 0 0; padding: 0; display: grid; gap: 4px; }
.promises li {
  display: grid; grid-template-columns: 44px 1fr; align-items: baseline;
  font: 600 clamp(24px, 3.2vw, 40px)/1.25 var(--sans); letter-spacing: -.025em;
}
.promises svg { width: 26px; height: 26px; transform: translateY(3px); }
.promises svg path { fill: none; stroke: var(--success); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 30; stroke-dashoffset: 0; }

/* ---------- Abschluss ---------- */

.cta { text-align: center; padding: calc(var(--g) * 4) 0 calc(var(--g) * 3); }
.cta__icon { width: 96px; height: 96px; border-radius: 22px; margin: 0 auto 36px; box-shadow: 0 0 0 1px var(--icon-edge), var(--device-shadow); }
.cta h2 { font: 700 clamp(38px, 6vw, 78px)/1 var(--sans); letter-spacing: -.04em; margin: 0 auto; max-width: 12em; }
.cta p { color: var(--label); margin: 22px auto 0; }
.cta .btn { margin-top: 40px; transition: box-shadow .2s ease, transform .2s ease; }
/* Der Ring kommt erst, wenn das Endstück den Button erreicht hat (Verzögerung ≈ Dauer des Strichs). */
.cta.is-reached .btn { box-shadow: 0 0 0 7px var(--bg), 0 0 0 8px var(--ink); transition: box-shadow .35s ease calc(.6s + var(--arrive-delay, 0s)), transform .2s ease; }
.cta .mono { margin-top: 22px; color: var(--faint); }

footer { padding: calc(var(--g) * 1.5) 0 calc(var(--g) * 1); }
footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 14px 24px; color: var(--faint); border-top: 1px solid var(--grid); padding-top: 24px; }
footer a { text-decoration: none; }
footer a:hover { color: var(--ink); }
footer .mono { font-size: 11px; letter-spacing: .2em; }

/* ---------- Smartphone und schmales Tablet ---------- */

/* Nur unter 900 px: Desktop bleibt unverändert. */
@media (max-width: 899px) {
  .section { padding: calc(var(--g) * 2.5) 0; }

  /* Hero: die beiden Mono-Zeilen direkt unter der Headline, Buttons in natürlicher Breite. */
  .hero { padding-top: calc(var(--g) * 1.5); }
  .hero__text { display: flex; flex-direction: column; }
  .hero__tags { order: 1; margin-top: 18px; }
  .hero__meta { order: 2; margin-top: 8px; font-size: 12px; color: var(--label); letter-spacing: .26em; }
  .hero__lead { order: 3; margin-top: 24px; }
  .hero__cta { order: 4; flex-direction: column; align-items: flex-start; gap: 12px; margin-top: 28px; }

  /* Szenen rasten nicht ein: Text mit allen Schritten, darunter das Spielfeld im normalen Fluss.
     gridline.js zieht die Linien, während das Feld durch den Bildschirm läuft, und hebt den passenden Schritt hervor. */
  .scrolly, .scrolly--short { height: auto; }
  .scrolly__pin { position: relative; height: auto; padding: calc(var(--g) * 2.5) 0 0; }
  .scrolly__pin > .wrap { grid-template-rows: none; height: auto; gap: 36px; padding-block: 0; }
  .scrolly__text { order: 1; }
  .scrolly__stage { order: 2; }
  .steps { gap: 18px; margin-top: 22px; font-size: 16px; line-height: 1.45; }
  .steps li { grid-template-columns: 1fr; gap: 6px; }
  .step-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
  .step-chips .pin-chip { width: 24px; height: 24px; font-size: 10px; }
  .legend { display: none; }
  /* Das Feld hat innen Rand für die Pins, deshalb darf es etwas in die Seitenränder ragen. */
  .board-box { width: min(100% + 24px, 460px); gap: 10px; }
  /* Kein Wechsel zum Screenshot: ohne Einrasten fehlt die feste Bühne dafür. */
  .solved-phone { display: none; }

  .hint { flex-direction: column; gap: 16px; }
  .hint__icon { width: 44px; height: 44px; }
  .hint__icon svg { width: 18px; height: 18px; }

  .mode { padding: 28px 0; gap: 12px; }
  .mode__name small { margin-top: 6px; }
  .mode__visual { min-height: 0; margin-top: 8px; }
  .mode__visual .board { width: 200px; }

  .promises { gap: 8px; }
  .promises li { grid-template-columns: 36px 1fr; font-size: 22px; }
  .cta { padding: calc(var(--g) * 3) 0 calc(var(--g) * 2.5); }
}

/* ---------- Einblenden ---------- */

/* Zuerst CSS Scroll-driven Animations; ohne Unterstützung setzt gridline.js die Klasse .is-in. */
@supports (animation-timeline: view()) {
  .reveal {
    animation: reveal linear both;
    animation-timeline: view();
    animation-range: entry 5% cover 28%;
  }
  .promises li svg path {
    animation: draw-check linear both;
    animation-timeline: view();
    animation-range: entry 40% cover 40%;
  }
  /* Schmal übernimmt gridline.js die Tiefe: in iOS Safari blieb die CSS-Fassung stehen. */
  @media (min-width: 900px) {
    [data-depth] {
      animation: drift linear both;
      animation-timeline: scroll(root);
      animation-range: 0 100vh;
    }
  }
}
@keyframes reveal { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: none; } }
@keyframes draw-check { from { stroke-dashoffset: 30; } to { stroke-dashoffset: 0; } }
@keyframes drift { to { transform: translateY(calc(var(--depth) * -100vh)); } }

@supports not (animation-timeline: view()) {
  .js .reveal { opacity: 0; transform: translateY(28px); transition: opacity .7s ease, transform .7s cubic-bezier(.2, .7, .2, 1); }
  .js .reveal.is-in { opacity: 1; transform: none; }
  .js .promises li svg path { stroke-dashoffset: 30; transition: stroke-dashoffset .5s ease .15s; }
  .js .promises li.is-in svg path { stroke-dashoffset: 0; }
}

/* ---------- Ohne JavaScript ---------- */

/* Leere Spielfelder ausblenden; im <noscript> steht jeweils eine fertige Fassung. Szenen werden normale Abschnitte. */
svg[data-board]:empty, .week__day > svg:empty { display: none; }
html:not(.js) .scrolly, html:not(.js) .scrolly--short { height: auto; }
html:not(.js) .scrolly__pin { position: relative; height: auto; padding: calc(var(--g) * 2) 0; }
html:not(.js) .theme-toggle, html:not(.js) .sound-toggle { display: none; }
html:not(.js) .solved-phone { position: relative; left: auto; top: auto; transform: none; opacity: 1; margin-top: 32px; }

/* ---------- Weniger Bewegung ---------- */

/* Die Szenen bleiben: Sie bewegen sich nur, solange man selbst scrollt, und erklären das Spiel. Weg fallen Tiefe
   (Parallax, schwebende Pins), Einblend-Wege und Dauerbewegung. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal, .js .reveal { transform: none !important; }
  [data-depth] { animation: none !important; transform: none !important; }
  .scroll-hint svg { animation: none; }
  .far-dots { display: none; }
  .btn:hover { transform: none; }
}
