/*
 * The showroom's page (src/showroom/frame.js): the demo bar and the device
 * around the app. Reads the app's tokens (tokens.css), so the page and the
 * app look like one thing in day and night. Two layouts:
 * - framed (windows from 700 px): the bar with the scenarios, the device
 *   (kiosk or phone) scaled to the space below;
 * - full (a phone: up to 699 px wide or 500 px high, frame.js
 *   pageLayout()): a slim bar, the scenarios in a menu under
 *   "Ausprobieren", the app fills the rest of the screen.
 * The bar never lies over the app: it takes its own space above the
 * frame, the answer to a scenario too while it shows, and the phone's
 * menu only while it is open.
 */

:root {
  /* The device: graphite in both themes, like the kiosk's housing. */
  --sr-bezel: #121417;
  --sr-bezel-edge: #2c3036;
  --sr-device-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
  --sr-page-pad: var(--space-6);
}

/*
 * The intro (intro.js) in the page's own colours (data-tone: the theme it
 * plays in): light by day, the night's dark by night. Its background is the
 * page's surface with a hint of water light where the drop lands, so the
 * intro comes out of the page's colour and goes back into it (review
 * 2026-10-10: a dark intro faded into the day page through a dull grey).
 */
.sr-intro[data-tone="night"],
.sr-intro-backdrop[data-tone="night"],
.sr-intro-fade[data-tone="night"] {
  --sr-i-bg: var(--page-night);
  --sr-i-depth: #0f1722;
  --sr-i-text: #eceef1;
  --sr-i-text-2: #afb5bd;
  --sr-i-drop-top: #a9d6fb;
  --sr-i-drop-bottom: #529fe2;
  --sr-i-ring: #6db5f2;
  --sr-i-rim: #d2eaff;
  --sr-i-rim-opacity: 0.42;
  --sr-i-soft-opacity: 0.06;
  --sr-i-glow: rgba(109, 181, 242, 0.2);
}

.sr-intro[data-tone="day"],
.sr-intro-backdrop[data-tone="day"],
.sr-intro-fade[data-tone="day"] {
  --sr-i-bg: var(--page-day);
  --sr-i-depth: #fbfcfe;
  --sr-i-text: #14181d;
  --sr-i-text-2: #454d57;
  --sr-i-drop-top: #5ca8e8;
  --sr-i-drop-bottom: #1c6cb4;
  --sr-i-ring: #2f82cc;
  --sr-i-rim: #2f82cc;
  --sr-i-rim-opacity: 0.34;
  --sr-i-soft-opacity: 0.05;
  --sr-i-glow: rgba(47, 130, 204, 0.12);
}

:root[data-theme="day"] {
  --sr-bezel: #1c1f23;
  --sr-bezel-edge: #3a3f46;
  --sr-device-shadow: 0 18px 48px rgba(16, 24, 40, 0.22);
}

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

html,
body {
  height: 100%;
  margin: 0;
}

html {
  background: var(--surface-0);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  background: var(--surface-0);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--type-body-size);
  line-height: var(--type-body-line);
  letter-spacing: var(--type-body-tracking);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

p {
  margin: 0;
}

