:root {
    --ink: #1c1612;
    --muted: #6b5e52;
    --paper: #f6f1e8;
    --paper-2: #efe6d8;
    --card: #fffaf3;
    --line: #e0d4c4;
    --wine: #7a2e2a;
    --wine-dark: #5c1f1c;
    --wine-soft: #f3e4e0;
    --forest: #3d5a45;
    --warn: #9a6700;
    --warn-bg: #f8edc8;
    --danger: #9b1c1c;
    --radius: 12px;
    --shadow: 0 10px 30px rgba(28, 22, 18, 0.08);
    --sidebar: #241c18;
    --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
    --sans: "Segoe UI", system-ui, sans-serif;
    --app-footer-h: 0px;
}
html {
    --text-scale: 1;
    font-size: calc(16px * var(--text-scale));
}
@media (max-width: 840px) {
    html:not([data-text-scale]) { --text-scale: 1.15; }
    html[data-text-scale="100"] { --text-scale: 1; }
    html[data-text-scale="115"] { --text-scale: 1.15; }
    html[data-text-scale="130"] { --text-scale: 1.3; }
    html[data-text-scale="145"] { --text-scale: 1.45; }
    html[data-text-scale="160"] { --text-scale: 1.6; }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
[hidden] { display: none !important; }
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
body {
    font-family: var(--sans);
    color: var(--ink);
    background: var(--paper);
    line-height: 1.5;
}
a { color: var(--wine); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

.app-shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}
.sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    height: 100vh;
    max-height: 100dvh;
    overflow: auto;
    background: var(--sidebar);
    color: #f3ebe3;
    padding: 22px 18px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: inherit;
    text-decoration: none;
    font-weight: 650;
    letter-spacing: 0.04em;
}
.brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--wine);
    display: grid;
    place-items: center;
    font-size: 0.78rem;
    font-weight: 700;
}
.brand-mark-lg { width: 48px; height: 48px; margin: 0 auto 12px; font-size: 0.9rem; }
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-nav a {
    color: #d9cdc2;
    text-decoration: none;
    padding: 8px 10px;
    border-radius: 8px;
}
.side-nav a:hover, .side-nav a.is-active { background: rgba(255,255,255,0.08); color: #fff; }
.side-book {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 14px;
}
.side-book-label { margin: 0; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: #b4a497; }
.side-book-head {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin: 4px 0 10px;
}
.side-book-title { margin: 0; font-weight: 650; flex: 1; min-width: 0; }
.side-book-rename {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.85rem;
    height: 1.85rem;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #d9cdc2;
    cursor: pointer;
}
.side-book-rename:hover,
.side-book-rename:focus-visible {
    background: rgba(255,255,255,0.08);
    color: #fff;
}
.side-book-rename .btn-ico { width: 1rem; height: 1rem; }
.side-foot {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    font-size: 0.85rem;
    color: #b4a497;
}
.side-backup-btn {
    width: 100%;
    background: var(--wine);
    border-color: var(--wine);
    color: #fff;
    justify-content: center;
}
.side-backup-btn:hover,
.side-backup-btn:focus-visible {
    background: var(--wine-dark);
    border-color: var(--wine-dark);
    color: #fff;
}
.side-backup-btn:disabled {
    opacity: 0.65;
}
.side-foot-user {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: baseline;
}
.side-foot a { color: #f3ebe3; }

.app-main { min-width: 0; }
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 20px 28px 0;
}
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 10px;
    border: 1px solid var(--line);
    background: var(--card);
    border-radius: 10px;
    cursor: pointer;
    flex-shrink: 0;
}
.nav-toggle-bar {
    display: block;
    height: 2px;
    width: 100%;
    background: var(--ink);
    border-radius: 2px;
}
.nav-backdrop { display: none; }
.topbar h1 { margin: 0; font-family: var(--serif); font-size: 1.7rem; font-weight: 600; }
.topbar-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.page { padding: 20px 28px 48px; }
/* ---------- Co-Autor: Chat-Liste links, Unterhaltung rechts ---------- */
body.coauthor-page .app-main {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}
body.coauthor-page .page {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding-top: 16px;
    padding-bottom: calc(var(--app-footer-h) + 20px);
}
.coauthor {
    --ca-user: #f3e4e0;
    --ca-user-line: #e6cdc6;
    --ca-bot: #fff;
    --ca-log-bg: #f4eee4;
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-template-columns: 272px minmax(0, 1fr);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.coauthor-side {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    padding: 14px 10px;
    background: var(--paper-2);
    border-right: 1px solid var(--line);
}
.coauthor-new { justify-content: center; width: 100%; }
.coauthor-chats {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.coauthor-chat-item {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 9px 10px;
    border-radius: 8px;
    color: var(--ink);
    text-decoration: none;
    font-size: 0.92rem;
}
.coauthor-chat-item:hover { background: rgba(122, 46, 42, 0.07); }
.coauthor-chat-item.is-active { background: var(--card); box-shadow: inset 3px 0 0 var(--wine); font-weight: 600; }
.coauthor-chat-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.coauthor-chat-date { flex: 0 0 auto; font-size: 0.76rem; font-weight: 400; color: var(--muted); }
.coauthor-chats-empty { margin: 8px 10px; color: var(--muted); font-size: 0.88rem; }
.coauthor-side-backdrop { display: none; }

.coauthor-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}
.coauthor-head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--line);
    background: var(--card);
}
.btn.coauthor-side-toggle { display: none; }
/* Schwebender Notiz-Pin unten rechts soll den Senden-Knopf nicht verdecken */
body.coauthor-page:has(.reader-fabs) .coauthor-form { padding-right: 74px; }
.coauthor-title {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    font-family: var(--serif);
    font-size: 1.12rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.coauthor-head-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.btn.coauthor-del { color: var(--danger); }

.coauthor-log {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 18px clamp(12px, 3vw, 36px) 24px;
    background: var(--ca-log-bg);
}
.coauthor-day {
    align-self: center;
    margin: 10px 0 4px;
}
.coauthor-day span {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 999px;
    background: rgba(255, 250, 243, 0.92);
    border: 1px solid var(--line);
    font-size: 0.76rem;
    color: var(--muted);
}
.coauthor-row { display: flex; }
.coauthor-row--user { justify-content: flex-end; }
.coauthor-row--assistant { justify-content: flex-start; }
.coauthor-bubble {
    position: relative;
    max-width: min(46rem, 82%);
    padding: 9px 13px 6px;
    border-radius: 14px;
    background: var(--ca-bot);
    border: 1px solid var(--line);
    box-shadow: 0 1px 2px rgba(28, 22, 18, 0.06);
    line-height: 1.5;
    overflow-wrap: anywhere;
}
.coauthor-row--assistant .coauthor-bubble { border-top-left-radius: 4px; }
.coauthor-row--user .coauthor-bubble {
    background: var(--ca-user);
    border-color: var(--ca-user-line);
    border-top-right-radius: 4px;
}
.coauthor-bubble.is-error { background: #fbeaea; border-color: #ebc3c3; color: var(--danger); }
.coauthor-row--user .coauthor-text { white-space: pre-wrap; }
.coauthor-text > :first-child { margin-top: 0; }
.coauthor-text > :last-child { margin-bottom: 0; }
.coauthor-text p { margin: 0 0 0.65em; }
.coauthor-text h4 { margin: 0.9em 0 0.35em; font-size: 0.98rem; font-weight: 700; }
.coauthor-text ul, .coauthor-text ol { margin: 0 0 0.65em; padding-left: 1.35em; }
.coauthor-text li { margin: 0.2em 0; }
.coauthor-text code { padding: 0 4px; border-radius: 4px; background: var(--paper-2); font-size: 0.88em; }
.coauthor-time {
    display: block;
    margin-top: 2px;
    text-align: right;
    font-size: 0.7rem;
    color: var(--muted);
}

.coauthor-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.coauthor-action {
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--card);
}
.coauthor-action.is-applied { border-color: rgba(61, 90, 69, 0.35); background: #f1f6f1; }
.coauthor-action-info { display: flex; flex-direction: column; gap: 1px; }
.coauthor-action-kind { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.coauthor-action-title { font-size: 0.95rem; }
.coauthor-action-preview { margin-top: 6px; font-size: 0.88rem; }
/* Denkstufe in KI-Chats (wird von app.js in Chat-Formulare eingesetzt) */
.llm-effort {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    margin: 0;
    font-weight: 400;
    gap: 2px;
    flex: 0 0 auto;
    align-self: flex-start;
    padding: 0 4px 0 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--card);
    color: var(--muted);
    font-size: 0.82rem;
    cursor: pointer;
}
.llm-effort-ico svg { width: 15px; height: 15px; display: block; }
.llm-effort select {
    width: auto;
    margin: 0;
    padding: 6px 4px;
    border: 0;
    background: transparent;
    color: var(--ink);
    font: inherit;
    cursor: pointer;
}
.llm-effort select:focus { outline: none; box-shadow: none; }
.llm-effort:focus-within { border-color: var(--wine); }
.coauthor-form .llm-effort { align-self: center; }
.coauthor-typing-label { margin-left: 6px; font-size: 0.8rem; color: var(--muted); }
.coauthor-action-warn { margin: 6px 0 0; padding: 6px 9px; border-radius: 6px; background: var(--warn-bg); color: var(--warn); font-size: 0.84rem; }
.coauthor-action-preview summary { cursor: pointer; color: var(--wine); }
.coauthor-action-body {
    max-height: 18rem;
    overflow-y: auto;
    margin-top: 6px;
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--paper);
    white-space: pre-wrap;
    font-family: var(--serif);
}
.coauthor-action-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.coauthor-applied { font-size: 0.82rem; font-weight: 650; color: var(--forest); }

.coauthor-typing { display: flex; gap: 5px; padding: 13px 15px; }
.coauthor-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--muted);
    opacity: 0.35;
    animation: coauthor-blink 1.2s infinite ease-in-out;
}
.coauthor-dot:nth-child(2) { animation-delay: 0.2s; }
.coauthor-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes coauthor-blink {
    0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
    40% { opacity: 0.9; transform: translateY(-3px); }
}

.coauthor-empty {
    margin: auto;
    max-width: 34rem;
    padding: 24px;
    text-align: center;
}
.coauthor-empty h3 { margin: 0 0 8px; font-family: var(--serif); font-size: 1.35rem; }
.coauthor-empty p { margin: 0 0 16px; color: var(--muted); line-height: 1.5; }
.coauthor-suggest { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.coauthor-chip {
    padding: 7px 13px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--card);
    color: var(--ink);
    font: inherit;
    font-size: 0.86rem;
    cursor: pointer;
}
.coauthor-chip:hover { border-color: var(--wine); color: var(--wine); }
.coauthor-loading { margin: auto; color: var(--muted); }

.coauthor-banner { margin: 10px 16px 0; }
.coauthor-form {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 10px 14px 12px;
    border-top: 1px solid var(--line);
    background: var(--card);
}
.coauthor-form textarea {
    flex: 1 1 auto;
    min-height: 44px;
    max-height: 220px;
    margin: 0;
    padding: 11px 16px;
    border-radius: 22px;
    resize: none;
    line-height: 1.4;
    overflow-y: auto;
}
.coauthor-send {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: var(--wine);
    color: #fff;
    cursor: pointer;
}
.coauthor-send:hover { background: var(--wine-dark); }
.coauthor-send:disabled { opacity: 0.5; cursor: default; }
.coauthor-send svg { width: 20px; height: 20px; }

@media (max-width: 840px) {
    body.coauthor-page .page { padding: 10px 10px calc(var(--app-footer-h) + 10px); }
}
/* Unter 1100px wird die Chat-Liste zur ausklappbaren Leiste, damit das Gespräch Platz hat */
@media (max-width: 1100px) {
    .coauthor { grid-template-columns: minmax(0, 1fr); }
    .coauthor-side {
        position: absolute;
        inset: 0 auto 0 0;
        z-index: 5;
        width: min(300px, 86%);
        transform: translateX(-102%);
        transition: transform 0.2s ease;
        box-shadow: var(--shadow);
    }
    .coauthor.is-side-open .coauthor-side { transform: none; }
    .coauthor-side-backdrop:not([hidden]) {
        display: block;
        position: absolute;
        inset: 0;
        z-index: 4;
        background: rgba(28, 22, 18, 0.3);
    }
    .btn.coauthor-side-toggle { display: inline-flex; }
    .coauthor-head { padding: 8px 10px; }
    .coauthor-head-actions .btn { padding-inline: 8px; }
    .coauthor-bubble { max-width: 92%; }
}
@media (max-width: 600px) {
    .coauthor-btn-label { display: none; }
    .coauthor-head .btn { padding-inline: 9px; }
}

