:root {
  color-scheme: light;
  --ink-black: #000000;
  --ink-deep: #0f172a;
  --ink-primary: #1e293b;
  --ink-secondary: #334155;
  --ink-muted: #64748b;
  --ink-subtle: #94a3b8;
  --paper-white: #ffffff;
  --paper-soft: #f8fafc;
  --paper-card: #f1f5f9;
  --line-strong: #0f172a;
  --line-medium: #cbd5e1;
  --line-light: #e2e8f0;
  --radius-card: 18px;
  --radius-pill: 999px;
  --shadow-card: 0 8px 24px rgba(15, 23, 42, 0.06);
  --shadow-sheet: 0 20px 48px rgba(15, 23, 42, 0.16);
  --lyric-size: 1.06rem;
}

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

html,
body {
  margin: 0;
  padding: 0;
  background: var(--paper-soft);
  color: var(--ink-primary);
  font-family: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--ink-deep);
}

:focus-visible {
  outline: 2px solid var(--ink-deep);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-light);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 0 0 auto;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 12px;
  background: var(--ink-deep);
  color: var(--paper-white);
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-title {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--ink-deep);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-sub {
  font-size: 0.74rem;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 1 1 0;
  min-width: 0;
}

body:not(.is-fullscreen-feed) #feedBookSelect {
  display: none;
}

#openSettingsBtn {
  flex: 0 0 auto;
}

.icon-btn,
.ghost-btn,
.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  min-width: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line-medium);
  background: var(--paper-white);
  color: var(--ink-deep);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

.icon-btn {
  padding: 0 10px;
}

.icon-btn:hover,
.ghost-btn:hover {
  background: var(--paper-card);
  border-color: var(--ink-secondary);
}

.primary-btn {
  background: var(--ink-deep);
  border-color: var(--ink-deep);
  color: var(--paper-white);
}

.primary-btn:hover {
  background: var(--ink-primary);
}

.btn-compact {
  min-height: 44px;
  padding: 0 12px;
  font-size: 0.84rem;
}

/* Main container */
.app-shell {
  max-width: 960px;
  margin: 0 auto;
  padding: 12px 12px calc(104px + env(safe-area-inset-bottom, 0px));
  min-width: 0;
}

.view-panel[hidden] {
  display: none !important;
}

/* Filter bar inside feed */
.feed-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.feed-filter-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 260px;
}

.feed-filter-group .compact-select {
  min-width: 0;
  flex: 1 1 180px;
}

.compact-select,
.select-input {
  min-height: 44px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--line-medium);
  background: var(--paper-white);
  color: var(--ink-deep);
  font-size: 0.86rem;
  font-weight: 600;
}

.feed-counter {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-secondary);
  background: var(--paper-card);
  border: 1px solid var(--line-light);
  border-radius: var(--radius-pill);
  padding: 6px 12px;
  white-space: nowrap;
}

/* 3-slot vertical stage */
.swipe-stage-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.swipe-stage {
  position: relative;
  width: 100%;
  min-height: min(69vh, 620px);
  overflow: hidden;
  border-radius: var(--radius-card);
  border: 1px solid var(--line-medium);
  background: var(--paper-white);
  box-shadow: var(--shadow-card);
  touch-action: pan-y;
}

.swipe-slot {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--paper-white);
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease;
  will-change: transform;
}

.swipe-slot.is-dragging {
  transition: none;
}

.swipe-slot[data-offset="-1"] {
  transform: translateY(-102%);
  opacity: 0.35;
  pointer-events: none;
}

.swipe-slot[data-offset="0"] {
  transform: translateY(0%);
  opacity: 1;
  z-index: 2;
}

.swipe-slot[data-offset="1"] {
  transform: translateY(102%);
  opacity: 0.35;
  pointer-events: none;
}

/* Horizontal slide header inside active card */
.card-slide-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 10px 12px;
  background: var(--paper-soft);
  border-bottom: 1px solid var(--line-light);
  flex: none;
}