.sr-page {
  position: relative;
  /* Above the intro's background, light, rings and words (z-index 0), under its drop and tap layer (30). */
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

/* ── The bar ─────────────────────────────────────────────────────────── */

/*
 * One calm row (Stephan 2026-10-09: "einfach, Apple style"): the wordmark
 * and its badge on the left, the scenarios in the middle, the view and the
 * reset on the right. The scenarios stand centred over the device while
 * the window allows it (German from 1120 px); below that the shorter side
 * gives way, so one row still holds them down to 1010 px: a kiosk-size
 * window and a tablet held sideways keep the calm single row (review
 * 2026-10-10: two rows took a fifth of a 1024 × 600 window). A window
 * narrower than that gives the scenarios a row of their own under it
 * (German needs 998 px in one row, measured 2026-10-10; English 895 px).
 */
.sr-bar {
  display: grid;
  grid-template-columns: minmax(max-content, 1fr) auto minmax(max-content, 1fr);
  grid-template-areas: "brand actions end";
  align-items: center;
  gap: var(--space-3) var(--space-4);
  padding: var(--space-3) var(--sr-page-pad);
  background: var(--surface-1);
  border-bottom: 1px solid var(--hairline);
}

@media (max-width: 1009px) {
  .sr-bar {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand end"
      "actions actions";
  }
}

/*
 * With "Ersteinrichtung" (Stephan 2026-11-06) the four scenarios need
 * 595 px in German; a kiosk-size window (1024 px) gives the middle 492 px,
 * and the bar broke into three rows, 121 px high. A little narrower here
 * keeps the single calm row: 69 px high, 44 px to spare at 1024 px and
 * about 30 at 1010 (measured 2026-11-06). From 1200 px on (a tablet held
 * sideways) the bar keeps its full size; below 1010 the scenarios have a
 * row of their own as before.
 */
@media (min-width: 1010px) and (max-width: 1199px) {
  .sr-bar {
    padding-inline: var(--space-4);
    column-gap: var(--space-3);
  }

  .sr-bar .sr-button,
  .sr-bar .sr-switch-option {
    padding: 0 10px;
    font-size: 14px;
  }

  .sr-bar .sr-scenarios {
    gap: 6px;
  }
}

.sr-brand {
  grid-area: brand;
  justify-self: start;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.sr-name {
  font-size: var(--type-title3-size);
  line-height: var(--type-title3-line);
  letter-spacing: var(--type-title3-tracking);
  font-weight: var(--weight-semibold);
  /* The wordmark leads to the website (SITE_LINKS.home) and still reads as the wordmark. */
  color: inherit;
  text-decoration: none;
  border-radius: var(--radius-sm);
}

.sr-name:hover {
  opacity: 0.72;
}

.sr-name:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.sr-badge {
  padding: 1px 9px;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  color: var(--text-secondary);
  font-size: var(--type-caption-size);
  line-height: var(--type-caption-line);
  font-weight: var(--weight-medium);
}

.sr-bar-end {
  grid-area: end;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* ── Controls ────────────────────────────────────────────────────────── */

.sr-button,
.sr-switch-option {
  min-height: var(--touch-min);
  padding: 0 var(--space-4);
  border: 0;
  border-radius: var(--radius-full);
  font: inherit;
  font-weight: var(--weight-medium);
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
}

.sr-button {
  background: var(--surface-2);
  color: var(--text-primary);
  transition: background-color var(--duration-fast) var(--ease-standard), opacity var(--duration-fast) var(--ease-standard);
}

.sr-button:hover:not(:disabled) {
  background: var(--fill-hover);
}

.sr-button:active:not(:disabled) {
  transform: scale(var(--press-scale));
}

.sr-button:disabled {
  cursor: default;
  opacity: 0.45;
}

/* The scenario just tapped, while the app answers: it keeps the focus and becomes the story's progress (frame.js). */
.sr-button[aria-disabled="true"] {
  cursor: default;
}

/* The scenario that runs in demo time: says so, and stays readable. */
.sr-button.is-running {
  opacity: 1;
  background: color-mix(in srgb, var(--accent) 20%, var(--surface-2));
}

/* The reset is a quiet word, not a second button beside the view. */
.sr-reset {
  padding: 0 var(--space-3);
  background: transparent;
  color: var(--accent);
}

.sr-button:focus-visible,
.sr-switch-option:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* The view: one capsule; the chosen side is a thumb inset into it (the option keeps its full 44 px). */
.sr-switch {
  display: inline-flex;
  border-radius: var(--radius-full);
  background: var(--surface-2);
}

.sr-switch-option {
  padding: 0 var(--space-4);
  background: transparent;
  color: var(--text-secondary);
}

.sr-switch-option[aria-pressed="true"] {
  background: var(--fill-thumb);
  box-shadow: inset 0 0 0 3px var(--surface-2);
  color: var(--text-primary);
}

.sr-menu-toggle,
.sr-reset-menu {
  display: none;
}

/* ── Scenarios and their answer ──────────────────────────────────────── */

.sr-actions {
  grid-area: actions;
  justify-self: center;
  display: flex;
  justify-content: center;
  min-width: 0;
}

.sr-scenarios {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2);
}

.sr-status {
  min-height: var(--type-body-line);
  margin: var(--space-2) var(--sr-page-pad) 0;
  color: var(--text-secondary);
  text-align: center;
}

/* ── The device ──────────────────────────────────────────────────────── */

/* Its bottom edge is near the legal line under it (.sr-legal-page), which keeps the page's distance to the window's edge. */
.sr-stage {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3) var(--sr-page-pad) var(--space-2);
}

.sr-holder {
  position: relative;
  flex: none;
}

.sr-device {
  position: absolute;
  top: 0;
  left: 0;
  padding: var(--sr-bezel-size);
  border-radius: var(--sr-device-radius);
  background: var(--sr-bezel);
  box-shadow: 0 0 0 1px var(--sr-bezel-edge), var(--sr-device-shadow);
  transform-origin: 0 0;
}

/* Sizes match frame.js DEVICE_SCREENS and DEVICE_BEZELS. */
.sr-device[data-device="kiosk"] {
  --sr-bezel-size: 16px;
  --sr-device-radius: 22px;
}

.sr-device[data-device="phone"] {
  --sr-bezel-size: 12px;
  --sr-device-radius: 38px;
}

.sr-app {
  display: block;
  border: 0;
  background: var(--surface-0);
}

.sr-device[data-device="kiosk"] .sr-app {
  width: 1024px;
  height: 600px;
  border-radius: 6px;
}

/*
 * The screen's corners stay clear of the app: it has no safe-area insets
 * here, its tab bar runs into the corners, and a rounder screen cut off
 * the end of „Einstellungen“ (review 2026-10-09, once no scrollbar took
 * the width any more).
 */
.sr-device[data-device="phone"] .sr-app {
  width: 390px;
  height: 844px;
  border-radius: 26px;
}

/* ── Impressum and Datenschutz ───────────────────────────────────────── */

/*
 * Quiet (Stephan 2026-10-10: nothing extra to read): small secondary text,
 * centred under the device on a window that frames it, at the end of the
 * menu on a phone. Each link's box is 24 px high under the device (WCAG
 * 2.5.8, a pointer's target) and the touch minimum in the phone's menu.
 */
.sr-legal {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  color: var(--text-secondary);
  font-size: var(--type-caption-size);
  line-height: var(--type-caption-line);
  letter-spacing: var(--type-caption-tracking);
}

.sr-legal-link {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-full);
  color: inherit;
  text-decoration: none;
  touch-action: manipulation;
}

.sr-legal-link:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

.sr-legal-link:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.sr-legal-menu {
  display: none;
}

/* ── A running story (story-progress.js, chapters.js) ────────────────── */

