/*
 * auTark mobil – nur Handy (bis 767 px): Tastenleiste wie an einem Rekorder statt des
 * Hamburger-Menüs, auf REC/FEATURES der Kassetten-Umschalter und das Kassettendeck (Issue #40),
 * beim Seitenwechsel ein kurzer VHS-Effekt (Issue #41), die Bühne bewegt sich dezent ohne Video (Issue #48),
 * auf VHS Bildschirm, Videorekorder und Kassettenregal (Issue #49), auf PLAY und in der Vergrößerung
 * von PAUSE Wischen mit Zählwerk (Issue #50).
 *
 * Desktop und Tablet bleiben wie das Eltern-Theme (v2): Außerhalb der Media-Query steht nur das
 * Ausblenden der neuen Elemente. Farben und Schrift aus assets/css/theme.css des Eltern-Themes
 * (--autark-light, --autark-menu, --autark-line, Comfortaa/Monoton).
 */

.tastenleiste,
.kassette,
.deck,
.vhs-monitor__leer,
.vhs-rekorder,
.vhs-regal,
.vhs-monitor__schliessen,
.termine__bedienung,
.fotos-zaehlwerk,
.vhs-osd,
.vhs-kopfumschaltung {
  display: none;
}

@media (max-width: 767px) {
  :root {
    /* Höhe der Leiste ohne Safe-Area: Taste 52 px, Rand oben 7 px, unten 9 px, Kante 1 px. */
    --mobil-leiste: 69px;
    --mobil-unten: calc(var(--mobil-leiste) + env(safe-area-inset-bottom, 0px));
    --mobil-led-an: #b8e07c;
    --mobil-led-rec: #ff4436;
    /* Höhe des Kassettendecks über der Leiste (nur sichtbar, solange ein Song eingelegt ist). */
    --mobil-deck: 112px;
  }

  /* ------------------------------------------------------------ Hamburger aus, Platz für die Leiste */

  .menu-toggle,
  .menu-panel {
    display: none;
  }

  body {
    padding-bottom: var(--mobil-unten);
  }

  .nach-oben.is-active {
    bottom: calc(var(--mobil-unten) + 14px);
  }

  /* Deck eingelegt: Platz auch dafür, damit der letzte Song nicht darunter verschwindet. */
  .hat-deck body {
    padding-bottom: calc(var(--mobil-unten) + var(--mobil-deck));
  }

  .hat-deck .nach-oben.is-active {
    bottom: calc(var(--mobil-unten) + var(--mobil-deck) + 14px);
  }

  /* ------------------------------------------------------------ Tastenleiste */

  .tastenleiste {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 250;
    display: block;
    padding: 7px max(8px, env(safe-area-inset-right, 0px)) calc(9px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
    border-top: 1px solid rgba(218, 222, 208, 0.1);
    /* Gebürstetes, dunkles Blech: feine Längsrillen über einem Verlauf. */
    background:
      repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 3px),
      linear-gradient(#171717, #0a0a0a);
    box-shadow: 0 -12px 24px rgba(0, 0, 0, 0.55);
  }

  /*
   * Tasten nach Beschriftung verschieden breit (wie an echten Geräten: STOP/EJECT ist breiter),
   * der übrige Platz wird gleichmäßig verteilt.
   */
  .tastenleiste__liste {
    display: flex;
    gap: 5px;
    max-width: 520px;
    margin: 0 auto;
    padding: 0;
    list-style: none;
  }

  .tastenleiste__eintrag {
    flex: 1 1 auto;
  }

  .taste {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    box-sizing: border-box;
    height: 52px;
    min-width: 44px;
    padding: 0 6px 6px;
    border-radius: 3px 3px 5px 5px;
    background: linear-gradient(#2c2c2b, #1b1b1a 55%, #151514);
    /* Kante oben hell, Körper nach unten in den Schatten: Taste steht 3 px über der Leiste. */
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.09),
      inset 0 -2px 0 rgba(0, 0, 0, 0.45),
      0 3px 0 #050505,
      0 4px 6px rgba(0, 0, 0, 0.6);
    color: var(--autark-menu);
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition:
      transform 0.09s ease-out,
      box-shadow 0.09s ease-out,
      color 0.15s;
  }

  /* Status-LED oben links: aus = dunkles Glas. */
  .taste__led {
    position: absolute;
    top: 6px;
    left: 50%;
    width: 12px;
    height: 3px;
    margin-left: -6px;
    border-radius: 2px;
    background: #0c0c0c;
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.8), 0 1px 0 rgba(255, 255, 255, 0.05);
    transition: background-color 0.15s, box-shadow 0.15s;
  }

  .taste__symbol {
    width: 18px;
    height: 18px;
    margin-bottom: 4px;
    color: var(--autark-light);
    opacity: 0.62;
    transition: opacity 0.15s;
  }

  .taste--rec .taste__symbol {
    color: #c8433a;
    opacity: 0.8;
  }

  .taste__text {
    font-size: 9px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: nowrap;
  }

  .taste:hover {
    color: #b5b5b0;
  }

  /* Eingerastet: 3 px tiefer, flacher Schatten, LED an. */
  .taste.is-gedrueckt {
    transform: translateY(3px);
    background: linear-gradient(#161616, #1d1d1c 60%, #222221);
    box-shadow:
      inset 0 2px 3px rgba(0, 0, 0, 0.75),
      inset 0 -1px 0 rgba(255, 255, 255, 0.05),
      0 0 0 #050505,
      0 1px 2px rgba(0, 0, 0, 0.6);
    color: var(--autark-light);
  }

  .taste.is-gedrueckt .taste__symbol {
    opacity: 1;
  }

  .taste.is-gedrueckt .taste__led {
    background: var(--mobil-led-an);
    box-shadow: 0 0 6px rgba(184, 224, 124, 0.75), 0 0 1px var(--mobil-led-an);
  }

  .taste--rec.is-gedrueckt .taste__led {
    background: var(--mobil-led-rec);
    box-shadow: 0 0 7px rgba(255, 68, 54, 0.85), 0 0 1px var(--mobil-led-rec);
  }

  .taste--rec.is-gedrueckt .taste__symbol {
    color: var(--mobil-led-rec);
  }

  .taste:focus-visible {
    outline: 2px solid var(--autark-light);
    outline-offset: 2px;
  }

  /* Kurzer Druck beim Tippen (assets/js/mobil.js setzt .is-druck), auch auf die schon gedrückte Taste. */
  .taste:active,
  .taste.is-druck {
    transform: translateY(4px);
    box-shadow:
      inset 0 2px 4px rgba(0, 0, 0, 0.8),
      0 0 0 #050505;
  }

  /* ------------------------------------------------------------ Kassetten-Umschalter (REC/FEATURES) */

  .kassette {
    display: block;
    box-sizing: border-box;
    max-width: 360px;
    margin: 0 auto 34px;
    padding: 0 20px;
  }

  /* Gehäuse wie eine Kassette: dunkel, abgerundet, oben die Beschriftungsfläche je Seite. */
  .kassette__seiten {
    position: relative;
    display: grid;
    grid-auto-columns: minmax(0, 1fr);
    grid-auto-flow: column;
    gap: 6px;
    margin: 0;
    padding: 7px;
    border: 1px solid rgba(218, 222, 208, 0.16);
    border-radius: 9px;
    background: linear-gradient(#141414, #0b0b0b);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
    list-style: none;
  }

  /* Schrauben in den Ecken. */
  .kassette__seiten::before,
  .kassette__seiten::after {
    position: absolute;
    bottom: 3px;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: rgba(218, 222, 208, 0.18);
    content: '';
  }

  .kassette__seiten::before {
    left: 3px;
  }

  .kassette__seiten::after {
    right: 3px;
  }

  .kassette__seite {
    display: flex;
    align-items: center;
    gap: 9px;
    box-sizing: border-box;
    min-height: 44px;
    padding: 6px 10px;
    border-radius: 5px;
    color: var(--autark-menu);
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.2s, color 0.2s;
  }

  .kassette__buchstabe {
    flex: none;
    font-family: 'Monoton', 'Comfortaa', sans-serif;
    font-size: 22px;
    line-height: 1;
  }

  .kassette__text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
    text-transform: uppercase;
  }

  .kassette__nr {
    font-size: 9px;
    letter-spacing: 0.08em;
    opacity: 0.75;
  }

  .kassette__name {
    overflow: hidden;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Trenner „ · “ nur für Screenreader (Name: „Seite B · FEATURES“), sichtbar stehen die Teile untereinander. */
  .kassette__trenner {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  /* Eingelegte Seite: helles Etikett. */
  .kassette__seite.is-aktiv {
    background: var(--autark-light);
    color: #111;
    box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.25);
  }

  .kassette__seite:not(.is-aktiv):hover {
    color: var(--autark-light);
  }

  .kassette__seite:focus-visible {
    outline: 2px solid var(--autark-light);
    outline-offset: 2px;
  }

  /* ------------------------------------------------------------ Kassettendeck (REC/FEATURES, Issue #40) */

  /*
   * Leiste direkt über der Tastenleiste, gleiches dunkles Blech. Links die Kassette, rechts Zählwerk
   * und Laufwerkstasten. Erscheint, sobald ein Song eingelegt ist (assets/js/deck.js nimmt hidden weg).
   */
  .deck {
    position: fixed;
    right: 0;
    bottom: var(--mobil-unten);
    left: 0;
    z-index: 249;
    display: flex;
    align-items: center;
    gap: 12px;
    box-sizing: border-box;
    height: var(--mobil-deck);
    padding: 9px max(12px, env(safe-area-inset-right, 0px)) 9px max(12px, env(safe-area-inset-left, 0px));
    border-top: 1px solid rgba(218, 222, 208, 0.1);
    border-bottom: 1px solid #000;
    background:
      repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 3px),
      linear-gradient(#1c1c1b, #111110);
    box-shadow: 0 -12px 24px rgba(0, 0, 0, 0.5);
    touch-action: pan-y;
    -webkit-user-select: none;
    user-select: none;
    transition:
      transform 0.28s cubic-bezier(0.2, 0.8, 0.3, 1),
      opacity 0.2s ease-out;
  }

  @starting-style {
    .deck {
      opacity: 0;
      transform: translateY(14px);
    }
  }

  .deck[hidden] {
    display: none;
  }

  .deck__kassette {
    flex: none;
    width: clamp(132px, 40vw, 172px);
    transition: transform 0.32s cubic-bezier(0.25, 1.4, 0.5, 1);
  }

  .deck__kassette.is-gezogen {
    transition: none;
  }

  /* Die Kassette: Gehäuse mit vier Schrauben, Etikett, Sichtfenster, unten die Kopföffnung. */
  .mc {
    position: relative;
    aspect-ratio: 100 / 64;
    border-radius: 6px;
    background:
      radial-gradient(circle at 5px 5px, #4a4a47 0 1.3px, transparent 1.8px),
      radial-gradient(circle at calc(100% - 5px) 5px, #4a4a47 0 1.3px, transparent 1.8px),
      radial-gradient(circle at 5px calc(100% - 5px), #4a4a47 0 1.3px, transparent 1.8px),
      radial-gradient(circle at calc(100% - 5px) calc(100% - 5px), #4a4a47 0 1.3px, transparent 1.8px),
      linear-gradient(160deg, #2e2e2c, #1b1b1a 55%, #131312);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.09),
      inset 0 -1px 0 rgba(0, 0, 0, 0.6),
      0 2px 0 #050505,
      0 5px 12px rgba(0, 0, 0, 0.65);
  }

  .mc__etikett {
    position: absolute;
    top: 7%;
    right: 6%;
    left: 6%;
    display: flex;
    align-items: baseline;
    gap: 5px;
    box-sizing: border-box;
    height: 72%;
    padding: 3px 6px 0;
    border-radius: 3px;
    background: var(--autark-light);
    color: #161616;
    line-height: 1.2;
  }

  /* Zwei Streifen unter der Beschriftung, wie auf alten Leerkassetten; rot wie die REC-Taste. */
  .mc__etikett::after {
    position: absolute;
    top: 33%;
    right: 6px;
    left: 6px;
    height: 4px;
    background: linear-gradient(#c8433a 0 2px, transparent 2px 3px, rgba(22, 22, 22, 0.35) 3px 4px);
    content: '';
  }

  .mc__seite {
    flex: none;
    font-family: 'Monoton', 'Comfortaa', sans-serif;
    font-size: 14px;
    line-height: 1;
  }

  .mc__titel {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    font-size: 8.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
  }

  .mc__nr {
    flex: none;
    font-size: 7px;
    font-weight: 700;
    letter-spacing: 0.04em;
    opacity: 0.6;
  }

  .mc__fenster {
    position: absolute;
    top: 37%;
    left: 12%;
    width: 76%;
    height: auto;
    overflow: visible;
  }

  .mc__glas {
    fill: url(#mc-glas);
    stroke: rgba(0, 0, 0, 0.55);
  }

  .mc__glanz {
    fill: rgba(255, 255, 255, 0.05);
  }

  /* Bandwickel: deck.js skaliert ihn mit dem Fortschritt (links ab-, rechts zunehmend). */
  .mc__wickel {
    fill: url(#mc-band);
    transform-box: fill-box;
    transform-origin: center;
    transition: transform 0.3s linear;
  }

  .mc__wickel--rechts {
    transform: scale(0.48);
  }

  .mc__nabe,
  .mc__zaehne {
    fill: #e6e3d6;
  }

  .mc__loch {
    fill: #141414;
  }

  /* Spulen drehen nur, solange der Song läuft; bei Pause bleiben sie in ihrer Stellung stehen. */
  .mc__spule {
    transform-box: fill-box;
    transform-origin: center;
    animation: mc-drehen 2.4s linear infinite;
    animation-play-state: paused;
  }

  .deck.is-laeuft .mc__spule {
    animation-play-state: running;
  }

  @keyframes mc-drehen {
    to {
      transform: rotate(-360deg);
    }
  }

  /* Kopföffnung unten: Trapez mit zwei Führungslöchern. */
  .mc__kopf {
    position: absolute;
    bottom: 0;
    left: 21%;
    width: 58%;
    height: 15%;
    border-radius: 2px 2px 0 0;
    background:
      radial-gradient(circle at 22% 55%, #050505 0 2px, transparent 2.5px),
      radial-gradient(circle at 78% 55%, #050505 0 2px, transparent 2.5px),
      linear-gradient(#232322, #1a1a19);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
    clip-path: polygon(7% 0, 93% 0, 100% 100%, 0 100%);
  }

  .deck__bedienung {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
  }

  /* Bandzählwerk: vertieftes, schwarzes Fenster, Ziffern in Monoton. */
  .deck__zaehlwerk {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    height: 38px;
    margin: 0;
    border-radius: 4px;
    background: linear-gradient(#040404, #0c0c0c);
    box-shadow:
      inset 0 2px 4px rgba(0, 0, 0, 0.9),
      inset 0 -1px 0 rgba(255, 255, 255, 0.04),
      0 1px 0 rgba(255, 255, 255, 0.05);
    color: var(--autark-light);
    font-family: 'Monoton', 'Comfortaa', sans-serif;
    font-size: 24px;
    line-height: 1;
    letter-spacing: 0.06em;
    transition: text-shadow 0.3s;
  }

  .deck.is-laeuft .deck__zaehlwerk {
    text-shadow: 0 0 10px rgba(218, 222, 208, 0.3);
  }

  .deck__knoepfe {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
  }

  /* Laufwerkstasten wie die Tasten der Leiste, nur flacher. */
  .deck__knopf {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    height: 44px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 3px 3px 5px 5px;
    background: linear-gradient(#2c2c2b, #1b1b1a 55%, #151514);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.09),
      inset 0 -2px 0 rgba(0, 0, 0, 0.45),
      0 3px 0 #050505,
      0 4px 6px rgba(0, 0, 0, 0.6);
    color: var(--autark-light);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    /* Nur senkrecht scrollen: waagerechtes Wischen über einen Knopf gehört dem Deck. */
    touch-action: pan-y;
    transition:
      transform 0.09s ease-out,
      box-shadow 0.09s ease-out,
      opacity 0.15s;
  }

  .deck__knopf svg {
    fill: currentColor;
    opacity: 0.72;
  }

  .deck__icon-pause,
  .deck__knopf--play.is-an .deck__icon-play {
    display: none;
  }

  .deck__knopf--play.is-an .deck__icon-pause {
    display: block;
  }

  .deck__led {
    position: absolute;
    top: 5px;
    left: 50%;
    width: 10px;
    height: 3px;
    margin-left: -5px;
    border-radius: 2px;
    background: #0c0c0c;
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.8), 0 1px 0 rgba(255, 255, 255, 0.05);
    transition: background-color 0.15s, box-shadow 0.15s;
  }

  /* Wiedergabe: Play-Taste eingerastet, LED grün wie die gedrückte Taste der Leiste. */
  .deck__knopf--play.is-an {
    transform: translateY(3px);
    background: linear-gradient(#161616, #1d1d1c 60%, #222221);
    box-shadow:
      inset 0 2px 3px rgba(0, 0, 0, 0.75),
      inset 0 -1px 0 rgba(255, 255, 255, 0.05),
      0 1px 2px rgba(0, 0, 0, 0.6);
  }

  .deck__knopf--play.is-an svg {
    opacity: 1;
  }

  .deck__knopf--play.is-an .deck__led {
    background: var(--mobil-led-an);
    box-shadow: 0 0 6px rgba(184, 224, 124, 0.75), 0 0 1px var(--mobil-led-an);
  }

  .deck__knopf:active:not(:disabled) {
    transform: translateY(4px);
    box-shadow:
      inset 0 2px 4px rgba(0, 0, 0, 0.8),
      0 0 0 #050505;
  }

  .deck__knopf:disabled {
    cursor: default;
    opacity: 0.35;
  }

  .deck__knopf:focus-visible {
    outline: 2px solid var(--autark-light);
    outline-offset: 2px;
  }
}

/*
 * ------------------------------------------------------------ Seitenwechsel wie ein Rekorder (Issues #41, #56)
 *
 * Cross-Document View Transition, nur Handy und nur ohne „Bewegung reduzieren“. Beide Seiten müssen
 * zustimmen (inline, inc/uebergang.php); Desktop/Tablet und Browser ohne Unterstützung wechseln die
 * Seite wie gewohnt.
 * Ablauf (0,8 s, wie ein Bandwechsel mit schlechtem Tracking):
 * - Das alte Bild läuft in Rot/Cyan auseinander (SVG-Filter #vhs-farbsaum aus inc/uebergang.php),
 *   reißt waagerecht aus und verlischt; darunter flackert Bildrauschen.
 * - Das neue Bild läuft mit Farbsaum, Spurlinien und mehreren breiten Störbalken ein (Maske = Durchblick
 *   aufs Rauschen) und rastet ein.
 * - Unten flimmert das Kopfumschalt-Rauschen (.vhs-kopfumschaltung), oben links zeigt die Rekorder-Anzeige
 *   (.vhs-osd) Symbol und Name der Zielseite. Beide gibt es nur während des Übergangs (:active-view-transition),
 *   jeweils als eigene Ebene der neuen Seite.
 * Tastenleiste und Deck haben eigene Namen und damit eigene Ebenen über dem Effekt: Die Leiste steht,
 * das Deck der alten Seite fährt nach unten weg (auf der neuen Seite ist es erst nach dem Start da).
 */
.vhs-filter {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

@media (max-width: 767px) and (prefers-reduced-motion: no-preference) {
  /*
   * Die Zustimmung selbst (@view-transition { navigation: auto }) steht nicht hier, sondern inline im
   * Kopf der Seite (inc/uebergang.php): Kommt diese Datei als letzte render-blockierende Datei an, prüft
   * Chrome die Zustimmung, bevor ihre Regeln gelten, und lässt den Übergang aus.
   */

  .tastenleiste {
    view-transition-name: tastenleiste;
  }

  .deck {
    view-transition-name: deck;
  }

  /* Eigene Regeln: Kennt ein Browser :active-view-transition nicht, bleiben die Elemente aus. */
  :root:active-view-transition .vhs-osd {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 18px);
    left: max(18px, env(safe-area-inset-left, 0px));
    z-index: 251;
    display: block;
    color: #eef3e4;
    font-family: 'Comfortaa', sans-serif;
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    /* Leichter Leuchtrand wie die Schrift eines Rekorder-Menüs auf der Röhre. */
    text-shadow:
      0 0 1px #fff,
      0 0 6px rgba(184, 224, 124, 0.75),
      2px 0 0 rgba(255, 68, 54, 0.45),
      -2px 0 0 rgba(0, 220, 255, 0.4);
    pointer-events: none;
    view-transition-name: osd;
  }

  :root:active-view-transition .vhs-osd__symbol {
    letter-spacing: 0;
  }

  :root:active-view-transition .vhs-kopfumschaltung {
    position: fixed;
    right: -24px;
    bottom: var(--mobil-unten);
    left: -24px;
    z-index: 251;
    display: block;
    height: 16px;
    background:
      linear-gradient(90deg, transparent 0 8%, rgba(255, 255, 255, 0.55) 8% 9%, transparent 9% 63%, rgba(255, 255, 255, 0.4) 63% 64.5%, transparent 64.5%),
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='r'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .86 0 0 0 0 .87 0 0 0 0 .82 2.2 0 0 0 -.9'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23r)'/%3E%3C/svg%3E")
        0 0 / 320px 40px,
      rgba(5, 5, 5, 0.85);
    pointer-events: none;
    view-transition-name: kopfumschaltung;
  }

  /* Bühne hinter den beiden Bildern: Schwarz mit Rauschen (feTurbulence, waagerecht gestreckt). */
  ::view-transition-group(root) {
    background:
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='r'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .86 0 0 0 0 .87 0 0 0 0 .82 2.2 0 0 0 -.9'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23r)'/%3E%3C/svg%3E")
        0 0 / 420px 105px,
      #050505;
    animation: vhs-rauschen 800ms steps(1) both;
  }

  ::view-transition-old(root) {
    animation: vhs-raus 320ms cubic-bezier(0.5, 0, 0.9, 0.6) both;
  }

  ::view-transition-new(root) {
    animation: vhs-rein 580ms 220ms cubic-bezier(0.2, 0.7, 0.3, 1) both;
    /*
     * Erste Ebene: oben (0–40 %) dicht, darunter vier breite Störbalken; die Maske rutscht nach unten,
     * die Balken laufen von oben durchs Bild. Zweite Ebene: Spurlinien (4 px).
     */
    -webkit-mask-image:
      linear-gradient(#000 0 45%, rgba(0, 0, 0, 0.1) 45% 53%, #000 53% 62%, rgba(0, 0, 0, 0.35) 62% 72%, #000 72% 80%, transparent 80% 84%, #000 84% 90%, rgba(0, 0, 0, 0.2) 90% 97%, #000 97%),
      linear-gradient(#000 75%, rgba(0, 0, 0, 0.55) 75%);
    mask-image:
      linear-gradient(#000 0 45%, rgba(0, 0, 0, 0.1) 45% 53%, #000 53% 62%, rgba(0, 0, 0, 0.35) 62% 72%, #000 72% 80%, transparent 80% 84%, #000 84% 90%, rgba(0, 0, 0, 0.2) 90% 97%, #000 97%),
      linear-gradient(#000 75%, rgba(0, 0, 0, 0.55) 75%);
    -webkit-mask-size: 100% 250%, 100% 4px;
    mask-size: 100% 250%, 100% 4px;
    -webkit-mask-repeat: no-repeat, repeat;
    mask-repeat: no-repeat, repeat;
    -webkit-mask-composite: source-in;
    mask-composite: intersect;
  }

  /* Leiste steht: neues Bild sofort, ohne Überblenden (die neu gedrückte Taste ist schon eingerastet). */
  ::view-transition-group(tastenleiste),
  ::view-transition-new(tastenleiste) {
    animation: none;
  }

  ::view-transition-old(tastenleiste) {
    display: none;
  }

  ::view-transition-group(deck),
  ::view-transition-new(deck) {
    animation: none;
  }

  ::view-transition-old(deck) {
    animation: vhs-deck-raus 200ms ease-in both;
  }

  /* Anzeige und Rauschstreifen gehören nur zur neuen Seite und bewegen sich nicht als Gruppe. */
  ::view-transition-group(osd),
  ::view-transition-group(kopfumschaltung) {
    animation: none;
  }

  ::view-transition-old(osd),
  ::view-transition-old(kopfumschaltung) {
    display: none;
  }

  ::view-transition-new(osd) {
    animation: vhs-osd 800ms linear both;
  }

  ::view-transition-new(kopfumschaltung) {
    animation: vhs-kopf 800ms steps(1) both;
  }

  @keyframes vhs-raus {
    0% {
      opacity: 1;
      transform: none;
      filter: url("#vhs-farbsaum-leicht");
    }

    30% {
      opacity: 1;
      transform: translateX(-9px) skewX(-4deg);
      filter: url("#vhs-farbsaum") brightness(1.35) contrast(1.3) saturate(0.7);
    }

    65% {
      opacity: 0.75;
      transform: translateX(13px) scaleY(1.03) skewX(3deg);
      filter: url("#vhs-farbsaum") brightness(1.7) contrast(1.6) saturate(0.4);
    }

    100% {
      opacity: 0;
      transform: translateX(-5px) scaleY(1.05);
      filter: url("#vhs-farbsaum") brightness(2) contrast(1.8) saturate(0.2);
    }
  }

  @keyframes vhs-rein {
    0% {
      opacity: 0.25;
      transform: translateX(16px) skewX(-3deg);
      filter: url("#vhs-farbsaum") brightness(1.8) contrast(1.6) saturate(0.3);
      -webkit-mask-position: 0 100%, 0 0;
      mask-position: 0 100%, 0 0;
    }

    25% {
      opacity: 0.85;
      transform: translateX(-8px) skewX(2deg);
      filter: url("#vhs-farbsaum") brightness(1.3) contrast(1.3) saturate(0.6);
    }

    45% {
      transform: translateX(5px);
      filter: url("#vhs-farbsaum-leicht") brightness(1.15) saturate(0.85);
    }

    70% {
      transform: translateX(-2px);
      filter: url("#vhs-farbsaum-leicht") brightness(1.05);
      -webkit-mask-size: 100% 250%, 100% 4px;
      mask-size: 100% 250%, 100% 4px;
    }

    /* Zum Schluss werden die Spurlinien so breit, dass der dunkle Streifen unter dem Bildrand liegt. */
    100% {
      opacity: 1;
      transform: none;
      filter: none;
      -webkit-mask-position: 0 0, 0 0;
      mask-position: 0 0, 0 0;
      -webkit-mask-size: 100% 250%, 100% 400%;
      mask-size: 100% 250%, 100% 400%;
    }
  }

  /* Rauschen springt in Stufen, damit es flackert statt zu gleiten. */
  @keyframes vhs-rauschen {
    0% {
      background-position: 0 0, 0 0;
    }

    12% {
      background-position: -137px 41px, 0 0;
    }

    25% {
      background-position: 89px -73px, 0 0;
    }

    37% {
      background-position: -211px 17px, 0 0;
    }

    50% {
      background-position: 53px 96px, 0 0;
    }

    62% {
      background-position: -64px -29px, 0 0;
    }

    75% {
      background-position: 171px 58px, 0 0;
    }

    87% {
      background-position: -23px -88px, 0 0;
    }
  }

  @keyframes vhs-deck-raus {
    to {
      opacity: 0;
      transform: translateY(24px);
    }
  }

  /* Anzeige: flackert an, steht, verlischt zum Ende des Übergangs. */
  @keyframes vhs-osd {
    0% {
      opacity: 0;
    }

    6% {
      opacity: 1;
    }

    10% {
      opacity: 0.35;
    }

    16%,
    78% {
      opacity: 1;
    }

    100% {
      opacity: 0;
    }
  }

  /* Kopfumschaltung: der Streifen springt seitlich hin und her und flimmert, am Ende ist er weg. */
  @keyframes vhs-kopf {
    0% {
      opacity: 1;
      transform: translateX(-14px) scaleY(1);
    }

    10% {
      transform: translateX(11px) scaleY(1.4);
    }

    20% {
      opacity: 0.7;
      transform: translateX(-6px) scaleY(0.8);
    }

    30% {
      opacity: 1;
      transform: translateX(16px) scaleY(1.2);
    }

    40% {
      transform: translateX(-10px) scaleY(1);
    }

    50% {
      opacity: 0.8;
      transform: translateX(7px) scaleY(1.3);
    }

    60% {
      opacity: 1;
      transform: translateX(-13px) scaleY(0.9);
    }

    70% {
      transform: translateX(4px) scaleY(1.1);
    }

    80% {
      opacity: 0.6;
      transform: translateX(-3px) scaleY(0.7);
    }

    90%,
    100% {
      opacity: 0;
      transform: none;
    }
  }
}

/*
 * ------------------------------------------------------------ Bühne mit dezenter Bewegung (Issue #48)
 *
 * Das Handy lädt kein Hintergrundvideo (Datenvolumen). Statt dessen bewegt sich das Deko-Bild kaum
 * merklich, nur CSS, ohne zusätzliche Requests:
 * - Zoom: das Bild wird über 28 s um 4 % größer und driftet leicht nach links, dann zurück.
 * - Schimmer: feine Zeilen wie auf einer Röhre, dazu alle 11 s ein heller, weicher Balken von oben nach unten.
 * - Details je Seite (body-Klasse aus functions.php): REC/FEATURES die rote Lampe links unten blinkt
 *   wie eine Aufnahme-LED, PLAY die Glasröhren glühen warm, ON/OFF das Gerät flackert beim Laden an.
 * Die Details liegen in Prozent auf der Handy-Fassung des Deko-Bilds (736 × 414, bis 736 px Breite).
 * Außer Sicht hält assets/js/mobil.js alles an (.stage.is-ruhend), bei „Bewegung reduzieren“ entfällt alles.
 */
@media (max-width: 767px) and (prefers-reduced-motion: no-preference) {
  .stage__media {
    transform-origin: 50% 0;
    animation: buehne-zoom 28s ease-in-out infinite alternate;
  }

  /* Zeilen und Schimmer nur über dem Bild (Fläche im Seitenverhältnis des Deko-Bilds), unter Schriftzug und Pfeil. */
  .stage::after {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    width: 100%;
    aspect-ratio: var(--stage-image-ratio, 16 / 9);
    background:
      linear-gradient(transparent, rgba(255, 255, 255, 0.16) 45%, rgba(255, 255, 255, 0.16) 55%, transparent) 0 -67% / 100% 40% no-repeat,
      repeating-linear-gradient(rgba(0, 0, 0, 0.16) 0 1px, transparent 1px 3px);
    /* Überlagern statt Übermalen: Schwarz bleibt schwarz, nur das Bild bekommt Zeilen und Schimmer. */
    mix-blend-mode: overlay;
    pointer-events: none;
    content: '';
    animation: buehne-schimmer 11s linear infinite;
  }

  .stage.is-ruhend .stage__media,
  .stage.is-ruhend .stage__media::before,
  .stage.is-ruhend::after {
    animation-play-state: paused;
  }

  /* ON/OFF: einmal beim Laden kurz anflackern wie ein altes Gerät, das warm wird. */
  .buehne-start .stage__media {
    animation:
      buehne-einschalten 1.1s ease-out both,
      buehne-zoom 28s ease-in-out infinite alternate;
  }

  @keyframes buehne-zoom {
    to {
      transform: scale(1.04) translateX(-1%);
    }
  }

  /* Balken läuft in gut der Hälfte der Zeit durch, danach Ruhe. */
  @keyframes buehne-schimmer {
    0% {
      background-position: 0 -67%, 0 0;
    }

    55%,
    100% {
      background-position: 0 167%, 0 0;
    }
  }

  @keyframes buehne-einschalten {
    0% {
      opacity: 0;
      filter: brightness(1.6);
    }

    12% {
      opacity: 0.55;
    }

    20% {
      opacity: 0.1;
    }

    34% {
      opacity: 0.8;
    }

    42% {
      opacity: 0.35;
    }

    60% {
      opacity: 1;
      filter: brightness(1.25);
    }

    100% {
      opacity: 1;
      filter: none;
    }
  }
}

@media (max-width: 736px) and (prefers-reduced-motion: no-preference) {
  /* Leuchten über dem Bild, so groß wie das Bild (736 × 414), wandert mit dem Zoom mit. */
  .buehne-rec .stage__media::before,
  .buehne-rec-ton .stage__media::before,
  .buehne-play .stage__media::before {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    width: 100%;
    aspect-ratio: 736 / 414;
    mix-blend-mode: screen;
    pointer-events: none;
    content: '';
  }

  /* REC: die rote Lampe links unten (28 % / 52,7 % der Bildbreite) blinkt ruhig. */
  .buehne-rec .stage__media::before,
  .buehne-rec-ton .stage__media::before {
    background: radial-gradient(4.2% 7.5% at 28% 93.6%, rgba(255, 92, 70, 0.85), rgba(255, 50, 36, 0.35) 45%, transparent);
    animation: buehne-rec-lampe 2.4s ease-in-out infinite;
  }

  /* PLAY: die vier Glasröhren glühen warm am Heizfaden und atmen leicht; dahinter ein Hauch Wärme auf dem Chassis. */
  .buehne-play .stage__media::before {
    background:
      radial-gradient(1.8% 5% at 34% 58%, rgba(255, 140, 50, 0.85), rgba(255, 100, 30, 0.3) 50%, transparent),
      radial-gradient(1.8% 5% at 44.2% 58%, rgba(255, 140, 50, 0.85), rgba(255, 100, 30, 0.3) 50%, transparent),
      radial-gradient(2.4% 7% at 59.2% 55%, rgba(255, 140, 50, 0.85), rgba(255, 100, 30, 0.3) 50%, transparent),
      radial-gradient(2.4% 7% at 65.6% 55%, rgba(255, 140, 50, 0.85), rgba(255, 100, 30, 0.3) 50%, transparent),
      radial-gradient(22% 20% at 50% 56%, rgba(255, 130, 50, 0.12), transparent);
    animation: buehne-roehren 6s ease-in-out infinite;
  }

  @keyframes buehne-rec-lampe {
    0%,
    100% {
      opacity: 0.15;
    }

    30%,
    60% {
      opacity: 1;
    }
  }

  @keyframes buehne-roehren {
    0%,
    100% {
      opacity: 0.6;
    }

    48% {
      opacity: 1;
    }

    52% {
      opacity: 0.85;
    }

    56% {
      opacity: 1;
    }
  }
}

/*
 * ------------------------------------------------------------ VHS: Videokassetten (Issue #49)
 *
 * Oben die Anlage als Foto (assets/images/vhs-anlage.webp): ein alter Röhrenfernseher, darunter ein
 * Videorekorder. Das Foto des Fernsehers ist lizenzfrei (vom Nutzer bereitgestellt), Markenschriftzüge
 * sind entfernt, der Rekorder ist in Farbe und Körnung des Fotos dazugezeichnet. Darauf liegen die
 * echten Elemente, in Prozent des Fotos (770 × 949 px) gesetzt: in der Röhre der Bildschirm
 * (.vhs-monitor mit den Videos des Eltern-Themes, immer nur das der eingelegten Kassette, in 16:9
 * mit schwarzen Balken), am Rekorder Schacht, Anzeige, VOLLBILD und Auswurftaste. Unten das Regal mit
 * den Kassetten als Rücken mit Etikett. Einlegen/Auswerfen: assets/js/videokassetten.js.
 */
@media (max-width: 767px) {
  .page-content--vhs {
    padding-bottom: 34px;
  }

  .vhs-anlage {
    max-width: 420px;
    margin: 0 auto;
  }

  .vhs-geraet {
    position: relative;
    aspect-ratio: 770 / 949;
    background: url('../images/vhs-anlage.webp') 0 0 / 100% 100% no-repeat;
  }

  /* ---------- Bildschirm: die Röhre (99/101 bis 667/526 px im Foto) */

  .vhs-monitor {
    position: absolute;
    top: 10.643%;
    left: 12.857%;
    width: 73.766%;
    height: 44.784%;
    overflow: hidden;
    border-radius: 7% / 9.4%;
  }

  .vhs-anlage .vhs {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    padding: 0;
    background: transparent;
  }

  .hat-kassette .vhs {
    background: #050605;
  }

  /* Nur das Video der eingelegten Kassette, so breit wie die Röhre, in 16:9. */
  .vhs-anlage .vhs__video {
    position: relative;
    display: none;
    flex: none;
    width: 100%;
    aspect-ratio: 16 / 9;
    margin: 0;
  }

  .vhs-anlage .vhs__video.is-eingelegt {
    display: block;
    animation: vhs-bild-an 0.5s 0.25s ease-out both;
  }

  .vhs-anlage .vhs__hinweis {
    padding: 6px 9px;
    font-size: 10px;
  }

  /* Leere Röhre: feine Zeilen, Kanal oben links, Hinweis in der Mitte wie die Bildschirmanzeige eines Rekorders. */
  .vhs-monitor__leer {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
      repeating-linear-gradient(rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 3px),
      radial-gradient(ellipse at 50% 45%, rgba(26, 28, 26, 0.55), rgba(7, 8, 7, 0.88) 78%);
    color: var(--autark-light);
    pointer-events: none;
    transition: opacity 0.25s;
  }

  .vhs-monitor__kanal {
    position: absolute;
    top: 12%;
    left: 9%;
    color: var(--mobil-led-an);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-shadow: 0 0 6px rgba(184, 224, 124, 0.5);
  }

  .vhs-monitor__text {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    opacity: 0.85;
    animation: vhs-blinken 2.4s steps(1) infinite;
  }

  .vhs-monitor__text::after {
    display: block;
    margin-top: 6px;
    font-size: 9px;
    text-align: center;
    content: '\25BC';
    opacity: 0.7;
  }

  .hat-kassette .vhs-monitor__leer {
    opacity: 0;
  }

  /* Glanz auf dem Glas, über allem, ohne Klicks zu fangen. */
  .vhs-monitor::before {
    position: absolute;
    inset: 0;
    z-index: 3;
    border-radius: inherit;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.06), transparent 38%);
    box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.75);
    pointer-events: none;
    content: '';
  }

  /* Suchlauf nach dem Einlegen: Rauschen und ein durchlaufender Balken, dann steht das Bild. */
  .vhs-monitor.is-suchlauf::after {
    position: absolute;
    inset: 0;
    z-index: 2;
    background:
      linear-gradient(transparent 0 40%, rgba(230, 232, 222, 0.35) 46%, rgba(230, 232, 222, 0.1) 52%, transparent 58%) 0 0 / 100% 250% no-repeat,
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='r'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .86 0 0 0 0 .87 0 0 0 0 .82 2.2 0 0 0 -.9'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23r)'/%3E%3C/svg%3E")
        0 0 / 320px 80px,
      #050505;
    pointer-events: none;
    content: '';
    animation: vhs-suchlauf 0.75s linear both;
  }

  /* ---------- Videorekorder (35/699 bis 735/949 px im Foto, also 700 × 250) */

  .vhs-rekorder {
    position: absolute;
    top: 73.656%;
    left: 4.545%;
    display: block;
    width: 90.909%;
    height: 26.344%;
  }

  /* Schacht (40/30 bis 392/84 im Rekorder): darin die Klappe, die beim Einlegen nach innen kippt. */
  .vhs-rekorder__schacht {
    position: absolute;
    top: 12%;
    left: 5.714%;
    box-sizing: border-box;
    width: 50.286%;
    height: 21.6%;
    padding: 3px;
    perspective: 120px;
  }

  .vhs-rekorder__klappe {
    display: block;
    height: 100%;
    border-radius: 1px;
    background:
      repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 3px),
      linear-gradient(#2a221d, #17120f);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 1px 2px rgba(0, 0, 0, 0.7);
    transform-origin: 50% 0;
    transition: transform 0.25s ease-in, filter 0.25s;
  }

  .is-schluckt .vhs-rekorder__klappe {
    transform: rotateX(-62deg);
    filter: brightness(0.45);
  }

  /* Kassette drin: Klappe zu, durch den Spalt schimmert das Etikett. */
  .hat-kassette .vhs-rekorder__schacht {
    background: linear-gradient(transparent 0 72%, rgba(218, 222, 208, 0.25) 72% 84%, transparent 84%);
  }

  /*
   * Untere Reihe (40/110 bis 670/224 im Rekorder): Anzeige im dunklen Fenster des Fotos, rechts in der
   * Mulde die beiden Tasten.
   */
  .vhs-rekorder__leiste {
    position: absolute;
    top: 44%;
    left: 5.714%;
    display: grid;
    grid-template-columns: 55.873% 6.984% 17.46% 1.27% 17.46%;
    align-items: center;
    width: 90%;
    height: 45.6%;
  }

  /* Anzeige: grüne Leuchtschrift wie die LEDs der Tasten; ohne Kassette dunkel. */
  .vhs-rekorder__anzeige {
    display: flex;
    grid-column: 1;
    align-items: center;
    gap: 8px;
    box-sizing: border-box;
    min-width: 0;
    height: 93%;
    margin: 0;
    padding: 0 8px;
    background: repeating-linear-gradient(rgba(255, 255, 255, 0.02) 0 1px, transparent 1px 2px);
    color: rgba(184, 224, 124, 0.32);
    font-size: 10px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
  }

  .vhs-rekorder__zustand {
    flex: none;
  }

  .vhs-rekorder__titel {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    color: var(--autark-light);
    font-size: 11px;
    letter-spacing: 0.06em;
    text-overflow: ellipsis;
    text-align: right;
  }

  .hat-kassette .vhs-rekorder__anzeige {
    color: var(--mobil-led-an);
    text-shadow: 0 0 6px rgba(184, 224, 124, 0.55);
  }

  .is-laeuft .vhs-rekorder__zustand::before {
    margin-right: 5px;
    content: '\25B6';
  }

  /* Auswurftaste und VOLLBILD (Issue #57) wie die Laufwerkstasten des Kassettendecks. */
  .vhs-rekorder__vollbild {
    grid-column: 3;
  }

  .vhs-rekorder__auswurf {
    grid-column: 5;
  }

  .vhs-rekorder__auswurf,
  .vhs-rekorder__vollbild {
    position: relative;
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 100%;
    height: 89.5%;
    min-height: 40px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 2px 2px 4px 4px;
    background: linear-gradient(#352c26, #221c18 55%, #18130f);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.09),
      inset 0 -2px 0 rgba(0, 0, 0, 0.45),
      0 3px 0 #050505,
      0 4px 6px rgba(0, 0, 0, 0.6);
    color: var(--autark-light);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition:
      transform 0.09s ease-out,
      box-shadow 0.09s ease-out,
      opacity 0.15s;
  }

  .vhs-rekorder__auswurf svg {
    margin-top: 4px;
    fill: currentColor;
    opacity: 0.72;
  }

  /* VOLLBILD ohne LED: vier Ecken als Symbol. */
  .vhs-rekorder__vollbild svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.72;
  }

  .vhs-rekorder__led {
    position: absolute;
    top: 5px;
    left: 50%;
    width: 10px;
    height: 3px;
    margin-left: -5px;
    border-radius: 2px;
    background: #0c0c0c;
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.8), 0 1px 0 rgba(255, 255, 255, 0.05);
    transition: background-color 0.15s, box-shadow 0.15s;
  }

  .hat-kassette .vhs-rekorder__led {
    background: var(--mobil-led-an);
    box-shadow: 0 0 6px rgba(184, 224, 124, 0.75), 0 0 1px var(--mobil-led-an);
  }

  .vhs-rekorder__auswurf:active:not(:disabled),
  .vhs-rekorder__vollbild:active:not(:disabled) {
    transform: translateY(4px);
    box-shadow:
      inset 0 2px 4px rgba(0, 0, 0, 0.8),
      0 0 0 #050505;
  }

  .vhs-rekorder__auswurf:disabled,
  .vhs-rekorder__vollbild:disabled {
    cursor: default;
    opacity: 0.4;
  }

  .vhs-rekorder__auswurf:focus-visible,
  .vhs-rekorder__vollbild:focus-visible {
    outline: 2px solid var(--autark-light);
    outline-offset: 2px;
  }

  /* ---------- Regal mit Kassetten (Rücken nach vorn) */

  .vhs-regal {
    display: grid;
    gap: 8px;
    margin: 26px 0 0;
    padding: 0;
    list-style: none;
  }

  /* Fach: leere Mulde, sichtbar, solange die Kassette im Rekorder steckt. */
  .vhs-regal__fach {
    border-radius: 5px;
    background: linear-gradient(#060606, #0d0d0d);
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.9), 0 1px 0 rgba(255, 255, 255, 0.04);
  }

  .vhs-kassette {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    box-sizing: border-box;
    width: 100%;
    height: 56px;
    margin: 0;
    padding: 6px 10px 6px 14px;
    border: 0;
    border-radius: 4px;
    /* Schwarzer Kunststoff, an den Enden die Griffrillen des Gehäuses. */
    background:
      repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 3px) 3px 50% / 7px 70% no-repeat,
      repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 3px) calc(100% - 3px) 50% / 7px 70% no-repeat,
      linear-gradient(#232322, #141413 60%, #0e0e0d);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.08),
      inset 0 -1px 0 rgba(0, 0, 0, 0.6),
      0 3px 0 #050505,
      0 5px 10px rgba(0, 0, 0, 0.6);
    color: #161616;
    font: inherit;
    text-align: left;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: transform 0.12s ease-out, box-shadow 0.12s ease-out;
  }

  .vhs-kassette:active {
    transform: translateY(2px);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.06),
      0 1px 0 #050505,
      0 2px 4px rgba(0, 0, 0, 0.6);
  }

  .vhs-kassette:focus-visible {
    outline: 2px solid var(--autark-light);
    outline-offset: 2px;
  }

  .vhs-kassette.is-unterwegs {
    z-index: 5;
    pointer-events: none;
  }

  .vhs-kassette.is-im-rekorder {
    visibility: hidden;
  }

  /* Etikett: helles Papier wie auf der Musikkassette, links ein Standbild aus dem Video. */
  .vhs-kassette__etikett {
    position: relative;
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    gap: 9px;
    box-sizing: border-box;
    min-width: 0;
    height: 100%;
    padding: 4px 10px 4px 4px;
    border-radius: 2px;
    background: var(--autark-light);
    box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.25);
  }

  /* Zwei Streifen unten, rot wie die REC-Taste – wie auf dem Etikett im Kassettendeck. */
  .vhs-kassette__etikett::after {
    position: absolute;
    right: 10px;
    bottom: 5px;
    left: 66px;
    height: 4px;
    background: linear-gradient(#c8433a 0 2px, transparent 2px 3px, rgba(22, 22, 22, 0.35) 3px 4px);
    content: '';
  }

  .vhs-kassette__bild {
    flex: none;
    width: 52px;
    height: 100%;
    border-radius: 1px;
    background: #111 var(--etikett) 50% / cover no-repeat;
    filter: saturate(0.75) contrast(1.05);
  }

  .vhs-kassette__text {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
    padding-bottom: 6px;
    line-height: 1.2;
    text-transform: uppercase;
  }

  /* Bandname wie im Schriftzug, nicht in Großbuchstaben. */
  .vhs-kassette__band {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: none;
    opacity: 0.6;
  }

  .vhs-kassette__titel {
    overflow: hidden;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .vhs-kassette__nr {
    flex: none;
    align-self: flex-start;
    padding-top: 4px;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.04em;
    opacity: 0.6;
  }

  /* Geprägtes Logo auf dem Gehäuse. */
  .vhs-kassette__marke {
    flex: none;
    width: 30px;
    color: #3a3a38;
    font-family: 'Monoton', 'Comfortaa', sans-serif;
    font-size: 13px;
    line-height: 1;
    text-align: center;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.8), 0 -1px 0 rgba(255, 255, 255, 0.05);
  }

  @keyframes vhs-suchlauf {
    0% {
      opacity: 1;
      background-position: 0 100%, 0 0, 0 0;
    }

    25% {
      background-position: 0 60%, -97px 31px, 0 0;
    }

    50% {
      opacity: 0.9;
      background-position: 0 30%, 61px -43px, 0 0;
    }

    75% {
      opacity: 0.55;
      background-position: 0 10%, -149px 17px, 0 0;
    }

    100% {
      opacity: 0;
      background-position: 0 0, 37px 59px, 0 0;
    }
  }

  @keyframes vhs-bild-an {
    from {
      opacity: 0;
      filter: brightness(1.6) contrast(1.3) saturate(0.3);
    }

    to {
      opacity: 1;
      filter: none;
    }
  }

  @keyframes vhs-blinken {
    0%,
    70% {
      opacity: 0.8;
    }

    85% {
      opacity: 0.25;
    }
  }
}

/*
 * ------------------------------------------------------------ VHS: Vollbild und Kinomodus (Issue #57)
 *
 * Die Klassen setzt nur die Taste VOLLBILD (assets/js/videokassetten.js), die es nur auf dem Handy
 * gibt. Trotzdem außerhalb der Media-Query: Quer gehalten ist das Handy oft breiter als 767 px.
 * is-vollbild gilt für echtes Vollbild (Fullscreen-API) und Kinomodus, is-kino nur für den Kinomodus
 * (fest über der Seite, die Seite dahinter scrollt nicht). Schwarzer Grund, das Video in 16:9 mittig,
 * Safe-Area frei, oben rechts „Schließen“. Ohne Animation.
 */
.vhs-monitor.is-vollbild {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  border-radius: 0;
  background: #000;
  box-shadow: none;
}

html:has(.vhs-monitor.is-kino),
html:has(.vhs-monitor.is-kino) body {
  overflow: hidden;
}

.vhs-monitor.is-vollbild::before,
.vhs-monitor.is-vollbild::after,
.vhs-monitor.is-vollbild .vhs-monitor__leer {
  display: none;
}

.vhs-monitor.is-vollbild .vhs {
  position: relative;
  flex: none;
  width: min(100%, calc((100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) * 16 / 9));
  max-width: none;
  height: auto;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  margin: 0;
  padding: 0;
  border-radius: 0;
  background: #000;
  box-shadow: none;
}

.vhs-monitor.is-vollbild .vhs__video {
  position: absolute;
  inset: 0;
  display: none;
  margin: 0;
}

.vhs-monitor.is-vollbild .vhs__video.is-eingelegt {
  display: block;
}

.vhs-monitor.is-vollbild .vhs-monitor__schliessen {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  right: calc(env(safe-area-inset-right, 0px) + 10px);
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 7px;
  box-sizing: border-box;
  min-width: 44px;
  height: 44px;
  margin: 0;
  padding: 0 13px;
  border: 1px solid rgba(218, 222, 208, 0.22);
  border-radius: 4px;
  background: rgba(12, 12, 12, 0.72);
  color: var(--autark-light);
  font: 700 11px/1 'Comfortaa', sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.vhs-monitor.is-vollbild .vhs-monitor__schliessen svg {
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
}

.vhs-monitor.is-vollbild .vhs-monitor__schliessen:focus-visible {
  outline: 2px solid var(--autark-light);
  outline-offset: 2px;
}

/* Quer neben dem Video wenig Platz: nur das Kreuz. */
@media (orientation: landscape) {
  .vhs-monitor.is-vollbild .vhs-monitor__schliessen {
    justify-content: center;
    padding: 0;
  }

  .vhs-monitor.is-vollbild .vhs-monitor__schliessen-text {
    display: none;
  }
}

/*
 * ------------------------------------------------------------ Wischen: PLAY und PAUSE (Issue #50)
 *
 * PLAY ab zwei Terminen: ein waagerechtes Band (CSS Scroll Snap), je Termin eine Karte aus dem
 * Blech des Kassettendecks; die nächste Karte schaut rechts herein. Darüber Zurück/Weiter und das
 * Zählwerk „1/3“ wie am Deck (assets/js/termine.js). PAUSE: In der Vergrößerung wischt WordPress
 * selbst zum nächsten/vorherigen Foto (Core, Wischen über 50 px); hier bekommen die Knöpfe die Form der Laufwerkstasten und
 * dazwischen steht das Zählwerk „2/6“ (assets/js/fotos.js), das neue Foto gleitet aus der Wischrichtung herein.
 */
@media (max-width: 767px) {
  /* ---------- PLAY */

  .termine__wischen {
    /* Bis an den Bildschirmrand, die Karten selbst stehen in der Spalte der Seite (35 px Rand). */
    --termine-rand: 35px;
    margin-inline: calc(-1 * var(--termine-rand));
  }

  .termine__band {
    position: relative;
    display: flex;
    /* Jede Karte so hoch wie ihr Inhalt; das Band wird so hoch wie die höchste. */
    align-items: flex-start;
    gap: 12px;
    padding: 4px var(--termine-rand) 30px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--termine-rand);
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .termine__band::-webkit-scrollbar {
    display: none;
  }

  .termine__band:focus-visible {
    outline: 2px solid var(--autark-light);
    outline-offset: -2px;
  }

  .termine__band > .termin {
    display: flex;
    flex: 0 0 100%;
    flex-direction: column;
    box-sizing: border-box;
    min-width: 0;
    margin: 0;
    padding: 14px 14px 16px;
    border: 1px solid rgba(218, 222, 208, 0.1);
    border-radius: 6px;
    background:
      repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 3px),
      linear-gradient(#1a1a19, #0f0f0e);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.06),
      0 3px 0 #050505,
      0 10px 20px rgba(0, 0, 0, 0.6);
    scroll-snap-align: start;
    scroll-snap-stop: always;
    transition: opacity 0.3s ease-out;
  }

  /* Die Karte daneben tritt zurück, bis sie hereingewischt ist. */
  .js .termine__band > .termin:not(.is-aktiv) {
    opacity: 0.45;
  }

  .termine__band .termin__flyer {
    margin: 0 0 22px;
  }

  /* Hochformat-Flyer nicht höher als gut die Hälfte des Bildschirms, damit die Karten ähnlich hoch bleiben. */
  .termine__band .termin__flyer-bild {
    width: auto;
    max-width: 100%;
    max-height: 56vh;
    margin-inline: auto;
    border-radius: 3px;
  }

  .termine__band .termin__titel {
    margin-bottom: 14px;
    font-size: 28px;
    line-height: 1.4;
    text-align: left;
  }

  .termine__band .termin__datum {
    margin-bottom: 14px;
    font-size: 19px;
    text-align: left;
  }

  .termine__band .termin__ort,
  .termine__band .termin__uhrzeit {
    margin-bottom: 16px;
    text-align: left;
  }

  .termine__band .termin__link {
    margin: 0;
    padding-top: 4px;
  }

  .js .termine__bedienung {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 0 0 12px;
  }

  .termine__knopf,
  .hat-fotos .wp-lightbox-overlay .wp-lightbox-navigation-button {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 56px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 3px 3px 5px 5px;
    background: linear-gradient(#2c2c2b, #1b1b1a 55%, #151514);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.09),
      inset 0 -2px 0 rgba(0, 0, 0, 0.45),
      0 3px 0 #050505,
      0 4px 6px rgba(0, 0, 0, 0.6);
    color: var(--autark-light);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition:
      transform 0.09s ease-out,
      box-shadow 0.09s ease-out,
      opacity 0.15s;
  }

  .termine__knopf svg {
    fill: currentColor;
    opacity: 0.72;
  }

  .termine__knopf:active:not(:disabled),
  .hat-fotos .wp-lightbox-overlay .wp-lightbox-navigation-button:active {
    transform: translateY(4px);
    box-shadow:
      inset 0 2px 4px rgba(0, 0, 0, 0.8),
      0 0 0 #050505;
  }

  .termine__knopf:disabled {
    cursor: default;
    opacity: 0.35;
  }

  .termine__knopf:focus-visible,
  .hat-fotos .wp-lightbox-overlay .wp-lightbox-navigation-button:focus-visible {
    outline: 2px solid var(--autark-light);
    outline-offset: 2px;
  }

  /* Zählwerk wie am Kassettendeck: vertieftes, schwarzes Fenster, Ziffern in Monoton. */
  .termine__zaehlwerk,
  .fotos-zaehlwerk {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-width: 104px;
    height: 38px;
    margin: 0;
    padding: 0 14px;
    border-radius: 4px;
    background: linear-gradient(#040404, #0c0c0c);
    box-shadow:
      inset 0 2px 4px rgba(0, 0, 0, 0.9),
      inset 0 -1px 0 rgba(255, 255, 255, 0.04),
      0 1px 0 rgba(255, 255, 255, 0.05);
    color: var(--autark-light);
    font-family: 'Monoton', 'Comfortaa', sans-serif;
    font-size: 22px;
    line-height: 1;
    letter-spacing: 0.06em;
    text-shadow: 0 0 10px rgba(218, 222, 208, 0.3);
    white-space: nowrap;
  }

  /* ---------- PAUSE: Vergrößerung */

  /* Knöpfe unten als Laufwerkstasten, das Zählwerk mittig dazwischen. */
  .hat-fotos .wp-lightbox-overlay .wp-lightbox-navigation-button-prev,
  .hat-fotos .wp-lightbox-overlay .wp-lightbox-navigation-button-next {
    position: absolute;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 22px);
    padding: 0;
  }

  .hat-fotos .wp-lightbox-overlay .wp-lightbox-navigation-button-prev {
    left: calc(env(safe-area-inset-left, 0px) + 20px);
  }

  .hat-fotos .wp-lightbox-overlay .wp-lightbox-navigation-button-next {
    right: calc(env(safe-area-inset-right, 0px) + 20px);
  }

  /* Gegen die Inline-Stile und Hover-Regeln von WordPress (background: none). */
  .hat-fotos .wp-lightbox-overlay .wp-lightbox-navigation-button:is(:hover, :focus, :not(:hover):not(:active):not(.has-background)) {
    padding: 0;
    background: linear-gradient(#2c2c2b, #1b1b1a 55%, #151514);
  }

  .hat-fotos .wp-lightbox-overlay .wp-lightbox-navigation-button svg {
    width: 24px;
    height: 24px;
    opacity: 0.8;
  }

  /* Steht neben der Lightbox im body (fotos.js), über ihr; sichtbar nur, solange sie offen ist. */
  .fotos-zaehlwerk {
    position: fixed;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 25px);
    left: 50%;
    z-index: 100001;
    translate: -50% 0;
    pointer-events: none;
  }

  .fotos-zaehlwerk[hidden] {
    display: none;
  }
}

@media (max-width: 767px) and (prefers-reduced-motion: no-preference) {
  .termine__band {
    scroll-behavior: smooth;
  }

  /* Neues Foto gleitet aus der Wischrichtung herein (assets/js/fotos.js setzt die Klasse). */
  .fotos-weiter .wp-lightbox-overlay.zoom.active .lightbox-image-container {
    animation: fotos-von-rechts 0.32s cubic-bezier(0.2, 0.8, 0.3, 1);
  }

  .fotos-zurueck .wp-lightbox-overlay.zoom.active .lightbox-image-container {
    animation: fotos-von-links 0.32s cubic-bezier(0.2, 0.8, 0.3, 1);
  }

  @keyframes fotos-von-rechts {
    from {
      opacity: 0;
      translate: 48px 0;
    }
  }

  @keyframes fotos-von-links {
    from {
      opacity: 0;
      translate: -48px 0;
    }
  }
}

@media (max-width: 767px) and (prefers-reduced-motion: reduce) {
  .taste,
  .taste__led,
  .taste__symbol,
  .kassette__seite,
  .deck,
  .deck__kassette,
  .deck__knopf,
  .mc__wickel,
  .vhs-monitor__leer,
  .vhs-rekorder__klappe,
  .vhs-rekorder__auswurf,
  .vhs-rekorder__vollbild,
  .vhs-rekorder__led,
  .vhs-kassette,
  .termine__band > .termin,
  .termine__knopf,
  .hat-fotos .wp-lightbox-overlay .wp-lightbox-navigation-button {
    transition: none;
  }

  /* VHS: Bild steht sofort, kein Suchlauf, kein Blinken. */
  .vhs-anlage .vhs__video.is-eingelegt,
  .vhs-monitor__text,
  .vhs-monitor.is-suchlauf::after {
    animation: none;
  }

  .vhs-monitor.is-suchlauf::after {
    display: none;
  }

  /* Spulen stehen still, das Zählwerk läuft weiter. */
  .mc__spule {
    animation: none;
  }

  .taste:active,
  .taste.is-druck {
    transform: translateY(3px);
  }
}

/*
 * ------------------------------------------------------------ ON/OFF mit quer gehaltenem Handy
 *
 * Quer ist das Handy breiter als 767 px oder knapp darunter; dann gilt (ohne Tastenleiste) das Layout
 * des Eltern-Themes, und der Schriftzug lag mitten auf dem Gerät, „LOW NOISE“ war abgeschnitten
 * (Rückmeldung von Gordon). Nur quer, niedrig und mit Touch: das Gerät links, der Schriftzug rechts
 * daneben, beides ganz im Bild. Hochformat, Tablet und Desktop bleiben unverändert.
 */
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .stage--start {
    min-height: 100vh;
    min-height: 100svh;
  }

  .stage--start::before {
    display: none;
  }

  .stage--start .stage__media {
    right: auto;
    width: 56%;
  }

  .stage--start .stage__image {
    padding: 0 0 0 max(12px, env(safe-area-inset-left, 0px));
    box-sizing: border-box;
    object-position: center;
  }

  .stage--start .stage__content {
    width: 44%;
    max-width: none;
    margin: 0 0 0 56%;
    padding: 0 max(16px, env(safe-area-inset-right, 0px)) 0 4%;
  }

  .stage--start .stage__column {
    padding: 0;
  }

  /* Ab 768 px steht oben links das Hamburger-Menü des Eltern-Themes: Platz lassen. */
  @media (min-width: 768px) {
    .stage--start .stage__image {
      padding-left: max(64px, env(safe-area-inset-left, 0px));
    }
  }

  .stage--start .is-style-autark-schriftzug {
    font-size: clamp(30px, 6.2vw, 56px);
  }

  .stage--start .is-style-autark-gross,
  .stage--start .is-style-autark-gross-duenn {
    margin-bottom: 0.4em;
    font-size: clamp(22px, 4.6vw, 43px);
  }
}