.lede, .muted, .hint { color: var(--muted); }
.hint { font-size: 0.88rem; }
.stack { display: flex; flex-direction: column; gap: 12px; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 0.92rem; }
label > .muted,
label > .hint { font-weight: 400; }
input, textarea, select {
    font: inherit;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
}
textarea { resize: vertical; }
.btn, button.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    border-radius: 9px;
    padding: 8px 14px;
    font: inherit;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { text-decoration: none; background: var(--paper-2); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.catalog-heading {
    font-family: var(--serif);
    font-size: 1.35rem;
    font-weight: 600;
    margin: 28px 0 14px;
}
.catalog-heading:first-of-type { margin-top: 8px; }
.songs-toolbar { margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.songs-toolbar input { width: min(420px, 100%); }
.album-filter-card { cursor: pointer; transition: border-color 0.12s ease, box-shadow 0.12s ease; }
.album-filter-card:hover,
.album-filter-card:focus-visible {
    border-color: var(--wine);
    box-shadow: 0 8px 22px rgba(90, 40, 36, 0.12);
}
.album-filter-card.is-active {
    border-color: var(--wine);
    box-shadow: 0 0 0 2px rgba(122, 46, 46, 0.22);
}
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.table-wrap .table { margin: 0; border-radius: 0; }
.table th[data-sort] { cursor: pointer; user-select: none; white-space: nowrap; }
.table th[data-sort]::after { content: ""; margin-left: 6px; color: var(--muted); font-size: 0.75em; }
.table th[data-dir="asc"]::after { content: "▲"; }
.table th[data-dir="desc"]::after { content: "▼"; }
.cell-action {
    border: 0;
    background: none;
    padding: 0;
    margin: 0;
    font: inherit;
    color: var(--wine);
    cursor: pointer;
    text-align: left;
}
.cell-action:hover { text-decoration: underline; }
.cell-action.is-empty { color: var(--muted); font-style: italic; }
.cell-action--title {
    font-family: var(--serif);
    font-size: 1.08rem;
    font-weight: 650;
    color: var(--ink);
}
.cell-action--title:hover { color: var(--wine); }

body.editor-open { overflow: hidden; }
.editor-root[hidden] { display: none !important; }
.editor-root {
    position: fixed;
    inset: 0;
    z-index: 70;
    background: var(--paper);
}
.lyrics-editor {
    display: grid;
    grid-template-rows: auto 1fr;
    height: 100%;
    min-height: 0;
}
.lyrics-editor-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--line);
    background: var(--card);
}
.lyrics-editor-ident { min-width: 0; flex: 1; }
.lyrics-editor-head h2 { margin: 0; font-family: var(--serif); font-size: 1.35rem; }
.story-title-field {
    display: block;
    margin: 0;
    font-size: 0.78rem;
    font-weight: 650;
    color: var(--muted);
}
.story-title-field input {
    display: block;
    width: 100%;
    max-width: 36rem;
    margin-top: 4px;
    font-family: var(--serif);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--ink);
    background: var(--paper, #fff);
    border: 1px solid var(--line, rgba(0,0,0,.14));
    border-radius: 8px;
    padding: 0.4rem 0.6rem;
}
.story-title-field input:focus {
    outline: none;
    border-color: var(--wine);
    box-shadow: 0 0 0 3px rgba(122, 46, 42, 0.12);
}
.story-close-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-top: 10px;
}
.story-close-checks .toggle {
    font-size: 0.82rem;
    gap: 8px;
}
.story-close-checks .toggle-track {
    width: 38px;
    height: 22px;
}
.story-close-checks .toggle-thumb {
    width: 16px;
    height: 16px;
}
.story-close-checks .toggle input:checked + .toggle-track .toggle-thumb {
    transform: translateX(16px);
}
.story-wordcount { margin: 0 0 10px; font-weight: 650; }
.story-lyrics-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0 0 10px;
}
.story-lyrics-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
    flex: 1 1 auto;
}
.story-lyrics-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 100%;
    padding: 4px 6px 4px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--card);
    font-size: 0.88rem;
}
.story-lyrics-chip span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.story-lyrics-chip-x {
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0 4px;
}
.story-lyrics-chip-x:hover { color: var(--wine); }
.lyric-pick-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    align-items: end;
}
.lyric-pick-toolbar input[type="search"] {
    flex: 1 1 14rem;
    min-width: 12rem;
    margin: 0;
}
.lyric-pick-toolbar select { margin: 0; min-width: 10rem; }
.lyric-pick-rel {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.78rem;
    font-weight: 650;
    color: var(--muted);
    margin: 0;
}
.lyric-pick .table-wrap { max-height: min(55vh, 28rem); }
.lyric-pick .table td:last-child { white-space: nowrap; }
.story-quick-prompts {
    margin: 8px 0 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    padding: 0 10px;
}
.story-quick-prompts > summary {
    cursor: pointer;
    font-weight: 650;
    padding: 8px 0;
    color: var(--wine);
    list-style: none;
}
.story-quick-prompts > summary::-webkit-details-marker { display: none; }
.story-quick-prompts > summary::after {
    content: "▾";
    float: right;
    color: var(--muted);
}
.story-quick-prompts[open] > summary::after { content: "▴"; }
.story-quick-prompts-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0 0 10px;
}
.story-quick-prompts-list .btn { text-align: left; width: 100%; justify-content: flex-start; }
.story-texts { margin: 10px 0; padding: 0; border: 0; }
.story-texts legend { font-weight: 650; margin-bottom: 6px; }
.story-char {
    background: #eceff7;
    border-bottom: 2px solid #5a6d9a;
    border-radius: 3px;
    padding: 0 2px;
    cursor: pointer;
}
.story-char:hover { background: #dde2f0; }
.story-person-hint {
    background: #f8e6a0;
    border-bottom: 2px solid #c47a32;
    border-radius: 3px;
    padding: 0 2px;
    cursor: pointer;
}
.story-person-hint:hover { background: #f3d778; }
.story-people-banner { margin: 0 0 10px; }
.story-people-list { margin: 0; padding-left: 1.2em; }
.story-people-list li { margin: 0 0 12px; }
.story-people-list .btn { margin-top: 6px; }
.story-people-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.story-people-list .story-people-actions .btn { margin-top: 0; }
.story-review-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.15em;
    height: 1.15em;
    margin-left: 6px;
    border-radius: 50%;
    background: #c47a32;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1;
    vertical-align: middle;
}
.reader-layout .story-char { cursor: pointer; }
.reader-char-tip {
    position: fixed;
    z-index: 36;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: min(320px, calc(100vw - 16px));
    padding: 8px 10px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: var(--shadow);
    pointer-events: auto;
}
.reader-char-tip[hidden] { display: none !important; }
.reader-char-tip-name {
    font-weight: 650;
    line-height: 1.25;
    min-width: 0;
}
.wysiwyg.story-wysiwyg h2 {
    font-family: var(--serif);
    font-size: 1.45rem;
    margin: 0.85em 0 0.4em;
}
.wysiwyg.story-wysiwyg h3 {
    font-family: var(--serif);
    font-size: 1.2rem;
    margin: 0.75em 0 0.3em;
}
.wysiwyg.story-wysiwyg ul,
.wysiwyg.story-wysiwyg ol { margin: 0.35em 0 0.85em 1.35em; padding: 0; }
.reader-prose h2 {
    font-family: var(--serif);
    font-size: 1.4rem;
    margin: 1.2em 0 0.4em;
}
.reader-prose h3 {
    font-family: var(--serif);
    font-size: 1.18rem;
    margin: 1em 0 0.35em;
}
.reader-prose ul,
.reader-prose ol { margin: 0.4em 0 1em 1.35em; }
.lyrics-editor-kicker { margin: 0 0 2px; font-size: 0.82rem; }
.lyrics-player { margin-top: 10px; max-width: 42rem; }
.lyrics-player-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.lyrics-player-seek { flex: 1; min-width: 80px; accent-color: var(--wine); height: 6px; padding: 0; }
.lyrics-player-time { font-variant-numeric: tabular-nums; font-size: 0.8rem; color: var(--muted); min-width: 2.4em; }
.btn.btn-player {
    width: 36px;
    height: 36px;
    padding: 0;
    color: #fff;
}
.btn.btn-player-play { background: #3d5a45; border-color: #3d5a45; }
.btn.btn-player-play:hover { background: #2f4636; }
.btn.btn-player-pause { background: #c47a32; border-color: #c47a32; }
.btn.btn-player-pause:hover { background: #a05e22; }
.btn.btn-player-stop { background: var(--wine); border-color: var(--wine); }
.btn.btn-player-stop:hover { background: var(--wine-dark); }
.lyrics-editor-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn-ico {
    width: 1.05em;
    height: 1.05em;
    flex-shrink: 0;
    display: block;
}
.btn.btn-save {
    background: #3d5a45;
    border-color: #3d5a45;
    color: #fff;
}
.btn.btn-save:hover { background: #2f4636; border-color: #2f4636; color: #fff; }
.btn.btn-save-close {
    background: var(--wine);
    border-color: var(--wine);
    color: #fff;
}
.btn.btn-save-close:hover { background: var(--wine-dark); border-color: var(--wine-dark); color: #fff; }
.btn.btn-align {
    background: #3f6f72;
    border-color: #3f6f72;
    color: #fff;
}
.btn.btn-align:hover { background: #33595c; border-color: #33595c; color: #fff; }
.btn.btn-danger {
    background: #fff;
    border-color: var(--danger);
    color: var(--danger);
}
.btn.btn-danger:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}
.btn.btn-create {
    background: #3f6f72;
    border-color: #3f6f72;
    color: #fff;
}
.btn.btn-create:hover { background: #33595c; border-color: #33595c; color: #fff; }
.btn.btn-cancel {
    background: transparent;
    border-color: var(--line);
    color: var(--muted);
}
.btn.btn-cancel:hover {
    background: var(--paper-2);
    color: var(--ink);
}
.btn.btn-close-editor {
    width: 40px;
    height: 40px;
    padding: 0;
    background: #f3e4e0;
    border-color: #e0c8c4;
    color: var(--wine);
}
.btn.btn-close-editor:hover { background: #ead3cd; color: var(--wine-dark); }
.btn.btn-send {
    background: #5a6d9a;
    border-color: #5a6d9a;
    color: #fff;
}
.btn.btn-send:hover { background: #4a5c86; border-color: #4a5c86; color: #fff; }
.btn.btn-apply {
    background: #3d5a45;
    border-color: #3d5a45;
    color: #fff;
}
.btn.btn-apply:hover { background: #2f4636; border-color: #2f4636; color: #fff; }
.btn.btn-dismiss {
    background: #f3e4e0;
    border-color: #e0c8c4;
    color: var(--wine-dark);
}
.btn.btn-dismiss:hover { background: #ead3cd; }
.lyrics-editor-split {
    display: grid;
    grid-template-columns: 1.35fr minmax(280px, 1fr);
    min-height: 0;
    height: 100%;
}
.lyrics-pane, .lyrics-chat {
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 14px 16px 18px;
    overflow: hidden;
}
.lyrics-pane { border-right: 1px solid var(--line); }
.lyrics-chat {
    background: var(--paper-2);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.editor-chat-fold {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    display: block;
}
.editor-chat-fold > summary,
.editor-extra-fold > summary {
    cursor: pointer;
    font-weight: 650;
    font-size: 1rem;
    list-style: none;
}
.editor-chat-fold > summary::-webkit-details-marker,
.editor-extra-fold > summary::-webkit-details-marker { display: none; }
.lyric-story-neighbor {
    margin: 0 0 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--paper-2);
    flex-shrink: 0;
}
.lyric-story-neighbor + .wysiwyg { margin-top: 0; }
.wysiwyg + .lyric-story-neighbor { margin-top: 10px; }
.lyric-story-neighbor > summary {
    cursor: pointer;
    font-weight: 650;
    padding: 8px 12px;
    list-style: none;
}
.lyric-story-neighbor > summary::-webkit-details-marker { display: none; }
.lyric-story-neighbor[hidden] { display: none; }
.lyric-story-neighbor-body {
    padding: 0 12px 12px;
    max-height: 240px;
    overflow: auto;
    font-family: var(--serif);
    font-size: 0.95rem;
    line-height: 1.55;
}
.lyric-story-neighbor-body .story-char { pointer-events: none; }
.editor-chat-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}
.story-quick-prompts { flex-shrink: 0; }
.lyrics-chat-toolbar {
    display: flex;
    justify-content: flex-end;
    flex-shrink: 0;
    margin: 4px 0 0;
}
.btn-short { display: none; }
@media (min-width: 841px) {
    .lyrics-editor-split {
        overflow: hidden;
    }
    .lyrics-chat {
        min-height: 0;
        max-height: 100%;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        scrollbar-gutter: stable;
    }
    .editor-chat-fold {
        display: block;
        height: auto;
        max-height: none;
        overflow: visible;
        flex: 0 0 auto;
    }
    .editor-chat-fold > summary,
    .editor-extra-fold > summary { display: none; }
    .lyrics-chat > .editor-notes-fold {
        flex: 0 0 auto;
        margin: 0 0 10px;
        border: 0;
        border-radius: 0;
        background: transparent;
        overflow: visible;
    }
    .lyrics-chat > .editor-notes-fold > summary {
        display: block;
        cursor: default;
        pointer-events: none;
        padding: 0;
        margin: 0 0 6px;
        font-weight: 650;
        font-size: 1rem;
    }
    .lyrics-chat > .editor-notes-fold .editor-notes {
        margin: 0;
        padding: 0;
    }
    .editor-chat-body {
        display: flex;
        flex-direction: column;
        height: auto;
        max-height: none;
        overflow: visible;
        flex: none;
        min-height: 0;
    }
    .lyrics-chat-log {
        flex: 0 0 auto;
        min-height: 5rem;
        max-height: 16rem;
        overflow-y: auto;
        overscroll-behavior: contain;
    }
    .lyrics-chat-form,
    .lyrics-chat-toolbar,
    .lyrics-core,
    .lyrics-core-actions,
    .editor-notes,
    .editor-side-fold,
    .story-quick-prompts {
        flex-shrink: 0;
    }
}
.lyrics-chat h3 { margin: 0 0 6px; font-size: 1rem; }
.lyrics-core { margin: 8px 0 0; font-weight: 600; }
.lyrics-core textarea {
    font-weight: 400;
    min-height: 4.6em;
    line-height: 1.4;
}
.lyrics-core-actions { margin: 6px 0 10px; }
.editor-notes { margin: 0 0 10px; }
.editor-notes .muted { font-weight: 400; margin: 0 0 6px; }
.editor-notes textarea {
    display: block;
    width: 100%;
    min-height: 5.4em;
    box-sizing: border-box;
}
.editor-side-fold-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 0 10px;
    font-weight: 400;
}
.editor-side-fold-body .muted,
.editor-side-fold-body .hint { margin: 0; }
.editor-side-fold-body textarea {
    min-height: 4.6em;
    line-height: 1.4;
    font-weight: 400;
}
.editor-side-fold [data-editor-notes] { min-height: 5.4em; }
.editor-side-fold [data-translator-run],
.editor-side-fold [data-rhymes-run],
.editor-side-fold [data-synonyms-run],
.editor-side-fold [data-core-generate] {
    align-self: flex-start;
}
.translator-result {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px 11px;
    min-height: 4.6em;
    max-height: 12em;
    overflow: auto;
    white-space: pre-wrap;
    line-height: 1.45;
    font-weight: 400;
}
.translator-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.translator-nav-idx {
    font-weight: 650;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    white-space: nowrap;
}
.rhymes-result {
    display: block;
    width: 100%;
    font: inherit;
    color: inherit;
    text-align: left;
    cursor: pointer;
}
.rhymes-result:hover,
.rhymes-result:focus-visible {
    border-color: var(--wine);
    outline: none;
}
.note-card {
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
}
.note-card.is-dragging { opacity: 0.55; }
.note-card.is-main {
    background: #f7ebe3;
    border: 2px solid var(--wine);
    box-shadow: var(--shadow);
}
.note-card .lyric-card-top { margin: 0 0 4px; }
.note-pin {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}
.note-pin:hover { background: var(--paper-2); color: var(--ink); }
.note-pin svg,
.note-pin path { pointer-events: none; }
.note-pin.is-on {
    background: transparent;
    color: var(--danger);
}
.note-pin.is-on:hover { background: #fdecea; color: #8a1515; }
.card-icon-btn.note-pin.is-on {
    background: #fff;
    color: var(--danger);
    border-color: var(--danger);
}
.card-icon-btn.note-pin.is-on:hover {
    background: #fdecea;
    color: #8a1515;
    border-color: #8a1515;
}
.note-main-badge {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    margin: 0 0 10px;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--wine);
    color: #fffaf3;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.note-card .btn-row { margin-top: auto; padding-top: 10px; }
.card-icon-row {
    gap: 8px;
}
.card-icon-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
    color: var(--ink);
    cursor: pointer;
    box-shadow: var(--shadow);
}
.card-icon-btn svg,
.card-icon-btn path {
    pointer-events: none;
}
.card-icon-btn:hover,
.card-icon-btn:focus-visible {
    background: #fff;
    border-color: var(--wine);
    color: var(--wine);
    outline: none;
}
.card-icon-btn--danger {
    color: var(--danger);
    border-color: var(--danger);
}
.card-icon-btn--danger:hover,
.card-icon-btn--danger:focus-visible {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}
.card-icon-btn:disabled {
    opacity: 0.45;
    cursor: wait;
    pointer-events: none;
}
.reader-fabs {
    position: fixed;
    z-index: 35;
    right: 18px;
    bottom: calc(var(--app-footer-h) + 18px);
    display: flex;
    align-items: center;
    gap: 10px;
}
.reader-back {
    width: 52px;
    height: 52px;
    padding: 0;
    border: 1px solid rgba(28, 22, 18, 0.18);
    border-radius: 50%;
    background: transparent;
    color: var(--wine);
    box-shadow: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}
.reader-back:hover,
.reader-back:focus-visible {
    background: rgba(255, 250, 243, 0.55);
    border-color: var(--wine);
    outline: none;
}
.reader-read {
    width: 52px;
    height: 52px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(122, 46, 42, 0.48);
    color: #fffaf3;
    box-shadow: 0 10px 28px rgba(28, 22, 18, 0.18);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    backdrop-filter: blur(6px);
}
.reader-read:hover,
.reader-read:focus-visible {
    background: rgba(122, 46, 42, 0.9);
    outline: none;
}
.reader-fan {
    width: 52px;
    height: 52px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(122, 46, 42, 0.48);
    color: #fffaf3;
    box-shadow: 0 10px 28px rgba(28, 22, 18, 0.18);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
}
.reader-fan:hover,
.reader-fan:focus-visible {
    background: rgba(122, 46, 42, 0.9);
    outline: none;
}
.reader-fan:disabled {
    opacity: 0.6;
    cursor: wait;
}
.reader-main-note {
    width: 52px;
    height: 52px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(122, 46, 42, 0.48);
    color: #fffaf3;
    box-shadow: 0 10px 28px rgba(28, 22, 18, 0.18);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
}
.reader-main-note:hover,
.reader-main-note:focus-visible {
    background: rgba(122, 46, 42, 0.9);
    outline: none;
}
.reader-lyric-view {
    width: 52px;
    height: 52px;
    padding: 0;
    border: 1px solid rgba(28, 22, 18, 0.18);
    border-radius: 50%;
    background: rgba(255, 250, 243, 0.72);
    color: var(--wine);
    box-shadow: 0 10px 28px rgba(28, 22, 18, 0.12);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
}
.reader-lyric-view:hover,
.reader-lyric-view:focus-visible {
    background: rgba(255, 250, 243, 0.95);
    outline: none;
}
.reader-lyric-view.is-on {
    background: rgba(122, 46, 42, 0.48);
    border-color: transparent;
    color: #fffaf3;
    box-shadow: 0 10px 28px rgba(28, 22, 18, 0.18);
}
.reader-lyric-view.is-on:hover,
.reader-lyric-view.is-on:focus-visible {
    background: rgba(122, 46, 42, 0.9);
}
.reader-lyric-sort-done {
    display: none;
    width: 52px;
    height: 52px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(62, 196, 88, 0.62);
    color: #fff;
    box-shadow: 0 0 0 0 rgba(62, 196, 88, 0.55), 0 10px 28px rgba(28, 22, 18, 0.18);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
    animation: lyric-sort-done-pulse 1.15s ease-in-out infinite;
}
body.lyric-sort-mode .reader-lyric-sort-done,
body.lyric-order-dirty .reader-lyric-sort-done,
.reader-lyric-sort-done.is-shown {
    display: inline-flex !important;
}
.reader-lyric-sort-done:hover,
.reader-lyric-sort-done:focus-visible {
    background: rgba(46, 184, 74, 0.95);
    outline: none;
    animation-play-state: paused;
}
@keyframes lyric-sort-done-pulse {
    0%, 100% {
        transform: scale(1);
        background: rgba(62, 196, 88, 0.55);
        box-shadow: 0 0 0 0 rgba(62, 196, 88, 0.55), 0 10px 28px rgba(28, 22, 18, 0.18);
    }
    50% {
        transform: scale(1.1);
        background: rgba(86, 220, 110, 0.95);
        box-shadow: 0 0 0 12px rgba(62, 196, 88, 0), 0 10px 28px rgba(28, 22, 18, 0.22);
    }
}
#btn-lyric-sort.is-active,
#btn-lyric-sort.is-active:hover {
    background: var(--wine);
    border-color: var(--wine);
    color: #fff;
}
.lyric-sort-hint { display: none; margin: 0 0 12px; }
body.lyric-sort-mode .lyric-card {
    cursor: pointer;
    user-select: none;
    touch-action: manipulation;
}
body.lyric-sort-mode .lyric-card:not([data-sort-n]) {
    opacity: 0.78;
}
body.lyric-sort-mode .lyric-card.is-filtered-out { cursor: default; }
body.lyric-sort-mode .lyric-card .btn-row,
body.lyric-sort-mode .lyric-card .btn-count,
body.lyric-sort-mode .lyric-drag,
body.lyric-sort-mode .badge-story-link {
    pointer-events: none;
}
body.lyric-sort-mode .lyric-drag { visibility: hidden; }
.lyric-card[data-sort-n] {
    outline: 2px solid var(--wine);
    outline-offset: -2px;
}
.lyric-card[data-sort-n]::after {
    content: attr(data-sort-n);
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    min-width: 1.7rem;
    height: 1.7rem;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--wine);
    color: #fffaf3;
    font-family: var(--sans);
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1.7rem;
    text-align: center;
    box-shadow: 0 4px 12px rgba(28, 22, 18, 0.2);
}
body.lyric-sort-mode .lyric-sort-hint { display: block; }
body.editor-open .reader-fabs,
body.modal-full-open .reader-fabs { display: none; }

.note-edit-body {
    margin: 0;
    height: 100dvh;
    overflow: hidden;
    background: var(--paper);
}
.note-edit-body .note-editor {
    display: grid;
    grid-template-rows: auto 1fr;
    width: 100%;
    height: 100dvh;
    min-height: 0;
    background: var(--paper);
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
}
.note-editor-body {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 12px 16px 16px;
    gap: 10px;
}
.note-edit-body .note-wysiwyg {
    flex: 1 1 auto;
    min-height: 0;
    font-family: var(--serif);
    font-size: 1.08rem;
}
.note-editor [data-fullscreen] {
    min-width: 40px;
}
.note-edit-body .note-editor:fullscreen,
.note-edit-body:fullscreen .note-editor {
    width: 100%;
    height: 100%;
}
.lyrics-char-insert {
    display: flex;
    gap: 8px;
    margin: 8px 0 0;
    align-items: stretch;
}
.lyrics-char-insert select { flex: 1; min-width: 0; font-weight: 400; }
.lyrics-char-linked { margin: 6px 0 0; }
.wysiwyg-toolbar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}
.wysiwyg-toolbar-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.toolbar-sep {
    width: 1px;
    align-self: stretch;
    min-height: 1.5em;
    background: var(--line);
    margin: 0 4px;
}
body.editor-open .modal-root { z-index: 90; }
.translate-label {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 650;
    color: var(--muted);
}
.translate-preview {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px 14px;
    max-height: 28vh;
    overflow: auto;
    line-height: 1.65;
}
.translate-preview--orig {
    color: var(--muted);
    background: var(--paper-2);
    white-space: pre-wrap;
}
.translate-preview p { margin: 0 0 0.6em; }
.translate-preview p:last-child { margin-bottom: 0; }
.wysiwyg {
    flex: 1;
    min-height: 240px;
    overflow: auto;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 16px 18px;
    font-size: 1.02rem;
    line-height: 1.65;
    outline: none;
}
.wysiwyg:focus { border-color: var(--wine); }
.wysiwyg p { margin: 0 0 0.65em; }
.wysiwyg p:last-child { margin-bottom: 0; }
.lyric-part {
    border-left: 3px solid var(--wine);
    background: var(--wine-soft);
    padding: 6px 12px 8px;
    margin: 10px 0;
    border-radius: 0 8px 8px 0;
    line-height: 1.55;
}
.lyric-part p,
.lyric-part div {
    margin: 0;
    padding: 0;
}
.lyric-part::before {
    content: attr(data-label);
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--wine);
    margin-bottom: 4px;
}
.lyric-part--verse { border-color: #3d5a45; background: #e8f0ea; }
.lyric-part--verse::before { color: #3d5a45; }
.lyric-part--pre-chorus { border-color: #c47a32; background: #f8eee3; }
.lyric-part--pre-chorus::before { color: #a05e22; }
.lyric-part--chorus { border-color: #7a2e2a; background: #f3e4e0; }
.lyric-part--chorus::before { color: #7a2e2a; }
.lyric-part--interlude { border-color: #3f6f72; background: #e6f1f2; }
.lyric-part--interlude::before { color: #3f6f72; }
.lyric-part--prelude { border-color: #5a6d9a; background: #eceff7; }
.lyric-part--prelude::before { color: #4a5c86; }
.lyric-part--intro { border-color: #6a7c38; background: #eef3e0; }
.lyric-part--intro::before { color: #55632c; }
.lyric-part--outro { border-color: #7a4a62; background: #f4e8ee; }
.lyric-part--outro::before { color: #6a3d54; }
.part-btn { border-left-width: 4px; }
.btn.part-btn--verse { border-left-color: #3d5a45; background: #e8f0ea; }
.btn.part-btn--verse:hover { background: #d7e4da; }
.btn.part-btn--pre-chorus { border-left-color: #c47a32; background: #f8eee3; }
.btn.part-btn--pre-chorus:hover { background: #f0e0cc; }
.btn.part-btn--chorus { border-left-color: #7a2e2a; background: #f3e4e0; }
.btn.part-btn--chorus:hover { background: #ead3cd; }
.btn.part-btn--interlude { border-left-color: #3f6f72; background: #e6f1f2; }
.btn.part-btn--interlude:hover { background: #d4e6e8; }
.btn.part-btn--prelude { border-left-color: #5a6d9a; background: #eceff7; }
.btn.part-btn--prelude:hover { background: #dde2f0; }
.btn.part-btn--intro { border-left-color: #6a7c38; background: #eef3e0; }
.btn.part-btn--intro:hover { background: #e0e8cc; }
.btn.part-btn--outro { border-left-color: #7a4a62; background: #f4e8ee; }
.btn.part-btn--outro:hover { background: #ead7e1; }
.btn[data-lyric-break] {
    border-left: 4px dashed var(--muted);
}
.lyric-trail { min-height: 1.8em; }
.wysiwyg > p.lyric-trail:last-child {
    margin-top: 6px;
    padding-top: 4px;
}
.lyric .lyric-part { margin: 8px 0; }
.lyrics-chat-log {
    flex: 1 1 0%;
    overflow-y: auto;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 10px 0;
    min-height: 5rem;
}
.lyrics-chat-msg {
    padding: 8px 10px;
    border-radius: 10px;
    white-space: pre-wrap;
    font-size: 0.9rem;
    max-width: 100%;
}
.lyrics-chat-msg--user { background: #fff; align-self: flex-end; }
.lyrics-chat-msg--assistant { background: var(--card); border: 1px solid var(--line); }
.lyrics-chat-form { display: flex; flex-direction: column; gap: 8px; }
.lyrics-chat-world {
    font-weight: 500;
    font-size: 0.82rem;
    line-height: 1.35;
    color: var(--muted);
}
.lyrics-chat-world input { margin: 0; }
.lyrics-suggest {
    position: absolute;
    inset: 0;
    grid-row: 1 / -1;
    grid-column: 1 / -1;
    background: rgba(28,22,18,0.45);
    display: grid;
    place-items: center;
    padding: 20px;
    z-index: 40;
}
.lyrics-editor { position: relative; }
.lyrics-suggest[hidden] { display: none !important; }
.lyrics-suggest-card {
    width: min(640px, 96vw);
    max-height: 80vh;
    overflow: auto;
    background: var(--card);
    border-radius: 16px;
    padding: 18px 20px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.25);
}
.lyrics-suggest-preview {
    border: 1px dashed var(--line);
    border-radius: 10px;
    padding: 12px 14px;
    margin: 10px 0 16px;
    background: #fff;
}
.lyrics-suggest-preview[hidden] { display: none !important; }
.lyrics-suggest-stack { min-height: 0; }
.lyrics-suggest-version[hidden] { display: none !important; }
.lyrics-suggest-nav { margin: 0 0 14px; }
.lyrics-suggest-core {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px 14px;
    margin: 10px 0;
    background: var(--wine-soft);
}
.lyrics-suggest-core h4 {
    margin: 0 0 6px;
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--wine);
}
.lyrics-suggest-core-text { margin: 0; line-height: 1.5; }
.lyrics-suggest-core textarea {
    width: 100%;
    min-height: 4.5rem;
    margin: 0;
    resize: vertical;
    font: inherit;
    line-height: 1.5;
    background: #fff;
}

@media (max-width: 840px) {
    .lyrics-editor-split {
        display: flex;
        flex-direction: column;
        grid-template-columns: none;
        grid-template-rows: none;
        height: auto;
        min-height: 0;
        overflow: visible;
    }
    .lyrics-pane { border-right: 0; border-bottom: 1px solid var(--line); }
}
.btn-primary { background: var(--wine); border-color: var(--wine); color: #fff; }
.btn-primary:hover { background: var(--wine-dark); color: #fff; }
.btn-small { padding: 5px 10px; font-size: 0.85rem; }
.btn-ghost { background: transparent; }
.btn-icon {
    border: 0; background: transparent; font-size: 1.4rem; cursor: pointer; color: var(--muted);
}
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.btn-has-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.45em;
}
.btn-has-icon .btn-ico { display: block; }
.btn-has-icon .btn-label { line-height: 1.2; }
.btn-menu {
    position: relative;
    display: inline-flex;
}
.btn-menu-flyout {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 40;
    min-width: max(12rem, 100%);
    max-width: min(22rem, 90vw);
    max-height: min(50vh, 20rem);
    overflow: auto;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 12px 28px rgba(28, 22, 18, 0.16);
}
.topbar-actions .btn-menu {
    z-index: 5;
}
.topbar-actions .btn-menu.is-open {
    z-index: 60;
}
.btn-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ink);
    text-decoration: none;
    text-align: left;
    font: inherit;
    cursor: pointer;
}
.btn-menu-item .btn-ico {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    display: block;
}
.btn-menu-item:hover,
.btn-menu-item:focus-visible {
    background: var(--paper-2);
    outline: none;
}
.btn-menu.is-open .btn-menu-flyout { display: block; }
.toolbar { margin-bottom: 16px; }

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}
.char-grid {
    grid-template-columns: repeat(auto-fill, minmax(22rem, 1fr));
}
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
}
.card.book-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.book-card-link,
.book-card-link:hover,
.book-card-link:focus,
.book-card-link:focus-visible {
    display: block;
    text-decoration: none;
    color: inherit;
    flex: 1 1 auto;
    min-width: 0;
    cursor: pointer;
}
.card.book-card:hover,
.card.book-card:focus-within {
    border-color: var(--wine);
    box-shadow: 0 10px 28px rgba(90, 40, 36, 0.14);
    transform: translateY(-2px);
}
.card.book-card h2 { color: inherit; }
.topbar-book-title {
    cursor: text;
    border-radius: 8px;
}
.topbar-book-title.is-editing {
    outline: 1px solid var(--wine);
    background: var(--card);
    box-shadow: 0 0 0 3px rgba(122, 46, 42, 0.12);
}
.card h2 { margin: 0 0 8px; font-size: 1.15rem; font-family: var(--serif); }
.char-card-photo {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    max-height: 220px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--paper-2);
    margin: 0 0 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.char-card-photo img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    display: block;
}
.char-emotion-strip {
    display: flex;
    gap: 6px;
    margin: -4px 0 12px;
}
.char-emotion-thumb {
    position: relative;
    flex: 1;
    aspect-ratio: 3 / 4;
    max-height: 52px;
    border-radius: 6px;
    overflow: hidden;
    background: var(--paper-2);
    border: 1px solid var(--line, rgba(0, 0, 0, 0.08));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: var(--muted, #666);
}
.char-emotion-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    display: block;
}
.char-emotion-thumb:not(.is-filled) {
    opacity: 0.45;
}
.char-profile-photo {
    width: 100%;
    max-height: 240px;
    border-radius: 10px;
    height: auto;
    object-fit: cover;
    object-position: top center;
    display: block;
}
.char-card-initial {
    font-family: var(--serif);
    font-size: 3rem;
    color: var(--wine);
    opacity: 0.55;
}
.char-photo-edit {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: hidden;
}
.char-photo-edit > label,
.char-photo-edit > .btn-row {
    flex: 0 0 auto;
}
.char-photo-frame {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 10px;
    background: var(--paper-2);
}
.char-photo-frame [data-photo-empty] {
    margin: 0;
    padding: 12px;
    text-align: center;
}
.char-photo-edit img[data-photo-preview] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: top center;
    display: block;
}
.char-card-section {
    margin: 0 0 12px;
}
.char-card-section h3 {
    margin: 0 0 4px;
    font-family: var(--sans);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.char-card-section h3 svg {
    flex-shrink: 0;
    opacity: 0.85;
}
.char-card-section p { margin: 0; line-height: 1.45; }
.char-profile-text {
    white-space: pre-wrap;
    line-height: 1.55;
}
.char-edit-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
}
.char-edit-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 20px 28px;
    flex: 1 1 auto;
    min-height: 0;
    align-items: stretch;
}
.char-edit-col {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    overflow: hidden;
}
.char-edit-col--media {
    min-height: 0;
}
.char-edit-notes { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; }
.char-edit-notes textarea {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    resize: none;
}
.char-edit-links {
    flex: 1 1 0;
    min-height: 0;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px 14px;
    background: var(--paper-2);
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.char-edit-links[hidden] { display: none !important; }
.char-edit-links h3 {
    margin: 0 0 6px;
    font-size: 0.95rem;
}
.char-edit-links ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.char-edit-links li {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}
.char-edit-links .muted { font-size: 0.82rem; }
.char-edit-ai {
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px 14px;
    background: var(--paper-2);
}
.char-edit-ai-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex: 0 0 auto;
}
.char-edit-ai-head h3 {
    margin: 0 0 4px;
    font-size: 0.95rem;
}
.char-edit-ai-head .hint { margin: 0; }
.char-edit-ai-head .btn { flex-shrink: 0; }
.char-edit-ai .char-profile-text {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}
.char-edit-ai[hidden],
.char-photo-edit img[data-photo-preview][hidden] {
    display: none !important;
}
.char-edit-actions {
    margin-top: 0;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    flex-shrink: 0;
}
.char-assign-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
}
.char-assign-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 20px 28px;
    flex: 1 1 auto;
    min-height: 0;
    align-items: stretch;
}
.char-assign-col {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
}
.char-assign-notes {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.char-assign-notes textarea {
    flex: 1 1 auto;
    min-height: 10rem;
    resize: vertical;
}
.char-assign-photo-edit {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.char-assign-photo {
    position: relative;
    flex: 1 1 auto;
    min-height: 220px;
    overflow: hidden;
    border-radius: 12px;
    background: var(--paper-2);
    display: flex;
    align-items: center;
    justify-content: center;
}
.char-assign-photo img[data-photo-preview] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: cover;
    object-position: top center;
    border-radius: 0;
    display: block;
}
.char-assign-actions {
    margin-top: 0;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    flex-shrink: 0;
    flex-wrap: wrap;
}
.char-assign-actions .btn {
    min-height: 2.4rem;
}
.char-profile-view {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 20px 28px;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
}
.char-profile-view-photo {
    position: relative;
    min-height: 0;
    overflow: hidden;
    border-radius: 12px;
    background: var(--paper-2);
    display: flex;
    align-items: center;
    justify-content: center;
}
.char-profile-view-photo img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    display: block;
}
.char-profile-view-links {
    min-height: 0;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px 16px;
    background: var(--paper-2);
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.char-profile-view-links h3,
.char-profile-view-col h3 {
    margin: 0 0 8px;
    font-size: 0.95rem;
}
.char-profile-view-links ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.char-profile-view-links li {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}
.char-profile-view-links .muted { font-size: 0.82rem; }
.char-profile-view-col {
    min-height: 0;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px 16px;
    background: var(--paper-2);
}
.card-foot { font-size: 0.85rem; color: var(--muted); margin: 12px 0 0; }
.lyric-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    align-items: center;
    margin: 0 0 12px;
}
.lyric-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.lyric-view-switch {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.list-layout-switch {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-left: auto;
}
.lyric-toolbar #lyric-search,
.lyric-toolbar #note-search {
    width: min(280px, 100%);
    flex: 1 1 180px;
    min-width: 140px;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
    color: inherit;
    font: inherit;
}
.lyric-filter .btn.is-active,
.lyric-filter .btn.is-active:hover,
.lyric-view-switch .btn.is-active,
.lyric-view-switch .btn.is-active:hover,
.list-layout-switch .btn.is-active,
.list-layout-switch .btn.is-active:hover {
    background: var(--wine);
    border-color: var(--wine);
    color: #fff;
}
.lyric-filter .btn.is-active:hover,
.lyric-view-switch .btn.is-active:hover,
.list-layout-switch .btn.is-active:hover {
    background: var(--wine-dark);
    border-color: var(--wine-dark);
}
.lyric-filter .lyric-filter-both {
    background: #d7eadc;
    border-color: #8fb89a;
    color: #2b4a34;
}
.lyric-filter .lyric-filter-both:hover {
    background: #c7e0ce;
    border-color: #7aa887;
}
.lyric-filter .lyric-filter-both.is-active,
.lyric-filter .lyric-filter-both.is-active:hover {
    background: #3d5a45;
    border-color: #3d5a45;
    color: #fff;
}
.lyric-filter .lyric-filter-album {
    background: #f6e4c8;
    border-color: #e0b878;
    color: #7a4a12;
}
.lyric-filter .lyric-filter-album:hover {
    background: #f0d7ae;
    border-color: #d4a45e;
}
.lyric-filter .lyric-filter-album.is-active,
.lyric-filter .lyric-filter-album.is-active:hover {
    background: #c47a32;
    border-color: #c47a32;
    color: #fff;
}
.lyric-filter .lyric-filter-none {
    background: #e8e6e3;
    border-color: #c9c4bd;
    color: #5c5852;
}
.lyric-filter .lyric-filter-none:hover {
    background: #ddd9d4;
    border-color: #b8b2aa;
}
.lyric-filter .lyric-filter-none.is-active,
.lyric-filter .lyric-filter-none.is-active:hover {
    background: #6b6660;
    border-color: #6b6660;
    color: #fff;
}
.lyric-filter-empty { margin: 0 0 12px; }
.story-place {
    margin: 0;
    padding: 0;
    border: 0;
}
.story-place legend {
    font-weight: 650;
    margin: 0 0 8px;
}
.story-place-switch {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.story-place-switch .btn.is-active,
.story-place-switch .btn.is-active:hover {
    background: var(--wine);
    border-color: var(--wine);
    color: #fff;
}
.story-from-lyrics-form textarea {
    min-height: 10em;
}
.story-from-fact-form [data-fact-preview] {
    white-space: pre-wrap;
    max-height: 8em;
    overflow: auto;
}
.story-proposal-title {
    font-family: var(--serif);
    margin: 0 0 10px;
    font-size: 1.35rem;
}
.story-proposal .story-preview {
    margin-bottom: 14px;
}
#lyric-grid[data-card-view="core"] [data-lyric-preview="notes"],
#lyric-grid[data-card-view="notes"] [data-lyric-preview="core"] {
    display: none;
}
.lyric-card-preview { cursor: pointer; }
.lyric-card-edit-form textarea {
    width: 100%;
    min-height: 8em;
    resize: vertical;
}
.lyric-card {
    position: relative;
    display: flex;
    flex-direction: column;
}
.lyric-card.is-linked {
    background: var(--wine-soft);
    border-color: #d4b4ae;
    box-shadow: inset 3px 0 0 var(--wine), var(--shadow);
}
.lyric-card--both,
.lyric-card--story {
    background: #d7eadc;
    border-color: #8fb89a;
    box-shadow: inset 3px 0 0 #3d5a45, var(--shadow);
}
.lyric-card--album {
    background: #f6e4c8;
    border-color: #e0b878;
    box-shadow: inset 3px 0 0 #c47a32, var(--shadow);
}
.lyric-card--none {
    background: #e8e6e3;
    border-color: #c9c4bd;
    box-shadow: inset 3px 0 0 #8a847c, var(--shadow);
}
.lyric-card.is-dragging {
    opacity: 0.55;
}
body.is-lyric-dragging {
    overflow: hidden;
    touch-action: none;
    user-select: none;
}
body.is-lyric-dragging .lyric-card {
    touch-action: none;
}
.lyric-card.is-filtered-out,
.lyric-row.is-filtered-out,
.note-card.is-filtered-out,
.note-row.is-filtered-out { display: none !important; }
#lyric-table-wrap,
#note-table-wrap { display: none; }
html[data-texts-layout="table"] #lyric-grid,
html[data-notes-layout="table"] #note-grid { display: none; }
html[data-texts-layout="table"] #lyric-table-wrap,
html[data-notes-layout="table"] #note-table-wrap { display: block; }
html[data-texts-layout="table"] .lyric-view-switch,
html[data-texts-layout="table"] .reader-lyric-view,
html[data-texts-layout="table"] #btn-lyric-sort,
html[data-texts-layout="table"] #btn-lyric-sort-done {
    display: none !important;
}
html[data-texts-layout="table"] .lyric-sort-hint { display: none !important; }
.lyric-card-top {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 8px;
}
.lyric-card-cover {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
    background: var(--paper-2);
}
.lyric-table-cover {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 6px;
    vertical-align: middle;
    margin-right: 8px;
    background: var(--paper-2);
}
.lyric-status-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 650;
    white-space: nowrap;
}
.lyric-status-pill--both,
.lyric-status-pill--story {
    background: #3d5a45;
    color: #fff;
}
.lyric-status-pill--album {
    background: #c47a32;
    color: #fff;
}
.lyric-status-pill--none {
    background: #6b6660;
    color: #fff;
}
button.lyric-status-pill {
    border: 0;
    font: inherit;
    cursor: pointer;
    line-height: inherit;
}
button.lyric-status-pill:hover {
    filter: brightness(1.12);
}
.lyric-row--both td,
.lyric-row--story td {
    background: #d7eadc;
}
.lyric-row--album td {
    background: #f6e4c8;
}
.lyric-row--none td {
    background: #e8e6e3;
}
.table tbody tr.lyric-row--both:hover td,
.table tbody tr.lyric-row--story:hover td {
    background: #c7e0ce;
}
.table tbody tr.lyric-row--album:hover td {
    background: #f0d7ae;
}
.table tbody tr.lyric-row--none:hover td {
    background: #ddd9d4;
}
.table tbody tr.lyric-row--both:hover td:first-child,
.table tbody tr.lyric-row--story:hover td:first-child {
    box-shadow: inset 3px 0 0 #3d5a45;
}
.table tbody tr.lyric-row--album:hover td:first-child {
    box-shadow: inset 3px 0 0 #c47a32;
}
.table tbody tr.lyric-row--none:hover td:first-child {
    box-shadow: inset 3px 0 0 #8a847c;
}
.note-row.is-main td {
    background: #fff;
}
.table tbody tr.note-row.is-main:hover td {
    background: #f4f4f4;
}
.table tbody tr.note-row.is-main:hover td:first-child {
    box-shadow: inset 3px 0 0 var(--wine);
}
.note-row {
    cursor: pointer;
}
#note-table-wrap {
    background: #fff;
}
#note-table {
    background: #fff;
    table-layout: fixed;
}
#note-table thead th,
#note-table tbody td {
    background: #fff;
}
#note-table tbody tr:hover td {
    background: #f4f4f4;
}
#note-table th:nth-child(1) { width: 22%; }
#note-table th:nth-child(2) { width: 34%; }
#note-table th:nth-child(3) { width: 14%; }
#note-table th:nth-child(4) { width: 12%; }
#note-table th:nth-child(5) { width: 9.75rem; }
#note-table td.note-excerpt {
    white-space: normal;
    overflow-wrap: break-word;
    word-break: break-word;
    line-height: 1.4;
    color: var(--muted);
    font-size: 0.92rem;
}
#note-table td[data-label="Titel"] {
    overflow-wrap: anywhere;
}
#note-table td[data-label="Aktualisiert"],
#note-table td[data-label="Hauptnotiz"] {
    white-space: nowrap;
}
#note-table td.table-actions {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    width: 9.75rem;
    min-width: 9.75rem;
    vertical-align: middle;
}
#lyric-table td.table-actions {
    display: table-cell;
    vertical-align: middle;
    white-space: nowrap;
    width: 1%;
}
#lyric-table .table-actions-inner {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
}
.lyric-drag {
    margin-left: auto;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    cursor: grab;
    touch-action: none;
}
.lyric-drag svg { fill: currentColor; }
.lyric-drag:hover { background: var(--paper-2); color: var(--ink); }
.lyric-drag:active { cursor: grabbing; }
.lyric-card h2 { margin: 0 0 10px; }
.lyric-card-album {
    margin: 0 0 2px;
    font-size: 0.78rem;
    color: var(--muted);
    line-height: 1.3;
}
button.lyric-card-album {
    display: block;
    width: 100%;
    border: 0;
    background: none;
    padding: 0;
    text-align: left;
    cursor: pointer;
    font: inherit;
    color: var(--muted);
}
button.lyric-card-album:hover {
    color: var(--wine);
    text-decoration: underline;
}
button.lyric-card-album.is-empty {
    font-style: italic;
}
.lyric-card .char-card-section p {
    white-space: pre-wrap;
    max-height: 10rem;
    overflow: auto;
}
.lyric-view-modal {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    flex: 1 1 auto;
    height: 100%;
}
.lyric-view-lang {
    margin: 0;
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-weight: 700;
}
.lyric-view-body {
    flex: 1 1 auto;
    min-height: 12rem;
    overflow: auto;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 16px 18px;
    font-family: var(--serif);
    font-size: 1.05rem;
    line-height: 1.65;
}
.lyric-view-body p { margin: 0 0 0.65em; }
.lyric-view-body p:last-child { margin-bottom: 0; }
.lyric-view-actions { margin-top: 4px; flex-shrink: 0; }
.lyric-print-dialog {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
}
.lyric-print-dialog .list-layout-switch {
    margin: 0;
}
.lyric-print-dialog .check-row {
    margin: 0;
}
.lyric-print-preview {
    background: #d8d2c8;
    color: #000;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px;
    max-height: min(58vh, 40rem);
    overflow: auto;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 12pt;
    line-height: 1.45;
}
.lyric-print-preview-desk {
    position: relative;
    overflow: hidden;
}
.lyric-print-preview-stage {
    transform-origin: top left;
}
.lyric-print-preview .lyric-print-page {
    box-sizing: border-box;
    width: 210mm;
    height: 297mm;
    max-height: 297mm;
    padding: 12mm;
    margin: 0 0 6mm;
    overflow: hidden;
    background: #fff;
    color: #000;
    box-shadow: 0 1px 6px rgba(28, 22, 18, 0.22);
}
.lyric-print-preview .lyric-print-page:last-child { margin-bottom: 0; }
.lyric-print-preview .lyric-print-title {
    font-size: 20pt;
    font-weight: 700;
    margin: 0 0 14pt;
    color: #000;
}
.lyric-print-preview .lyric-print-chapter,
.lyric-print-measure .lyric-print-chapter {
    font-size: 14pt;
    font-weight: 700;
    margin: 0;
    color: #000;
    font-family: Georgia, "Times New Roman", serif;
}
.lyric-print-preview p,
.lyric-print-preview h1,
.lyric-print-preview h2,
.lyric-print-preview h3,
.lyric-print-preview h4,
.lyric-print-preview ul,
.lyric-print-preview ol,
.lyric-print-preview li,
.lyric-print-preview blockquote,
.lyric-print-measure p,
.lyric-print-measure h2,
.lyric-print-measure h3,
.lyric-print-measure h4,
.lyric-print-measure ul,
.lyric-print-measure ol,
.lyric-print-measure li,
.lyric-print-measure blockquote {
    margin: 0;
    padding: 0;
}
.lyric-print-preview .lyric-print-block,
.lyric-print-measure .lyric-print-block {
    margin: 0;
    padding: 0;
    font-size: 12pt;
    line-height: 1.45;
    color: #000;
}
.print-pick {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.print-pick[hidden] { display: none; }
.print-pick-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-weight: 600;
}
.print-pick-tools {
    display: flex;
    gap: 6px;
}
.print-pick-tools .btn-row,
.print-pick-head .btn-row {
    margin-top: 0;
}
.print-multiselect {
    max-height: 12rem;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.print-pick-row {
    margin: 0;
    padding: 8px 10px;
    border-radius: 8px;
    font-weight: 500;
}
.print-pick-row:hover,
.print-pick-row:has(input:checked) {
    background: var(--wine-soft);
}
.lyric-print-preview .lyric-print-cols {
    display: flex;
    align-items: flex-start;
    gap: 0;
    width: 100%;
}
.lyric-print-preview .lyric-print-cols--2 { gap: 10mm; }
.lyric-print-preview .lyric-print-col {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}
.lyric-print-preview .lyric-print-clip {
    overflow: hidden;
}
.lyric-print-preview .lyric-part,
.lyric-print-preview .lyric-print-loose {
    background: none !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    color: #000 !important;
    font-size: 12pt !important;
    line-height: 1.45 !important;
}
.lyric-print-preview .lyric-part::before {
    content: attr(data-label);
    display: block;
    font-size: 14pt;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
    color: #000 !important;
    margin: 0 0 3pt;
}
.lyric-print-preview .lyric-part:not([data-label])::before { content: none; }
.lyric-print-preview .lyric-part p,
.lyric-print-preview .lyric-part div,
.lyric-print-preview .lyric-print-loose p,
.lyric-print-preview .lyric-print-loose div {
    margin: 0;
    font-size: 12pt;
    color: #000;
}
.lyric-print-preview .story-char,
.lyric-print-preview .story-person-hint {
    background: none !important;
    border: none !important;
    color: inherit !important;
    padding: 0 !important;
    border-radius: 0 !important;
}
.lyric-print-preview .lyric-trail { display: none !important; }
.lyric-print-measure {
    position: absolute;
    left: -9000px;
    top: 0;
    width: 210mm;
    pointer-events: none;
    visibility: hidden;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 12pt;
    line-height: 1.45;
    color: #000;
}
.lyric-print-measure .lyric-print-title {
    font-size: 20pt;
    font-weight: 700;
    margin: 0 0 14pt;
    font-family: Georgia, "Times New Roman", serif;
    color: #000;
}
.lyric-print-measure .lyric-part,
.lyric-print-measure .lyric-print-loose {
    background: none !important;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 12pt !important;
    line-height: 1.45 !important;
}
.lyric-print-measure .lyric-part::before {
    content: attr(data-label);
    display: block;
    font-size: 14pt;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
    color: #000;
    margin: 0 0 3pt;
}
.lyric-print-measure .lyric-part:not([data-label])::before { content: none; }
.lyric-print-frame {
    position: fixed;
    left: 0;
    top: 0;
    width: 210mm;
    height: 297mm;
    border: 0;
    opacity: 0;
    pointer-events: none;
    z-index: -1;
}
.lyric-card .btn-row { margin-top: auto; padding-top: 10px; }
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}
.dashboard-grid--single { grid-template-columns: 1fr; }
.dashboard-panel h2 {
    margin: 0 0 14px;
    font-family: var(--serif);
    font-size: 1.2rem;
}
.recent-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.recent-list li {
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}
.recent-list li:last-child { padding-bottom: 0; border-bottom: 0; }
.recent-main {
    display: block;
    width: 100%;
    border: 0;
    background: none;
    padding: 0;
    margin: 0;
    font: inherit;
    font-weight: 650;
    text-align: left;
    color: var(--ink);
    cursor: pointer;
    text-decoration: none;
}
a.recent-main { color: var(--ink); }
.recent-main:hover { color: var(--wine); text-decoration: underline; }
.recent-meta { margin: 4px 0 0; font-size: 0.85rem; }
@media (max-width: 840px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}
.cover { width: 100%; height: 140px; object-fit: cover; border-radius: 8px; margin-bottom: 10px; }
.badge {
    display: inline-block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--paper-2);
    color: var(--muted);
}
.badge-open { background: #e5efe8; color: var(--forest); }
.badge-closed { background: var(--wine-soft); color: var(--wine); }
button.badge-story-link {
    border: 0;
    font: inherit;
    font-size: 0.72rem;
    font-weight: 650;
    cursor: pointer;
    line-height: inherit;
}
button.badge-story-link:hover,
button.badge-story-link:focus-visible {
    background: var(--wine);
    color: #fffaf3;
    outline: none;
}
.story-pick-menu {
    position: fixed;
    z-index: 60;
    min-width: 220px;
    max-width: min(340px, calc(100vw - 16px));
    max-height: min(50vh, 20rem);
    overflow: auto;
    padding: 6px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(28, 22, 18, 0.2);
}
.story-pick-menu button {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    background: transparent;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
    color: var(--ink);
}
.story-pick-menu button:hover,
.story-pick-menu button:focus-visible {
    background: var(--wine-soft);
    outline: none;
}
.story-pick-menu .story-pick-title {
    display: block;
    font-weight: 650;
}
.story-pick-menu .story-pick-book {
    display: block;
    margin-top: 2px;
    font-size: 0.78rem;
    color: var(--muted);
}
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.card-meta { display: flex; gap: 6px; margin-bottom: 8px; }

.empty-state {
    text-align: center;
    padding: 48px 16px;
    background: var(--card);
    border: 1px dashed var(--line);
    border-radius: var(--radius);
}
.empty-inline { margin: 12px 0; padding: 24px; }

.banner {
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 16px;
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}
.banner-warn { background: var(--warn-bg); color: #5c3d00; }
.banner-ok { background: #e7efe8; color: var(--forest); }
.lyrics-story-review {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    align-items: center;
}
.lyrics-story-review .btn { margin-left: auto; }
.lyric-propose-preview {
    max-height: min(50vh, 22rem);
    overflow: auto;
    background: #fff;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--line);
}
.lyric-propose-preview .lyric-part { margin: 0 0 12px; }
.story-review-ignore {
    margin-left: 6px;
    font-size: 0.78rem;
    padding: 2px 8px;
}
.alert { padding: 10px 12px; border-radius: 8px; margin: 0 0 12px; }
.alert-error { background: #fde8e8; color: var(--danger); }

.timeline { max-width: none; width: 100%; }
.timeline-merge-bar {
    position: sticky;
    top: 0;
    z-index: 4;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    align-items: center;
    justify-content: space-between;
    max-width: none;
    width: 100%;
    margin: 0 0 14px;
    padding: 10px 14px;
    background: var(--wine-soft);
    border: 1px solid var(--wine);
    border-radius: 10px;
    box-shadow: var(--shadow);
}
.timeline-merge-bar[hidden] { display: none !important; }
.timeline-merge-bar [data-merge-hint] {
    font-weight: 650;
    color: var(--wine-dark);
}
.timeline-node.is-picked {
    outline: 2px solid var(--wine);
    outline-offset: 2px;
}
.timeline-pick {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.2rem;
    min-height: 2.2rem;
    cursor: pointer;
}
.timeline-head-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
    margin-left: auto;
}
.timeline-head-actions .timeline-pick {
    margin-left: 0;
}
.timeline-head-actions .btn-menu {
    z-index: 5;
}
.timeline-head-actions .btn-menu.is-open {
    z-index: 60;
}
.timeline-block:has(.btn-menu.is-open) {
    position: relative;
    z-index: 8;
}
.timeline-head-actions .btn-menu-flyout {
    right: 0;
    left: auto;
    min-width: 16rem;
    max-height: min(70vh, 28rem);
}
.timeline-more {
    padding: 4px 8px;
    min-width: 2.2rem;
}
.timeline-more .btn-ico {
    width: 18px;
    height: 18px;
    display: block;
}
.timeline-prose-text,
.timeline-head-main h2 {
    cursor: text;
}
.timeline-pick input {
    width: 1.2rem;
    height: 1.2rem;
    accent-color: var(--wine);
    cursor: pointer;
}
.timeline-node {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow);
    position: relative;
}
.timeline-block.is-dragging {
    opacity: 0.55;
}
body.is-reordering {
    user-select: none;
    cursor: grabbing;
}
.timeline-drag {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    cursor: grab;
    touch-action: none;
    align-self: flex-start;
    margin-top: 2px;
}
.timeline-drag svg { fill: currentColor; }
.timeline-drag:hover { background: var(--paper-2); color: var(--ink); }
.timeline-drag:active { cursor: grabbing; }
.timeline-head {
    display: flex;
    gap: 12px 20px;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.timeline-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    align-items: stretch;
}
.timeline-scenes {
    display: none;
    margin: 0;
    min-width: 0;
    min-height: 0;
}
.timeline-scenes:not([hidden]) {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
}
.timeline-thumb-wrap {
    position: relative;
    margin: 0;
    flex: 0 0 auto;
}
.timeline-thumb {
    width: 96px;
    height: 54px;
    object-fit: cover;
    border-radius: 8px;
    background: var(--paper-2);
    border: 1px solid var(--line);
    display: block;
    cursor: zoom-in;
}
.scene-image-chat {
    position: absolute;
    left: 6px;
    bottom: 6px;
    z-index: 2;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(28, 22, 18, 0.78);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}
.scene-image-chat:hover {
    background: var(--wine);
}
.scene-image-chat .btn-ico {
    width: 16px;
    height: 16px;
    display: block;
}
.scene-prompt-text {
    width: 100%;
    min-height: 16rem;
    max-height: min(70vh, 40rem);
    overflow: auto;
    font-family: var(--mono, ui-monospace, Menlo, Consolas, monospace);
    font-size: 0.88rem;
    line-height: 1.45;
    white-space: pre-wrap;
}
.scene-revise-preview {
    margin: 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--line);
    background: var(--paper-2);
    max-height: 220px;
}
.scene-revise-preview img {
    display: block;
    width: 100%;
    height: 220px;
    object-fit: contain;
    background: #1c1612;
}
.image-revise-compare {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.image-revise-compare figure {
    margin: 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--line);
    background: var(--paper-2);
}
.image-revise-compare .is-new {
    border-color: var(--wine, #7a2e2a);
    box-shadow: 0 0 0 1px rgba(122, 46, 42, 0.25);
}
.image-revise-compare figcaption {
    font-size: 0.78rem;
    padding: 6px 8px 0;
    color: var(--muted, #6b6258);
}
.image-revise-compare img {
    display: block;
    width: 100%;
    height: 220px;
    object-fit: contain;
    background: #1c1612;
}
.char-emotion-thumb {
    position: relative;
}
.char-emotion-thumb .scene-image-chat {
    width: 22px;
    height: 22px;
    left: 2px;
    bottom: 2px;
}
.char-emotion-thumb .scene-image-chat .btn-ico {
    width: 12px;
    height: 12px;
}
@media (max-width: 640px) {
    .image-revise-compare {
        grid-template-columns: 1fr;
    }
    .image-revise-compare img,
    .scene-revise-preview img {
        height: 180px;
    }
}
@media (min-width: 841px) {
    .timeline-row:not(.has-no-scenes) {
        grid-template-columns: minmax(0, 1.15fr) minmax(240px, 1fr);
    }
    .timeline-scenes:not([hidden]) {
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 10px;
        height: 100%;
        align-self: stretch;
    }
    .timeline-scenes .timeline-thumb-wrap {
        flex: 1 1 0;
        min-height: 0;
        width: 100%;
    }
    .timeline-scenes .timeline-thumb {
        width: 100%;
        height: 100%;
        min-height: 4.5rem;
        border-radius: 12px;
    }
}
@media (max-width: 840px) {
    .timeline-scenes:not([hidden]) {
        order: -1;
    }
}
.timeline-thumb-del,
.story-image-thumb-del {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(28, 22, 18, 0.72);
    color: #fff;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}
.timeline-thumb-del:hover,
.story-image-thumb-del:hover {
    background: var(--wine);
}
.timeline-head-main {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    min-width: 0;
    flex: 1 1 180px;
}
.timeline-head h2 { margin: 0; font-family: var(--serif); font-size: 1.25rem; }
.timeline-flags {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.timeline-flag {
    display: inline-flex;
    width: 28px;
    height: 28px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--paper-2);
    color: var(--muted);
    line-height: 0;
    padding: 0;
    margin: 0;
    font: inherit;
    cursor: pointer;
}
button.timeline-flag:hover,
button.timeline-flag:focus-visible {
    opacity: 1;
    outline: none;
    box-shadow: 0 0 0 2px color-mix(in srgb, #3d5a45 40%, transparent);
}
.timeline-flag.is-ready {
    color: #3d5a45;
    border-color: color-mix(in srgb, #3d5a45 40%, var(--line));
    background: color-mix(in srgb, #3d5a45 12%, var(--paper));
}
.timeline-flag.is-missing,
.timeline-flag.is-pending {
    opacity: 0.5;
}
.timeline-flag-ico,
.timeline-tts-badge-ico {
    width: 16px;
    height: 16px;
    display: block;
}
.timeline-lyrics {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
    text-align: right;
    max-width: 42%;
}
.timeline-lyrics li {
    font-size: 0.78rem;
    line-height: 1.35;
    color: var(--muted);
}
.timeline-lyric-title { color: var(--ink); font-weight: 650; }
.timeline-lyric-album { display: block; }
.timeline-split {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(200px, 0.9fr);
    gap: 16px 22px;
    align-items: start;
}
.timeline-summary {
    background: var(--paper-2, #f6f1ea);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}
.timeline-summary h3,
.timeline-summary-fold > summary {
    margin: 0 0 6px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    font-family: var(--sans);
}
.timeline-summary-fold > summary {
    cursor: pointer;
    list-style: disclosure-closed inside;
    position: relative;
    padding-right: 1.7rem;
}
.timeline-summary-fold[open] > summary {
    list-style: disclosure-open inside;
    margin-bottom: 8px;
}
.timeline-summary-refresh {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 1.45rem;
    height: 1.45rem;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.timeline-summary-refresh:hover,
.timeline-summary-refresh:focus-visible {
    background: var(--paper);
    color: var(--ink);
    outline: none;
}
.timeline-summary-refresh:disabled {
    opacity: 0.55;
    cursor: wait;
}
.timeline-summary-refresh .btn-ico {
    width: 14px;
    height: 14px;
    display: block;
}
.timeline-summary-refresh.is-busy .btn-ico {
    animation: timeline-summary-spin 0.8s linear infinite;
}
@keyframes timeline-summary-spin {
    to { transform: rotate(360deg); }
}
.timeline-notes-view,
.timeline-summary-body {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}
.timeline-notes-view {
    background: var(--paper);
    border: 1px dashed var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    min-height: 4.5rem;
    cursor: text;
    user-select: none;
}
.timeline-notes-view.is-empty,
.timeline-summary-body.is-empty {
    color: var(--muted);
    font-style: italic;
    white-space: normal;
}
.timeline-notes-edit {
    display: block;
    width: 100%;
    min-height: 6.5em;
    margin: 0;
    padding: 10px 12px;
    font: inherit;
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--ink);
    background: var(--card);
    border: 1px solid var(--wine);
    border-radius: 10px;
    resize: vertical;
}
.timeline-notes.is-saving .timeline-notes-edit { opacity: 0.7; }
.timeline-summary-body {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
}
.timeline-summary p { margin: 0; font-size: 0.88rem; line-height: 1.5; }
.btn-menu-item.is-tts-missing {
    color: var(--danger);
}
.timeline-tts {
    margin: 8px 0 0;
    font-size: 0.82rem;
    line-height: 1.35;
}
.timeline-tts.is-ready {
    color: var(--ink);
}
.timeline-tts.is-partial {
    color: var(--wine, #8a3a3a);
}
.timeline-tts.is-empty {
    color: var(--danger);
    opacity: 1;
}
.timeline-tts-badge {
    display: none;
}
.timeline-tts-badge[hidden] {
    display: none !important;
}
.btn.is-tts-missing {
    border-color: color-mix(in srgb, var(--danger) 45%, var(--line));
    color: var(--danger);
}
.btn.is-tts-missing .btn-ico {
    color: var(--danger);
}
.timeline-gap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 22px 0 26px;
}
@media (max-width: 840px) {
    .timeline-gap {
        margin: 24px 0 32px;
    }
}
.timeline-gap .btn,
.timeline-gap .btn-ghost {
    background: #fff;
    color: var(--ink);
    border-color: var(--line);
}
.timeline-gap .btn-ghost {
    background: var(--paper-2, #f3ebe0);
}
.timeline-gap .btn:hover,
.timeline-gap .btn-ghost:hover {
    background: var(--paper-2, #efe6d8);
    color: var(--ink);
}
.timeline-gap .btn-ico {
    flex-shrink: 0;
    color: currentColor;
}
.char-badge-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 0;
    margin: 0 0 10px;
}
.story-image-bar,
.story-video-bar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0 0 12px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--paper-2);
}
.story-video-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.story-video-list:empty { display: none; }
.story-video-item {
    position: relative;
    margin: 0;
}
.story-video-item video,
.timeline-video {
    display: block;
    width: 100%;
    max-width: 36rem;
    border-radius: 10px;
    background: #111;
    border: 1px solid var(--line);
}
.story-video-controls {
    align-items: center;
}
.story-video-duration {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-weight: 650;
}
.story-video-duration input {
    width: 4.2rem;
    margin: 0;
}
.timeline-videos:not([hidden]) {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    grid-column: 1 / -1;
    margin: 0;
}
.timeline-video-wrap {
    position: relative;
    margin: 0;
    flex: 1 1 16rem;
    max-width: 28rem;
}
.story-image-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.story-image-thumbs:empty { display: none; }
.story-image-thumb {
    position: relative;
    margin: 0;
}
.story-image-thumb.is-placed {
    outline: 2px solid var(--wine);
    outline-offset: 2px;
    border-radius: 10px;
}
.story-image-thumb img {
    width: 128px;
    height: 72px;
    object-fit: cover;
    border-radius: 8px;
    display: block;
    border: 1px solid var(--line);
    background: var(--paper-2);
    cursor: zoom-in;
}
.scene-image-place {
    position: absolute;
    left: 4px;
    top: 4px;
    z-index: 2;
    border: 0;
    border-radius: 6px;
    padding: 3px 7px;
    font-size: 0.72rem;
    font-weight: 650;
    background: rgba(28, 22, 18, 0.78);
    color: #fff;
    cursor: pointer;
}
.scene-image-place:hover {
    background: var(--wine);
}
.story-image-thumb.is-placed .scene-image-place {
    background: var(--wine);
}
.story-wysiwyg .story-scene,
.reader-prose .story-scene,
.share-prose .story-scene {
    display: block;
    margin: 1.1em 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--line);
    background: var(--paper-2);
}
.story-wysiwyg .story-scene {
    position: relative;
    overflow: visible;
}
.story-wysiwyg .story-scene img,
.reader-prose .story-scene img,
.share-prose .story-scene img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 22rem;
    object-fit: cover;
    cursor: zoom-in;
}
.story-wysiwyg .story-scene.is-flash {
    outline: 3px solid var(--wine);
    outline-offset: 2px;
}
.story-wysiwyg .story-scene-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 999px;
    background: rgba(20, 16, 14, 0.72);
    color: #fff;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
}
.story-wysiwyg .story-scene-remove:hover {
    background: var(--wine);
}
.story-image-upload {
    position: relative;
    overflow: hidden;
    cursor: pointer;
}
.story-image-upload input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    font-size: 0;
}
.char-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0 0;
    padding: 0;
    list-style: none;
}
.char-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 999px;
    background: #eceff7;
    border: 1px solid #c5cde0;
    color: #3d4a6b;
    font-size: 0.8rem;
    font-weight: 650;
    line-height: 1.4;
}
.char-links-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.char-links-list li strong { display: block; }
.char-links-list li p { margin: 4px 0 0; }
.text-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; list-style: none; }
.text-chips li {
    background: var(--wine-soft);
    color: var(--wine-dark);
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 0.8rem;
}

.table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.table tbody tr {
    transition: background-color 0.12s ease;
}
.table tbody tr:hover td {
    background: var(--wine-soft);
}
.table tbody tr:hover td:first-child {
    box-shadow: inset 3px 0 0 var(--wine);
}
.table tbody tr:hover .cell-action--title {
    color: var(--wine-dark);
}
.check-list { display: flex; flex-direction: column; gap: 8px; }
.check-row { flex-direction: row; align-items: center; font-weight: 500; gap: 8px; }
.choice-list { display: flex; flex-direction: column; gap: 8px; }
.choice-card {
    display: flex;
    flex-direction: row;
    gap: 12px;
    align-items: flex-start;
    margin: 0;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--paper);
    cursor: pointer;
    font-weight: 500;
}
.choice-card:has(input:checked) {
    border-color: var(--wine, #7a2e2a);
    background: var(--wine-soft, #f6ebe9);
}
.choice-card > input {
    margin-top: 0.35em;
    flex: 0 0 auto;
}
.choice-card-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1 1 auto;
    min-width: 0;
}
.choice-card-body strong {
    font-weight: 650;
    text-wrap: pretty;
    overflow-wrap: normal;
    hyphens: manual;
}
.choice-card .muted { font-weight: 400; }
.ai-lyrics {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.ai-lyrics-head {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.ai-lyrics-head strong { font-size: 0.92rem; }
.ai-lyrics-list {
    max-height: 12rem;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    padding: 4px;
}
.ai-lyric-row {
    margin: 0;
    padding: 8px 10px;
    border-radius: 8px;
    font-weight: 500;
}
.ai-lyric-row:hover,
.ai-lyric-row:has(input:checked) {
    background: var(--wine-soft);
}
.ai-lyric-row > span {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}
.ai-lyric-row .muted {
    font-weight: 400;
    font-size: 0.82rem;
}

.settings-page {
    max-width: 1180px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.settings-form { max-width: none; width: 100%; display: flex; flex-direction: column; gap: 18px; }
.settings-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
    align-items: stretch;
}
.settings-row > fieldset,
.settings-form > fieldset {
    min-width: 0;
}
.settings-form fieldset > :not(legend) + :not(legend) {
    margin-top: 10px;
}
.settings-split-col > :not(:first-child),
.settings-fields-grid > :not(:first-child) {
    margin-top: 0;
}
.settings-fields-grid,
.settings-split {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}
.settings-split-col {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}
@media (min-width: 841px) {
    .settings-row:not(.settings-row--wide) {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }
    .settings-fields-grid,
    .settings-split {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 16px 28px;
        align-items: start;
    }
    .llm-task-panel {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 8px 16px;
        align-items: start;
    }
    .llm-task-panel > .hint,
    .llm-task-toolbar {
        grid-column: 1 / -1;
    }
}
.settings-form .settings-range {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.settings-form .settings-range-val {
    float: right;
    font-variant-numeric: tabular-nums;
    color: var(--muted, #6b635c);
    font-weight: 600;
}
.settings-form .settings-range input[type="range"] {
    width: 100%;
    accent-color: var(--wine);
}
.llm-task-panel {
    margin-top: 8px;
    padding-top: 4px;
}
.llm-task-toolbar { margin: 0 0 8px; }
.llm-task-group {
    margin: 12px 0 4px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
}
.llm-task-group h3 {
    margin: 0;
    padding: 10px 14px;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    background: var(--paper-2);
    border-bottom: 1px solid var(--line);
}
.llm-task-toggle {
    width: 100%;
    margin: 0;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    gap: 12px;
}
.llm-task-group .llm-task-toggle:last-child { border-bottom: 0; }
.llm-task-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1 1 auto;
    font-weight: 500;
}
.llm-task-copy strong { font-weight: 650; }
.llm-task-copy .muted { font-weight: 400; font-size: 0.85rem; }
.llm-task-flag {
    flex: 0 0 auto;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}
.llm-task-flag--pro { display: none; color: var(--wine); }
.llm-task-toggle:has(input:checked) .llm-task-flag--flash { display: none; }
.llm-task-toggle:has(input:checked) .llm-task-flag--pro { display: inline; }
.backup-list-title {
    margin: 16px 0 8px;
    font-size: 1rem;
}
.backup-list {
    list-style: none;
    margin: 0 0 16px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.backup-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--paper);
}
.backup-list-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
fieldset { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); padding: 16px; }
legend { font-weight: 650; padding: 0 6px; }
.form-status { color: var(--forest); }

.auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background:
        radial-gradient(900px 400px at 80% -10%, rgba(122, 46, 42, 0.18), transparent 60%),
        var(--paper);
}
.auth-card {
    width: min(420px, 92vw);
    background: var(--card);
    padding: 32px;
    border-radius: 18px;
    box-shadow: var(--shadow);
}
.auth-card h1 { font-family: var(--serif); margin: 0 0 6px; text-align: center; }
.auth-card .muted { text-align: center; }
.auth-card form { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }

.modal-root[hidden] { display: none; }
.modal-root { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(28,22,18,0.45); }
.modal {
    position: relative;
    width: min(720px, 94vw);
    max-height: 90vh;
    overflow: auto;
    background: var(--card);
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.25);
}
.modal.modal-wide { width: min(920px, 96vw); }
.modal.modal-full {
    width: calc(100vw - 16px);
    height: calc(100dvh - 16px);
    max-height: calc(100dvh - 16px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 12px;
}
.modal.modal-full .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.book-check {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
}
.book-check > .hint {
    margin: 0;
    flex-shrink: 0;
}
.book-check-list {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow: auto;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    counter-reset: book-check;
}
.book-check-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--paper-2);
    counter-increment: book-check;
}
.book-check-item.is-fixed {
    opacity: 0.72;
    background: var(--card);
}
.book-check-item-main {
    flex: 1 1 auto;
    min-width: 0;
}
.book-check-item-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 4px;
}
.book-check-item-head strong::before {
    content: counter(book-check) ". ";
    font-weight: 650;
}
.book-check-where { font-size: 0.9em; }
.book-check-detail,
.book-check-hint {
    margin: 0;
    line-height: 1.45;
}
.book-check-hint { margin-top: 6px; }
.book-check-item-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-start;
}
.book-check-done {
    font-size: 0.85rem;
    font-weight: 650;
    color: var(--muted);
    padding: 6px 0;
}
.ai-insert-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1 1 auto;
    min-height: 0;
}
.ai-insert-form > .hint { margin: 0; }
.ai-insert-slot {
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--paper-2);
}
.ai-insert-slot-label {
    margin: 0 0 10px;
    font-weight: 650;
}
.ai-insert-neighbors {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.ai-insert-neighbor {
    padding: 6px 10px;
    border-radius: 8px;
    background: var(--paper);
    border: 1px solid var(--line);
}
.ai-insert-neighbor p {
    display: none;
}
.ai-insert-here {
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px dashed var(--wine);
    background: var(--wine-soft);
    font-weight: 650;
    font-size: 0.92rem;
}
.ai-insert-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px 24px;
    flex: 0 0 auto;
    align-items: start;
}
.ai-insert-col {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}
.ai-insert-col--picks { gap: 16px; }
.ai-insert-form input[name="word_count"] { max-width: 10rem; }
.ai-insert-form label .muted { display: block; margin-top: 4px; }
.ai-insert-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1 1 auto;
    min-height: 0;
}
.ai-insert-brief { flex: 1 1 auto; min-height: 0; }
.ai-insert-brief textarea {
    flex: 1 1 auto;
    min-height: 6.5rem;
    resize: vertical;
}
.ai-ms {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.ai-ms-head {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.ai-ms-head strong { font-size: 0.92rem; }
.ai-ms-head .muted {
    font-weight: 400;
    font-size: 0.88rem;
}
.ai-ms-box {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.ai-ms-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    margin: 0;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
}
.ai-ms-toggle:hover { background: var(--paper-2); }
.ai-ms.is-open .ai-ms-toggle {
    border-color: var(--wine);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}
.ai-ms-toggle [data-ai-ms-label] {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted);
}
.ai-ms.has-value .ai-ms-toggle [data-ai-ms-label],
.ai-ms.is-open .ai-ms-toggle [data-ai-ms-label] {
    color: var(--ink);
}
.ai-ms-caret {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 0.8em;
}
.ai-ms.is-open .ai-ms-caret { transform: rotate(180deg); }
.ai-ms-chips { padding: 0 2px; }
.ai-ms-drop {
    border: 1px solid var(--line);
    border-top: 0;
    border-radius: 0 0 8px 8px;
    background: #fff;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: var(--shadow);
    z-index: 2;
}
.ai-ms-list {
    max-height: 11rem;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.ai-ms-row {
    margin: 0;
    padding: 8px 10px;
    border-radius: 8px;
    font-weight: 500;
    align-items: flex-start;
}
.ai-ms-row:hover,
.ai-ms-row:has(input:checked) {
    background: var(--wine-soft);
}
.ai-ms-row > span {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    font-weight: 500;
}
.ai-ms-row .muted {
    font-weight: 400;
    font-size: 0.82rem;
}
.ai-insert-actions {
    margin-top: 0;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    flex-shrink: 0;
}
.catalog-toggle { margin: 4px 0 20px; max-width: 42rem; }
label.toggle {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-weight: 500;
    user-select: none;
    width: auto;
}
.toggle input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.toggle-track {
    position: relative;
    flex: 0 0 auto;
    width: 46px;
    height: 26px;
    border-radius: 999px;
    background: #d4c8b8;
    box-shadow: inset 0 1px 3px rgba(28, 22, 18, 0.12);
    transition: background 0.2s ease;
}
.toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(28, 22, 18, 0.25);
    transition: transform 0.2s ease;
}
.toggle input:checked + .toggle-track {
    background: var(--wine);
}
.toggle input:checked + .toggle-track .toggle-thumb {
    transform: translateX(20px);
}
.toggle input:focus-visible + .toggle-track {
    outline: 2px solid var(--wine);
    outline-offset: 3px;
}
.toggle-text { line-height: 1.35; }
@media (prefers-reduced-motion: reduce) {
    .toggle-track, .toggle-thumb { transition: none; }
    .reader-lyric-sort-done { animation: none; }
}
.btn-count {
    border: 0;
    background: var(--wine-soft);
    color: var(--wine-dark);
    font: inherit;
    font-weight: 700;
    min-width: 2rem;
    padding: 4px 10px;
    border-radius: 999px;
    cursor: pointer;
}
.btn-count:hover { background: var(--wine); color: #fff; }
.table-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.facts-wrap { margin-top: 4px; }
.facts-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin: 0 0 12px;
}
.facts-filter .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.facts-lamp {
    display: inline-block;
    width: 0.72rem;
    height: 0.72rem;
    border-radius: 50%;
    flex-shrink: 0;
    vertical-align: middle;
    box-sizing: border-box;
}
.facts-lamp--full {
    background: #2f9e5a;
    box-shadow: 0 0 0 2px rgba(47, 158, 90, 0.22), 0 0 8px rgba(47, 158, 90, 0.45);
}
.facts-lamp--partial {
    background: #e39420;
    box-shadow: 0 0 0 2px rgba(227, 148, 32, 0.22), 0 0 8px rgba(227, 148, 32, 0.5);
}
.facts-lamp--open {
    background: #d13a32;
    box-shadow: 0 0 0 2px rgba(209, 58, 50, 0.22), 0 0 8px rgba(209, 58, 50, 0.45);
}
.facts-lamp--empty {
    background: transparent;
    border: 2px dashed var(--line);
    box-shadow: none;
}
.facts-filter .btn.is-active .facts-lamp--full {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.45), 0 0 8px rgba(47, 158, 90, 0.7);
}
.facts-filter .btn.is-active .facts-lamp--partial {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.45), 0 0 8px rgba(227, 148, 32, 0.7);
}
.facts-filter .btn.is-active .facts-lamp--open {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.45), 0 0 8px rgba(209, 58, 50, 0.7);
}
.facts-lamp--table {
    width: 0.95rem;
    height: 0.95rem;
}
.facts-table {
    table-layout: fixed;
    border-collapse: collapse;
}
.facts-table th,
.facts-table td {
    vertical-align: top;
    border-bottom: 1px solid var(--line);
}
.facts-table .facts-body {
    width: 100%;
    min-height: 2.6rem;
    resize: none;
    line-height: 1.45;
}
.facts-table .facts-row-new .facts-body { background: var(--paper); }
.facts-col-signal {
    width: 2.4rem;
    text-align: center;
}
.facts-table td.facts-col-signal {
    padding-top: 1.05rem;
}
.facts-table .facts-row.is-filtered-out { display: none !important; }
.facts-col-body { width: auto; }
.facts-col-reveals { width: 26%; }
.facts-table td.table-actions,
.facts-table th.facts-col-actions {
    display: table-cell;
    width: 8.5rem;
    vertical-align: top;
    white-space: nowrap;
}
.facts-row-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    align-items: flex-start;
}
.facts-reveals {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    align-items: baseline;
    min-height: 2.4rem;
}
.facts-reveals a { font-weight: 650; }
.facts-reveal-note { font-weight: 400; }
.story-preview { max-height: 55vh; overflow: auto; background: #fff; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); }
.story-read .story-preview {
    max-height: min(65vh, 36rem);
    font-family: var(--serif);
}
.story-read .reader-scene { margin: 0; }
.story-read .reader-scene-gallery {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 12px;
}
.story-read .reader-scene {
    flex: 1 1 140px;
    max-width: 220px;
    border-radius: 10px;
    overflow: hidden;
}
.story-read .reader-scene img {
    max-height: 140px;
    object-fit: cover;
    width: 100%;
    height: 100%;
    cursor: zoom-in;
}
.lb-lightbox[hidden] { display: none !important; }
.lb-lightbox {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(18, 14, 12, 0.82);
    cursor: zoom-out;
}
.lb-lightbox-img {
    max-width: min(96vw, 1100px);
    max-height: min(90dvh, 900px);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
    background: #111;
    cursor: default;
}
.lb-lightbox-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
}
.lb-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.28);
}
body.lb-lightbox-open {
    overflow: hidden;
}

.import-overlay[hidden] { display: none !important; }
.import-overlay {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    background: rgba(28, 22, 18, 0.5);
    padding: 20px;
}
.import-card {
    width: min(440px, 94vw);
    background: var(--card);
    border-radius: 16px;
    padding: 22px 24px 20px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.28);
}
.import-card h2 { margin: 0 0 8px; font-family: var(--serif); font-size: 1.25rem; }
.import-status { margin: 0 0 14px; min-height: 1.4em; }
.progress {
    height: 12px;
    border-radius: 999px;
    background: var(--paper-2);
    overflow: hidden;
    border: 1px solid var(--line);
}
.progress-bar {
    height: 100%;
    width: 0;
    background: var(--wine);
    border-radius: 999px;
    transition: width 0.25s ease;
}
.modal-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.modal-head h2 { margin: 0; font-size: 1.1rem; }
.modal-body { padding: 18px; }