/*
 * Its button in the bar becomes its progress (Stephan 2026-10-12): a pause
 * glyph (a play glyph while it stands) and one segment per chapter, the
 * chapters' names over their segments. The current segment fills with a
 * Web Animation of its transform over the chapter's time (story-progress.js);
 * the colours are the button's text, so they read on the bar's glass by day
 * and by night. The button keeps its height; it grows wider by the names.
 */
.sr-story {
  display: none;
  align-items: center;
  gap: var(--space-2);
}

.sr-button[data-story] .sr-button-label {
  display: none;
}

.sr-button[data-story] .sr-story {
  display: flex;
}

.sr-button[data-story] {
  padding: 0 var(--space-4) 0 var(--space-3);
}

.sr-story-glyph {
  display: inline-flex;
  flex: none;
  width: 16px;
  height: 16px;
}

.sr-story-glyph svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.sr-story-play,
.sr-story[data-paused] .sr-story-pause {
  display: none;
}

.sr-story[data-paused] .sr-story-play {
  display: block;
}

.sr-story-chapters {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

.sr-chapter {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 36px;
}

/*
 * Every name in the button's own colour, the current one semibold (review 2026-10-13: the names to come in the
 * secondary grey stood at 3.7 to 4.4:1 on the running button's glass over the garden, under the 4.5:1 of small text;
 * the segments say which chapters are done and which come).
 */
.sr-chapter-name {
  color: var(--text-primary);
  font-size: var(--type-caption-size);
  line-height: 16px;
  letter-spacing: var(--type-caption-tracking);
  font-weight: var(--weight-medium);
  text-align: center;
  white-space: nowrap;
}

.sr-chapter[data-state="current"] .sr-chapter-name {
  font-weight: var(--weight-semibold);
}

.sr-chapter-track {
  display: block;
  height: 3px;
  overflow: hidden;
  border-radius: 2px;
  background: color-mix(in srgb, currentColor 24%, transparent);
}

.sr-chapter-fill {
  display: block;
  height: 100%;
  background: currentColor;
  transform-origin: 0 50%;
  transform: scaleX(0);
}

/*
 * Where the names do not fit beside the other scenarios (one row from 1010 px, measured: the names take about 270 px,
 * „Sonnentag“ 105), the segments alone: the bar keeps its one row, the chapter card names the chapter.
 */
@media (min-width: 1010px) and (max-width: 1259px) {
  .sr-story-named .sr-chapter-name {
    display: none;
  }

  .sr-story-named .sr-chapter {
    min-width: 18px;
  }

  .sr-story-named .sr-story-chapters {
    align-items: center;
    gap: 4px;
  }
}

/* The phone's progress in its bar (frame.css, the phone's part); never on a window that frames the device. */
.sr-story-toggle {
  display: none;
}

/*
 * The bottom line (frame.js .sr-foot): the chapter card (chapters.js) in
 * room of its own, and under it the legal links. The room keeps its height
 * whether a card shows or not, so nothing moves when one comes or goes (it
 * fades in with a lift of 4 px and out again, once per story, no loop), and
 * the legal links stay where they are, visible and reachable. Review
 * 2026-10-12: sharing one cell, a caption hid Impressum and Datenschutz for
 * about 15 s a story (§ 5 DDG: "ständig verfügbar"), and its line box grew
 * the bottom line, which moved the device up for good. The room is the
 * card's title and its sentence (Stephan 2026-10-12: a calm card of two
 * lines instead of one caption line): one line of it where the window is
 * 1000 px wide or more (every sentence fits one there, measured), 20 px
 * more than the caption had, two lines below, 36 px more; a 1440 × 900
 * window still shows the kiosk at full size. A user's long zone name that
 * takes the sentence to a second line on a wide window grows the card
 * upwards, into the stage's margin, never over the legal links.
 */
.sr-foot {
  flex: none;
  display: grid;
  align-items: center;
  justify-items: center;
  padding: 0 var(--sr-page-pad) var(--space-2);
}

.sr-page {
  --sr-card-height: 68px;
}

@media (min-width: 1000px) {
  .sr-page {
    --sr-card-height: 52px;
  }
}

.sr-page[data-layout="framed"] .sr-foot {
  grid-template-rows: var(--sr-card-height) auto;
  row-gap: var(--space-1);
}

/*
 * Under the device the card keeps one width through the story, its words centred, and a new chapter's words come in a
 * swap (frame.js CARD_SWAP_MS; review 2026-10-13: sized to its words, the glass snapped from 600 to 686 to 308 px
 * as the words changed in the same frame).
 */
.sr-page[data-layout="framed"] .sr-card {
  align-self: end;
  width: min(100%, 880px);
}

.sr-page[data-layout="framed"] .sr-card-body {
  flex: 1 1 auto;
}

.sr-foot > * {
  min-width: 0;
}

.sr-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  max-width: min(100%, 880px);
  padding: 7px 18px;
  border-radius: 18px;
  background: var(--sr-caption-bg, var(--surface-1));
  color: var(--sr-caption-text, var(--text-primary));
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity 700ms var(--ease-standard), transform 700ms var(--ease-standard), visibility 0s linear 700ms;
}

.sr-page[data-card="shown"] .sr-card {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity 700ms var(--ease-standard), transform 700ms var(--ease-standard), visibility 0s;
}

.sr-card-body {
  min-width: 0;
}

.sr-card-title {
  font-size: var(--type-body-size);
  line-height: 20px;
  letter-spacing: var(--type-body-tracking);
  font-weight: var(--weight-semibold);
}