.slide-tab-btn {
  min-height: 44px;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-muted);
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.slide-tab-btn.active {
  background: var(--paper-white);
  border-color: var(--line-medium);
  color: var(--ink-deep);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.h-viewport {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.h-track {
  display: flex;
  width: 300%;
  height: 100%;
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.h-track.is-dragging {
  transition: none;
}

.h-slide {
  width: calc(100% / 3);
  height: 100%;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Slide 0: Song & Player */
.song-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.76rem;
  font-weight: 700;
  border: 1px solid var(--line-medium);
  background: var(--paper-soft);
  color: var(--ink-secondary);
}

.badge-pill.is-dark {
  background: var(--ink-deep);
  border-color: var(--ink-deep);
  color: var(--paper-white);
}

.song-tap-area {
  text-align: left;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line-light);
  background: var(--paper-soft);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.song-tap-area:hover {
  border-color: var(--ink-secondary);
  background: var(--paper-card);
}

.song-card-title {
  margin: 0 0 6px;
  font-size: clamp(1.18rem, 2.5vw, 1.48rem);
  line-height: 1.25;
  color: var(--ink-deep);
}

.song-card-firstline {
  margin: 0 0 8px;
  font-size: 0.96rem;
  color: var(--ink-secondary);
}

.song-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 0.82rem;
  color: var(--ink-muted);
}

/* Player panel */
.player-card {
  border: 1px solid var(--line-medium);
  border-radius: 14px;
  padding: 14px;
  background: var(--paper-white);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.player-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.player-source-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-deep);
}

.player-origin-note {
  font-size: 0.78rem;
  color: var(--ink-muted);
}

.player-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.audio-native,
.video-native {
  width: 100%;
  border-radius: 10px;
  background: var(--paper-soft);
}

.video-native {
  max-height: 230px;
}

.yt-frame-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line-light);
  background: var(--ink-deep);
}

.yt-frame-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.melody-progress {
  height: 5px;
  border-radius: var(--radius-pill);
  background: var(--line-light);
  overflow: hidden;
}

.melody-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--ink-deep);
  transition: width 0.12s linear;
}

.card-footer-actions {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 6px;
}

/* Slide 1: Stanzas */
.stanzas-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.font-controls {
  display: flex;
  gap: 6px;
}

.stanza-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.stanza-block {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line-light);
  background: var(--paper-soft);
}

.stanza-label {
  margin: 0 0 6px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.stanza-lines {
  margin: 0;
  font-size: var(--lyric-size);
  line-height: 1.62;
  color: var(--ink-deep);
}

/* Slide 2: References & Sources */
.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.meta-box {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line-light);
  background: var(--paper-soft);
}

.meta-box-label {
  display: block;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--ink-muted);
  margin-bottom: 3px;
}

.meta-box-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-deep);
}

.ref-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ref-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line-light);
  background: var(--paper-white);
}

/* Stage controls below stage */
.stage-nav-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.stage-nav-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stage-hint {
  font-size: 0.78rem;
  color: var(--ink-muted);
}

/* Books Shelf View */
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.section-title {
  margin: 0;
  font-size: 1.2rem;
  color: var(--ink-deep);
}

.section-sub {
  margin: 3px 0 0;
  font-size: 0.88rem;
  color: var(--ink-muted);
}

.books-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 10px;
  padding-top: 4px;
}

@media (min-width: 560px) {
  .books-grid {
    grid-template-columns: repeat(auto-fill, minmax(126px, 1fr));
    gap: 16px;
  }
}

.book-mini-card {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.book-mini-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid transparent;
  box-shadow: 0 5px 14px rgba(15, 23, 42, 0.12);
  background: var(--paper-card);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.book-mini-card:hover .book-mini-cover,
.book-mini-card.is-selected .book-mini-cover {
  border-color: var(--ink-deep);
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.22);
}

.book-mini-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.book-mini-fallback {
  width: 100%;
  height: 100%;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: linear-gradient(155deg, #1e293b 0%, #334155 100%);
  color: #f8fafc;
}

.book-mini-spine {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.72;
}

.book-mini-fallback-title {
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.24;
  color: #ffffff;
}

.book-mini-count-badge {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.8);
  color: #ffffff;
  font-size: 0.66rem;
  font-weight: 700;
  backdrop-filter: blur(4px);
}