.reader-layout { width: 100%; }
.reader-col { max-width: 680px; }
.reader-title h2 { font-size: 2rem; margin: 0 0 12px; font-family: var(--serif); }
.reader-title { font-family: var(--serif); }
.reader-blurb { font-style: italic; color: var(--muted); }
.reader-split {
    display: grid;
    grid-template-columns: minmax(0, 680px) minmax(240px, 1fr);
    gap: 0 28px;
    align-items: stretch;
    border-top: 1px solid var(--line);
    scroll-margin-top: 1.5rem;
}
.reader-main {
    min-width: 0;
}
.reader-chapter {
    padding: 28px 0;
    scroll-margin-top: 1.5rem;
    font-family: var(--serif);
    min-width: 0;
    max-width: none;
}
.reader-chapter-head {
    margin: 0 0 0.7em;
}
.reader-chapter-head h3 { margin: 0; }
.reader-chapter-head h3[data-read-title],
.reader-prose[data-read-body] {
    cursor: text;
    border-radius: 8px;
}
.reader-chapter-head h3.is-editing,
.reader-prose.is-editing {
    outline: 1px solid var(--wine);
    background: var(--card);
    box-shadow: 0 0 0 3px rgba(122, 46, 42, 0.12);
}
.reader-prose.is-editing { padding: 8px 10px; }
.reader-prose.is-empty:not(.is-editing)::before {
    content: attr(data-placeholder);
    color: var(--muted);
    font-style: italic;
}
.reader-rail {
    min-width: 0;
}
.reader-rail-sticky {
    position: sticky;
    top: 1.25rem;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    padding: 28px 0 12px;
    max-height: calc(100vh - 1.5rem);
    overflow: auto;
    background: var(--paper);
}
.reader-rail-edit {
    align-self: flex-end;
    text-align: center;
    white-space: normal;
    line-height: 1.25;
}
.reader-summary-fold {
    min-width: 0;
    flex: 0 0 auto;
}
.reader-summary-fold > summary {
    display: list-item;
    cursor: pointer;
    font-weight: 650;
    font-family: var(--sans);
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    list-style: disclosure-closed inside;
    padding: 2px 0;
}
.reader-summary-fold[open] > summary {
    list-style: disclosure-open inside;
    margin-bottom: 8px;
}
.reader-summary-fold > summary::-webkit-details-marker { display: revert; }
.reader-summary-head {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin: 0 0 8px;
}
.reader-summary-head .reader-notes-title { display: none; }
.reader-summary-view {
    white-space: pre-wrap;
    word-break: break-word;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 0.92rem;
    line-height: 1.55;
    font-family: var(--sans);
}
.reader-summary-view.is-empty {
    color: var(--muted);
    font-style: italic;
}
.reader-summary.is-saving .reader-summary-view { opacity: 0.7; }
.reader-notes-fold {
    min-width: 0;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.reader-notes-fold[open] {
    min-height: 12rem;
}
.reader-notes-fold > summary {
    display: none;
    cursor: pointer;
    font-weight: 650;
    list-style: none;
}
.reader-notes-fold > summary::-webkit-details-marker { display: none; }
.reader-notes {
    min-width: 0;
    font-family: var(--sans);
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.reader-notes-title {
    margin: 0 0 8px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}
.reader-notes-view {
    white-space: pre-wrap;
    word-break: break-word;
    background: var(--paper-2);
    border: 1px dashed var(--line);
    border-radius: 10px;
    padding: 12px 14px;
    min-height: 10rem;
    flex: 1 1 auto;
    font-size: 0.92rem;
    line-height: 1.5;
    cursor: text;
    user-select: none;
}
.reader-notes-view.is-empty {
    color: var(--muted);
    font-style: italic;
}
.reader-notes-edit {
    display: block;
    width: 100%;
    min-height: 8.5em;
    margin: 0;
    padding: 12px 14px;
    font: inherit;
    font-size: 0.92rem;
    line-height: 1.5;
    resize: vertical;
    background: var(--card);
    border: 1px solid var(--wine);
    border-radius: 10px;
}
.reader-notes.is-saving .reader-notes-edit { opacity: 0.7; }
.reader-gap {
    display: flex;
    justify-content: flex-start;
    padding: 4px 0 8px;
}
.reader-title + .reader-gap {
    padding-top: 8px;
    padding-bottom: 16px;
}
.reader-scene {
    margin: 0;
}
.reader-scene-gallery {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 1.1em;
    min-width: 0;
}
.reader-scene-gallery .reader-scene {
    margin: 0;
    flex: 1 1 12rem;
    min-width: 10rem;
    max-width: 100%;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--line);
    background: var(--paper-2);
}
.reader-scene-gallery .reader-scene:only-child {
    flex: 1 1 100%;
}
.reader-scene img {
    width: 100%;
    height: auto;
    max-height: 22rem;
    object-fit: cover;
    display: block;
    cursor: zoom-in;
    background: var(--paper-2);
}
.wysiwyg .lyrics-chat-sel,
.story-wysiwyg .story-chat-sel {
    background: #3d5a99;
    color: #fff;
}
::highlight(lyrics-chat-sel),
::highlight(story-chat-sel) {
    background-color: #3d5a99;
    color: #fff;
}
.lyrics-chat-sel-hint { margin: 0 0 6px; }
.reader-appendix { margin-top: 20px; background: var(--paper-2); padding: 12px 14px; border-radius: 10px; }
.reader-lyric { margin: 0 0 8px; scroll-margin-top: 1.5rem; }
.reader-lyric-sum {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    cursor: pointer;
}
.reader-lyric-sum .btn { flex-shrink: 0; }
.lyric { font-family: var(--sans); font-size: 0.92rem; }
.lyric p { margin: 0 0 0.55em; }
.lyric[data-read-lyric] {
    cursor: text;
    border-radius: 8px;
}
.lyric.is-editing {
    outline: 1px solid var(--wine);
    background: var(--card);
    box-shadow: 0 0 0 3px rgba(122, 46, 42, 0.12);
    padding: 8px 10px;
}
.lyric.is-empty:not(.is-editing)::before {
    content: attr(data-placeholder);
    color: var(--muted);
    font-style: italic;
}
.reader-toolbar { display: flex; gap: 10px; align-items: end; margin-bottom: 20px; max-width: 680px; }
.reader-tts {
    position: fixed;
    z-index: 34;
    left: 50%;
    transform: translateX(-50%);
    width: min(680px, calc(100vw - 120px));
    bottom: calc(var(--app-footer-h, 0px) + 16px);
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    align-items: center;
    padding: 10px 14px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(28, 22, 18, 0.18);
    overflow: visible;
}
.reader-tts[hidden] { display: none !important; }
.reader-tts-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.reader-tts-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1 1 160px;
}
.reader-tts-meta strong {
    font-size: 0.95rem;
    line-height: 1.25;
}
.reader-tts .btn-ico { pointer-events: none; }
.tts-rate-menu { position: relative; }
.tts-rate-btn {
    min-width: 3.15rem;
    font-variant-numeric: tabular-nums;
    font-weight: 650;
}
.tts-rate-flyout {
    top: auto;
    bottom: calc(100% + 6px);
    left: 0;
    min-width: 7.5rem;
    max-height: none;
}
.tts-rate-flyout .btn-menu-item.is-active {
    background: var(--paper-2);
    font-weight: 700;
}
.reader-split.is-tts-current .reader-chapter {
    box-shadow: 0 0 0 2px var(--wine);
    border-radius: 12px;
}
body.reader-tts-open .page {
    padding-bottom: calc(var(--app-footer-h, 0px) + 108px);
}
@media (max-width: 840px) {
    .reader-tts {
        left: 12px;
        right: 12px;
        width: auto;
        transform: none;
        bottom: calc(var(--app-footer-h, 0px) + 78px);
    }
    body.reader-tts-open .page {
        padding-bottom: calc(var(--app-footer-h, 0px) + 168px);
    }
}