.sr-card-text {
  color: var(--sr-caption-text-2, var(--text-secondary));
  font-size: var(--type-caption-size);
  line-height: 18px;
  letter-spacing: var(--type-caption-tracking);
  text-wrap: balance;
}

/* "Heute zeigen": a quiet pill of the card's glass, at its end. */
.sr-card-today {
  flex: none;
  background: rgba(255, 255, 255, 0.16);
  color: inherit;
}

.sr-card-today:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.24);
}

@media (max-width: 999px) {
  .sr-card-title {
    font-size: var(--type-caption-size);
    line-height: 18px;
    letter-spacing: var(--type-caption-tracking);
  }
}

/* Words for a screen reader only (where the story stands, read with each chapter's card). */
.sr-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ── The phone itself: the app fills the screen under a slim bar ─────── */

/* The menu drops down from the bar, over the app, while it is open. */
.sr-page[data-layout="full"] .sr-top {
  position: relative;
  z-index: 10;
}

.sr-page[data-layout="full"] {
  --sr-page-pad: var(--space-4);
}

.sr-page[data-layout="full"] .sr-bar {
  display: flex;
  justify-content: space-between;
  padding: max(var(--space-2), env(safe-area-inset-top)) max(var(--space-4), env(safe-area-inset-right)) var(--space-2)
    max(var(--space-4), env(safe-area-inset-left));
}

/* The app's own header names Tropfwerk right under the bar: the bar keeps its badge only. */
.sr-page[data-layout="full"] .sr-name,
.sr-page[data-layout="full"] .sr-bar-end {
  display: none;
}

.sr-page[data-layout="full"] .sr-menu-toggle {
  display: inline-block;
}

/*
 * It ends at the window's edge at the latest and scrolls (review 2026-10-10:
 * on a phone held sideways under Chrome's bars, 280 px high, Impressum and
 * Datenschutz at its end lay outside the window, out of reach). The
 * percentage is the height of .sr-top above it, which starts at the
 * window's top.
 */
.sr-page[data-layout="full"] .sr-actions {
  position: absolute;
  z-index: 10;
  top: 100%;
  left: 0;
  right: 0;
  display: none;
  flex-direction: column;
  justify-content: flex-start;
  gap: var(--space-3);
  max-height: calc(100vh - 100%);
  max-height: calc(100dvh - 100%);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--space-4) var(--space-4) max(var(--space-4), env(safe-area-inset-bottom));
  background: var(--surface-1);
  border-bottom: 1px solid var(--hairline);
  box-shadow: var(--shadow-2);
}

.sr-page[data-layout="full"] .sr-actions.is-open {
  display: flex;
}

.sr-page[data-layout="full"] .sr-scenarios {
  flex-direction: column;
  align-items: stretch;
}

.sr-page[data-layout="full"] .sr-scenarios .sr-button {
  border-radius: var(--radius-control);
}

.sr-page[data-layout="full"] .sr-reset-menu {
  display: block;
}

.sr-page[data-layout="full"] .sr-legal-page {
  display: none;
}

/*
 * A phone has no room under a device: a story's chapter card stands under
 * the bar, in room of its own that stays while the story runs (the app
 * moves down once when it starts and back once when it ends, not with
 * every chapter), and its progress with its pause in the bar between the
 * badge and the menu (the scenarios' buttons are in the menu there).
 */
.sr-page[data-layout="full"] .sr-top {
  order: 0;
}

.sr-page[data-layout="full"] .sr-foot {
  order: 1;
  display: none;
  /* The title and two lines of 18 px: a phone's narrow line breaks a sentence, and the app should not move with each. */
  min-height: calc(54px + 2 * var(--space-2) + 1px);
  padding: var(--space-2) max(var(--space-4), env(safe-area-inset-right)) var(--space-2) max(var(--space-4), env(safe-area-inset-left));
  background: var(--surface-1);
  border-bottom: 1px solid var(--hairline);
}

.sr-page[data-layout="full"][data-story] .sr-foot {
  display: grid;
}

.sr-page[data-layout="full"] .sr-stage {
  order: 2;
}

/*
 * Away from Today "Heute zeigen" takes the sentence's place, a button of the sentence's two lines (its reach 44 px by
 * its ::before), so the card keeps its room (review 2026-10-13: beside the sentence it took the sentence to four
 * lines, and the app moved 36 px down and back up with it).
 */
.sr-page[data-layout="full"] .sr-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: start;
  justify-self: stretch;
  max-width: none;
  padding: 0;
  border-radius: 0;
  background: none;
  text-align: start;
}

.sr-page[data-layout="full"] .sr-card-body {
  display: contents;
}

.sr-page[data-layout="full"] .sr-card-title {
  grid-area: 1 / 1;
}

.sr-page[data-layout="full"] .sr-card-text,
.sr-page[data-layout="full"] .sr-card-today {
  grid-area: 2 / 1;
}

.sr-page[data-layout="full"] .sr-card[data-away] .sr-card-text {
  visibility: hidden;
}

.sr-page[data-layout="full"] .sr-card-today {
  position: relative;
  align-self: start;
  min-height: 36px;
}

.sr-page[data-layout="full"] .sr-card-today::before {
  content: "";
  position: absolute;
  inset: -4px 0;
}

.sr-page[data-layout="full"] .sr-card-title {
  font-size: var(--type-caption-size);
  line-height: 18px;
  letter-spacing: var(--type-caption-tracking);
}