.book-mini-title {
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.22;
  color: var(--ink-deep);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-card {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-card);
  border: 1px solid var(--line-medium);
  background: var(--paper-white);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.book-cover-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  background: var(--paper-card);
  border-bottom: 1px solid var(--line-light);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.book-cover-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.book-cover-placeholder {
  width: 100%;
  height: 100%;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: linear-gradient(160deg, #f8fafc 0%, #e2e8f0 100%);
  color: var(--ink-deep);
}

.book-cover-placeholder.is-empty-slot {
  background: repeating-linear-gradient(
    -45deg,
    #f8fafc,
    #f8fafc 12px,
    #f1f5f9 12px,
    #f1f5f9 24px
  );
  border-bottom: 1px dashed var(--line-medium);
}

.book-cover-spine {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.book-cover-title {
  font-size: 1.08rem;
  font-weight: 800;
  line-height: 1.25;
  color: var(--ink-deep);
}

.book-cover-status {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--ink-secondary);
}

.book-card-body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
}

.book-card-title {
  margin: 0;
  font-size: 1rem;
  color: var(--ink-deep);
}

.book-card-desc {
  margin: 0;
  font-size: 0.84rem;
  color: var(--ink-muted);
}

.book-card-actions {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 6px;
}

/* Book TOC detail box */
.toc-panel {
  margin-top: 18px;
  border-radius: var(--radius-card);
  border: 1px solid var(--line-medium);
  background: var(--paper-white);
  padding: 16px;
  box-shadow: var(--shadow-card);
}

.toc-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.toc-jump-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.toc-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.toc-filters .select-input,
.toc-filters .text-input {
  min-height: 44px;
  flex: 1 1 200px;
}

.toc-more-row {
  display: flex;
  justify-content: center;
  padding-top: 8px;
}

.book-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.text-input {
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--line-medium);
  background: var(--paper-white);
  color: var(--ink-deep);
  font-size: 0.92rem;
}

.toc-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toc-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line-light);
  background: var(--paper-soft);
}

.toc-row-main {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.toc-num {
  min-width: 42px;
  font-weight: 800;
  color: var(--ink-deep);
}

.toc-song-title {
  font-weight: 700;
  color: var(--ink-deep);
}

/* Search view (entschlackt & mobil sicher) */
.search-bar-card {
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid var(--line-medium);
  background: var(--paper-white);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
  max-width: 100%;
  overflow: hidden;
}

.search-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.search-controls .text-input {
  width: 100%;
  min-width: 0;
}

.search-filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.search-filter-row select {
  flex: 1 1 0;
  width: 0;
  min-width: 0;
  max-width: 100%;
}

.search-filter-row button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.search-results {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.search-result-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line-light);
  background: var(--paper-white);
  cursor: pointer;
  transition: background-color 0.14s ease, border-color 0.14s ease;
}

.search-result-card:hover {
  background: var(--paper-soft);
  border-color: var(--line-medium);
}

.search-row-main {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 0;
  min-width: 0;
}

.search-row-num {
  flex: none;
  min-width: 44px;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--ink-deep);
  background: var(--paper-card);
  border-radius: 8px;
  padding: 4px 6px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.search-row-text {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.search-row-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink-deep);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-row-meta {
  font-size: 0.75rem;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-sheet-btn {
  flex: none;
  min-width: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: 10px;
}

.toggle-active {
  background: var(--ink-deep) !important;
  color: var(--paper-white) !important;
  border-color: var(--ink-deep) !important;
}

.scan-gallery {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.scan-page-card {
  border-radius: 12px;
  border: 1px solid var(--line-medium);
  background: var(--paper-soft);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.scan-page-caption {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-secondary);
}

.scan-page-img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
  border: 1px solid var(--line-light);
  background: #ffffff;
  cursor: zoom-in;
}

.scan-lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(15, 23, 42, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px;
  gap: 10px;
}

.scan-lightbox[hidden] {
  display: none !important;
}

.scan-lightbox-bar {
  width: 100%;
  max-width: 1100px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #ffffff;
}

.scan-lightbox-caption {
  font-size: 0.92rem;
  font-weight: 700;
}

.scan-lightbox img {
  max-width: 100%;
  max-height: calc(100vh - 88px);
  width: auto;
  height: auto;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
}

.song-edit-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.song-edit-form .text-input,
.song-edit-form textarea {
  width: 100%;
  min-height: 44px;
}

.song-edit-textarea {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line-medium);
  background: var(--paper-white);
  color: var(--ink-deep);
  font-family: inherit;
  font-size: 0.94rem;
  line-height: 1.5;
  min-height: 180px;
  resize: vertical;
}

/* Modal / Song Sheet */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(15, 23, 42, 0.56);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 14px;
}

#songSheetBackdrop {
  padding: 0;
}

.sheet-backdrop[hidden] {
  display: none !important;
}