.chat-box { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.chat-log { min-height: 40px; font-size: 0.9rem; color: var(--muted); }
.chat-input { display: flex; gap: 8px; }
.chat-input input { flex: 1; }
.hidden { display: none !important; }
.busy { opacity: 0.65; pointer-events: none; }

.pwa-banner {
    position: fixed;
    z-index: 50;
    left: 12px;
    right: 12px;
    bottom: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    background: var(--sidebar);
    color: #f3ebe3;
    padding: 14px 16px;
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}
.pwa-banner[hidden] { display: none !important; }
.pwa-banner-text { display: flex; flex-direction: column; gap: 2px; min-width: 200px; }
.pwa-banner-text span { font-size: 0.88rem; color: #d9cdc2; }
.pwa-banner-actions { display: flex; gap: 8px; }
.pwa-banner .btn { background: #fff; }
.pwa-banner .btn-primary { background: var(--wine); color: #fff; border-color: var(--wine); }
@media (display-mode: standalone) {
    .pwa-banner { display: none !important; }
}

.app-footer {
    display: none;
}

@media (max-width: 840px) {
    :root { --app-footer-h: calc(3.4rem + env(safe-area-inset-bottom, 0px)); }
    html, body { overflow-x: hidden; }
    .app-shell { grid-template-columns: 1fr; }
    .nav-toggle { display: inline-flex; }
    .nav-backdrop[hidden] { display: none !important; }
    body.nav-open { overflow: hidden; }
    body.nav-open .nav-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 55;
        background: rgba(28, 22, 18, 0.45);
    }
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(18rem, 86vw);
        z-index: 60;
        transform: translateX(-105%);
        transition: transform 0.2s ease;
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: stretch;
        padding-bottom: calc(var(--app-footer-h) + 12px);
        overflow: auto;
    }
    body.nav-open .sidebar { transform: translateX(0); }
    .side-nav { flex-direction: column; flex-wrap: nowrap; }
    .side-nav a { padding: 12px 12px; font-size: 1.05rem; }
    .side-book, .side-foot { width: 100%; }
    .topbar {
        flex-wrap: wrap;
        align-items: center;
        padding: 12px 16px 0;
        gap: 10px;
    }
    .topbar h1 {
        flex: 1;
        min-width: 0;
        font-size: 1.35rem;
        line-height: 1.2;
    }
    .topbar-actions {
        flex-basis: 100%;
        justify-content: flex-start;
    }
    .topbar-actions .btn { min-height: 2.6rem; }
    .btn-has-icon {
        justify-content: center;
        min-width: 2.6rem;
        padding-left: 10px;
        padding-right: 10px;
    }
    .btn-has-icon.btn-small { min-width: 2.4rem; }
    .btn-has-icon .btn-label {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }
    .btn-has-icon.btn-keep-label {
        min-width: 0;
        padding-left: 12px;
        padding-right: 14px;
    }
    .btn-has-icon.btn-keep-label .btn-label {
        position: static;
        width: auto;
        height: auto;
        padding: 0;
        margin: 0;
        overflow: visible;
        clip: auto;
        white-space: nowrap;
        border: 0;
    }
    .btn-has-icon .btn-ico {
        width: 1.15em;
        height: 1.15em;
    }
    .page { padding: 16px 16px calc(var(--app-footer-h) + 20px); }
    .btn, button.btn { min-height: 2.6rem; padding: 10px 14px; }
    .btn-small { min-height: 2.4rem; }
    .card-grid { grid-template-columns: 1fr; }
    .timeline-split { grid-template-columns: 1fr; }
    .timeline-lyrics { max-width: 100%; align-items: flex-start; text-align: left; }
    .reader-toolbar, .chat-input, .timeline-gap, .timeline-head {
        flex-wrap: wrap;
    }
    .reader-split {
        grid-template-columns: 1fr;
        gap: 0;
    }
    .reader-scene-gallery .reader-scene {
        flex: 1 1 calc(50% - 6px);
        min-width: 8rem;
    }
    .reader-scene img {
        max-height: 14rem;
    }
    .reader-rail {
        order: -1;
    }
    .reader-rail-sticky {
        top: 0;
        z-index: 4;
        padding: 8px 0 10px;
        margin: 0 0 8px;
        max-height: none;
        overflow: visible;
        border-bottom: 1px solid var(--line);
        box-shadow: 0 8px 16px var(--paper);
    }
    .reader-notes-fold,
    .reader-summary-fold {
        margin: 0;
        background: var(--paper-2);
        padding: 12px 14px;
        border-radius: 10px;
        flex: 0 0 auto;
        min-height: 0;
        display: block;
    }
    .reader-notes-fold[open] {
        min-height: 0;
    }
    .reader-notes-fold > summary,
    .reader-summary-fold > summary {
        display: list-item;
        padding: 4px 0;
        list-style: disclosure-closed inside;
        font-size: 0.75rem;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        color: var(--muted);
    }
    .reader-notes-fold[open] > summary,
    .reader-summary-fold[open] > summary {
        list-style: disclosure-open inside;
    }
    .reader-notes-fold > summary::-webkit-details-marker,
    .reader-summary-fold > summary::-webkit-details-marker { display: revert; }
    .reader-summary-head .reader-notes-title { display: none; }
    .reader-notes-title { display: none; }
    .reader-notes {
        position: static;
        padding: 8px 0 0;
        display: block;
        flex: none;
    }
    .reader-notes-view {
        min-height: 3.2em;
        background: var(--card);
        flex: none;
    }
    .chat-input { flex-direction: column; align-items: stretch; }
    .lyrics-editor-head {
        flex-direction: column;
        padding: 8px 10px;
        gap: 8px;
        flex-shrink: 0;
    }
    .lyrics-editor-head h2 { font-size: 1.15rem; line-height: 1.2; }
    .story-title-field input { font-size: 1.15rem; max-width: none; }
    .lyrics-editor-actions { width: 100%; gap: 6px; }
    .lyrics-editor-actions .btn { flex: 1 1 auto; min-height: 2.2rem; padding: 6px 10px; }
    .lyrics-editor-actions .btn-close-editor { flex: 0 0 40px; width: 40px; height: 40px; min-height: 40px; }
    .lyrics-editor-actions [data-print-lyrics-editor] {
        flex: 0 0 40px;
        width: 40px;
        height: 40px;
        min-height: 40px;
        padding: 6px;
    }
    .lyrics-editor-actions .btn-full { display: none; }
    .lyrics-editor-actions .btn-short { display: inline; }
    .lyrics-player { max-width: none; margin-top: 6px; }
    .lyrics-player-row { flex-wrap: nowrap; }
    .lyrics-player .hint {
        font-size: 0.75rem;
        margin: 4px 0 0;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .editor-root .btn.btn-player { min-height: 36px; width: 36px; height: 36px; }
    body.editor-open .app-footer,
    body.editor-open .pwa-banner { display: none !important; }
    body.editor-open .editor-root {
        z-index: 80;
        top: var(--editor-vtop, 0px);
        bottom: auto;
        height: var(--editor-vh, 100dvh);
        max-height: var(--editor-vh, 100dvh);
        overflow: hidden;
    }
    .editor-root { bottom: var(--app-footer-h); }
    body.editor-open .modal {
        max-height: calc(var(--editor-vh, 100dvh) - 16px);
    }
    .lyrics-editor {
        display: flex;
        flex-direction: column;
        height: 100%;
        max-height: 100%;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .lyrics-editor > .lyrics-editor-head {
        flex: 0 0 auto;
        position: sticky;
        top: 0;
        z-index: 5;
    }
    .lyrics-editor-split {
        display: flex;
        flex-direction: column;
        flex: 0 0 auto;
        height: auto !important;
        min-height: 0;
        max-height: none;
        overflow: visible;
        grid-template-columns: none;
        grid-template-rows: none;
    }
    .lyrics-pane,
    .lyrics-chat {
        position: relative;
        padding: 8px 10px;
        min-height: 0;
        height: auto !important;
        max-height: none;
        overflow: visible !important;
        display: block;
        flex: 0 0 auto;
    }
    .lyrics-pane {
        border-right: 0;
        border-bottom: 1px solid var(--line);
        order: 0;
    }
    .lyrics-chat {
        order: 1;
        padding: 8px 10px env(safe-area-inset-bottom, 0px);
        background: var(--paper);
    }
    .wysiwyg {
        display: block;
        flex: none !important;
        min-height: 12rem;
        height: min(42vh, 18rem);
        max-height: min(42vh, 18rem);
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 12px;
        margin: 0 0 8px;
        position: relative;
        z-index: 0;
    }
    .wysiwyg-toolbar { gap: 4px; margin-bottom: 6px; flex-shrink: 0; }
    .editor-root .wysiwyg-toolbar .btn {
        min-height: 2rem;
        padding: 4px 8px;
        font-size: 0.78rem;
    }
    .char-badge-bar { margin-bottom: 6px; }
    .story-lyrics-bar { margin-bottom: 6px; }
    .editor-extra-fold,
    .editor-chat-fold {
        margin: 0 0 8px;
        border: 1px solid var(--line);
        border-radius: 10px;
        background: var(--paper-2);
        flex: none;
        display: block;
        overflow: visible;
        max-height: none;
        height: auto;
        position: relative;
        z-index: 1;
    }
    .editor-extra-fold > summary,
    .editor-chat-fold > summary {
        display: block;
        padding: 8px 12px;
        cursor: pointer;
        font-weight: 650;
        font-size: 1rem;
        list-style: none;
        background: transparent;
    }
    .editor-extra-fold[open] > summary,
    .editor-chat-fold[open] > summary {
        border-bottom: 1px solid var(--line);
    }
    .editor-extra-fold > summary::after,
    .editor-chat-fold > summary::after {
        content: " ▾";
        color: var(--muted);
        font-weight: 400;
        margin-left: 0.25em;
    }
    .editor-extra-fold[open] > summary::after,
    .editor-chat-fold[open] > summary::after {
        content: " ▴";
    }
    .editor-extra-fold .story-image-bar {
        margin: 0;
        border: 0;
        border-radius: 0;
        padding: 8px 10px 12px;
        background: transparent;
        overflow: visible;
    }
    .editor-extra-fold .story-image-bar .btn-row {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin-top: 10px;
        position: relative;
        z-index: 1;
    }
    .editor-notes-fold .editor-notes {
        margin: 0;
        padding: 8px 12px 12px;
    }
    .story-image-thumb img { width: 104px; height: 58px; }
    .lyrics-chat > .editor-notes-fold,
    .lyrics-chat > .editor-chat-fold {
        margin: 0 0 8px;
    }
    .editor-chat-fold[open] {
        max-height: none;
        overflow: visible;
    }
    .editor-chat-body {
        padding: 0 12px 12px;
        flex: none;
        overflow: visible;
        min-height: 0;
        display: block;
    }
    .lyrics-core textarea { min-height: 3.2em; }
    .editor-notes textarea { min-height: 3.6em; }
    .editor-side-fold-body textarea { min-height: 3.2em; }
    .editor-side-fold [data-editor-notes] { min-height: 3.6em; }
    .lyrics-chat-form textarea { min-height: 3.2em; }
    .lyrics-chat-log { min-height: 48px; margin: 8px 0; }
    .modal { width: calc(100vw - 20px); max-height: calc(100vh - var(--app-footer-h) - 24px); }
    .modal.modal-full {
        width: calc(100vw - 12px);
        height: calc(100dvh - var(--app-footer-h) - 12px);
        max-height: calc(100dvh - var(--app-footer-h) - 12px);
    }
    .modal.modal-full .modal-body { overflow: auto; }
    .ai-insert-grid,
    .char-edit-grid,
    .char-assign-grid,
    .char-profile-view {
        grid-template-columns: 1fr;
        grid-template-rows: none;
        flex: none;
    }
    .char-edit-notes textarea {
        min-height: 7rem;
        flex: none;
    }
    .char-assign-notes textarea {
        min-height: 7rem;
        flex: none;
    }
    .char-assign-photo {
        min-height: 180px;
        aspect-ratio: 4 / 3;
        max-height: 280px;
        flex: none;
    }
    .char-photo-edit {
        flex: none;
        min-height: 0;
    }
    .char-photo-frame {
        min-height: 180px;
        max-height: 40vh;
        aspect-ratio: 4 / 3;
        flex: none;
    }
    .char-edit-ai {
        flex: none;
        min-height: 8rem;
        max-height: 40vh;
    }
    .char-edit-links {
        flex: none;
        max-height: 40vh;
    }
    .char-edit-ai-head {
        flex-wrap: wrap;
    }
    .char-profile-view-photo {
        min-height: 200px;
        aspect-ratio: 4 / 3;
        max-height: 280px;
    }
    .char-profile-view-links { max-height: 16rem; }
    .modal-full .ai-ms-list {
        max-height: 12rem;
        flex: none;
    }
    .book-check-item {
        flex-direction: column;
        align-items: stretch;
    }
    .book-check-item-actions {
        align-self: stretch;
    }
    .book-check-item-actions .btn {
        width: 100%;
    }
    .ai-insert-brief { flex: none; }
    .ai-insert-brief textarea {
        min-height: 6rem;
        flex: none;
    }
    .auth-card { width: min(420px, calc(100vw - 24px)); padding: 22px 18px; margin-bottom: var(--app-footer-h); }
    .auth-body { align-items: start; padding: 24px 12px calc(var(--app-footer-h) + 24px); }

    .table-wrap {
        border: 0;
        background: transparent;
        overflow: visible;
    }
    .table thead { display: none; }
    .table, .table tbody, .table tr, .table td {
        display: block;
        width: 100%;
    }
    .table {
        background: transparent;
        overflow: visible;
    }
    .table tbody { display: flex; flex-direction: column; gap: 12px; }
    .table tr {
        background: var(--card);
        border: 1px solid var(--line);
        border-radius: var(--radius);
        padding: 10px 14px;
        box-shadow: var(--shadow);
    }
    .table tbody tr:hover {
        background: var(--wine-soft);
    }
    .table tbody tr:hover td {
        background: transparent;
    }
    .table tbody tr:hover td:first-child {
        box-shadow: none;
    }
    .table tbody tr.lyric-row--both:hover,
    .table tbody tr.lyric-row--story:hover {
        background: #c7e0ce;
    }
    .table tbody tr.lyric-row--album:hover {
        background: #f0d7ae;
    }
    .table tbody tr.lyric-row--none:hover {
        background: #ddd9d4;
    }
    .table tbody tr.note-row.is-main:hover {
        background: #f4f4f4;
    }
    .table td {
        display: grid;
        grid-template-columns: 7.5rem 1fr;
        gap: 8px;
        align-items: start;
        border-bottom: 1px solid var(--line);
        padding: 8px 0;
    }
    .table td:last-child { border-bottom: 0; }
    .table td::before {
        content: attr(data-label);
        font-weight: 650;
        color: var(--muted);
        font-size: 0.78em;
        letter-spacing: 0.02em;
        padding-top: 0.2em;
    }
    .table td[data-label=""] {
        grid-template-columns: 1fr;
    }
    .table td[data-label=""]::before { display: none; }
    .table td.table-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        padding-top: 10px;
    }
    #lyric-table td.table-actions {
        display: flex;
        width: auto;
        min-width: 0;
        white-space: normal;
    }
    #lyric-table .table-actions-inner {
        flex-wrap: wrap;
        width: 100%;
    }
    #note-table {
        table-layout: auto;
    }
    #note-table th:nth-child(1),
    #note-table th:nth-child(2),
    #note-table th:nth-child(3),
    #note-table th:nth-child(4),
    #note-table th:nth-child(5),
    #note-table td.table-actions {
        width: auto;
        min-width: 0;
    }
    #note-table td.table-actions {
        flex-wrap: nowrap;
    }
    .facts-col-signal,
    .facts-col-body,
    .facts-col-reveals,
    .facts-table td.table-actions,
    .facts-table th.facts-col-actions { width: auto; }
    .facts-table td.facts-col-signal { padding-top: 8px; }
    .table td.table-actions::before { display: none; }

    .app-footer {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 72;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 8px 16px calc(8px + env(safe-area-inset-bottom, 0px));
        background: var(--card);
        border-top: 1px solid var(--line);
        box-shadow: 0 -8px 24px rgba(28, 22, 18, 0.08);
    }
    .app-footer-label {
        font-weight: 650;
        color: var(--muted);
    }
    .text-scale {
        display: flex;
        align-items: center;
        gap: 8px;
    }
    .text-scale-value {
        min-width: 3.6em;
        text-align: center;
        font-variant-numeric: tabular-nums;
        font-weight: 650;
    }
    .text-scale .btn { min-width: 2.8rem; font-weight: 700; }
    .pwa-banner { bottom: calc(var(--app-footer-h) + 10px); }
}