.sr-page[data-layout="full"] .sr-card-text {
  text-wrap: pretty;
}

.sr-page[data-layout="full"] .sr-card-today {
  background: var(--surface-2);
}

.sr-page[data-layout="full"] .sr-legal-menu {
  display: flex;
}

.sr-page[data-layout="full"] .sr-legal-menu .sr-legal-link {
  min-height: var(--touch-min);
  padding: 0 var(--space-3);
}

.sr-page[data-layout="full"] .sr-story-toggle:not([hidden]) {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  min-width: 0;
  max-width: 220px;
  margin: 0 var(--space-3);
  padding: 0 var(--space-3);
  background: color-mix(in srgb, var(--accent) 16%, var(--surface-2));
}

.sr-page[data-layout="full"] .sr-story-toggle .sr-story-toggle-progress:not([hidden]) {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
}

.sr-page[data-layout="full"] .sr-story-toggle .sr-story {
  display: flex;
  flex: 1 1 auto;
}

.sr-page[data-layout="full"] .sr-story-toggle .sr-story-chapters {
  flex: 1 1 auto;
  align-items: center;
}

.sr-page[data-layout="full"] .sr-story-toggle .sr-chapter {
  flex: 1 1 0;
  min-width: 12px;
}

/*
 * The answer to a scenario takes its own space under the bar while it
 * shows, then goes: the app moves down for it and keeps every control
 * free (review 2026-10-09: over the app it covered the Stopp it names).
 */
.sr-page[data-layout="full"] .sr-status {
  margin: 0;
  padding: var(--space-3) max(var(--space-4), env(safe-area-inset-right)) var(--space-3) max(var(--space-4), env(safe-area-inset-left));
  background: var(--surface-1);
  border-bottom: 1px solid var(--hairline);
  color: var(--text-primary);
  text-align: start;
}

.sr-page[data-layout="full"] .sr-status:empty {
  display: none;
}

/*
 * The app reaches the screen's bottom edge: its tab bar runs under the phone's home indicator, one surface to the
 * edge (backdrop.css; the page tells the app the inset, frame.js .sr-safe-probe). Review 2026-10-13: the stage kept
 * that room itself, a strip of the page's glass that met the tab bar at a visible edge.
 */
.sr-page[data-layout="full"] .sr-stage {
  padding: 0 env(safe-area-inset-right) 0 env(safe-area-inset-left);
  background: var(--surface-1);
}

/* The page's own safe-area-inset-bottom, as frame.js reads it (offsetHeight). */
.sr-safe-probe {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 0;
  height: env(safe-area-inset-bottom, 0px);
  visibility: hidden;
  pointer-events: none;
}

.sr-page[data-layout="full"] .sr-holder,
.sr-page[data-layout="full"] .sr-device {
  position: static;
  width: 100%;
  height: 100%;
  padding: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}

.sr-page[data-layout="full"] .sr-app {
  width: 100%;
  height: 100%;
  border-radius: 0;
}

/* ── The intro (intro.js) ─────────────────────────────────────────────── */

/*
 * While it plays, the page waits: the bar and the device are hidden until
 * their animations bring them in (the device shows inside the ring's
 * circle only); the phone's stage shows the intro's background, not its
 * surface.
 */
.sr-page[data-intro] .sr-top,
.sr-page[data-intro] .sr-holder,
.sr-page[data-intro] .sr-legal-page {
  opacity: 0;
}

/*
 * The legal line follows once everything has taken its place: one
 * transition when the intro ends, none when it starts (the page is laid
 * out before the intro marks it, and the line faded out under the falling
 * drop, seen under load 2026-10-10).
 */
.sr-legal-page {
  transition: opacity var(--duration-slow) var(--ease-standard);
}

.sr-page[data-intro] .sr-legal-page {
  transition: none;
}

.sr-page[data-intro] .sr-stage {
  background: transparent;
}

.sr-page[data-intro] .sr-holder {
  will-change: transform, opacity;
}

/*
 * Under the page (before it, z-index 0): the background, the light, the
 * rings and the words. The device covers them: no ring crosses the app or
 * the words, and the device grows over the words when it takes its place.
 */
.sr-intro-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
}

/* Over the page: the drop, and the layer that takes every tap while it plays (a tap ends it, reaches nothing under it). */
.sr-intro {
  position: fixed;
  inset: 0;
  z-index: 30;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
}

.sr-intro-backdrop > *,
.sr-intro > * {
  position: absolute;
  margin: 0;
  opacity: 0;
  will-change: transform, opacity;
}

.sr-intro-bg,
.sr-intro-fade {
  inset: 0;
  background: radial-gradient(120% 90% at var(--sr-intro-x, 50%) var(--sr-intro-y, 50%), var(--sr-i-depth) 0%, var(--sr-i-bg) 62%);
}

.sr-intro-drop {
  --sr-drop-width: 14px;
  --sr-drop-height: 21px;
  left: var(--sr-intro-x, 50%);
  top: var(--sr-intro-y, 50%);
  width: var(--sr-drop-width);
  height: var(--sr-drop-height);
  margin: calc(-1 * var(--sr-drop-height)) 0 0 calc(var(--sr-drop-width) / -2);
  overflow: visible;
  transform-origin: 50% 100%;
}

.sr-intro-stop-top {
  stop-color: var(--sr-i-drop-top);
}

.sr-intro-stop-bottom {
  stop-color: var(--sr-i-drop-bottom);
}