.sheet-dialog {
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 20px;
  background: var(--paper-white);
  border: 1px solid var(--line-medium);
  box-shadow: var(--shadow-sheet);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sheet-dialog.is-song-sheet {
  width: 100%;
  max-width: none;
  height: 100dvh;
  max-height: 100dvh;
  border-radius: 0;
  border: 0;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0;
}

@media (min-width: 680px) {
  .sheet-backdrop,
  #songSheetBackdrop {
    align-items: center;
    padding: 18px;
  }

  .sheet-dialog.is-song-sheet {
    max-width: 740px;
    height: auto;
    max-height: 88vh;
    border-radius: 20px;
    border: 1px solid var(--line-medium);
  }
}

.sheet-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line-light);
  padding-bottom: 10px;
}

.sheet-dialog.is-song-sheet .sheet-header {
  flex: none;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 12px;
  background: var(--paper-white);
}

.sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 14px 16px 24px;
}

.sheet-footer {
  flex: none;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line-light);
  background: var(--paper-white);
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.06);
}

.sheet-footer[hidden] {
  display: none !important;
}

.sheet-footer .primary-btn,
.sheet-footer .ghost-btn {
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.print-mode-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: var(--paper-soft);
  border: 1px solid var(--line-light);
  margin-bottom: 12px;
}

.print-mode-tab {
  height: 34px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-muted);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.print-mode-tab.active {
  background: var(--paper-white);
  color: var(--ink-deep);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.1);
}

.sheet-meta-line {
  margin: 0 0 12px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink-muted);
}

.sheet-scan-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 8px;
}

.sheet-scan-img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  cursor: zoom-in;
}

.print-document {
  display: none;
}

.sheet-title {
  margin: 0;
  font-size: 1.24rem;
  color: var(--ink-deep);
}

.form-grid {
  display: grid;
  gap: 10px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-secondary);
}

.inline-note {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line-light);
  background: var(--paper-soft);
  font-size: 0.84rem;
  color: var(--ink-secondary);
}

/* Bottom floating dock matching Bibel Companion */
.phone-dock-bar {
  position: fixed;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  left: 0;
  right: 0;
  z-index: 80;
  display: flex;
  justify-content: center;
  padding: 0 10px;
  pointer-events: none;
}

.phone-dock-bar .dock-inner {
  display: flex;
  width: max-content;
  max-width: 100%;
  gap: 4px;
  padding: 6px;
  border-radius: 26px;
  background: rgba(15, 23, 42, 0.96);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  pointer-events: auto;
}

.dock-item {
  display: flex;
  flex: 1 1 0;
  min-width: 72px;
  min-height: 54px;
  padding: 6px 14px;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 3px;
  border-radius: 18px;
  border: 0;
  background: transparent;
  color: #dbe3ef;
}

.dock-item.active,
.dock-item:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.dock-label {
  font-size: 0.72rem;
  font-weight: 700;
}

/* Access Gate (shared diary cookie/passcode lock) */
[hidden] {
  display: none !important;
}

.access-gate-wrap {
  min-height: calc(100vh - 80px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 14px;
}

.access-gate-card {
  width: 100%;
  max-width: 440px;
  border-radius: 20px;
  border: 1px solid var(--line-medium);
  background: var(--paper-white);
  box-shadow: var(--shadow-sheet);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: center;
}

.access-gate-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 2px;
  border-radius: 16px;
  background: var(--paper-soft);
  border: 1px solid var(--line-light);
  color: var(--ink-deep);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.access-gate-title {
  margin: 0;
  font-size: 1.2rem;
  color: var(--ink-deep);
}

.access-gate-desc {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--ink-secondary);
}

.access-gate-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.access-gate-form .text-input,
.access-gate-form .primary-btn {
  width: 100%;
  min-height: 46px;
}

.access-error {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #991b1b;
  font-size: 0.86rem;
  font-weight: 600;
}

@media (max-width: 420px) {
  .app-header {
    padding: 8px 10px;
  }

  .brand-sub {
    display: none;
  }

  .ghost-btn .btn-text-hide-xs {
    display: none;
  }

  .h-slide {
    padding: 12px;
  }

  .dock-item {
    min-width: 64px;
    padding: 6px 10px;
  }
}

@page {
  size: A4 portrait;
  margin: 14mm 15mm;
}