/* Öffentliche Teilen-Seite (Fans) */
.share-body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(1200px 520px at 12% -8%, rgba(122, 46, 42, 0.14), transparent 55%),
        radial-gradient(900px 420px at 100% 10%, rgba(61, 90, 69, 0.1), transparent 50%),
        linear-gradient(180deg, #f3ebe0 0%, var(--paper) 38%, #f7f2ea 100%);
    color: var(--ink);
    font-family: var(--sans);
}
.share-shell {
    width: min(42rem, calc(100% - 2rem));
    margin: 0 auto;
    padding: 2.5rem 0 7rem;
}
.share-shell.has-share-sticky {
    padding-top: 0;
}
.share-sticky-bar {
    position: sticky;
    top: 0;
    z-index: 50;
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    padding: 0.65rem max(1rem, calc(50vw - 21rem)) 0.7rem;
    background: rgba(243, 235, 224, 0.94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(122, 46, 42, 0.14);
    box-shadow: 0 8px 20px rgba(28, 22, 18, 0.06);
}
.share-sticky-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    width: min(42rem, 100%);
    margin: 0 auto;
}
.share-chapter-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}
.share-shell--error {
    padding-top: 18vh;
    text-align: center;
}
.share-kicker {
    margin: 0 0 0.6rem;
    font-size: 0.78rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--wine);
    font-weight: 700;
}
.share-hero h1,
.share-shell--error h1,
.share-chapter-head h2 {
    font-family: var(--serif);
    font-weight: 600;
    letter-spacing: -0.02em;
    margin: 0 0 0.75rem;
}
.share-hero h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    line-height: 1.15;
}
.share-lead {
    margin: 0 0 1.25rem;
    font-size: 1.08rem;
    line-height: 1.55;
    color: var(--muted);
    max-width: 36rem;
}
.share-hero-actions { margin-top: 1.25rem; }
/* Auf der Fan-Seite Labels immer sichtbar (unterscheidbare Audio-Aktionen) */
.share-body .share-btn-keep-label {
    min-width: 0;
    padding-left: 12px;
    padding-right: 14px;
}
.share-body .share-btn-keep-label .btn-label {
        position: static;
        width: auto;
        height: auto;
        padding: 0;
        margin: 0;
        overflow: visible;
        clip: auto;
        white-space: nowrap;
        border: 0;
    }