.sr-intro-ring {
  left: var(--sr-intro-x, 50%);
  top: var(--sr-intro-y, 50%);
  width: var(--sr-intro-ring, 600px);
  height: var(--sr-intro-ring, 600px);
  margin: calc(var(--sr-intro-ring, 600px) / -2) 0 0 calc(var(--sr-intro-ring, 600px) / -2);
}

.sr-intro-ring-clear {
  stop-color: var(--sr-i-ring);
  stop-opacity: 0;
}

.sr-intro-ring-soft {
  stop-color: var(--sr-i-ring);
  stop-opacity: var(--sr-i-soft-opacity);
}

.sr-intro-ring-rim {
  stop-color: var(--sr-i-rim);
  stop-opacity: var(--sr-i-rim-opacity);
}

.sr-intro-glow {
  left: var(--sr-intro-x, 50%);
  top: var(--sr-intro-y, 50%);
  width: var(--sr-intro-glow, 300px);
  height: var(--sr-intro-glow, 300px);
  margin: calc(var(--sr-intro-glow, 300px) / -2) 0 0 calc(var(--sr-intro-glow, 300px) / -2);
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--sr-i-glow), transparent);
}

.sr-intro-name,
.sr-intro-tagline {
  left: 0;
  right: 0;
  padding: 0 var(--space-4);
  text-align: center;
}

.sr-intro-name {
  top: var(--sr-intro-name-top, 20%);
  color: var(--sr-i-text);
  font-size: var(--type-display-s-size);
  line-height: var(--type-display-s-line);
  letter-spacing: var(--type-display-s-tracking);
  font-weight: var(--weight-semibold);
}

/* "Bewässerung. Sparsam. Effizient. Modern." (Stephan 2026-10-10) takes two lines on a phone: balanced, it
   breaks into "Bewässerung. Sparsam." and "Effizient. Modern." instead of leaving "Modern." alone on the
   second (measured at 390 px). intro.js measures the tagline's height, so the device makes room either way. */
.sr-intro-tagline {
  top: var(--sr-intro-tagline-top, 30%);
  text-wrap: balance;
  color: var(--sr-i-text-2);
  font-size: var(--type-title3-size);
  line-height: var(--type-title3-line);
  letter-spacing: var(--type-title3-tracking);
}

/*
 * On a phone the app itself is the device: while it floats, its screen
 * stands off the background with a hairline and a soft shadow, round like
 * its corners (intro.js INTRO_LAYOUT.cornerRadius). In its place at the
 * end both lie outside the window or under the bar, so they go unseen.
 */
.sr-page[data-intro][data-layout="full"] .sr-holder {
  border-radius: 28px;
  box-shadow: 0 0 0 1px var(--hairline), var(--sr-device-shadow);
}

@media (min-width: 900px) and (min-height: 640px) {
  .sr-intro-drop {
    --sr-drop-width: 16px;
    --sr-drop-height: 24px;
  }

  .sr-intro-name {
    font-size: var(--type-display-m-size);
    line-height: var(--type-display-m-line);
    letter-spacing: var(--type-display-m-tracking);
  }
}

/* ── Over the garden (frame.js, ambient/; framed windows only) ─────────── */

/*
 * The garden lies behind the page (ambient.css .amb, fixed to the window);
 * the page lets it through. The bar is glass without a backdrop filter:
 * the garden behind it is out of focus already, so a translucent surface
 * reads as frosted glass for free. Its controls are tints of it. The bar
 * follows the app's theme in 1200 ms, calmer than the app's 600 ms (it is
 * wider), once per change.
 */
:root {
  --sr-glass: rgba(21, 23, 26, 0.64);
  --sr-glass-edge: rgba(255, 255, 255, 0.08);
  --sr-control: rgba(255, 255, 255, 0.1);
  --sr-control-hover: rgba(255, 255, 255, 0.16);
  /* The glass's turn between day and night: slow at its ends, quick through the grey middle, where its words switch. */
  --sr-turn: cubic-bezier(0.72, 0, 0.28, 1);
}

:root[data-theme="day"] {
  --sr-glass: rgba(255, 255, 255, 0.68);
  --sr-glass-edge: rgba(16, 24, 40, 0.08);
  --sr-control: rgba(16, 24, 40, 0.07);
  --sr-control-hover: rgba(16, 24, 40, 0.12);
}

html[data-ambient] {
  background: #0b0c0e;
}

html[data-ambient] body {
  background: transparent;
}

html[data-ambient] .sr-page[data-layout="framed"] .sr-bar {
  background: var(--sr-glass);
  border-bottom-color: var(--sr-glass-edge);
}

/*
 * The words of the bar do not fade with the glass (review 2026-10-12): crossed together, glass and words were both
 * grey in the middle of the turn, every label about half a second unreadable (contrast down to 1.1). The glass and
 * its tints cross over the 1200 ms, slowly at the ends and quickly through the grey middle (--sr-turn); the words
 * switch at once after 600 ms, in that middle: light words on the dark glass until then, dark words on the light
 * glass from then on. Any colour is weak on the grey in passing; measured (tests/e2e/showroom.e2e.mjs), a label is
 * under 2:1 for at most 30 ms of the turn, the blue "Zurücksetzen" for 120 ms, where crossed together each was for
 * about half a second.
 * Every word carries its own colour: one inherited from its parent would switch with a delay of its own after its
 * parent's (the labels turned one after another).
 */
html[data-ambient] .sr-page[data-layout="framed"] .sr-bar {
  transition: background-color 1200ms var(--sr-turn), border-color 1200ms var(--sr-turn);
}