@media print {
  .app-header,
  .phone-dock-bar,
  .stage-nav-bar,
  .feed-toolbar,
  .card-slide-tabs,
  .fs-dots,
  .karaoke-progress-track {
    display: none !important;
  }
  .app-shell {
    padding: 0;
  }

  html,
  body.is-printing-song {
    position: static !important;
    overflow: visible !important;
    height: auto !important;
    background: #ffffff !important;
    color: #000000 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body.is-printing-song > *:not(#printDocument) {
    display: none !important;
  }

  body.is-printing-song #printDocument {
    display: block !important;
    position: static !important;
    width: 100% !important;
    background: #ffffff !important;
    color: #000000 !important;
    font-family: Georgia, "Times New Roman", serif;
  }

  .print-header {
    border-bottom: 0.6pt solid #94a3b8;
    padding-bottom: 4mm;
    margin-bottom: 6mm;
  }

  .print-title {
    margin: 0 0 2mm;
    font-size: 18pt;
    line-height: 1.2;
    color: #000000;
  }

  .print-meta {
    font-size: 9.5pt;
    line-height: 1.4;
    color: #334155;
  }

  .print-stanzas {
    font-size: 11.5pt;
    line-height: 1.5;
  }

  .print-stanzas.is-two-col {
    column-count: 2;
    column-gap: 12mm;
  }

  .print-stanza {
    break-inside: avoid;
    page-break-inside: avoid;
    margin-bottom: 5mm;
  }

  .print-stanza-num {
    font-size: 8.5pt;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #475569;
    margin-bottom: 1.2mm;
  }

  .print-scan-page {
    break-inside: avoid;
    page-break-inside: avoid;
    text-align: center;
  }

  .print-scan-page.has-page-break {
    break-before: page;
    page-break-before: always;
  }

  .print-scan-page img {
    display: block;
    max-width: 100%;
    max-height: 255mm;
    width: auto;
    height: auto;
    margin: 0 auto;
    object-fit: contain;
  }
}

/* ==========================================================================
   Intuitiver Vollbild-Swipe (Helles Theme als Standard, Dunkel per Zahnrad)
   ========================================================================== */