.share-chapter {
    margin: 2.5rem 0 0;
    padding-top: 1.75rem;
    border-top: 1px solid rgba(122, 46, 42, 0.16);
}
.share-chapter-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem 1rem;
    margin-bottom: 1rem;
}
.share-chapter-head h2 {
    font-size: clamp(1.35rem, 3vw, 1.85rem);
    flex: 1 1 auto;
}
.share-gallery {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 1.25rem;
    min-width: 0;
}
.share-scene {
    margin: 0;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--line);
    background: var(--paper-2);
    box-shadow: 0 16px 40px rgba(28, 22, 18, 0.08);
    flex: 1 1 12rem;
    min-width: 10rem;
    max-width: 100%;
}
.share-gallery .share-scene:only-child {
    flex: 1 1 100%;
}
.share-songs {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0 0 1.25rem;
}
.share-song {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 8px 14px;
    align-items: center;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--paper-2);
    box-shadow: 0 10px 24px rgba(28, 22, 18, 0.06);
}
.share-song-cover {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 10px;
    grid-row: 1 / span 2;
    background: var(--paper);
}
.share-song-cover--empty {
    background: linear-gradient(145deg, #d9cfc4, #b9aea3);
}
.share-song-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.share-song-title {
    font-size: 1.05rem;
    line-height: 1.25;
}
.share-song-album {
    color: var(--muted);
    font-size: 0.9rem;
}
.share-song-controls {
    grid-column: 2;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.share-song-seek {
    flex: 1;
    min-width: 60px;
    accent-color: var(--wine);
    height: 6px;
    padding: 0;
}
.share-song-time {
    font-variant-numeric: tabular-nums;
    font-size: 0.8rem;
    color: var(--muted);
    min-width: 2.4em;
}
.share-song.is-playing {
    border-color: rgba(122, 46, 42, 0.45);
}
.song-audio-fields {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.song-audio-fields audio {
    width: 100%;
}
@media (max-width: 640px) {
    .share-song {
        grid-template-columns: 56px minmax(0, 1fr);
    }
    .share-song-cover {
        width: 56px;
        height: 56px;
        grid-row: 1;
    }
    .share-song-controls {
        grid-column: 1 / -1;
    }
}
.share-scene img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 24rem;
    object-fit: cover;
    cursor: zoom-in;
}
.share-prose {
    font-family: var(--serif);
    font-size: 1.12rem;
    line-height: 1.75;
}
.share-prose p { margin: 0 0 1em; }
.share-prose .story-char {
    pointer-events: none;
    text-decoration: none;
    background: transparent;
    color: inherit;
    border: 0;
    padding: 0;
    border-radius: 0;
}
.share-player {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    overflow: visible;
    background: rgba(36, 28, 24, 0.94);
    color: #fffaf3;
    backdrop-filter: blur(8px);
    box-shadow: 0 -10px 30px rgba(28, 22, 18, 0.2);
}
.share-player-inner {
    width: min(48rem, calc(100% - 1.5rem));
    margin: 0 auto;
    padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px));
    display: flex;
    align-items: center;
    gap: 10px;
}
.share-player-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1 1 8rem;
}
.share-player-vol {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 1 9rem;
    min-width: 72px;
    margin-left: auto;
    color: rgba(255, 250, 243, 0.85);
}
.share-player-vol .btn-ico {
    width: 16px;
    height: 16px;
    display: block;
    flex: 0 0 auto;
}
.share-player-vol input[type="range"] {
    width: 100%;
    min-width: 56px;
    accent-color: #fffaf3;
    height: 6px;
    padding: 0;
}
.share-player-meta strong {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.share-player .muted { color: rgba(255, 250, 243, 0.72); }
.share-player .tts-rate-btn {
    background: transparent;
    border-color: rgba(255, 250, 243, 0.35);
    color: #fffaf3;
}
.share-player .tts-rate-btn:hover,
.share-player .tts-rate-btn:focus-visible {
    background: rgba(255, 250, 243, 0.12);
    color: #fffaf3;
}
.share-player .tts-rate-menu {
    z-index: 2;
}
.share-resume {
    position: fixed;
    left: 50%;
    bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    z-index: 32;
    width: min(42rem, calc(100% - 1.5rem));
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 14px;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(36, 28, 24, 0.94);
    color: #fffaf3;
    box-shadow: 0 12px 32px rgba(28, 22, 18, 0.28);
    backdrop-filter: blur(8px);
}
.share-resume[hidden] { display: none !important; }
.share-resume-label {
    margin: 0;
    flex: 1 1 12rem;
    font-size: 0.95rem;
    line-height: 1.35;
}
.share-resume-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.share-resume .btn {
    background: #fffaf3;
    color: #241c18;
    border-color: rgba(255, 250, 243, 0.35);
}
.share-resume .btn:hover {
    background: #fff;
    color: #241c18;
}
.share-resume .btn-primary {
    background: var(--wine);
    border-color: var(--wine);
    color: #fff;
}
.share-resume .btn-primary:hover {
    background: var(--wine-dark);
    border-color: var(--wine-dark);
    color: #fff;
}
.share-readaloud {
    position: fixed;
    inset: 0;
    z-index: 28;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 1.25rem 1.25rem 6.5rem;
    background:
        radial-gradient(900px 500px at 50% 20%, rgba(122, 46, 42, 0.22), transparent 60%),
        rgba(24, 18, 14, 0.94);
    color: #fffaf3;
}
.share-readaloud[hidden] { display: none !important; }
.share-readaloud-stage {
    width: min(44rem, 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.share-readaloud-img {
    display: block;
    width: 100%;
    max-height: min(68vh, 34rem);
    object-fit: contain;
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.25);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
.share-readaloud-empty {
    margin: 0;
    padding: 2rem 1rem;
    text-align: center;
    color: rgba(255, 250, 243, 0.7);
}
.share-readaloud-cap {
    margin: 0;
    font-family: var(--serif);
    font-size: 1.05rem;
    text-align: center;
    opacity: 0.9;
}
.share-readaloud-close {
    background: rgba(255, 250, 243, 0.12);
    border-color: rgba(255, 250, 243, 0.28);
    color: #fffaf3;
}
.share-readaloud-close:hover {
    background: rgba(255, 250, 243, 0.2);
}
body.share-readaloud-open {
    overflow: hidden;
}
body.share-readaloud-open .share-shell,
body.share-readaloud-open .reader-layout {
    visibility: hidden;
}
body.share-readaloud-open .share-sticky-bar {
    visibility: visible;
    pointer-events: auto;
}
.share-shell.has-share-sticky ~ .share-readaloud {
    padding-top: 4.5rem;
}
body.share-readaloud-open .reader-fabs {
    display: none;
}
body.share-player-open .share-shell {
    padding-bottom: 8rem;
}
body.share-player-open .share-resume {
    bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
}
.share-dialog input[data-share-url] {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.85rem;
}
.share-mail-box {
    margin: 4px 0 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.share-mail-box .btn { align-self: flex-start; }

/* Owner: Comic-Spur */
.comic-generate {
    margin: 0 0 1.75rem;
    padding: 1rem 1.1rem;
    border: 1px solid var(--line, rgba(0,0,0,.08));
    border-radius: 10px;
    background: var(--paper-2, rgba(0,0,0,.02));
}
.comic-generate .form-row {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin: 0 0 0.85rem;
}
.comic-generate select {
    max-width: 28rem;
}
.comic-generate h2,
.comic-pages h2 {
    margin: 0 0 0.75rem;
    font-family: var(--serif);
    font-size: 1.25rem;
}
.comic-page-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.comic-page-card {
    display: grid;
    grid-template-columns: minmax(88px, 120px) 1fr;
    gap: 1rem;
    align-items: start;
    padding: 0.75rem;
    border: 1px solid var(--line, rgba(0,0,0,.08));
    border-radius: 10px;
    background: var(--paper, #fff);
}
.comic-page-card--strip {
    grid-template-columns: 1fr;
}
.comic-page-card--strip:has(.comic-strip-rail) {
    grid-template-columns: minmax(0, 1.4fr) minmax(220px, 0.9fr);
}
.comic-strip-main {
    display: grid;
    grid-template-columns: minmax(11rem, 42%) 1fr;
    gap: 1rem;
    min-width: 0;
    align-items: start;
}
.comic-strip-rail {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}
.comic-strip-block-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 0 0 6px;
}
.comic-strip-block-head h3 {
    margin: 0;
}
.comic-strip-block-view {
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.88rem;
    line-height: 1.5;
    min-height: 4.2rem;
    cursor: text;
    user-select: none;
}
.comic-strip-block-view.is-empty {
    color: var(--muted);
    font-style: italic;
}
.comic-strip-block-edit {
    display: block;
    width: 100%;
    box-sizing: border-box;
    min-height: 5.5rem;
    margin: 0;
    padding: 8px 10px;
    font: inherit;
    font-size: 0.88rem;
    line-height: 1.5;
    resize: vertical;
    background: var(--card);
    border: 1px solid var(--wine);
    border-radius: 8px;
}
.comic-strip-block.is-saving .comic-strip-block-edit,
.comic-strip-block.is-saving .comic-strip-block-view {
    opacity: 0.7;
}
.comic-strip-thumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
}
.comic-strip-thumb {
    position: relative;
    margin: 0;
    width: 4.5rem;
    aspect-ratio: 3 / 4;
    border-radius: 6px;
    overflow: hidden;
    background: var(--paper-2, rgba(0,0,0,.04));
}
.comic-strip-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.comic-strip-thumb-del {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 1.35rem;
    height: 1.35rem;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: rgba(26, 20, 16, 0.78);
    color: #fff;
    font-size: 1.05rem;
    line-height: 1;
    cursor: pointer;
}
.comic-strip-thumb-del:hover {
    background: var(--wine, #7a2e2a);
}
.comic-strip-insert {
    width: 1.85rem;
    height: 1.85rem;
    padding: 0;
    border: 1px dashed var(--line, rgba(0,0,0,.25));
    border-radius: 999px;
    background: var(--paper-2, rgba(0,0,0,.04));
    color: var(--ink, #222);
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    flex: 0 0 auto;
}
.comic-strip-insert:hover {
    background: var(--wine, #7a2e2a);
    color: #fff;
    border-color: transparent;
}
.comic-panel-chat {
    left: auto;
    right: 8px;
    bottom: 8px;
    z-index: 8;
}
.comic-lettering .comic-panel-chat {
    width: 42px;
    height: 42px;
}
.comic-page-thumb {
    margin: 0;
    aspect-ratio: 9 / 16;
    max-height: 180px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--paper-2);
}
.comic-page-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    display: block;
}
.comic-page-meta h3 {
    margin: 0 0 0.35rem;
    font-size: 1.05rem;
    font-family: var(--serif);
}

/* Comic-Plan Modal */
.comic-plan-modal .comic-plan-panels {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin: 0.75rem 0 1rem;
    max-height: min(58vh, 36rem);
    overflow: auto;
    padding-right: 4px;
}
.comic-plan-panel {
    margin: 0;
    padding: 0.75rem 0.85rem 0.85rem;
    border: 1px solid var(--line, rgba(0,0,0,.1));
    border-radius: 10px;
    background: var(--paper-2, rgba(0,0,0,.02));
}
.comic-plan-panel legend {
    font-family: var(--serif);
    font-weight: 600;
    padding: 0 0.25rem;
}
.comic-plan-panel label {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin: 0.55rem 0 0;
    font-size: 0.9rem;
}
.comic-plan-panel textarea,
.comic-plan-panel input[type="text"] {
    width: 100%;
}
.comic-plan-dialogues {
    margin-top: 0.65rem;
}
.comic-plan-dlg-row {
    display: grid;
    grid-template-columns: minmax(5rem, 8rem) 1fr;
    gap: 0.5rem;
    margin-top: 0.4rem;
}

/* Fan: Comic-Modus */
.share-mode-toggle {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0;
}
.share-sticky-bar .share-mode-toggle .btn.is-active,
.share-mode-toggle .btn.is-active {
    background: var(--ink, #222);
    color: #fff;
    border-color: transparent;
}
.share-comic {
    margin: 1.25rem 0 2rem;
}
.share-comic-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.share-comic-nav--bottom {
    margin: 0.85rem 0 0;
}
.share-comic-counter {
    margin: 0;
    font-size: 0.9rem;
    color: var(--muted, #666);
}
.share-comic-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.share-comic-page {
    display: none;
    margin: 0;
    width: min(100%, 28rem);
}
.share-comic-page.is-active {
    display: block;
}
.share-comic-title {
    margin: 0 0 0.5rem;
    text-align: center;
    font-family: var(--serif);
    font-size: 1.05rem;
}
.comic-lettering-page {
    position: relative;
    width: 100%;
    container-type: inline-size;
}
.comic-lettering-page img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
    user-select: none;
}
.share-comic-page .comic-lettering-page {
    overflow: hidden;
    border-radius: 8px;
}
.share-comic-page .comic-lettering-page + .comic-lettering-page {
    margin-top: 0.65rem;
}
.share-video {
    margin: 1.25rem 0 2rem;
}
.share-video-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.share-video-nav--bottom {
    margin: 0.85rem 0 0;
}
.share-video-counter {
    margin: 0;
    font-size: 0.9rem;
    color: var(--muted, #666);
}
.share-video-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.share-video-page {
    display: none;
    margin: 0;
    width: 100%;
}
.share-video-page.is-active {
    display: block;
}
.share-video-title {
    margin: 0 0 0.5rem;
    text-align: center;
    font-family: var(--serif);
    font-size: 1.05rem;
}
.share-video-page video {
    width: 100%;
    aspect-ratio: 16 / 9;
    display: block;
    background: #1c1612;
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(28, 22, 18, 0.16);
}
.comic-bubble-tails {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    overflow: visible;
}
.comic-bubble-tail {
    fill: #fffef8;
    stroke: #1a1410;
    stroke-width: 2.15;
    stroke-linejoin: miter;
    stroke-linecap: butt;
    stroke-miterlimit: 10;
    paint-order: fill stroke;
    vector-effect: non-scaling-stroke;
}
.comic-bubbles {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
}
.comic-bubble {
    position: absolute;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.28em 0.5em;
    background: #fffef8;
    color: #1a1410;
    border: 2px solid #1a1410;
    border-radius: 1.15em;
    box-shadow: 0 2px 0 #1a1410;
    font-family: var(--sans);
    font-size: clamp(0.7rem, 4.4cqi, 1.12rem);
    font-weight: 650;
    line-height: 1.2;
    text-align: center;
    pointer-events: auto;
    overflow: hidden;
}
.comic-bubble--caption {
    border-radius: 3px;
    background: #1a1410;
    color: #fffef8;
    font-size: clamp(0.62rem, 3.6cqi, 0.95rem);
    font-weight: 600;
    padding: 0.22em 0.4em;
    box-shadow: none;
}
.comic-bubble--thought {
    border-radius: 50% / 45%;
    background: #fff;
}
.comic-bubble-text {
    margin: 0;
    width: 100%;
    max-height: 100%;
    overflow: hidden;
    outline: none;
    word-break: break-word;
}
.comic-bubble.is-selected {
    outline: 2px solid var(--wine, #7a2e2a);
    outline-offset: 2px;
    z-index: 2;
}
.comic-bubble-handle {
    display: none;
    position: absolute;
    right: 2px;
    bottom: 2px;
    width: 14px;
    height: 14px;
    border-radius: 2px;
    background: var(--wine, #7a2e2a);
    cursor: nwse-resize;
    z-index: 3;
}
.comic-bubble.is-selected .comic-bubble-handle { display: block; }
.comic-bubble.is-dragging { cursor: grabbing; }

.comic-lettering {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: flex;
    flex-direction: column;
    background: rgba(24, 18, 14, 0.94);
    color: #fffaf3;
    padding: 0.75rem 0.75rem 1rem;
}
body.comic-lettering-open .modal-root { z-index: 55; }
.comic-lettering[hidden] { display: none !important; }
body.comic-lettering-open { overflow: hidden; }
.comic-lettering-bar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
    margin-bottom: 0.35rem;
}
.comic-lettering-bar-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
}
.comic-add-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem 0.7rem;
}
.comic-add-chip {
    appearance: none;
    margin: 0;
    padding: 0.15rem;
    border: 0;
    background: transparent;
    cursor: pointer;
    line-height: 0;
}
.comic-add-chip:hover .comic-add-chip-face,
.comic-add-chip:focus-visible .comic-add-chip-face {
    outline: 2px solid #fffaf3;
    outline-offset: 2px;
}
.comic-add-chip-face.comic-bubble {
    position: relative;
    left: auto;
    top: auto;
    width: auto;
    height: auto;
    min-width: 3.6rem;
    min-height: 2.15rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    pointer-events: none;
    overflow: visible;
    box-shadow: none;
}
.comic-add-chip-face.comic-bubble--speech {
    padding: 0.32em 0.7em 0.62em;
}
.comic-add-chip-face.comic-bubble--speech::after {
    content: "";
    position: absolute;
    left: 22%;
    bottom: -6px;
    width: 10px;
    height: 10px;
    background: #fffef8;
    border-right: 2px solid #1a1410;
    border-bottom: 2px solid #1a1410;
    transform: rotate(45deg);
}
.comic-add-chip-face.comic-bubble--thought {
    padding: 0.4em 0.75em 0.55em;
}
.comic-add-chip-face.comic-bubble--thought::after {
    content: "";
    position: absolute;
    left: 18%;
    bottom: -7px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #1a1410;
}
.comic-add-chip-face.comic-bubble--caption {
    min-width: 4.2rem;
    padding: 0.28em 0.55em;
}
.comic-add-chip-face.comic-bubble--sfx {
    font-size: 0.62rem;
    min-width: 4.4rem;
    min-height: 2.4rem;
    padding: 0.55em 0.7em;
}
.comic-lettering-bar h2 {
    margin: 0;
    font-family: var(--serif);
    font-size: 1.15rem;
}
.comic-lettering-hint { color: rgba(255,250,243,0.75); margin: 0 0 0.6rem; }
.comic-lettering-scroller {
    flex: 1;
    overflow: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
    padding: 0.25rem 0 1.5rem;
}
.comic-lettering .comic-lettering-page {
    width: min(28rem, 100%);
    overflow: visible;
}
.comic-lettering .comic-bubbles { pointer-events: none; }
.comic-lettering .comic-bubble { pointer-events: auto; cursor: grab; }
.comic-lettering-page.is-bare .comic-bubbles,
.comic-lettering-page.is-bare .comic-bubble-tails,
.comic-lettering-page.is-bare .comic-tail-handle,
.comic-lettering-page.is-bare .comic-bubble-del {
    display: none;
}
.comic-panel-addbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.45rem 0.7rem;
    width: min(28rem, 100%);
}
.comic-bubble-del {
    position: absolute;
    z-index: 7;
    width: 1.4rem;
    height: 1.4rem;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: rgba(26, 20, 16, 0.88);
    color: #fff;
    font-size: 1.05rem;
    line-height: 1;
    cursor: pointer;
    transform: translate(-40%, -55%);
    box-shadow: 0 0 0 1px #fffef8;
}
.comic-bubble-del:hover {
    background: var(--wine, #7a2e2a);
}
.comic-insert-gap {
    width: min(28rem, 100%);
    margin: 0;
    padding: 0.45rem 0.75rem;
    border: 1px dashed rgba(255, 250, 243, 0.35);
    border-radius: 999px;
    background: rgba(255, 250, 243, 0.08);
    color: #fffaf3;
    cursor: pointer;
    font: inherit;
}
.comic-insert-gap:hover {
    background: rgba(255, 250, 243, 0.18);
}
.comic-bubble--sfx {
    overflow: visible;
    font-family: Impact, Haettenschweiler, 'Arial Black', sans-serif;
    font-style: italic;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 0.95;
    box-shadow: none;
    font-size: clamp(0.85rem, 5.2cqi, 1.35rem);
}
.comic-bubble--sfx-burst {
    background: #ffe566;
    color: #1a1410;
    border: 3px solid #1a1410;
    border-radius: 0;
    padding: 0.55em 0.7em;
    clip-path: polygon(50% 0%, 62% 18%, 88% 8%, 78% 32%, 100% 42%, 80% 55%, 92% 82%, 66% 72%, 50% 100%, 34% 72%, 8% 82%, 20% 55%, 0 42%, 22% 32%, 12% 8%, 38% 18%);
}
.comic-bubble--sfx-boom {
    background: #ff8a3d;
    color: #1a1410;
    border: 3px solid #1a1410;
    border-radius: 42% 58% 48% 52% / 48% 42% 58% 52%;
    padding: 0.5em 0.75em;
}
.comic-bubble--sfx-zap {
    background: #f4f7ff;
    color: #1a1410;
    border: 3px solid #1a1410;
    border-radius: 0;
    padding: 0.4em 0.55em;
    clip-path: polygon(8% 18%, 78% 0, 100% 38%, 72% 48%, 92% 100%, 22% 82%, 0 58%, 28% 46%);
}
.comic-bubble--sfx-crash {
    background: #1a1410;
    color: #ffe566;
    border: 4px solid #ffe566;
    border-radius: 3px;
    padding: 0.35em 0.45em;
    box-shadow: 4px 4px 0 #1a1410;
}
.comic-tail-handle {
    position: absolute;
    z-index: 5;
    width: 18px;
    height: 18px;
    padding: 0;
    border: 2px solid #fffef8;
    border-radius: 2px 2px 10px 2px;
    background: var(--wine, #7a2e2a);
    box-shadow: 0 0 0 1px #1a1410;
    transform: translate(-50%, -50%) rotate(45deg);
    cursor: grab;
    pointer-events: auto;
    opacity: 0.88;
}
.comic-tail-handle.is-selected {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(45deg) scale(1.12);
}
.comic-tail-handle:active { cursor: grabbing; }
body.share-comic-mode .share-hero-actions[data-share-text-only],
body.share-video-mode .share-hero-actions[data-share-text-only] {
    display: none;
}
@media (max-width: 840px) {
    .share-shell { width: calc(100% - 2.5rem); padding-top: 1.5rem; }
    .share-shell.has-share-sticky { padding-top: 0; }
    .share-prose { font-size: 1.05rem; }
    .share-readaloud { padding: 1rem 0.85rem 6.25rem; }
    .share-readaloud-img { max-height: min(58vh, 28rem); }
    .share-comic-page { width: 100%; }
    .comic-page-card { grid-template-columns: 88px 1fr; }
    .comic-page-card--strip,
    .comic-page-card--strip:has(.comic-strip-rail) {
        grid-template-columns: 1fr;
    }
    .comic-strip-main { grid-template-columns: minmax(8rem, 38%) 1fr; }
}
@media (max-width: 520px) {
    .comic-strip-main { grid-template-columns: 1fr; }
}

/* Story-Editor: Tabs Text / Szenenbilder / Video / Comic */
.lyrics-editor { grid-template-rows: auto minmax(0, 1fr); }
.lyrics-editor-split { min-height: 0; }
.story-tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 2px;
    flex-shrink: 0;
    margin: -4px 0 12px;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
    scrollbar-width: none;
}
.story-tabs::-webkit-scrollbar { display: none; }
.story-tab {
    appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    margin: 0 0 -1px;
    padding: 8px 14px;
    border: 0;
    border-bottom: 3px solid transparent;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-weight: 650;
    cursor: pointer;
    white-space: nowrap;
}
.story-tab:hover { color: var(--ink); }
.story-tab.is-active { color: var(--wine); border-bottom-color: var(--wine); }
.story-tab:focus-visible { outline: 2px solid var(--wine); outline-offset: -2px; border-radius: 6px 6px 0 0; }
.story-tab-count {
    min-width: 1.4em;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--wine-soft);
    color: var(--wine);
    font-size: 0.75rem;
    line-height: 1.5;
    text-align: center;
}
.story-tab-count[hidden] { display: none; }
.story-tab-panel {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.story-tab-panel[hidden] { display: none !important; }
.story-tab-panel--text {
    display: flex;
    flex-direction: column;
}
.story-tab-panel--text > * { flex-shrink: 0; }
.story-tab-panel--text > .wysiwyg {
    flex: 1 1 auto;
    min-height: 260px;
}
.story-tab-panel > .story-image-bar,
.story-tab-panel > .story-video-bar { margin: 0; }
.story-comic-bar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--paper-2);
}
.story-comic-pages { display: flex; flex-direction: column; gap: 14px; }
.story-comic-pages:empty { display: none; }
.story-comic-page { margin: 0; }
.story-comic-page figcaption { margin-top: 4px; font-size: 0.85rem; }
.story-comic-panels { display: flex; flex-wrap: wrap; gap: 6px; }
.story-comic-panels img {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
}
.story-tab-selection { margin: 0; font-size: 0.9rem; }
.story-tab-selection[hidden] { display: none; }
.story-tab-selection q { font-style: italic; }
@media (min-width: 841px) {
    .story-editor .lyrics-pane { padding-bottom: 14px; }
    .story-editor .lyrics-chat { scrollbar-gutter: stable; }
}
@media (max-width: 840px) {
    .story-tabs { margin: 0 0 8px; }
    .story-tab { padding: 8px 10px; font-size: 0.92rem; }
    .story-tab-panel,
    .story-tab-panel--text {
        display: block;
        overflow: visible;
    }
    .story-tab-panel--text > .wysiwyg.story-wysiwyg {
        min-height: 14rem;
        height: min(62dvh, 32rem);
        max-height: min(62dvh, 32rem);
    }
    .story-comic-panels img { width: 104px; height: 104px; }
}

/* Klappentext im Story-Editor: nur Text + KI-Hilfe, keine element-spezifischen Bereiche */
.story-editor.is-blurb-editor .story-close-checks,
.story-editor.is-blurb-editor .story-tabs,
.story-editor.is-blurb-editor [data-story-panel]:not([data-story-panel="text"]),
.story-editor.is-blurb-editor .wysiwyg-toolbar-row:has([data-char-assign]),
.story-editor.is-blurb-editor .story-lyrics-bar,
.story-editor.is-blurb-editor .char-badge-bar,
.story-editor.is-blurb-editor .story-people-banner,
.story-editor.is-blurb-editor .editor-notes-fold,
.story-editor.is-blurb-editor [data-delete] {
    display: none !important;
}

/* Klappentext-Ansicht (Tab „Klappentext“, Leser, Teilen-Seite) */
.blurb-view-text {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    max-width: 48rem;
}
.blurb-view-text > :first-child,
.reader-blurb > :first-child,
.share-lead > :first-child { margin-top: 0; }
.blurb-view-text > :last-child,
.reader-blurb > :last-child,
.share-lead > :last-child { margin-bottom: 0; }
.book-card > .btn + .btn { margin-top: .5rem; }

/* Story-Editor: Medien-Tabs (Comic-Panel / Video ändern, Hörbuch) */
.story-comic-panel { position: relative; display: block; }
.story-comic-panel img { display: block; }
.story-video-item .scene-image-chat { top: 6px; bottom: auto; }
.story-video-revise-preview { display: block; width: 100%; max-width: 36rem; border-radius: 10px; background: #111; }
.story-audio-bar { display: flex; flex-direction: column; gap: 10px; }
.story-audio-bar [data-story-audio-status] { margin: 0; }
.story-media-revise { display: flex; flex-direction: column; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.story-media-revise textarea { width: 100%; }
.story-media-revise .hint { margin: 0; }

/* Story-Editor: Prüfen (Vorschläge rechts statt Notizen/KI-Hilfe) */
.lyrics-chat.is-reviewing > .editor-extra-fold { display: none; }
.story-review { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.story-review[hidden] { display: none; }
.story-review-head h3 { margin: 0; }
.story-review-head p { margin: 2px 0 0; }
.story-review-list { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 0; }
.story-review-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--card, #fff); }
.story-review-item h4 { margin: 0 0 4px; font-size: .95rem; }
.story-review-item p { margin: 0 0 6px; }
.story-review-item--person { border-left: 4px solid #e6c200; }
.story-review-item--continuity { border-left: 4px solid #c0392b; }
.story-review-item--link { border-left: 4px solid var(--accent, #6b4f2a); }
.story-review-item.is-info { opacity: .85; }
.story-review-actions { margin-top: 4px; flex-wrap: wrap; }
.story-review-preview summary { cursor: pointer; font-size: .9rem; }
.story-review-preview-body { max-height: 260px; overflow-y: auto; padding: 8px; margin-top: 6px; border: 1px solid var(--line); border-radius: 8px; font-size: .9rem; }
.story-review-preview-body img { max-width: 100%; height: auto; }
.story-review-all { align-self: flex-start; }
.story-review-options .story-close-checks { flex-direction: column; align-items: flex-start; }
.story-editor.is-blurb-editor [data-review-open],
.story-editor.is-blurb-editor [data-story-split],
.story-editor.is-blurb-editor [data-review-panel] { display: none !important; }

/* Story-Editor: Prüf-Fortschritt */
.story-review-progress { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card, #fff); }
.story-review-progress[hidden] { display: none; }
.story-review-progress-row { display: flex; align-items: center; gap: 8px; font-size: .9rem; }
.story-review-progress-step { flex: 1; min-width: 0; }
.story-review-progress-pct { font-variant-numeric: tabular-nums; font-weight: 650; }
.story-review-progress-track { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.story-review-progress-bar { height: 100%; width: 0; border-radius: inherit; background: var(--accent, #7a2e2a); transition: width .35s ease; }
.story-review-spinner { width: 16px; height: 16px; flex: none; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent, #7a2e2a); animation: story-review-spin .8s linear infinite; }
@keyframes story-review-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .story-review-spinner { animation-duration: 2.4s; } .story-review-progress-bar { transition: none; } }

/* Szenenbild-Modal: Aussehen aus früheren Szenen */
.scene-ref-box { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; background: var(--card); }
.scene-ref-box > summary { cursor: pointer; font-weight: 650; padding: 2px 0; }
.scene-ref-box[open] > summary { margin-bottom: 8px; }
.scene-ref-box .hint { margin: 0 0 8px; }
.scene-ref-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; }
.scene-ref-thumb { appearance: none; flex: 0 0 auto; width: 128px; padding: 0; border: 2px solid transparent; border-radius: 8px; background: transparent; color: var(--muted); font: inherit; font-size: 0.75rem; text-align: left; cursor: pointer; }
.scene-ref-thumb img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; }
.scene-ref-thumb span { display: block; padding: 2px 4px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.scene-ref-thumb:hover { border-color: var(--line); }
.scene-ref-thumb.is-selected { border-color: var(--wine); color: var(--wine); }
.scene-ref-thumb.is-loading { opacity: 0.5; cursor: progress; }
.scene-ref-status { margin: 0 0 8px; font-size: 0.85rem; }
.scene-appearance-text { width: 100%; min-height: 5rem; font: inherit; font-size: 0.9rem; line-height: 1.4; }
.scene-ref-check { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 0.9rem; }

/* Story-Element teilen */
.story-split-preview { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card, #fff); }
.story-split-preview p { margin: 0 0 4px; }
.story-split-preview p:last-child { margin: 0; }

/* Story-Editor: nicht platzierte Szenenbilder vor dem Text (wie im Lesemodus) */
.story-unplaced-images { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 10px; }
.story-unplaced-images[hidden] { display: none; }
.story-unplaced-images .story-unplaced-scene { position: relative; margin: 0; flex: 1 1 12rem; min-width: 10rem; max-width: 100%; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--paper-2); }
.story-unplaced-images .story-unplaced-scene:only-child { flex: 1 1 100%; }
.story-unplaced-images img { display: block; width: 100%; height: auto; max-height: 22rem; object-fit: cover; }
.story-unplaced-images .story-scene-remove { position: absolute; top: 8px; right: 8px; z-index: 2; width: 2rem; height: 2rem; border: 0; border-radius: 999px; background: rgba(20, 16, 14, 0.72); color: #fff; font-size: 1.25rem; line-height: 1; cursor: pointer; }
.story-unplaced-images .story-scene-remove:hover { background: var(--wine); }
.story-editor.is-blurb-editor [data-unplaced-images] { display: none !important; }

/* Story-Editor (Desktop): ganze linke Spalte scrollt mit dem Seitenscrollbalken ganz rechts,
   die rechte Spalte (Notizen/KI-Hilfe/Prüfung) bleibt beim Scrollen stehen. */
@media (min-width: 841px) {
    .story-editor .lyrics-editor-split {
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        scrollbar-gutter: stable;
    }
    .story-editor .lyrics-pane {
        overflow: visible;
        min-height: 100%;
    }
    .story-editor .story-tab-panel {
        flex: 0 0 auto;
        overflow: visible;
    }
    .story-editor .story-tab-panel--text > .wysiwyg.story-wysiwyg {
        flex: 0 0 auto;
        height: auto;
        max-height: none;
        min-height: 520px;
        overflow: visible;
    }
    .story-editor .lyrics-chat {
        position: sticky;
        top: 0;
        align-self: start;
        height: var(--story-split-h, 100%);
        max-height: var(--story-split-h, 100%);
    }
}

/* ============ Fan-View: Buch-Ansicht (js/share-book.js) ============ */
body.share-book-open { overflow: hidden; }
body.share-book-open .share-resume,
body.share-book-open .share-sticky-bar { display: none !important; }
.share-book-open-btn,
.share-install-open-btn { margin-top: 0.5rem; }
.share-install-open-btn { margin-left: 0.4rem; }
.share-book {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(1100px 600px at 50% 40%, rgba(255, 236, 200, 0.10), transparent 70%),
        linear-gradient(160deg, #3a2a20 0%, #2a1d16 55%, #20160f 100%);
    color: #f4ead8;
    font-family: var(--sans);
}
.share-book[hidden] { display: none; }
/* Keine Leisten: Menü oben links, Seitenzahl unten rechts – halbtransparent über dem Buch */
.share-book-float {
    position: absolute;
    z-index: 6;
}
.share-book-menu.share-book-float {
    top: calc(14px + env(safe-area-inset-top, 0px));
    left: calc(14px + env(safe-area-inset-left, 0px));
}
.share-book-fab,
.share-book-badge {
    appearance: none;
    border: 1px solid rgba(244, 234, 216, 0.22);
    background: rgba(30, 21, 16, 0.38);
    color: #f4ead8;
    font: inherit;
    cursor: pointer;
    opacity: 0.6;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition: opacity 0.2s ease, background 0.2s ease;
}
.share-book-fab {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    font-size: 1.05rem;
    line-height: 1;
}
.share-book-fab:hover, .share-book-fab:focus-visible, .share-book-fab[aria-expanded="true"],
.share-book-badge:hover, .share-book-badge:focus-visible { opacity: 1; background: rgba(30, 21, 16, 0.75); }
.share-book-badge {
    right: calc(14px + env(safe-area-inset-right, 0px));
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    min-height: 32px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-variant-numeric: tabular-nums;
}
.share-book-badge[hidden] { display: none; }
.share-book-pagenav {
    position: absolute;
    z-index: 7;
    left: 50%;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    width: min(560px, calc(100% - 20px));
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 16px;
    background: rgba(30, 21, 16, 0.92);
    color: #f4ead8;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.share-book-pagenav[hidden] { display: none; }
.share-book-pagenav-mid { flex: 1 1 auto; min-width: 0; display: grid; gap: 4px; justify-items: center; }
.share-book-pagenav .share-book-pagenav-label { display: flex; flex-direction: row; align-items: center; gap: 6px; margin: 0; font-size: 0.85rem; font-weight: 400; font-variant-numeric: tabular-nums; white-space: nowrap; }
.share-book-pagenav .share-book-pagenav-input {
    display: inline-block;
    width: 4.2em;
    min-width: 0;
    margin: 0;
    min-height: 0;
    height: 30px;
    padding: 2px 4px;
    border: 1px solid rgba(244, 234, 216, 0.35);
    border-radius: 6px;
    background: rgba(244, 234, 216, 0.1);
    color: inherit;
    font: inherit;
    text-align: center;
}
.share-book-pagenav .share-book-pagenav-slider { width: 100%; margin: 0; padding: 0; min-height: 0; border: 0; background: none; accent-color: #c9a46a; }
.share-book-nav {
    appearance: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(244, 234, 216, 0.3);
    background: rgba(244, 234, 216, 0.08);
    color: inherit;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
}
.share-book-nav:hover:not(:disabled) { background: rgba(244, 234, 216, 0.2); }
.share-book-nav:disabled { opacity: 0.3; cursor: default; }

.share-book-stage {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 2200px;
    user-select: none;
    -webkit-user-select: none;
}
.share-book-page,
.share-book-leaf {
    width: var(--book-w, 560px);
    height: var(--book-h, 800px);
}
.share-book-page,
.share-book-leaf-front,
.share-book-leaf-back {
    background:
        linear-gradient(90deg, rgba(90, 60, 30, 0.22) 0, rgba(90, 60, 30, 0.06) 3.5%, transparent 9%),
        radial-gradient(140% 90% at 50% 45%, #fbf6ea 0%, #f4ecda 70%, #ece0c8 100%);
    color: #2a211a;
}
.share-book-page {
    position: relative;
    border-radius: 3px 10px 10px 3px;
    box-shadow:
        1px 1px 0 #e8dcc3, 2px 2px 0 #d9caab, 3px 3px 0 #e6d9be, 4px 4px 0 #d3c3a3,
        0 30px 60px rgba(0, 0, 0, 0.45), 0 8px 18px rgba(0, 0, 0, 0.3);
}
.share-book-viewport {
    position: absolute;
    inset: clamp(26px, 5.5%, 52px) clamp(20px, 9%, 56px) clamp(30px, 6%, 56px) clamp(24px, 10%, 62px);
    overflow: hidden;
}
.share-book-flow {
    height: 100%;
    column-fill: auto;
    will-change: transform;
    font-family: var(--serif);
    font-size: calc(clamp(1rem, 0.6vw + 0.85rem, 1.12rem) * var(--book-font-scale, 1));
    line-height: 1.62;
    hyphens: auto;
    -webkit-hyphens: auto;
}
.share-book-shade {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.35), transparent 60%);
    border-radius: inherit;
}
.share-book-leaf {
    position: absolute;
    left: calc(50% - var(--book-w, 560px) / 2);
    top: calc(50% - var(--book-h, 800px) / 2);
    transform-origin: left center;
    transform-style: preserve-3d;
    pointer-events: none;
    z-index: 2;
}
.share-book-leaf[hidden] { display: none; }
.share-book-leaf-front,
.share-book-leaf-back {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 3px 10px 10px 3px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}
.share-book-leaf-back {
    transform: rotateY(180deg);
    background:
        linear-gradient(270deg, rgba(90, 60, 30, 0.25) 0, transparent 12%),
        radial-gradient(140% 90% at 50% 45%, #f6efdf 0%, #ebdfc6 100%);
}
.share-book-leaf-gloss {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.35) 35%, rgba(0, 0, 0, 0.28) 100%);
}

/* Typografie im Buch */
.share-book-flow p { margin: 0; text-align: justify; }
.share-book-flow .book-prose p { margin: 0 0 0.75em; }
.share-book-flow .book-prose h2,
.share-book-flow .book-prose h3 { break-after: avoid; margin: 1em 0 0.4em; font-weight: 600; }
.share-book-flow .story-char { background: none; border: 0; padding: 0; color: inherit; text-decoration: none; pointer-events: none; }
.book-titlepage,
.book-tocpage {
    break-after: column;
    height: var(--book-inner-h, 100%);
}
.book-titlepage {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.book-title {
    margin: 0;
    font-family: var(--serif);
    font-size: clamp(2.2rem, 7vw, 3.4rem);
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1.1;
    color: #3b1e18;
}
.book-rule { width: 40%; height: 1px; margin: 1.4em auto 1em; background: linear-gradient(90deg, transparent, #7a2e2a, transparent); }
.book-subtitle { margin: 0 !important; text-align: center !important; font-size: 0.85rem; letter-spacing: 0.22em; text-transform: uppercase; color: #7a2e2a; }
.book-ornament { text-align: center; color: #7a2e2a; font-size: 1.3rem; margin: 0.2em 0 1em; }
.book-ornament--top { font-size: 1.6rem; margin-bottom: 1.4em; }
.book-toc-head { margin: 1.5em 0 1em; text-align: center; font-family: var(--serif); font-weight: 600; letter-spacing: 0.08em; }
.book-toc { list-style: none; margin: 0; padding: 0; }
.book-toc li { margin: 0 0 0.35em; }
.book-toc-link {
    appearance: none;
    display: flex;
    align-items: baseline;
    gap: 6px;
    width: 100%;
    padding: 2px 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.book-toc-link:hover .book-toc-title { color: #7a2e2a; text-decoration: underline; }
.book-toc-title { flex: 0 1 auto; }
.book-toc-dots { flex: 1 1 auto; border-bottom: 1px dotted rgba(42, 33, 26, 0.45); transform: translateY(-0.3em); min-width: 1em; }
.book-toc-page { flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.book-chapter { break-before: column; }
.book-chapter-kicker { margin: 1.6em 0 0.3em !important; text-align: center !important; font-size: 0.75rem; letter-spacing: 0.24em; text-transform: uppercase; color: #7a2e2a; }
.book-chapter-title { margin: 0 0 0.3em; text-align: center; font-family: var(--serif); font-size: 1.55em; font-weight: 600; line-height: 1.2; color: #3b1e18; break-after: avoid; }
.book-chapter .book-prose > p:first-child::first-letter {
    float: left;
    font-size: 3.3em;
    line-height: 0.85;
    padding: 0.06em 0.08em 0 0;
    color: #7a2e2a;
    font-weight: 600;
}
.book-figure {
    margin: 0 0 1em;
    break-inside: avoid;
    border: 0;
    background: none;
}
.book-figure img {
    display: block;
    width: 100%;
    height: var(--book-img-h, 240px);
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(60, 40, 20, 0.25);
    filter: sepia(0.08);
}
@media (prefers-reduced-motion: reduce) {
    .share-book-flow { will-change: auto; }
}
@media (max-width: 600px) {
    .share-book-flow p { text-align: left; }
}
.share-book-menu { position: relative; }
.share-book-menu-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 5;
    min-width: 15rem;
    padding: 6px;
    border-radius: 12px;
    background: #f7efe0;
    color: #2a211a;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}
.share-book-menu-panel[hidden] { display: none; }
.share-book-menu-item {
    appearance: none;
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.share-book-menu-item:hover { background: rgba(122, 46, 42, 0.1); }
.share-book-menu-row { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-top: 1px solid rgba(42, 33, 26, 0.12); border-bottom: 1px solid rgba(42, 33, 26, 0.12); margin: 4px 0; }
.share-book-menu-label { flex: 1 1 auto; }
.share-book-font-btn {
    appearance: none;
    min-width: 38px;
    height: 34px;
    border: 1px solid rgba(42, 33, 26, 0.25);
    border-radius: 8px;
    background: #fffaf0;
    color: inherit;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
.share-book-font-btn:disabled { opacity: 0.35; cursor: default; }
.share-book-font-val { min-width: 3.4em; text-align: center; font-variant-numeric: tabular-nums; font-size: 0.9rem; }
/* Titelbild randlos auf Seite 1 */
.share-book-cover { display: none; position: absolute; inset: 0; z-index: 1; overflow: hidden; border-radius: inherit; background: #1b130e; }
.is-cover .share-book-cover { display: block; }
.share-book-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Querformat-Titelbild auf einer Hochformat-Seite: nicht stark hochskalieren (sonst pixelig),
   sondern ganz zeigen – oben/unten füllt eine weichgezeichnete Kopie */
.share-book-cover-bg { display: none; }
.share-book-cover.is-landscape .share-book-cover-bg {
    display: block; position: absolute; inset: -20px; width: calc(100% + 40px); height: calc(100% + 40px);
    object-fit: cover; filter: blur(18px) brightness(0.55); transform: scale(1.05);
}
.share-book-cover.is-landscape > img:not(.share-book-cover-bg),
.share-book-cover.is-landscape > video {
    position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: center 58%;
}
.share-book-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(10, 6, 4, 0.78) 0%, rgba(10, 6, 4, 0.25) 34%, transparent 55%, rgba(10, 6, 4, 0.35) 100%); }
.share-book-cover-text { position: absolute; z-index: 1; left: 8%; right: 8%; top: 9%; text-align: center; }
.share-book-cover-text .book-title { color: #f6ead2; text-shadow: 0 2px 14px rgba(0, 0, 0, 0.7); }
.share-book-cover-text .book-rule { background: linear-gradient(90deg, transparent, #e9c98f, transparent); }
.book-titlepage.has-cover > * { visibility: hidden; }
/* Bücher-Übersicht: Titelbild */
.book-card-cover { margin: -4px 0 12px; border-radius: 10px; overflow: hidden; aspect-ratio: 3 / 2; background: var(--paper-2); }
.book-card-cover[hidden] { display: none; }
.book-card-cover img { width: 100%; height: 100%; object-fit: cover; object-position: center 60%; display: block; }
.book-cover-preview { display: flex; justify-content: center; align-items: center; min-height: 6rem; padding: 8px; border: 1px dashed var(--line); border-radius: 10px; background: var(--paper-2); }
.book-cover-preview img { max-height: 46vh; max-width: 100%; border-radius: 8px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18); }
.book-cover-preview p { margin: 0; }
.book-cover-upload { cursor: pointer; }
/* Buchsatz-Regeln: gelten bei jeder Schriftgröße, weil der Browser jede Seite neu setzt */
.share-book-flow {
    orphans: 2;               /* keine einzelne Absatzzeile unten auf der Seite (Schusterjunge) */
    widows: 2;                /* keine einzelne Absatzzeile oben auf der Seite (Hurenkind) */
    hyphenate-limit-chars: 7 3 3;  /* nur Wörter ab 7 Zeichen trennen, mind. 3 Zeichen je Teil */
    -webkit-hyphenate-limit-before: 3;
    -webkit-hyphenate-limit-after: 3;
    hyphenate-limit-lines: 2; /* höchstens 2 Trennungen in Folge */
    text-rendering: optimizeLegibility;
    font-kerning: normal;
    font-variant-ligatures: common-ligatures;
}
.share-book-flow p { text-wrap: pretty; }   /* ausgewogene Zeilen, kein einzelnes Wort in der letzten Zeile */
.share-book-flow .book-prose p { break-inside: auto; }
.book-chapter-title,
.book-chapter-kicker,
.book-toc,
.book-title { hyphens: manual; -webkit-hyphens: manual; text-wrap: balance; }
.book-chapter-title,
.book-ornament { break-after: avoid; }
.share-book-flow .book-prose h2,
.share-book-flow .book-prose h3 { hyphens: manual; text-wrap: balance; }
/* Buch-Ansicht: Song-Knopf im Kapitel + Player */
.book-song {
    appearance: none;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin: 0 0 1em;
    padding: 8px 12px;
    border: 1px solid rgba(122, 46, 42, 0.35);
    border-radius: 999px;
    background: rgba(122, 46, 42, 0.06);
    color: #3b1e18;
    font: inherit;
    font-size: 0.9em;
    text-align: left;
    cursor: pointer;
    break-inside: avoid;
    hyphens: manual;
}
.book-song:hover { background: rgba(122, 46, 42, 0.14); }
.book-song-play { flex: 0 0 auto; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #7a2e2a; color: #fff; font-size: 0.75rem; padding-left: 2px; }
.book-song-label { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.book-song-label small { font-size: 0.72em; letter-spacing: 0.08em; text-transform: uppercase; color: #7a2e2a; }
.share-book-player { position: absolute; left: 50%; bottom: calc(58px + env(safe-area-inset-bottom, 0px)); z-index: 4; transform: translateX(-50%); width: min(560px, calc(100% - 24px)); display: flex; justify-content: center; }
.share-book-player[hidden] { display: none; }
.share-book-player-panel { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 14px; background: rgba(30, 21, 16, 0.94); color: #f4ead8; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5); backdrop-filter: blur(8px); }
.share-book-player-panel[hidden] { display: none; }
.share-book-player-cover { width: 46px; height: 46px; border-radius: 8px; object-fit: cover; flex: 0 0 auto; }
.share-book-player-cover[hidden] { display: none; }
.share-book-player-main { flex: 1 1 auto; min-width: 0; }
.share-book-player-title { margin: 0 0 4px; font-weight: 650; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.share-book-player-row { display: flex; align-items: center; gap: 6px; }
.share-book-pbtn { appearance: none; flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%; border: 1px solid rgba(244, 234, 216, 0.3); background: rgba(244, 234, 216, 0.1); color: inherit; font-size: 0.8rem; cursor: pointer; }
.share-book-pbtn:hover { background: rgba(244, 234, 216, 0.22); }
.share-book-pbtn[hidden] { display: none; }
.share-book-pmin { align-self: flex-start; font-size: 1rem; }
.share-book-ptime { flex: 0 0 auto; font-size: 0.75rem; font-variant-numeric: tabular-nums; opacity: 0.85; }
.share-book-pseek { flex: 1 1 auto; min-width: 40px; accent-color: #e9c98f; }
.share-book-player-pill { appearance: none; display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 8px 14px; border: 1px solid rgba(244, 234, 216, 0.35); border-radius: 999px; background: rgba(30, 21, 16, 0.94); color: #f4ead8; font: inherit; font-size: 0.85rem; cursor: pointer; box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.share-book-player-pill[hidden] { display: none; }
.share-book-pill-icon { display: inline-block; }
.share-book-player-pill.is-playing .share-book-pill-icon { animation: book-note 1.2s ease-in-out infinite; }
@keyframes book-note { 50% { transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .share-book-player-pill.is-playing .share-book-pill-icon { animation: none; } }
/* Buch-Untertitel */
.book-subtitle-text { margin: 0 0 1.2em !important; text-align: center !important; font-family: var(--serif); font-style: italic; font-size: 1.15em; line-height: 1.35; color: #5a3a2c; hyphens: manual; text-wrap: balance; }
.share-book-cover-text .book-subtitle-text { color: #f1dfbd; text-shadow: 0 2px 10px rgba(0, 0, 0, 0.75); }
.share-subtitle { margin: -0.4rem 0 1rem; font-family: var(--serif); font-style: italic; font-size: 1.15rem; color: var(--muted); }
.book-card-subtitle { margin: -0.4rem 0 0.5rem; font-style: italic; color: var(--muted); }
.book-card-subtitle[hidden] { display: none; }

/* Fan-View: Hinweis „Als App installieren“ (oben, damit er Player/Fortsetzen-Leiste unten nicht verdeckt) */
.share-install {
    position: fixed;
    left: 50%;
    top: calc(0.75rem + env(safe-area-inset-top, 0px));
    transform: translate(-50%, -12px);
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 70;
    width: min(42rem, calc(100% - 1.5rem));
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 14px;
    padding: 12px 14px;
    border-radius: 14px;
    background: #fffaf3;
    color: #241c18;
    border: 1px solid rgba(122, 46, 42, 0.22);
    box-shadow: 0 12px 32px rgba(28, 22, 18, 0.22);
}
.share-install.is-visible { opacity: 1; transform: translate(-50%, 0); }
.share-install[hidden] { display: none !important; }
.share-install-text { flex: 1 1 14rem; display: grid; gap: 2px; font-size: 0.95rem; line-height: 1.35; }
.share-install-text span { color: var(--muted); font-size: 0.88rem; }
.share-install-actions { display: flex; flex-wrap: wrap; gap: 8px; }
@media (prefers-reduced-motion: reduce) { .share-install { transition: none; } }

/* Passwortfeld mit Augen-Knopf (Anmeldung, Zurücksetzen, Einrichtung) */
.pw-field { position: relative; display: block; }
.pw-field input { width: 100%; padding-right: 44px; }
.pw-toggle {
    position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
    width: 34px; height: 34px; padding: 6px; border: 0; border-radius: 8px;
    background: transparent; color: var(--muted, #6b6259); cursor: pointer;
}
.pw-toggle:hover, .pw-toggle:focus-visible { color: var(--wine, #7a2e2a); background: rgba(0,0,0,.05); }
.pw-toggle svg { width: 20px; height: 20px; display: block; }

/* ---------- Adventskalender (Planung + Fan-Hinweis) ---------- */
.advent-app { display: grid; gap: 1rem; }
.advent-card { padding: 1.1rem 1.2rem; }
.advent-card h2, .advent-days-head h2 { margin: 0 0 .6rem; font-family: var(--serif); font-size: 1.25rem; }
.advent-settings-grid { display: grid; gap: 1.5rem; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
@media (max-width: 860px) { .advent-settings-grid { grid-template-columns: 1fr; } }
.advent-linkbox a { word-break: break-all; }
.advent-linkbox code { word-break: break-all; font-size: .8rem; }
.advent-small { font-size: .85rem; }
.advent-qr { display: block; width: 160px; height: 160px; image-rendering: pixelated; margin: .5rem 0; }
.advent-form { display: grid; gap: .6rem; }
.advent-form label { display: grid; gap: .25rem; font-size: .9rem; }
.advent-form textarea { font-family: inherit; }
.advent-row { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: end; }
.advent-row label { display: grid; gap: .25rem; }
.advent-grow { flex: 1 1 min(260px, 100%); min-width: 0; }
.advent-days-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .6rem; }
.advent-days-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.advent-check { display: inline-flex; gap: .35rem; align-items: center; font-size: .9rem; }
[data-advent-status].is-error { color: var(--wine, #7a2e2a); }
.advent-days { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }
.advent-day { padding: .9rem 1rem; display: grid; gap: .55rem; align-content: start; }
.advent-day-head { display: flex; flex-wrap: wrap; gap: .3rem .8rem; align-items: baseline; }
.advent-day-head strong { font-family: var(--serif); font-size: 1.15rem; }
.advent-day-els { flex-basis: 100%; font-size: .85rem; }
.advent-day .banner { margin: 0; padding: .35rem .6rem; font-size: .85rem; }
.advent-range { margin: 0; font-size: .9rem; line-height: 1.45; }
.advent-day-tools { display: flex; flex-wrap: wrap; gap: .4rem; }
.advent-teaser { display: grid; gap: .25rem; font-size: .85rem; }
.advent-teaser textarea { font-family: inherit; font-size: .9rem; }
.advent-media { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .2rem; }
.advent-thumb { position: relative; flex: 0 0 auto; width: 78px; height: 78px; border-radius: 8px; overflow: hidden;
    border: 2px solid transparent; cursor: pointer; background: rgba(0,0,0,.05); display: grid; place-items: center; }
.advent-thumb.is-active { border-color: var(--wine, #7a2e2a); }
.advent-thumb input { position: absolute; opacity: 0; pointer-events: none; }
.advent-thumb img { width: 100%; height: 100%; object-fit: cover; }
.advent-thumb--none span { font-size: .75rem; text-align: center; padding: .2rem; }
.advent-slides { display: flex; gap: .5rem; overflow-x: auto; align-items: flex-start; }
.advent-slides img { width: 130px; height: auto; border-radius: 6px; flex: 0 0 auto; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.advent-caption { flex: 0 0 260px; max-height: 260px; overflow: auto; white-space: pre-wrap; font-size: .75rem;
    background: rgba(0,0,0,.04); padding: .5rem; border-radius: 6px; margin: 0; }
.advent-cut { display: grid; gap: .6rem; }
.advent-cut-list { list-style: none; margin: 0; padding: 0; max-height: 60vh; overflow: auto; display: grid; gap: .3rem; }
.advent-cut-item button { width: 100%; text-align: left; display: grid; gap: .15rem; padding: .45rem .6rem; border-radius: 8px;
    border: 1px solid rgba(0,0,0,.1); background: transparent; cursor: pointer; font: inherit; color: inherit; }
.advent-cut-item button:hover { background: rgba(0,0,0,.04); }
.advent-cut-item.is-current button { border-color: var(--wine, #7a2e2a); background: rgba(122,46,42,.07); }
.advent-cut-text { font-size: .9rem; }
.advent-cut-meta { font-size: .75rem; }

/* Fan-Seite */
.advent-banner { margin: 0 auto 1.5rem; max-width: 46rem; padding: 1rem 1.1rem; border-radius: 14px;
    background: linear-gradient(160deg, #1b2a44, #0e1726); color: #f7f0e3; }
.advent-banner .advent-title { margin: 0; font-family: var(--serif); font-size: 1.2rem; color: #e6c26e; }
.advent-banner .advent-sub { margin: .3rem 0 0; font-size: .92rem; color: #d7dbe4; }
.advent-preview { margin: 0 0 .5rem; font-size: .8rem; color: #ffd98a; }
.advent-countdown { font-variant-numeric: tabular-nums; white-space: nowrap; }
.advent-doors { list-style: none; margin: .8rem 0 0; padding: 0; display: grid; gap: .35rem;
    grid-template-columns: repeat(auto-fill, minmax(2.4rem, 1fr)); }
.advent-door a, .advent-door span { display: grid; place-items: center; height: 2.4rem; border-radius: 8px;
    font-weight: 600; text-decoration: none; font-size: .95rem; }
.advent-door span { border: 1px dashed rgba(247,240,227,.3); color: rgba(247,240,227,.45); }
.advent-door.is-open a { background: rgba(230,194,110,.18); color: #f7f0e3; border: 1px solid rgba(230,194,110,.5); }
.advent-door.is-today a { background: #e6c26e; color: #0e1726; }
.advent-mark { display: flex; gap: .6rem; align-items: baseline; justify-content: center; margin: 2rem 0 1.2rem;
    padding-top: 1rem; border-top: 1px solid rgba(0,0,0,.12); scroll-margin-top: 5rem; }
.advent-mark:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.advent-mark-num { font-family: var(--serif); font-weight: 600; color: var(--wine, #7a2e2a); }
.advent-mark-date { font-size: .85rem; color: var(--muted, #6b6259); }
.book-adventpage { break-after: column; height: var(--book-inner-h, 100%); display: flex; align-items: center; }
.book-adventpage .advent-banner { margin: 0; width: 100%; }
.book-adventpage .advent-door.is-open span { background: rgba(230,194,110,.18); color: #f7f0e3; border: 1px solid rgba(230,194,110,.5); }
.book-adventpage .advent-door.is-today span { background: #e6c26e; color: #0e1726; }
.share-book-flow .advent-mark { break-after: avoid; }

/* Fan-View Buchansicht: Doppelseite am PC (links gerade, rechts ungerade, Falz in der Mitte) */
.share-book-page--left[hidden] { display: none; }
.share-book-page.face-left,
.share-book-leaf-front.face-left,
.share-book-leaf-back.face-left {
    background:
        linear-gradient(270deg, rgba(90, 60, 30, 0.24) 0, rgba(90, 60, 30, 0.07) 3.5%, transparent 9%),
        radial-gradient(140% 90% at 50% 45%, #fbf6ea 0%, #f4ecda 70%, #ece0c8 100%);
    border-radius: 10px 3px 3px 10px;
}
.share-book-leaf-back.face-right {
    background:
        linear-gradient(90deg, rgba(90, 60, 30, 0.22) 0, rgba(90, 60, 30, 0.06) 3.5%, transparent 9%),
        radial-gradient(140% 90% at 50% 45%, #fbf6ea 0%, #f4ecda 70%, #ece0c8 100%);
    border-radius: 3px 10px 10px 3px;
}
.share-book-page.face-left {
    box-shadow:
        -1px 1px 0 #e8dcc3, -2px 2px 0 #d9caab, -3px 3px 0 #e6d9be, -4px 4px 0 #d3c3a3,
        0 30px 60px rgba(0, 0, 0, 0.45), 0 8px 18px rgba(0, 0, 0, 0.3);
}
.face-left .share-book-viewport {
    left: clamp(20px, 9%, 56px);
    right: clamp(24px, 10%, 62px);
}
.face-left .share-book-shade { background: linear-gradient(270deg, rgba(0, 0, 0, 0.35), transparent 60%); }
.share-book-page--left.is-closed { visibility: hidden; }
.share-book.is-spread .share-book-leaf.is-fwd {
    left: 50%;
    transform-origin: left center;
}
.share-book.is-spread .share-book-leaf.is-back {
    left: calc(50% - var(--book-w, 560px));
    transform-origin: right center;
}
/* Falz: weicher Schatten genau in der Buchmitte */
.share-book.is-spread .share-book-stage::after {
    content: "";
    position: absolute;
    left: 50%;
    top: calc(50% - var(--book-h, 800px) / 2);
    width: 28px;
    height: var(--book-h, 800px);
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 1;
    background: linear-gradient(90deg, transparent, rgba(60, 40, 20, 0.16) 45%, rgba(40, 25, 12, 0.28) 50%, rgba(60, 40, 20, 0.16) 55%, transparent);
}
.share-book.is-spread .share-book-page--left.is-closed ~ .share-book-page { box-shadow: 0 30px 60px rgba(0, 0, 0, 0.45), 0 8px 18px rgba(0, 0, 0, 0.3); }
.share-book.is-spread.is-front-cover .share-book-stage::after { display: none; }
/* Inhaltsverzeichnis nur so hoch wie nötig – sonst schob der Überschriften-Abstand es auf eine leere zweite Seite */
.book-tocpage { height: auto; }
.advent-pkg { font-size: .75rem; padding: .1rem .5rem; border-radius: 999px; white-space: nowrap; }
.advent-pkg--ok { background: #e7efe8; color: var(--forest, #2f5d3a); }
.advent-pkg--stale { background: var(--warn-bg, #fdf0cf); color: #5c3d00; font-weight: 600; }
.advent-pkg--new { background: rgba(0,0,0,.06); color: var(--muted, #6b6259); }

/* Editor-Werkzeugleisten (Story + Lyrics): kompakt, beim Scrollen fixiert */
.btn.btn-tool {
    min-width: 36px;
    justify-content: center;
    padding-left: 8px;
    padding-right: 8px;
    font-weight: 700;
}
.btn.btn-tool .btn-ico { margin: 0; }
.lyrics-pane .wysiwyg-toolbar {
    position: sticky;
    top: 0;
    z-index: 6;
    margin-top: -6px;
    padding: 6px 0 8px;
    background: var(--paper);
    box-shadow: 0 8px 10px -10px rgba(28, 22, 18, 0.35);
}
.story-lyrics-bar:not(:has(.story-lyrics-chips > *)) { display: none; }
/* Adventskalender: Schlussseite „Weiter geht's morgen“ */
.advent-endpage, .book-advent-end { display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; gap: .6rem; }
.advent-endpage { margin: 2.5rem auto 1rem; max-width: 32rem; padding: 2rem 1.2rem; border-top: 1px solid rgba(0,0,0,.12); }
.book-advent-end { break-before: column; break-inside: avoid; height: var(--book-inner-h, 100%); padding: 1rem; }
.advent-end-figure { margin: 0; display: grid; justify-items: center; gap: .4rem; }
.advent-end-figure img { width: min(55vw, 220px); max-height: 38vh; aspect-ratio: 1; object-fit: cover; border-radius: 50%;
    box-shadow: 0 6px 24px rgba(0,0,0,.25); border: 3px solid #e6c26e; }
.advent-end-figure figcaption { font-size: .85rem; font-style: italic; color: var(--muted, #6b6259); }
.advent-end-icon { font-size: 4rem; line-height: 1; }
.advent-end-title { margin: .4rem 0 0; font-family: var(--serif); font-size: 1.6rem; color: var(--wine, #7a2e2a); }
.advent-end-text { margin: 0; text-align: center !important; }
.advent-end-hint { margin: .4rem 0 0; font-size: .85rem; color: var(--muted, #6b6259); text-align: center !important; }

/* --- Kurzfilm-Dialog (js/video-film.js) --- */
/* Das Vollbild-Modal schneidet ab (overflow: hidden) – der Dialog scrollt selbst, Blöcke werden nicht gestaucht */
.film-modal {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.film-modal > *,
.film-segments > * { flex-shrink: 0; }
.film-settings { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; }
.film-settings legend { padding: 0 6px; font-weight: 600; }
.film-settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px 14px; }
.film-progress { width: 100%; height: 10px; }
.film-beats ol { margin: 6px 0 0 1.2em; font-size: .92em; }
.film-segments { gap: 12px; }
.film-seg { border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--card); }
.film-seg--done { border-left-color: #3c8a4f; }
.film-seg--submitted, .film-seg--submitting { border-left-color: var(--wine); }
.film-seg--failed { border-left-color: var(--danger); }
.film-seg-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-bottom: 6px; }
.film-seg-head select { width: auto; margin-left: auto; }
.film-seg-status { font-size: .85em; color: var(--muted); }
.film-seg-video { width: 100%; max-width: 480px; display: block; margin: 4px 0 8px; border-radius: 6px; background: #000; }
.film-seg textarea { width: 100%; font-size: .9em; }
.film-until { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.film-until select { width: auto; }

/* --- Seitenleiste: Hintergrund-Prozesse (js/bg-tasks.js) --- */
.side-tasks { display: flex; flex-direction: column; gap: 8px; padding: 8px 10px; border: 1px solid rgba(255,255,255,.14); border-radius: 8px; background: rgba(255,255,255,.04); }
.side-tasks-head { margin: 0; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: #b4a497; }
.side-task { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; align-items: center; }
.side-task-title { grid-column: 1; color: #f3ebe3; font-weight: 600; font-size: .85rem; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-task-info { grid-column: 1; font-size: .75rem; color: #b4a497; }
.side-task-bar { grid-column: 1 / -1; width: 100%; height: 6px; }
.side-task-stop { grid-column: 2; grid-row: 1 / span 2; background: transparent; border: 1px solid rgba(255,255,255,.3); color: #f3ebe3; border-radius: 6px; font-size: .72rem; padding: 3px 8px; cursor: pointer; }
.side-task-stop:hover { background: rgba(255,255,255,.1); }
.side-task--done .side-task-title { font-weight: 400; }

/* --- Videos-Übersicht (videos.php) --- */
.video-overview { display: flex; flex-direction: column; gap: 16px; }
.video-ov-row { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; background: var(--card); }
.video-ov-row.is-empty { opacity: .7; }
.video-ov-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.video-ov-head .btn { margin-left: auto; }
.video-ov-num { min-width: 1.8em; height: 1.8em; border-radius: 50%; background: var(--wine-soft); color: var(--wine-dark); display: inline-flex; align-items: center; justify-content: center; font-size: .85rem; font-weight: 600; }
.video-ov-title { margin: 0; font-family: var(--serif); font-size: 1.15rem; }
.video-ov-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.video-ov-item { margin: 0; }
.video-ov-item video { width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 6px; display: block; }
.video-ov-item figcaption { font-size: .85rem; margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.video-ov-badge { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--wine); }
.video-ov-prompt { width: 100%; }
.video-ov-prompt pre { white-space: pre-wrap; font-size: .8rem; max-height: 220px; overflow: auto; }
.video-ov-film { margin: 0 0 8px; font-size: .9rem; color: var(--wine-dark); }

/* --- Videos-Seite: Abspieler „am Stück“ + aufklappbare Elemente --- */
.vplayer { position: sticky; top: 8px; z-index: 5; margin-bottom: 16px; padding: 12px; border-radius: 10px; background: #111; color: #eee; box-shadow: var(--shadow); }
.vplayer-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 8px; }
.vplayer-head strong { color: #fff; }
.vplayer-count { margin-left: auto; }
.vplayer-video { width: 100%; max-height: 62vh; background: #000; border-radius: 6px; display: block; }
.vplayer-list { margin: 8px 0 0; padding-left: 1.4em; max-height: 120px; overflow: auto; font-size: .85rem; }
.vplayer-jump { background: none; border: 0; color: #ccc; cursor: pointer; padding: 1px 0; text-align: left; }
.vplayer-list li.is-active .vplayer-jump { color: #fff; font-weight: 600; }
details.video-ov-row > summary { list-style: none; cursor: pointer; margin-bottom: 0; }
details.video-ov-row > summary::-webkit-details-marker { display: none; }
details.video-ov-row > summary::after { content: '▸'; margin-left: 4px; color: var(--muted); }
details.video-ov-row[open] > summary::after { content: '▾'; }
details.video-ov-row[open] > summary { margin-bottom: 8px; }
.video-ov-meta { margin-left: auto; font-size: .85rem; }
.video-ov-body { display: flex; flex-direction: column; gap: 10px; }
.share-video-autonext { display: inline-flex; align-items: center; gap: 4px; font-size: .85rem; margin-left: 8px; }

/* Adventskalender: Status, neuer Kalender aus ausgewählten Story-Elementen */
.advent-status-box { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.advent-status-box h2 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.advent-status { font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 2px 10px; border-radius: 999px; background: var(--paper-2); color: var(--muted); }
.advent-status.is-active { background: #dfeee3; color: var(--forest); }
.advent-status.is-done { background: var(--wine-soft); color: var(--wine); }
.advent-next-form { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.advent-next-els { display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); max-height: 320px; overflow: auto; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
.advent-history { margin-top: 12px; }
.advent-history ul { margin: 6px 0 0; padding-left: 1.2rem; }
.advent-banner.is-done .advent-doors { opacity: .75; }

/* Veröffentlichung von Story-Elementen (js/publish.js) */
.story-publish { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; font-size: .88rem; }
.publish-badge { font-weight: 700; }
.publish-badge--draft { background: var(--paper-2); color: var(--muted); }
.publish-badge--scheduled { background: var(--warn-bg); color: var(--warn); }
.publish-badge--live { background: #dfeee3; color: var(--forest); }
.publish-badge--advent { background: #1b2a44; color: #e6c26e; }
.story-publish-warn { margin: 6px 0 0; padding: 6px 10px; font-size: .85rem; border-radius: 8px; max-width: 46rem; }
.story-publish-form input[type="datetime-local"] { max-width: 16rem; }

/* Kurzanleitung Veröffentlichungen (anleitung.php) */
.guide { max-width: 52rem; }
.guide-toc { margin-bottom: 16px; }
.guide-toc ol { margin: 6px 0 0; padding-left: 1.3rem; columns: 2 16rem; }
.guide-sec { margin-bottom: 16px; scroll-margin-top: 16px; }
.guide-sec h2 { margin: 0 0 8px; font-size: 1.15rem; }
.guide-sec li { margin-bottom: 6px; }

/* Einstellungen → Fan-App-Logos */
.settings-fanlogos { margin-bottom: 18px; }
.fanlogo-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.fanlogo-item h3 { margin: 0 0 8px; font-size: 1rem; }
.fanlogo-preview { display: grid; place-items: center; height: 130px; border-radius: 12px; background: #000; margin-bottom: 8px; }
.fanlogo-preview img { max-height: 104px; max-width: 86%; object-fit: contain; }
.fanlogo-preview--icon img { border-radius: 50%; }

/* Adventskalender: Song/Video je Türchen, Lyrics zum Aufklappen */
.advent-media-block { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 30rem; margin: 1rem auto; }
.advent-media-block--end { margin-top: 1.2rem; }
.advent-media-kicker { margin: 0; font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; color: var(--wine); font-weight: 700; text-align: center; }
.advent-video { position: relative; display: block; width: 100%; padding: 0; border: 0; border-radius: 12px; overflow: hidden; background: #111; cursor: pointer; aspect-ratio: 16 / 9; margin: 0; }
.advent-video img, .advent-video video { width: 100%; height: 100%; object-fit: cover; display: block; }
.advent-video--file { cursor: default; }
.advent-video-play { position: absolute; inset: 0; margin: auto; width: 60px; height: 42px; border-radius: 12px; background: rgba(0, 0, 0, .7); color: #fff; display: grid; place-items: center; font-size: 1.2rem; }
.advent-video:hover .advent-video-play { background: #c00; }
.advent-video-title { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 10px 8px; color: #fff; font-size: .85rem; text-align: left; background: linear-gradient(transparent, rgba(0, 0, 0, .75)); }
.advent-video--file .advent-video-title { position: static; background: none; color: var(--muted); padding: 4px 0 0; }
.advent-video-frame { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 12px; display: block; }
.share-song--link { grid-template-columns: 72px minmax(0, 1fr) auto; }
.share-song-kicker { display: block; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--wine); font-weight: 700; }
.share-song-spotify { white-space: nowrap; }
.share-song-lyrics { grid-column: 1 / -1; }
.share-song-lyrics summary { cursor: pointer; font-weight: 600; color: var(--wine); font-size: .9rem; }
.share-song-lyrics-body, .book-lyrics-text { font-family: var(--serif); font-size: .95rem; line-height: 1.5; }
.share-song-lyrics-body p, .book-lyrics-text p { margin: .5em 0; }
.book-song-wrap { margin: 0 0 1em; }
.book-song-wrap .book-song { margin-bottom: .4em; text-decoration: none; color: inherit; }
.book-song-lyrics { appearance: none; border: 0; background: none; padding: 2px 6px; cursor: pointer; font-family: var(--sans); font-size: .82rem; font-weight: 600; color: var(--wine); text-decoration: underline; }
.book-advent-end .advent-media-block { max-width: 22rem; margin: .8rem auto 0; }
.book-advent-end .advent-video { max-height: 30vh; }
/* Planungsseite: Song/Video je Tag */
.advent-links { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; justify-content: flex-start; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); text-align: left; }
.advent-links > label { display: flex !important; flex-direction: row !important; flex-wrap: wrap; align-items: center !important; gap: 8px; margin: 0; text-align: left; }
.advent-links select { max-width: 100%; min-width: min(14rem, 100%); }
.advent-links-thumbs { display: flex; gap: 6px; align-items: center; }
.advent-links-thumbs:empty { display: none; }
.advent-link-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; }
.advent-link-thumb--video { height: 36px; }
/* Story-Editor: Lyrics für Fans */
.story-publish .story-publish-lyrics { display: inline-flex !important; flex-direction: row !important; align-items: center; gap: 6px; margin: 0; font-size: .85rem; font-weight: 400; }
.story-publish .story-publish-lyrics input { width: auto; margin: 0; }
.book-advent-end.has-media { gap: .35rem; justify-content: flex-start; padding-top: .6rem; overflow: hidden; }
.book-advent-end.has-media .advent-end-figure img { width: auto; height: min(18vh, 150px); max-height: none; }
.book-advent-end.has-media .advent-end-figure figcaption { display: none; }
.book-advent-end.has-media .advent-end-title { font-size: 1.25rem; margin: 0; }
.book-advent-end.has-media .advent-media-block { gap: 6px; margin-top: .3rem; }
.book-advent-end.has-media .advent-video { max-height: 22vh; width: auto; aspect-ratio: 16 / 9; margin: 0 auto; }
.book-advent-end.has-media .advent-video-frame { max-height: 26vh; }
.book-advent-end.has-media .book-song-wrap { margin: 0; }
.book-advent-end.has-media .book-song { margin: 0 0 .2em; padding: 5px 10px; }
.book-lyrics-overlay { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 16px; background: rgba(20, 14, 10, .6); }
.book-lyrics-card { position: relative; width: min(32rem, 100%); max-height: 85vh; overflow: auto; padding: 22px 22px 18px; border-radius: 16px; background: #f7f0e3; color: #2b2420; box-shadow: 0 20px 50px rgba(0, 0, 0, .35); }
.book-lyrics-title { margin: 0 32px 10px 0; font-family: var(--serif); font-size: 1.3rem; }
.book-lyrics-close { position: absolute; right: 10px; top: 8px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .06); font-size: 1.4rem; cursor: pointer; }

/* Adventskalender: Ein/Aus + Simulations-Tag */
.advent-control {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 12px 24px;
    padding: 14px 16px; margin-bottom: 16px; border: 1px solid var(--border, #ddd); border-radius: 12px;
}
.advent-control.is-off { border-color: #d97706; background: rgba(217, 119, 6, .08); }
.advent-control .hint { margin: 6px 0 0; }
.advent-control select { display: block; margin-top: 4px; max-width: 100%; }
.advent-control .btn-row { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }
.advent-control label.advent-switch { display: flex; flex-direction: row; align-items: center; gap: 8px; cursor: pointer; }
.advent-control label.advent-switch input { width: 18px; height: 18px; margin: 0; flex: none; }

/* ---------- Lebende Bilder (Fan-View): Szenenbild mit Video, Cover-Video, Hörbuch-Knopf im Buch ---------- */
.is-living { position: relative; cursor: pointer; }
.living-wrap { display: inline-block; position: relative; max-width: 100%; }
.living-badge {
    position: absolute; right: 10px; bottom: 10px; z-index: 2;
    width: 38px; height: 38px; border-radius: 50%;
    display: grid; place-items: center;
    background: rgba(20, 14, 10, 0.62); color: #fff;
    border: 1.5px solid rgba(255, 255, 255, 0.85);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.living-badge svg { width: 20px; height: 20px; margin-left: 2px; }
.is-living.is-playing .living-badge { opacity: 0; }
.is-living:focus-visible { outline: 3px solid #c9a227; outline-offset: 2px; }
.living-video {
    position: absolute; inset: 0; z-index: 1;
    width: 100%; height: 100%; object-fit: cover; display: block;
    border-radius: inherit; background: transparent;
}
.share-book .is-living img, .share-scene.is-living img { display: block; }
.share-book-cover .share-book-cover-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.share-book-audio {
    position: absolute; z-index: 6;
    right: calc(14px + env(safe-area-inset-right, 0px));
    bottom: calc(54px + env(safe-area-inset-bottom, 0px));
    display: inline-flex; align-items: center; gap: 6px;
    min-height: 32px; padding: 4px 12px; border-radius: 999px;
    border: 1px solid rgba(244, 234, 216, 0.22);
    background: rgba(30, 21, 16, 0.55); color: #f4ead8;
    font: inherit; font-size: 0.82rem; cursor: pointer;
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.share-book-audio svg { width: 16px; height: 16px; }
.share-book-audio:hover, .share-book-audio:focus-visible { background: rgba(30, 21, 16, 0.8); }
.share-book-audio[hidden] { display: none; }

/* Titelbild-Dialog: lebendes Titelbild */
.book-cover-living { border-top: 1px solid var(--border, #e5ddd0); padding-top: 12px; display: grid; gap: 8px; }
.book-cover-living h3 { margin: 0; font-size: 1rem; }
.book-cover-video-box video { display: block; max-width: 100%; max-height: 320px; border-radius: 8px; background: #000; }
.book-cover-show { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.book-cover-show label { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; font-weight: 600; }
.book-card-cover video { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Story-Editor: Knopf „Lebendes Bild“ am Szenenbild (rechts unten) + Dialog */
.scene-image-living {
    position: absolute; right: 6px; bottom: 6px; z-index: 2;
    width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%;
    background: rgba(28, 22, 18, 0.78); color: #fff; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}
.scene-image-living .btn-ico { width: 15px; height: 15px; margin-left: 2px; }
.scene-image-living:hover { background: var(--wine); }
.scene-image-living.has-video { background: var(--wine); box-shadow: 0 0 0 2px #fff, 0 4px 12px rgba(0, 0, 0, 0.25); }
.living-modal-media { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.living-modal-media figure { margin: 0; }
.living-modal-media img, .living-modal-media video { display: block; width: 100%; max-height: 300px; object-fit: contain; border-radius: 8px; background: #000; }

/* Zähler am Menüpunkt „Fan-App“ (neue Fan-Nachrichten + ungeprüfte Gästebuch-Einträge) */
.side-nav .side-badge { display: inline-block; min-width: 1.4em; padding: 0 6px; margin-left: 6px; border-radius: 999px; background: #d64545; color: #fff; font-size: .72rem; line-height: 1.5; text-align: center; vertical-align: middle; }

/* Buchansicht: Song-Knopf wird an Ort und Stelle zum Player (gleiche Höhe, kein Player unten) */
.book-song.is-active { position: relative; overflow: hidden; background: rgba(122, 46, 42, 0.12); }
.book-song.is-active .book-song-label { flex: 1; }
.book-song.is-active .book-song-label small { text-transform: none; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.book-song.is-active .book-song-play { font-size: 0.7rem; padding-left: 0; }
.book-song-stop {
    flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%;
    display: grid; place-items: center; font-size: 0.8rem; color: #7a2e2a;
    border: 1px solid rgba(122, 46, 42, 0.35); background: rgba(255, 255, 255, 0.5);
}
.book-song-stop:hover { background: rgba(122, 46, 42, 0.15); }
.book-song-bar { position: absolute; left: 14px; right: 14px; bottom: 3px; height: 4px; border-radius: 2px; background: rgba(122, 46, 42, 0.18); cursor: pointer; }
.book-song-bar::before { content: ''; position: absolute; left: 0; right: 0; top: -8px; bottom: -6px; } /* größere Tippfläche */
.book-song-bar-fill { display: block; height: 100%; width: 0; border-radius: 2px; background: #7a2e2a; }

/* Lebende Bilder: Länge + Bewegungsstärke */
.living-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .75rem; margin: .5rem 0; }
.living-options label { display: flex; flex-direction: column; gap: .25rem; margin: 0; }

/* Szenenvideo zum Szenenbild (Fan-View/Leser): ganzes Video mit Steuerung, ×-Knopf zurück zum Bild */
.living-video--scene { object-fit: contain; background: #000; }
.living-close {
    position: absolute; top: 8px; right: 8px; z-index: 3;
    width: 34px; height: 34px; border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.85);
    background: rgba(20, 14, 10, 0.7); color: #fff;
    font-size: 22px; line-height: 1; cursor: pointer;
    display: grid; place-items: center;
}
.living-close:hover { background: rgba(20, 14, 10, 0.9); }
.video-ov-fan { width: 100%; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin-top: 6px; font-size: .85rem; }
.video-ov-fan label { margin: 0; display: inline-flex; align-items: center; gap: 6px; }
.video-ov-fan select { width: auto; font-size: .85rem; }

/* Story-Editor: Reiterleiste (Text/Szenenbilder/Video/Comic/Hörbuch) haftet oben, Werkzeugleiste direkt darunter */
.lyrics-pane .story-tabs {
    position: sticky;
    top: 0;
    z-index: 7;
    background: var(--paper);
}
.lyrics-pane .story-tabs + .story-tab-panel .wysiwyg-toolbar,
.lyrics-pane .wysiwyg-toolbar {
    top: var(--story-tabs-h, 0px);
}

/* Verlinkte Lyrics: ♪-Schalter „in der Fan-View zum Abspielen zeigen“ */
.story-lyrics-chip-fan {
    border: 0; background: transparent; cursor: pointer;
    font-size: .95rem; line-height: 1; padding: 0 4px;
    color: var(--muted); opacity: .45; text-decoration: line-through;
}
.story-lyrics-chip-fan.is-on { color: var(--wine); opacity: 1; text-decoration: none; }
.story-lyrics-chip-fan:hover { opacity: 1; }

/* Szenenvideo: Ladefenster während Higgsfield rechnet (js/living-images.js) */
.sv-busy { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 16px; background: rgba(20, 16, 14, .55); backdrop-filter: blur(2px); }
.sv-busy-card { width: min(460px, 100%); background: var(--paper, #fffaf3); color: var(--ink, #222); border-radius: 14px; padding: 22px 22px 18px; box-shadow: 0 18px 50px rgba(0,0,0,.35); display: grid; gap: 12px; }
.sv-busy-head { display: flex; align-items: center; gap: 12px; font-size: 1.1rem; }
.sv-busy-card p { margin: 0; }
.sv-busy-spinner { width: 28px; height: 28px; flex: none; border-radius: 50%; border: 3px solid var(--line, #ddd); border-top-color: var(--accent, #7a2e2a); animation: story-review-spin .8s linear infinite; }
.sv-busy-track { height: 10px; border-radius: 999px; background: var(--line, #e6ded3); overflow: hidden; }
.sv-busy-bar { height: 100%; width: 0; border-radius: inherit; background: var(--accent, #7a2e2a); transition: width 1s linear; }
.sv-busy-meta { font-size: .85rem; }
.sv-busy--error .sv-busy-spinner { animation: none; border-color: var(--accent, #7a2e2a); }
@media (prefers-reduced-motion: reduce) { .sv-busy-spinner { animation-duration: 2.4s; } .sv-busy-bar { transition: none; } }

/* ---------- Songs zu diesem Kapitel: gemeinsame Sektion + Video zum Song ---------- */
.share-songs { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: .8rem 0; gap: 10px; }
.share-songs-head { margin: 0; font-family: var(--sans); font-size: .74rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--wine); }
.share-song-video-badge { align-self: flex-start; margin-top: 3px; padding: 1px 8px; border-radius: 999px; background: rgba(122, 46, 42, .1); color: var(--wine); font-size: .74rem; font-weight: 700; }
.share-song-mode { grid-column: 2; display: inline-flex; justify-self: start; border: 1px solid rgba(122, 46, 42, .35); border-radius: 999px; overflow: hidden; }
.share-song-mode button { appearance: none; border: 0; background: none; padding: 3px 12px; font: inherit; font-size: .8rem; font-weight: 600; color: var(--wine); cursor: pointer; }
.share-song-mode button.is-on { background: var(--wine); color: #fff; }
.share-song-video { grid-column: 1 / -1; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: #000; }
.share-song-video[hidden] { display: none; }
.share-song-video iframe, .share-song-video video { display: block; width: 100%; height: 100%; border: 0; }
.share-song-video-poster { appearance: none; position: relative; display: block; width: 100%; height: 100%; padding: 0; border: 0; background: #000; cursor: pointer; }
.share-song-video-poster img { width: 100%; height: 100%; object-fit: cover; opacity: .85; }
.share-song-video-poster span { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: rgba(122, 46, 42, .9); color: #fff; font-size: 1.5rem; padding-left: 4px; }
@media (max-width: 640px) { .share-song-mode { grid-column: 1 / -1; } }

/* Buchansicht: eine Sektion „Songs zu diesem Kapitel“, Knöpfe kompakt zwischen zwei Linien */
.book-songs { margin: 0 0 1.1em; padding: .45em 0 .35em; border-top: 1px solid rgba(122, 46, 42, .35); border-bottom: 1px solid rgba(122, 46, 42, .35); break-inside: avoid; }
.book-songs-head { margin: 0 0 .4em; font-size: .72em; letter-spacing: .1em; text-transform: uppercase; color: #7a2e2a; text-align: center; text-indent: 0; }
.book-songs .book-song-wrap { margin: 0 0 .3em; }
.book-songs .book-song-wrap:last-child { margin-bottom: 0; }
.book-songs .book-song { margin: 0; padding: 5px 10px; }
.book-song-row { display: flex; align-items: stretch; gap: 6px; }
.book-song-row .book-song { flex: 1; min-width: 0; }
.book-song-vbtn { appearance: none; flex: 0 0 auto; padding: 0 12px; border: 1px solid rgba(122, 46, 42, .35); border-radius: 999px; background: none; color: #7a2e2a; font: inherit; font-size: .8em; font-weight: 600; cursor: pointer; white-space: nowrap; }
.book-song-vbtn:hover { background: rgba(122, 46, 42, .1); }
.book-song-label small.book-song-vnote { text-transform: none; letter-spacing: 0; }
.book-video-card { position: relative; width: min(56rem, 100%); padding: 18px 18px 16px; border-radius: 16px; background: #f7f0e3; color: #2b2420; box-shadow: 0 20px 50px rgba(0, 0, 0, .35); }
.book-video-card .book-lyrics-title { margin: 0 44px 10px 0; }
.book-video-media { aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: #000; }
.book-video-media iframe, .book-video-media video { display: block; width: 100%; height: 100%; border: 0; }

/* Verwaltung: Badge „Video verfügbar“ (Songliste, Verlinken-Dialog, Lyrics-Chips) */
.badge-video { background: rgba(122, 46, 42, .12); color: var(--wine); white-space: nowrap; }
.story-lyrics-chip-video { margin-left: 5px; font-size: .75em; color: var(--wine); }
.song-video-row { display: flex; gap: 8px; margin-top: 4px; }
.song-video-row input, .song-video-row select { flex: 1; min-width: 0; }
.song-video-frame { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 10px; background: #000; }

/* Szenenbild mit „Lebendem Bild“ (stumme Schleife statt Standbild), optional zusätzlich Szenenvideo (js/share-living.js) */
.has-loop { position: relative; }
.share-book .has-loop img, .share-scene.has-loop img { display: block; }
.living-ambient { pointer-events: none; }
.is-playing .living-ambient { visibility: hidden; }
.living-modal .living-h { margin: .6rem 0 0; padding-top: .7rem; border-top: 1px solid var(--line); font-size: 1rem; }

/* Story-Element: Hörbuch/Comic/Video für Fans anbieten (Schalter in einer Zeile) */
.story-publish-media { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; flex-basis: 100%; }
.story-publish-media .story-publish-lyrics { display: inline-flex; align-items: center; gap: 4px; margin: 0; }

/* Charaktere: Emotionsbilder anklickbar (oben groß), großes Bild → Vollansicht */
.char-card .char-card-photo img { cursor: zoom-in; }
.char-emotion-thumb.is-filled img { cursor: pointer; transition: opacity .15s; }
.char-emotion-thumb.is-filled:hover img { opacity: .85; }
.char-emotion-thumb.is-active { outline: 2px solid var(--wine); outline-offset: 1px; }

/* Story-Editor (Desktop): Rasterzeile wächst mit dem Text. Sonst ist die linke Spalte nur fensterhoch
   und die haftende Reiterleiste scrollt bei langen Texten weg (Lücke über der Werkzeugleiste). */
@media (min-width: 841px) {
    .story-editor .lyrics-editor-split { grid-template-rows: max-content; }
}

/* ===== Editoren auf dem Handy (Story + Lyrics) =====
   Ein einziger Scrollbereich (der ganze Editor). Der Kopf mit Titel/Aktionen scrollt mit weg,
   Reiter- und Werkzeugleiste haften oben. Vorher hafteten Kopf UND Leisten an derselben Stelle
   und schoben sich übereinander; das Textfeld hatte zusätzlich einen eigenen inneren Scrollbereich. */
@media (max-width: 840px) {
    .lyrics-editor > .lyrics-editor-head {
        position: static;
        box-shadow: none;
    }
    .lyrics-editor .wysiwyg,
    .lyrics-editor .story-tab-panel--text > .wysiwyg.story-wysiwyg {
        height: auto;
        max-height: none;
        min-height: 14rem;
        overflow: visible;
    }
    .lyrics-pane .story-tabs {
        position: sticky;
        top: 0;
        z-index: 7;
        margin: 0;
        padding-top: 4px;
        background: var(--paper);
    }
    .lyrics-pane .wysiwyg-toolbar {
        top: var(--story-tabs-h, 0px);
        margin: 0 -10px 8px;
        padding: 6px 10px 8px;
        background: var(--paper);
    }
    /* Werkzeugleisten: je Gruppe eine Zeile, bei Bedarf seitlich wischen statt umbrechen */
    .lyrics-pane .wysiwyg-toolbar-row {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }
    .lyrics-pane .wysiwyg-toolbar-row::-webkit-scrollbar { display: none; }
    .lyrics-pane .wysiwyg-toolbar-row > * { flex: 0 0 auto; }
    .editor-root .wysiwyg-toolbar .btn.btn-tool { min-width: 34px; padding: 4px 7px; }
    .lyrics-pane .toolbar-sep { margin: 0 2px; }
}

/* Handy: Dialoge liegen über der „Schrift“-Leiste (die sonst Speichern/Löschen verdeckte),
   und das KI-Profil im Dialog „Charakter bearbeiten“ scrollt nicht mehr in einem eigenen Kästchen. */
@media (max-width: 840px) {
    body:has(#modal-root:not([hidden])) .app-footer { display: none !important; }
    .modal-root { z-index: 75; }
    body.editor-open .modal-root { z-index: 90; }
    .modal { max-height: calc(100dvh - 24px); }
    .char-edit-ai { flex: 0 0 auto; overflow: visible; max-height: none; }
    .char-edit-col { overflow: visible; }
    .char-edit-ai .char-profile-text { flex: 0 0 auto; overflow: visible; margin-top: 10px; }
    .char-edit-ai-head { flex-wrap: wrap; }
}

/* Leser-Menü in der Fan-App: Rückweg zur App */
a.share-book-menu-item { text-decoration: none; box-sizing: border-box; }
.share-book-menu-home { font-weight: 600; border-bottom: 1px solid rgba(42, 33, 26, 0.12); border-radius: 8px 8px 0 0; margin-bottom: 4px; }

/* ===== Untertitel von Story-Elementen (z. B. Zeitangabe) ===== */
.story-subtitle-field { display: block; margin: 6px 0 0; font-size: 0.78rem; font-weight: 650; color: var(--muted); }
.story-subtitle-field .muted { font-weight: 400; }
.story-subtitle-field input { display: block; width: 100%; max-width: 36rem; margin-top: 3px; font-family: var(--serif); font-style: italic; font-size: 1rem; }
.story-subtitle-hint { margin: 6px 0 0; font-size: 0.82rem; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.story-subtitle-hint[hidden] { display: none; }
.story-editor.is-blurb-editor [data-subtitle-field],
.story-editor.is-blurb-editor [data-subtitle-suggest] { display: none !important; }
.timeline-subtitle { flex-basis: 100%; order: -1; margin-bottom: -4px; font-family: var(--serif); font-style: italic; font-size: 0.92rem; color: var(--muted); }
.timeline-subtitle[hidden] { display: none; }
.timeline-head-main > h2 { order: 0; }
.timeline-head-main > :not(h2):not(.timeline-subtitle) { order: 1; }
.share-chapter-titles { flex: 1 1 auto; min-width: 0; }
.share-chapter-titles h2 { margin-bottom: 0.2rem; }
.share-chapter-subtitle { margin: 0 0 0.15rem; font-family: var(--serif); font-style: italic; font-size: 1.6rem; line-height: 1.2; color: var(--muted); }
.reader-chapter-subtitle { margin: 0 0 2px; font-family: var(--serif); font-style: italic; font-size: 1.17em; color: var(--muted); }
.book-chapter-subtitle { margin: 0 0 0.2em !important; text-align: center !important; text-indent: 0 !important; font-family: var(--serif); font-style: italic; font-size: 1.55em; font-weight: 400; line-height: 1.2; color: #6a4a3a; hyphens: manual; text-wrap: balance; break-after: avoid; }
.book-toc-subtitle { font-style: italic; font-size: 0.85em; opacity: 0.75; }

/* Titelbild enthält den Titel selbst: kein Schriftzug, keine Abdunklung oben */
.share-book-cover.no-title::after { background: none; }
.book-cover-title-opt { display: flex; gap: 8px; align-items: baseline; margin: 10px 0 4px; font-size: .9rem; }
.advent-health { display: grid; gap: .4rem; margin: 0 0 .8rem; }
.advent-health p { margin: 0; }
.advent-health .btn { justify-self: start; }

/* Adventskalender: Beitrags-Vorschau wie Instagram/Facebook */
.igp-wrap { display: grid; justify-items: center; gap: .8rem; }
.igp-tabs { display: inline-flex; gap: .25rem; padding: .25rem; border-radius: 999px; background: rgba(0,0,0,.06); }
.igp-tabs button { border: 0; background: transparent; padding: .35rem .9rem; border-radius: 999px; font: inherit; font-size: .9rem; cursor: pointer; color: inherit; }
.igp-tabs button.is-active { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.15); font-weight: 600; }
.igp-pane { width: 100%; display: grid; justify-items: center; gap: .5rem; }
.igp-post { width: min(100%, 470px, calc((100vh - 400px) * .8)); background: #fff; color: #0f0f0f; border: 1px solid #dbdbdb; border-radius: 10px; overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.4; }
.igp-head { display: flex; align-items: center; gap: .6rem; padding: .6rem .75rem; }
.igp-avatar { width: 34px; height: 34px; border-radius: 50%; padding: 2px; flex: 0 0 auto;
    background: conic-gradient(#feda75, #fa7e1e, #d62976, #962fbf, #4f5bd5, #feda75); }
.igp-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; border: 2px solid #fff; background: #000; display: block; }
.igp-user { display: grid; line-height: 1.2; flex: 1; min-width: 0; }
.igp-user small { color: #737373; font-size: 12px; }
.igp-icon { display: inline-flex; width: 26px; height: 26px; color: #0f0f0f; }
.igp-icon svg { width: 100%; height: 100%; fill: currentColor; }
.igp-media { position: relative; background: #000; outline: none; }
.igp-r45 { aspect-ratio: 4 / 5; }
.igp-track { display: flex; width: 100%; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.igp-track::-webkit-scrollbar { display: none; }
.igp-track img { flex: 0 0 100%; width: 100%; height: 100%; object-fit: cover; scroll-snap-align: center; user-select: none; }
.igp-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; border-radius: 50%; border: 0;
    background: rgba(255,255,255,.85); color: #111; font-size: 22px; line-height: 1; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.igp-prev { left: 10px; } .igp-next { right: 10px; }
.igp-count { position: absolute; top: 10px; right: 10px; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; padding: .15rem .55rem; border-radius: 999px; }
.igp-dots { display: flex; justify-content: center; gap: 4px; padding: .5rem 0 0; }
.igp-dots span { width: 6px; height: 6px; border-radius: 50%; background: #c7c7c7; }
.igp-dots span.is-on { background: #0095f6; }
.igp-actions { display: flex; gap: .9rem; padding: .35rem .75rem .25rem; margin-top: -1.4rem; }
.igp-spacer { flex: 1; }
.igp-caption { padding: .35rem .75rem; word-wrap: break-word; }
.igp-more { border: 0; background: none; color: #737373; font: inherit; cursor: pointer; padding: 0; }
.igp-link { color: #00376b; }
.igp-time { margin: 0; padding: .1rem .75rem .8rem; color: #737373; font-size: 10px; letter-spacing: .03em; }
.igp-meta { margin: 0; font-size: .8rem; color: var(--muted, #6b6259); }
.igp-meta.is-warn { color: var(--wine, #7a2e2a); font-weight: 600; }
.igp-fb { border-radius: 8px; }
.igp-fb .igp-avatar { background: none; padding: 0; }
.igp-fb .igp-link { color: #0064d1; }
.igp-fb-text { padding: 0 .75rem .6rem; }
.igp-fb .igp-dots { padding-bottom: .3rem; }
.igp-fb-actions { display: flex; justify-content: space-around; border-top: 1px solid #e4e6eb; margin: .3rem .75rem 0; padding: .35rem 0 .5rem; color: #65676b; font-weight: 600; font-size: 13px; }
.igp-fb-actions span { display: inline-flex; align-items: center; gap: .35rem; }
.igp-fb-actions svg { width: 18px; height: 18px; fill: currentColor; }
.igp-story { position: relative; width: min(100%, 300px); aspect-ratio: 9 / 16; border-radius: 14px; overflow: hidden; background: #000;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: #fff; }
.igp-story > img { width: 100%; height: 100%; object-fit: cover; display: block; }
.igp-story-bar { position: absolute; top: 8px; left: 8px; right: 8px; height: 2px; background: rgba(255,255,255,.45); border-radius: 2px; z-index: 2; }
.igp-story-bar span { display: block; width: 40%; height: 100%; background: #fff; border-radius: 2px; }
.igp-story-head { position: absolute; top: 14px; left: 0; right: 0; z-index: 2; color: #fff; font-size: 13px; }
.igp-story-head small { opacity: .8; }
.igp-story-head .igp-avatar { width: 30px; height: 30px; }
.igp-sticker { position: absolute; left: 50%; bottom: 14%; transform: translateX(-50%); background: #fff; color: #0095f6; font-weight: 700;
    font-size: 12px; padding: .45rem .8rem; border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,.35); white-space: nowrap; max-width: 90%; overflow: hidden; text-overflow: ellipsis; }
.igp-foot { display: flex; justify-content: space-between; align-items: center; gap: .5rem; width: min(100%, 470px); }
.igp-post { min-width: min(100%, 300px); }
.advent-links-hint { margin: .2rem 0 0; font-size: .8rem; }

/* Regie-Vorgaben pro Buch in den Video-Dialogen (js/video-directives.js) */
.video-directives { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; background: var(--paper-2); }
.video-directives summary { cursor: pointer; font-weight: 600; }
.video-directives[open] summary { margin-bottom: 6px; }
.video-directives textarea { width: 100%; }

/* Lebendes Bild: Antippen hält die Schleife an (Standbild) / lässt sie weiterlaufen (js/share-living.js) */
.is-loop-toggle { cursor: pointer; }
.is-loop-toggle:focus-visible { outline: 3px solid #c9a227; outline-offset: 2px; }
.is-loop-paused .living-ambient { visibility: hidden; }
.is-loop-toggle.is-living .living-badge { pointer-events: auto; cursor: pointer; }

/* Lebendes Bild „Einmal-Wiedergabe“: Standbild nach dem Ende, Play-Symbol zum Wiederholen (js/share-living.js) */
.is-loop-ended .living-ambient { visibility: hidden; }
.living-once-badge {
    position: absolute; right: 10px; bottom: 10px; z-index: 2;
    width: 30px; height: 30px; border-radius: 50%;
    display: grid; place-items: center;
    background: rgba(20, 14, 10, 0.55); color: #fff;
    border: 1.5px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.living-once-badge svg { width: 16px; height: 16px; margin-left: 2px; }
.is-loop-running .living-once-badge, .is-playing .living-once-badge { opacity: 0; }
.is-scene-video .living-once-badge { right: 56px; bottom: 14px; }

/* Adventskalender am Handy: nichts darf breiter als der Bildschirm werden */
.advent-app, .advent-app > *, .advent-control-part, .advent-settings-grid > * { min-width: 0; }
.advent-app input:not([type="checkbox"]):not([type="radio"]), .advent-app select, .advent-app textarea { max-width: 100%; box-sizing: border-box; }
.advent-links > label { max-width: 100%; }
@media (max-width: 600px) {
    .advent-card, .advent-day { padding: .8rem; }
    .advent-control { padding: 12px; }
    .advent-row > label { flex: 1 1 100%; }
    .advent-days-actions { width: 100%; }
    .advent-days-actions .btn { flex: 1 1 auto; }
    .advent-links > label { flex: 1 1 100%; }
    .advent-links select { flex: 1 1 100%; min-width: 0; }
}

/* Adventskalender: Schlussseite „Fortsetzung folgt“ mit Sterne-Bewertung */
.advent-rate { display: grid; gap: .55rem; justify-items: center; width: min(100%, 22rem); margin: .4rem auto 0; }
.advent-rate-q { margin: 0; text-align: center !important; }
.advent-stars { display: flex; gap: .15rem; }
.advent-star { border: 0; background: none; padding: 0 .1rem; font-size: 2.1rem; line-height: 1; cursor: pointer; color: rgba(120, 90, 50, .35);
    transition: transform .12s ease, color .12s ease; }
.advent-star.is-on { color: #d9a53a; text-shadow: 0 1px 0 rgba(90, 50, 10, .35); }
.advent-star:hover, .advent-star:focus-visible { transform: scale(1.15); outline: none; }
.advent-rate textarea { width: 100%; box-sizing: border-box; font: inherit; font-size: .9rem; padding: .5rem .6rem; border-radius: 8px;
    border: 1px solid rgba(90, 58, 26, .35); background: rgba(255, 252, 244, .8); color: inherit; resize: vertical; }
.advent-rate-send { border: 0; border-radius: 999px; padding: .5rem 1.2rem; font: inherit; font-weight: 600; cursor: pointer;
    background: var(--wine, #7a2e2a); color: #fff; }
.advent-rate-send:disabled { opacity: .45; cursor: default; }
.advent-rate-msg { margin: 0; min-height: 1.2em; font-size: .85rem; text-align: center !important; }
.book-advent-end .advent-star { font-size: 1.8rem; }

/* Planungsseite: Bewertungen */
.advent-rating-sum { font-family: var(--sans, inherit); font-size: .9rem; font-weight: 400; margin-left: .4rem; }
.advent-rating-dist { display: grid; grid-template-columns: auto 1fr auto; gap: .25rem .6rem; align-items: center; max-width: 24rem; font-size: .85rem; margin: .4rem 0 .8rem; }
.advent-rating-bar { height: 8px; border-radius: 4px; background: rgba(0, 0, 0, .07); overflow: hidden; }
.advent-rating-bar i { display: block; height: 100%; background: #d9a53a; }
.advent-rating-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; max-height: 28rem; overflow: auto; }
.advent-rating-list li { padding: .6rem .7rem; border: 1px solid var(--line, rgba(0,0,0,.1)); border-radius: 10px; }
.advent-rating-head { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .8rem; }
.advent-rating-head .btn { margin-left: auto; }
.advent-rating-stars { color: #d9a53a; letter-spacing: .08em; font-size: 1.05rem; }
.advent-rating-body { margin: .35rem 0 0; white-space: normal; overflow-wrap: anywhere; }

/* Kurzfilm: Figurenbilder als Vorlage (pro Film) */
.film-cast { margin-top: .5rem; }
.film-cast-grid { display: flex; flex-wrap: wrap; gap: .5rem; }
.film-cast-item { display: flex; align-items: center; gap: .4rem; padding: .3rem .5rem; border: 1px solid var(--border, #ddd); border-radius: 8px; cursor: pointer; font-size: .9rem; }
.film-cast-item img { width: 36px; height: 36px; object-fit: cover; border-radius: 6px; }
.film-cast-item input:not(:checked) ~ img { filter: grayscale(1); opacity: .45; }

/* Buchansicht: Song-Fußleiste (bleibt beim Blättern sichtbar, Buch wird darüber kleiner) */
.share-book-dock {
    flex: none;
    position: relative;
    z-index: 8;
    display: flex;
    align-items: center;
    gap: 12px;
    width: min(640px, calc(100% - 24px));
    margin: 0 auto calc(8px + env(safe-area-inset-bottom, 0px));
    padding: 8px 12px;
    border-radius: 14px;
    background: rgba(30, 21, 16, 0.92);
    border: 1px solid rgba(244, 234, 216, 0.18);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
    color: #f4ead8;
    box-sizing: border-box;
}
.share-book-dock[hidden] { display: none; }
.share-book.is-fullbleed .share-book-dock { width: 100%; margin: 0; border-radius: 0; border-width: 1px 0 0; padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
.share-book-dock-play, .share-book-dock-stop {
    appearance: none; flex: none; cursor: pointer; font: inherit; line-height: 1;
    border-radius: 50%; color: #f4ead8;
}
.share-book-dock-play { width: 38px; height: 38px; border: 1px solid rgba(244, 234, 216, 0.4); background: rgba(244, 234, 216, 0.1); font-size: 0.9rem; }
.share-book-dock-stop { width: 30px; height: 30px; border: 0; background: transparent; opacity: 0.7; font-size: 0.95rem; }
.share-book-dock-stop:hover, .share-book-dock-play:hover { opacity: 1; background: rgba(244, 234, 216, 0.18); }
.share-book-dock-mid { flex: 1 1 auto; min-width: 0; display: grid; gap: 6px; }
.share-book-dock-line { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.share-book-dock-line strong { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.92rem; }
.share-book-dock-line small { flex: none; opacity: 0.75; font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.share-book-dock-bar { display: block; height: 14px; cursor: pointer; position: relative; }
.share-book-dock-bar::before, .share-book-dock-fill { content: ''; position: absolute; left: 0; top: 5px; height: 4px; border-radius: 2px; }
.share-book-dock-bar::before { right: 0; background: rgba(244, 234, 216, 0.22); }
.share-book-dock-fill { background: #e8c37a; width: 0; }
/* Schwebende Knöpfe unten über die Leiste heben */
.share-book.has-dock .share-book-badge,
.share-book.has-dock .share-book-pagenav { bottom: calc(14px + var(--book-dock-h, 0px) + env(safe-area-inset-bottom, 0px)); }
.share-book.has-dock .share-book-audio { bottom: calc(54px + var(--book-dock-h, 0px) + env(safe-area-inset-bottom, 0px)); }

/* Kurzfilm-Storyboard: Figuren-Referenzbilder und Startbild je Abschnitt */
.film-cast-item { flex-direction: column; align-items: flex-start; gap: .3rem; cursor: default; }
.film-cast-pick { display: flex; align-items: center; gap: .4rem; cursor: pointer; }
.film-cast-pick img { width: 44px; height: 56px; object-fit: cover; border-radius: 6px; background: #ddd; }
.film-cast-pick input:not(:checked) ~ img { filter: grayscale(1); opacity: .45; }
.film-cast-mark { font-size: .8rem; }
.film-seg-media { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .75rem; align-items: start; }
.film-seg-key { display: flex; flex-direction: column; gap: .35rem; }
.film-seg-keyimg { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; background: #111; }
.film-seg-keyempty { aspect-ratio: 16 / 9; display: flex; align-items: center; justify-content: center; border: 1px dashed var(--border, #ccc); border-radius: 8px; font-size: .9rem; }
.film-seg-keylabel { font-size: .8rem; }
.film-board-status { font-weight: 600; }
@media (max-width: 700px) { .film-seg-media { grid-template-columns: 1fr; } }
.film-seg-keyframe { position: relative; }
.film-seg-keyframe .film-seg-keyimg { display: block; }
.film-seg-keyframe .film-seg-keyimg[hidden] { display: none; }
.film-seg-revise { display: flex; flex-direction: column; gap: .4rem; padding: .6rem; border: 1px solid var(--line, #ddd); border-radius: 8px; }
.film-seg-revise-draft { margin: 0; display: flex; flex-direction: column; gap: .25rem; }
.film-seg-revise-draft .film-seg-keyimg { outline: 2px solid var(--wine, #8a2b2b); }
.film-seg-revise textarea { width: 100%; }
.film-cast-zoom { cursor: zoom-in; }
.film-cast-view { display: flex; flex-direction: column; gap: .5rem; padding: .75rem; border: 1px solid var(--line, #ddd); border-radius: 8px; }
.film-cast-big { max-width: 100%; max-height: 45vh; width: auto; align-self: flex-start; border-radius: 8px; background: #ddd; }
.film-attach summary { cursor: pointer; font-size: .9rem; }
.film-attach-grid { display: flex; flex-wrap: wrap; gap: .4rem; margin: .4rem 0; }
.film-attach-item { display: flex; flex-direction: column; align-items: center; gap: .15rem; width: 84px; padding: 3px; border: 2px solid transparent; border-radius: 6px; background: none; cursor: pointer; font-size: .7rem; line-height: 1.15; }
.film-attach-item img { width: 76px; height: 56px; object-fit: cover; border-radius: 4px; background: #ddd; }
.film-attach-item.is-on { border-color: var(--wine, #8a2b2b); background: rgba(138, 43, 43, .08); }
.film-attach-upload { align-self: flex-start; cursor: pointer; }
/* Vorlagen-Auswahl (Figurenbild / Referenzbild neu zeichnen) */
.source-picker { display: flex; flex-direction: column; gap: .4rem; }
.source-picker > label:not(.btn) { display: flex; flex-direction: column; gap: .2rem; font-size: .9rem; }
.film-attach-item.source-picker-none::before { content: "–"; display: flex; align-items: center; justify-content: center; width: 76px; height: 56px; border-radius: 4px; background: rgba(0, 0, 0, .06); font-size: 1.2rem; color: var(--muted, #777); }