html[data-ambient] .sr-page[data-layout="framed"] .sr-bar .sr-name {
  color: var(--text-primary);
}

html[data-ambient] .sr-page[data-layout="framed"] .sr-bar .sr-name,
html[data-ambient] .sr-page[data-layout="framed"] .sr-bar .sr-badge,
html[data-ambient] .sr-page[data-layout="framed"] .sr-bar .sr-switch,
html[data-ambient] .sr-page[data-layout="framed"] .sr-bar .sr-switch-option {
  transition: background-color 1200ms var(--sr-turn), box-shadow 1200ms var(--sr-turn), color 0s linear 600ms;
}

html[data-ambient] .sr-page[data-layout="framed"] .sr-bar .sr-button {
  transition: background-color 1200ms var(--sr-turn), color 0s linear 600ms, opacity var(--duration-fast) var(--ease-standard);
}

html[data-ambient] .sr-page[data-layout="framed"] .sr-badge,
html[data-ambient] .sr-page[data-layout="framed"] .sr-switch,
html[data-ambient] .sr-page[data-layout="framed"] .sr-button:not(.sr-reset) {
  background: var(--sr-control);
}

html[data-ambient] .sr-page[data-layout="framed"] .sr-button:not(.sr-reset):hover:not(:disabled) {
  background: var(--sr-control-hover);
}

html[data-ambient] .sr-page[data-layout="framed"] .sr-reset {
  background: transparent;
}

html[data-ambient] .sr-page[data-layout="framed"] .sr-switch-option[aria-pressed="true"] {
  box-shadow: inset 0 0 0 3px var(--sr-control);
}

html[data-ambient] .sr-page[data-layout="framed"] .sr-button.is-running,
html[data-ambient] .sr-page[data-layout="framed"] .sr-button.is-running:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 24%, var(--sr-control));
}

/* The answer to a refused scenario: a pill of the bar's glass under it. */
html[data-ambient] .sr-page[data-layout="framed"] .sr-status {
  justify-self: center;
  width: fit-content;
  max-width: calc(100% - 2 * var(--sr-page-pad));
  margin: var(--space-2) auto 0;
  padding: 0 var(--space-3);
  border-radius: var(--radius-full);
  background: var(--sr-glass);
  color: var(--text-primary);
  transition: background-color 1200ms var(--sr-turn), color 0s linear 600ms;
}

html[data-ambient] .sr-page[data-layout="framed"] .sr-status:empty {
  background: transparent;
}

/*
 * The bottom line over the garden: light text on a faint dark pill in both
 * themes, readable on the bright lawn of the day and on the night.
 */
html[data-ambient] .sr-page[data-layout="framed"] {
  --sr-caption-bg: rgba(12, 14, 18, 0.42);
  --sr-caption-text: #ffffff;
  --sr-caption-text-2: rgba(255, 255, 255, 0.86);
}

html[data-ambient] .sr-page[data-layout="framed"] .sr-legal-page {
  width: fit-content;
  padding: 0 var(--space-1);
  border-radius: var(--radius-full);
  background: rgba(12, 14, 18, 0.42);
  color: rgba(244, 246, 248, 0.86);
}

html[data-ambient] .sr-page[data-layout="framed"] .sr-legal-link:hover {
  color: #ffffff;
}

/*
 * A phone's page over the garden (Stephan 2026-10-13: "schade, dass am Handy die Demo-Hintergründe nicht wirklich
 * sichtbar sind"): the garden lies behind the app like a phone's wallpaper. The app's frame and its stage are
 * see-through (the app's own page is, and veils the garden in its own theme, backdrop.css). The bar, the chapter
 * card's band under it and a refusal's answer are glass: a translucent surface that blurs and saturates the garden
 * behind it, dense enough for their words over the garden without a veil (the app's lies under the app only), nearly
 * solid where a browser has no backdrop filter. The menu stays a solid surface: it lies over the app's words.
 */
html[data-ambient] .sr-page[data-layout="full"] {
  --sr-phone-glass: color-mix(in srgb, var(--surface-1) 86%, transparent);
  --sr-phone-glass-filter: blur(24px) saturate(1.8);
}

html[data-ambient] .sr-page[data-layout="full"] .sr-app {
  background: transparent;
}

/* Until the light's photograph has loaded the garden is the page's colour (ambient.css: the night's, behind a device). */
html:has(.sr-page[data-layout="full"]) .amb {
  background: var(--surface-0);
}

html[data-ambient] .sr-page[data-layout="full"] .sr-bar,
html[data-ambient] .sr-page[data-layout="full"] .sr-foot,
html[data-ambient] .sr-page[data-layout="full"] .sr-status {
  background: var(--sr-phone-glass);
  -webkit-backdrop-filter: var(--sr-phone-glass-filter);
  backdrop-filter: var(--sr-phone-glass-filter);
}

html[data-ambient] .sr-page[data-layout="full"] .sr-stage {
  background: transparent;
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  html[data-ambient] .sr-page[data-layout="full"] {
    --sr-phone-glass: color-mix(in srgb, var(--surface-1) 94%, transparent);
  }
}

@media (prefers-reduced-motion: reduce) {
  .sr-button,
  .sr-legal-page,
  .sr-card,
  .sr-page[data-card="shown"] .sr-card {
    transition: none;
  }

  .sr-card {
    transform: none;
  }

  html[data-ambient] .sr-page[data-layout="framed"] .sr-bar,
  html[data-ambient] .sr-page[data-layout="framed"] .sr-bar *,
  html[data-ambient] .sr-page[data-layout="framed"] .sr-status {
    transition: none;
  }

  .sr-button:active:not(:disabled) {
    transform: none;
  }
}