body.is-fullscreen-feed {
  overflow: hidden;
  --fs-bg: radial-gradient(circle at 50% 0%, #ffffff 0%, #f1f5f9 100%);
  --fs-text: #0f172a;
  --fs-muted: #475569;
  --fs-subtle: #64748b;
  --fs-surface: rgba(255, 255, 255, 0.92);
  --fs-card: rgba(248, 250, 252, 0.94);
  --fs-border: rgba(15, 23, 42, 0.1);
  --fs-hud-bg: rgba(255, 255, 255, 0.96);
  --fs-hud-border: #e2e8f0;
  --fs-line-bg: rgba(245, 158, 11, 0.24);
  --fs-line-rest: rgba(15, 23, 42, 0.05);
  --fs-accent: #0f172a;
  --fs-progress-track: rgba(15, 23, 42, 0.1);
  --fs-progress-bar: linear-gradient(90deg, #0f172a, #d97706);
  --fs-bottom-fade: #f1f5f9;
  background: #f8fafc;
}

html[data-appearance="dark"] body.is-fullscreen-feed {
  --fs-bg: radial-gradient(circle at 50% 18%, #162038 0%, #090e1a 62%, #050811 100%);
  --fs-text: #f8fafc;
  --fs-muted: rgba(226, 232, 240, 0.78);
  --fs-subtle: rgba(148, 163, 184, 0.85);
  --fs-surface: rgba(255, 255, 255, 0.07);
  --fs-card: rgba(255, 255, 255, 0.04);
  --fs-border: rgba(255, 255, 255, 0.14);
  --fs-hud-bg: rgba(10, 15, 28, 0.94);
  --fs-hud-border: rgba(255, 255, 255, 0.14);
  --fs-line-bg: rgba(250, 204, 21, 0.28);
  --fs-line-rest: rgba(255, 255, 255, 0.08);
  --fs-accent: #fde68a;
  --fs-progress-track: rgba(255, 255, 255, 0.12);
  --fs-progress-bar: linear-gradient(90deg, #facc15, #fef08a);
  --fs-bottom-fade: #050811;
  background: #050811;
}

body.is-fullscreen-feed .app-shell {
  max-width: none;
  padding: 0;
}

body.is-fullscreen-feed .brand-compact-hide {
  display: none;
}

body.is-fullscreen-feed .app-header,
body.is-fullscreen-feed .phone-dock-bar {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

body.is-fullscreen-feed .app-header {
  top: 0;
  background: var(--fs-hud-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--fs-hud-border);
  color: var(--fs-text);
  padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px;
}

body.is-fullscreen-feed .app-header .header-actions {
  flex: 1 1 auto;
  justify-content: flex-end;
  min-width: 0;
}

body.is-fullscreen-feed .app-header .compact-select {
  flex: 1 1 0;
  width: 0;
  min-width: 0;
  max-width: 220px;
  background: var(--fs-card);
  border-color: var(--fs-hud-border);
  color: var(--fs-text);
}

body.is-fullscreen-feed .app-header .ghost-btn,
body.is-fullscreen-feed .app-header .icon-btn {
  background: var(--fs-card);
  border-color: var(--fs-hud-border);
  color: var(--fs-text);
}

body.is-fullscreen-feed .phone-dock-bar {
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
}

body.is-fullscreen-feed.hud-open .app-header,
body.is-fullscreen-feed.hud-open .phone-dock-bar {
  opacity: 1;
  pointer-events: auto;
}

/* Zahnrad-Menü (öffnet über ⚙️) */
.settings-popover {
  position: fixed;
  top: calc(64px + env(safe-area-inset-top, 0px));
  right: 12px;
  z-index: 98;
  width: min(330px, calc(100vw - 24px));
  padding: 14px;
  border-radius: 18px;
  background: var(--fs-hud-bg, var(--paper-white));
  border: 1px solid var(--fs-hud-border, var(--line-medium));
  box-shadow: var(--shadow-sheet);
  color: var(--fs-text, var(--ink-deep));
  display: flex;
  flex-direction: column;
  gap: 12px;
  backdrop-filter: blur(16px);
}

.settings-popover[hidden] {
  display: none !important;
}

.settings-row-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.settings-popover .ghost-btn {
  background: var(--fs-card, var(--paper-soft));
  border-color: var(--fs-hud-border, var(--line-medium));
  color: var(--fs-text, var(--ink-deep));
  font-size: 0.8rem;
  padding: 0 10px;
}

.settings-popover .toggle-active {
  background: var(--ink-deep) !important;
  color: #ffffff !important;
  border-color: var(--ink-deep) !important;
}

html[data-appearance="dark"] .settings-popover .toggle-active {
  background: #f8fafc !important;
  color: #070b14 !important;
  border-color: #f8fafc !important;
}

/* Bühne + Viewport-Einrast-Garantie */
body.is-fullscreen-feed .swipe-stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  min-height: 100dvh;
  z-index: 10;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: clip !important;
  background: var(--fs-bg);
  color: var(--fs-text);
  touch-action: none;
}

body.is-fullscreen-feed .h-viewport {
  overflow: clip !important;
}

body.is-fullscreen-feed .h-track {
  transform: translate3d(-33.3333%, 0, 0);
}

body.is-fullscreen-feed .swipe-slot {
  background: transparent;
}

body.is-fullscreen-feed .card-slide-tabs {
  display: none !important;
}

body.is-fullscreen-feed .h-slide {
  padding: 0;
  gap: 0;
  background: transparent;
  overflow: hidden;
}

body.is-fullscreen-feed .h-slide[data-slide="0"],
body.is-fullscreen-feed .h-slide.has-scrollable-scans {
  overflow-y: auto;
  touch-action: pan-y;
}

/* Slide 0 (links): Strukturierte Infobox (Buchcover + Titel & Urheber oben, Fundstellen, kompakter Liedtext/Noten, volle Aktionsleiste) */
.info-sheet-stage {
  flex: none;
  width: 100%;
  height: auto;
  min-height: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 14px calc(74px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.info-hero {
  flex: none;
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  padding: 12px;
  border-radius: 16px;
  background: var(--fs-surface);
  border: 1px solid var(--fs-border);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
}

.info-cover-thumb {
  width: 104px;
  aspect-ratio: 3 / 4;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--fs-border);
  background: var(--fs-card);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.info-cover-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.info-cover-thumb.is-clickable {
  padding: 0;
  cursor: pointer;
  transition: transform 0.14s ease;
}

.info-cover-thumb.is-clickable:active {
  transform: scale(0.97);
}

.info-cover-fallback {
  padding: 8px;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--fs-muted);
  line-height: 1.25;
}

.info-hero-body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.info-hero-top {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  gap: 2px;
  min-width: 0;
}

.info-song-title-sm {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.25;
  color: var(--fs-text);
}

.info-book-sub {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--fs-muted);
}

.info-hero-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--fs-border);
}

.info-meta-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.info-field-label {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fs-subtle);
}

.info-field-val {
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--fs-text);
  word-break: break-word;
}