/* ── The tour (tour.js) ──────────────────────────────────────────────── */

/*
 * Stephan 2026-11-06: after the intro a small guide in Apple's style, every
 * visit, with "Tour überspringen". A ring of light around one part of the
 * bar after the other, the rest under a calm veil (the ring's own shadow),
 * and a bubble of frosted glass beside it. Above the intro's layers (30).
 */
.sr-tour {
  position: fixed;
  inset: 0;
  z-index: 40;
}

/* Without a ring (the greeting, a phone's last step) the page behind goes soft and dark, as behind a sheet on iOS
   (Stephan 2026-11-06: "Hintergrund nicht ausgeblendet / verschwommen"). */
.sr-tour[data-ring="none"] {
  background: rgb(0 0 0 / 0.5);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  backdrop-filter: blur(14px) saturate(120%);
}

.sr-tour-ring {
  position: fixed;
  border-radius: 24px;
  box-shadow:
    0 0 0 2px rgb(255 255 255 / 0.9),
    0 0 28px 6px color-mix(in srgb, var(--accent) 50%, transparent),
    0 0 0 200vmax rgb(0 0 0 / 0.5);
  pointer-events: none;
  transition:
    left 420ms cubic-bezier(0.2, 0.8, 0.2, 1),
    top 420ms cubic-bezier(0.2, 0.8, 0.2, 1),
    width 420ms cubic-bezier(0.2, 0.8, 0.2, 1),
    height 420ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.sr-tour[data-ring="none"] .sr-tour-ring {
  display: none;
}

/* The bubble on the device's own content (its last step): the ring veils the app too, so the bubble stands out
   (Stephan 2026-11-06: "5 von 5 unterscheidet sich zu wenig vom Hintergrund"). */
.sr-tour[data-inside] .sr-tour-ring {
  box-shadow:
    0 0 0 2px rgb(255 255 255 / 0.9),
    0 0 28px 6px color-mix(in srgb, var(--accent) 50%, transparent),
    inset 0 0 0 200vmax rgb(0 0 0 / 0.6),
    0 0 0 200vmax rgb(0 0 0 / 0.5);
}

/* An elevated material, a step lighter than the page's surfaces and nearly opaque, with a clear edge: it reads
   against the app's own cards as much as against the veil. */
.sr-tour-bubble {
  --tour-glass: color-mix(in srgb, var(--surface-2) 86%, white 14%);
  position: fixed;
  box-sizing: border-box;
  width: min(330px, calc(100vw - 24px));
  padding: 16px 18px 12px;
  border-radius: 20px;
  background: var(--tour-glass);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  box-shadow: 0 24px 60px rgb(0 0 0 / 0.5), 0 2px 10px rgb(0 0 0 / 0.25), inset 0 0 0 1px rgb(255 255 255 / 0.22);
  color: var(--text-primary);
  opacity: 0;
  transform: translateY(6px) scale(0.98);
  transition:
    opacity 260ms ease-out,
    transform 320ms cubic-bezier(0.2, 0.8, 0.2, 1),
    left 420ms cubic-bezier(0.2, 0.8, 0.2, 1),
    top 420ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.sr-tour-bubble.is-in {
  opacity: 1;
  transform: none;
}

/* The arrow: a small triangle of the bubble's glass, pointing at the ring's centre. */
.sr-tour-bubble[data-arrow]::before {
  content: "";
  position: absolute;
  left: calc(var(--arrow-x, 50%) - 10px);
  width: 20px;
  height: 10px;
  background: var(--tour-glass);
}

.sr-tour-bubble[data-arrow="top"]::before {
  top: -10px;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.sr-tour-bubble[data-arrow="bottom"]::before {
  bottom: -10px;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}

.sr-tour-count {
  margin: 0 0 4px;
  color: var(--text-secondary);
  font-size: var(--type-caption-size);
  line-height: var(--type-caption-line);
  font-weight: var(--weight-medium);
}

.sr-tour-title {
  margin: 0;
  font-size: var(--type-headline-size);
  line-height: 1.3;
  font-weight: var(--weight-semibold);
}

.sr-tour-text {
  margin: 4px 0 0;
  color: var(--text-secondary);
  font-size: var(--type-body-size);
  line-height: 1.4;
}

.sr-tour-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.sr-tour-skip,
.sr-tour-next {
  min-height: var(--touch-min);
  border: 0;
  border-radius: var(--radius-full);
  font: inherit;
  font-weight: var(--weight-semibold);
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
}

.sr-tour-skip {
  padding: 0 var(--space-2);
  background: transparent;
  color: var(--text-secondary);
  font-weight: var(--weight-medium);
}

.sr-tour-next {
  padding: 0 var(--space-5, 20px);
  background: var(--accent);
  color: var(--on-accent);
}

.sr-tour-skip:hover,
.sr-tour-next:hover {
  filter: brightness(1.06);
}

.sr-tour-skip:focus-visible,
.sr-tour-next:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.sr-tour[data-motion="reduced"] .sr-tour-ring,
.sr-tour[data-motion="reduced"] .sr-tour-bubble {
  transition: none;
}

@media (prefers-reduced-motion: reduce) {
  .sr-tour-ring,
  .sr-tour-bubble {
    transition: none;
  }
}