.info-refs-card,
.info-lyrics-card {
  flex: none;
  border-radius: 14px;
  background: var(--fs-surface);
  border: 1px solid var(--fs-border);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.info-card-head {
  padding: 8px 12px;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fs-subtle);
  background: var(--fs-card);
  border-bottom: 1px solid var(--fs-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.info-head-action {
  border: 0;
  background: transparent;
  color: var(--fs-accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: none;
  padding: 2px 4px;
  cursor: pointer;
  white-space: nowrap;
}

.info-refs-list {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}

.info-ref-row {
  padding: 0;
  border-bottom: 1px solid var(--fs-border);
}

.info-ref-row:last-child {
  border-bottom: 0;
}

.info-ref-link {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  color: inherit;
  transition: background-color 0.14s ease;
}

.info-ref-link:hover,
.info-ref-link:active {
  background: var(--fs-card);
}

.info-ref-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.info-ref-book {
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--fs-text);
}

.info-ref-sub {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--fs-subtle);
}

.info-ref-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.info-ref-badge {
  flex: none;
  white-space: nowrap;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  background: var(--fs-card);
  border: 1px solid var(--fs-border);
  color: var(--fs-text);
}

.info-ref-chevron {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
  color: var(--fs-subtle);
}

.search-show-all-btn {
  width: 100%;
  height: 42px;
  margin-top: 6px;
}

.info-lyrics-card {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
}

.info-stanza-list {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.info-stanza-block + .info-stanza-block {
  padding-top: 10px;
  border-top: 1px dashed var(--fs-border);
}

.info-stanza-num {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fs-accent);
  margin-bottom: 3px;
}

.info-stanza-lines {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.info-stanza-line {
  font-size: 0.88rem;
  line-height: 1.44;
  color: var(--fs-text);
}

.info-scan-thumbs {
  padding: 10px 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
}

.info-scan-thumb-btn {
  border: 1px solid var(--fs-border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--fs-card);
  padding: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.info-scan-thumb-btn img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
}

.info-scan-thumb-btn span {
  padding: 4px 6px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--fs-muted);
}

.info-lyrics-empty {
  margin: 0;
  padding: 14px 12px;
  font-size: 0.84rem;
  color: var(--fs-muted);
  text-align: center;
}

.info-actions {
  flex: none;
  margin-top: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding-top: 0;
}

.info-actions .primary-btn,
.info-actions .ghost-btn {
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* Slide 1 (Mitte = Stream): Edge-to-edge Video + zentrales transform-basiertes Textfenster */
.fs-video-stage {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  overflow: hidden;
}

.fs-yt-box {
  position: relative;
  width: 100%;
  flex: none;
  height: min(40dvh, 56.25vw);
  min-height: 195px;
  max-height: 44dvh;
  background: #000000;
}

.fs-yt-box iframe,
.fs-yt-box video {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  object-fit: contain;
}

.fs-audio-box {
  flex: none;
  padding: calc(16px + env(safe-area-inset-top, 0px)) 20px 10px;
  background: var(--fs-card);
  border-bottom: 1px solid var(--fs-border);
}

.fs-audio-box audio {
  width: 100%;
}

/* Transform-zentrierter Karaoke-Viewport (verhindert jeglichen Viewport-Shift & erlaubt direktes ↑↓←→ Swipen) */
.karaoke-viewport {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  overflow: clip !important;
  touch-action: none;
  padding: 0 18px calc(68px + env(safe-area-inset-bottom, 0px));
  display: flex;
  justify-content: center;
}

.karaoke-viewport.is-fullscreen-karaoke {
  height: 100%;
  padding-top: calc(22px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px));
}

.karaoke-rail {
  width: 100%;
  max-width: 760px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 18px 0 55vh;
  text-align: center;
  will-change: transform;
  transition: transform 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Ruhige Einzelstrophen-Ansicht unter YouTube (ohne ungenauen Zeitmarken-Fake-Balken) */
.yt-stanza-viewer {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  padding: 10px 16px calc(64px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  overflow: hidden;
  touch-action: none;
}

.stanza-pill-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  flex: none;
}

.stanza-pill {
  min-width: 30px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--fs-border);
  background: var(--fs-surface);
  color: var(--fs-muted);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.stanza-pill.active {
  background: var(--fs-accent);
  color: #ffffff;
  border-color: var(--fs-accent);
}

html[data-appearance="dark"] .stanza-pill.active {
  color: #050811;
}

.yt-stanza-stage {
  width: 100%;
  max-width: 680px;
  min-height: 0;
  max-height: 100%;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.yt-stanza-card {
  width: 100%;
  margin: auto 0;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--fs-surface);
  border: 1px solid var(--fs-border);
  text-align: center;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
}

.yt-stanza-card[hidden] {
  display: none !important;
}

.yt-stanza-label {
  margin: 0 0 8px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fs-accent);
}

.yt-stanza-lines {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.yt-stanza-line {
  font-size: clamp(0.95rem, 3.1vw, 1.24rem);
  font-weight: 600;
  line-height: 1.42;
  color: var(--fs-text);
}

.karaoke-head {
  width: 100%;
  max-width: 760px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.karaoke-song-title {
  margin: 0;
  font-size: clamp(1.18rem, 3.8vw, 1.85rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--fs-text);
}

.karaoke-song-sub {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--fs-muted);
}

.karaoke-stanza {
  width: 100%;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid transparent;
  background: transparent;
  opacity: 0.36;
  transition: opacity 0.25s ease, background-color 0.25s ease, border-color 0.25s ease;
}

.karaoke-stanza.is-active-stanza {
  opacity: 1;
  background: var(--fs-surface);
  border-color: var(--fs-border);
}

.karaoke-stanza.is-past-stanza {
  opacity: 0.26;
}

.karaoke-stanza-label {
  margin: 0 0 6px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fs-subtle);
}

.karaoke-stanza.is-active-stanza .karaoke-stanza-label {
  color: var(--fs-accent);
}

.karaoke-lines {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.karaoke-line {
  display: inline-block;
  margin: 0 auto;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: clamp(1.12rem, 3.8vw, 1.82rem);
  font-weight: 600;
  line-height: 1.4;
  color: var(--fs-text);
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.fs-video-stage .karaoke-line {
  font-size: clamp(1.02rem, 3.3vw, 1.42rem);
}

.karaoke-line.is-active-line {
  font-weight: 800;
  transform: scale(1.03);
  background: linear-gradient(
    90deg,
    var(--fs-line-bg) var(--line-fill, 0%),
    var(--fs-line-rest) var(--line-fill, 0%)
  );
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.08);
}

.karaoke-line.is-past-line {
  opacity: 0.48;
}

/* Scans & ruhige Titelkarte */
.fs-scans-stage {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  padding: calc(18px + env(safe-area-inset-top, 0px)) 12px calc(54px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.fs-scans-stage .scan-gallery {
  width: 100%;
  max-width: 820px;
  margin-top: 0;
}

.fs-scans-stage .scan-page-card {
  background: var(--fs-surface);
  border-color: var(--fs-border);
  padding: 6px;
}

.fs-scans-stage .scan-page-caption {
  color: var(--fs-muted);
}

.fs-placeholder-stage {
  width: 100%;
  height: 100%;
  padding: 32px 24px 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
}

.fs-placeholder-title {
  margin: 0;
  font-size: clamp(1.45rem, 4.8vw, 2.2rem);
  font-weight: 800;
  color: var(--fs-text);
}

.fs-placeholder-sub {
  margin: 0;
  font-size: 0.96rem;
  color: var(--fs-muted);
}

/* Minimal-Fortschritt & Indikator unten */
.fs-bottom-minimal {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding-top: 24px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: linear-gradient(to top, var(--fs-bottom-fade, #f1f5f9) 64%, transparent 100%);
}

.fs-caption-line {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--fs-subtle);
  max-width: 92vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fs-dots {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
}

.fs-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.35);
  transition: width 0.2s ease, background-color 0.2s ease;
}

.fs-dot.active {
  width: 18px;
  background: var(--fs-text);
}

.karaoke-progress-track {
  width: 100%;
  height: 3px;
  background: var(--fs-progress-track);
}

.karaoke-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--fs-progress-bar);
  transition: width 0.08s linear;
}

.speed-hold-pill {
  position: fixed;
  top: calc(16px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 96;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.88);
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  pointer-events: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.stage-play-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 95;
  padding: 12px 20px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 800;
  pointer-events: none;
  backdrop-filter: blur(8px);
}
