/*
 * Soft sepia theme over Bootstrap 5 — solarized-light-leaning, dialed back.
 * Accent colors from https://ethanschoonover.com/solarized/
 *
 * Shell: icon rail (left) · media viewer (650px, portrait video) · chat pane.
 */
:root {
    --sol-base03: #002b36;
    --sol-base02: #073642;
    --sol-base01: #586e75;
    --sol-base00: #657b83;
    --sol-base0: #839496;
    --sol-base1: #93a1a1;
    --sol-base2: #eee8d5;
    --sol-base3: #fdf6e3;
    --sol-yellow: #b58900;
    --sol-orange: #cb4b16;
    --sol-red: #dc322f;
    --sol-magenta: #d33682;
    --sol-violet: #6c71c4;
    --sol-blue: #268bd2;
    --sol-cyan: #2aa198;
    --sol-green: #859900;

    /* Sepia surfaces — a touch of solarized warmth, not the full wash */
    --sepia-main: #fcfaf2;     /* chat panel */
    --sepia-panel: #f4efe1;    /* rail, media pane */
    --sepia-surface: #fffef9;  /* cards, composer, inputs */
    --sepia-border: #e8e1cd;
    --sepia-border-soft: #efe9d8;
    --sepia-ink: #56636b;

    --bs-body-bg: var(--sepia-main);
    --bs-body-color: var(--sol-base00);
    --bs-emphasis-color: var(--sol-base01);
    --bs-secondary-color: var(--sol-base1);
    --bs-border-color: var(--sepia-border);
    --bs-link-color: var(--sol-blue);
    --bs-link-hover-color: var(--sol-cyan);
}

/* One point up from the browser default (16px): the prose is read for long
   stretches, and every rem/em size in the app scales from this. */
html {
    font-size: calc(100% + 1pt);
}

body {
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
}

h1, h2, h3, h4, h5, h6, .fw-semibold {
    color: var(--sol-base01);
}

/* --- Bootstrap component tuning ------------------------------------- */

.btn-primary {
    --bs-btn-bg: var(--sol-blue);
    --bs-btn-border-color: var(--sol-blue);
    --bs-btn-hover-bg: #1e6fa8;
    --bs-btn-hover-border-color: #1e6fa8;
    --bs-btn-active-bg: #1e6fa8;
    --bs-btn-active-border-color: #1e6fa8;
}

.btn-outline-secondary {
    --bs-btn-color: var(--sol-base01);
    --bs-btn-border-color: var(--sepia-border);
    --bs-btn-hover-bg: var(--sepia-panel);
    --bs-btn-hover-border-color: var(--sepia-border);
    --bs-btn-hover-color: var(--sol-base01);
    --bs-btn-active-bg: var(--sepia-panel);
    --bs-btn-active-border-color: var(--sepia-border);
    --bs-btn-active-color: var(--sol-base01);
}

/* Small pill button used for header actions ("Summary", "⋯") */
.btn-pill {
    --bs-btn-color: var(--sol-base00);
    --bs-btn-bg: var(--sepia-surface);
    --bs-btn-border-color: var(--sepia-border);
    --bs-btn-hover-bg: var(--sepia-panel);
    --bs-btn-hover-border-color: var(--sepia-border);
    --bs-btn-hover-color: var(--sol-base01);
    --bs-btn-active-bg: var(--sepia-panel);
    --bs-btn-active-border-color: var(--sepia-border);
    --bs-btn-active-color: var(--sol-base01);
    border-radius: 999px;
}

.btn-pill.dropdown-toggle::after { display: none; }

.form-control, .form-select {
    background-color: var(--sepia-surface);
    border-color: var(--sepia-border);
    color: var(--sol-base01);
}

.form-control:focus, .form-select:focus {
    background-color: var(--sepia-surface);
    border-color: var(--sol-blue);
    color: var(--sol-base01);
    box-shadow: 0 0 0 0.2rem rgba(38, 139, 210, 0.12);
}

.form-control::placeholder {
    color: var(--sol-base1);
}

.card {
    --bs-card-bg: var(--sepia-surface);
    --bs-card-border-color: var(--sepia-border);
    --bs-card-border-radius: 0.75rem;
}

.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--sol-base00);
    --bs-table-border-color: var(--sepia-border);
}

.alert-danger {
    --bs-alert-bg: #fbeae9;
    --bs-alert-border-color: var(--sol-red);
    --bs-alert-color: var(--sol-red);
}

.alert-success {
    --bs-alert-bg: #f2f4e2;
    --bs-alert-border-color: var(--sol-green);
    --bs-alert-color: #6b7a00;
}

.dropdown-menu {
    --bs-dropdown-bg: var(--sepia-surface);
    --bs-dropdown-border-color: var(--sepia-border);
    --bs-dropdown-link-color: var(--sol-base00);
    --bs-dropdown-link-hover-bg: var(--sepia-panel);
    --bs-dropdown-link-hover-color: var(--sol-base01);
    --bs-dropdown-border-radius: 0.75rem;
    box-shadow: 0 6px 24px rgba(88, 110, 117, 0.12);
}

.text-muted, .form-text {
    color: var(--sol-base1) !important;
}

/* --- Icon rail ---------------------------------------------------------- */

.rail {
    width: 60px;
    background: var(--sepia-panel);
    border-right: 1px solid var(--sepia-border);
}

.rail-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 0.65rem;
    color: var(--sol-base00);
    background: transparent;
    text-decoration: none;
    font-size: 1.1rem;
}

.rail-link:hover {
    background: rgba(255, 254, 249, 0.8);
    color: var(--sol-base01);
}

.rail-link.active {
    background: var(--sepia-surface);
    color: var(--sol-blue);
    box-shadow: 0 1px 2px rgba(88, 110, 117, 0.08);
}

/* --- Media viewer -------------------------------------------------------- */

.media-pane {
    /* Exactly 592px, full height; disappears on small screens. */
    flex: 0 0 592px;
    width: 592px;
    background: var(--sepia-panel);
    border-right: 1px solid var(--sepia-border);
}

.media-stage {
    position: relative;
    min-height: 0;
}

/* The player: absolutely fill the stage (percentage heights don't
   resolve reliably inside a flex-grown box), hidden until a file is picked. */
.media-stage .media-video {
    display: none;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: #000;
}

.media-pane.has-media .media-video { display: block; }
.media-pane.has-media .media-empty { display: none; }

/* Fill mode, switched by the dropdown next to the video picker.
   Default (and .fit-cover): crop instead of letterboxing with black bars. */
.media-stage .media-video {
    object-fit: cover;
}

.media-pane.fit-contain .media-video { object-fit: contain; }
.media-pane.fit-fill .media-video { object-fit: fill; }

.media-empty {
    color: var(--sol-base1);
}

/* The error line under the video takes no room until there is an error, so the video runs to the bottom. */
.media-error:empty { display: none; }

/* The one control that always shows: same idea as the picture book's
   toggle, so the video keeps the whole stage instead of losing its bottom
   edge to a transport bar. */
.media-controls-toggle {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 2;
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    opacity: 0.35;
    transition: opacity 0.15s ease, background-color 0.15s ease;
}

.media-stage:hover .media-controls-toggle { opacity: 0.85; }
.media-controls-toggle:hover,
.media-controls-toggle.open { opacity: 1; background: rgba(0, 0, 0, 0.6); }

/* Playlist strip under the chat-page player. */
.playlist-strip {
    scrollbar-width: thin;
}

.playlist-thumb {
    width: 64px;
    height: 36px;
    border-radius: 0.35rem;
    overflow: hidden;
    background: var(--sepia-panel);
    outline: 2px solid transparent;
    outline-offset: 1px;
}

.playlist-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.playlist-thumb.active {
    outline-color: var(--sol-blue);
}

@media (max-width: 991.98px) {
    .media-pane { display: none !important; }
}

/* --- Picture book -------------------------------------------------------- */

/* Same slot as the video player, but the page is paper, not film: it sits on
   a dark ground and is never cropped — a picture with a face cut off is worse
   than one with margins. */
.picture-stage {
    background: var(--sol-base03, #002b36);
    overflow: hidden;
}

.picture-page {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Page turns: full-height hit areas hugging each edge, invisible until the
   pointer is over the picture. */
.picture-flip {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 15%;
    min-width: 2.5rem;
    border: 0;
    background: transparent;
    color: #fff;
    opacity: 0;
    transition: opacity 0.15s ease, background-color 0.15s ease;
}

.picture-flip-prev { left: 0; }
.picture-flip-next { right: 0; }

.picture-stage:hover .picture-flip { opacity: 0.55; }
.picture-flip:hover { opacity: 1 !important; background: rgba(0, 0, 0, 0.25); }

/* Status of a draw in flight, over the page rather than displacing it. */
.picture-working {
    display: none;  /* wire:loading.flex turns this on */
    position: absolute;
    left: 50%;
    bottom: 1rem;
    transform: translateX(-50%);
    align-items: center;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    white-space: nowrap;
    max-width: 90%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Page thumbnails are 16:9-ish like the video strip, but show the whole
   picture — the strip is how you find a page again. */
.picture-pane .playlist-thumb img {
    object-fit: cover;
}

/* The only chrome on a closed pane: opens and closes everything else.
   Sits over the picture rather than taking a row from it. */
.picture-controls-toggle {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    opacity: 0.35;
    transition: opacity 0.15s ease, background-color 0.15s ease;
}

.picture-stage:hover .picture-controls-toggle { opacity: 0.85; }
.picture-controls-toggle:hover,
.picture-controls-toggle.open { opacity: 1; background: rgba(0, 0, 0, 0.6); }

/* Which page you're on, when the controls that would say so are closed. */
.picture-count {
    position: absolute;
    right: 0.6rem;
    bottom: 0.5rem;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    opacity: 0.55;
}

/* --- Beat numbers ---------------------------------------------------------- */

/* A beat's id, in the margin of the walkthrough: the number its pages are
   filed under. Faded means nothing drawn, solid means there is — so the
   book's coverage reads straight down the column. */
.beat-id {
    flex-shrink: 0;
    min-width: 2.4rem;
    padding: 0 0.35rem;
    border: 1px solid transparent;
    border-radius: 0.35rem;
    background: none;
    font-size: 0.7rem;
    font-variant-numeric: tabular-nums;
    text-align: center;
    color: var(--sol-base1);
    opacity: 0.45;
}

.beat-id-drawn {
    color: var(--sol-blue);
    border-color: var(--sepia-border);
    background: var(--sepia-surface);
    opacity: 1;
    cursor: pointer;
}

.beat-id-drawn:hover {
    border-color: var(--sol-blue);
    background: var(--sol-blue);
    color: var(--sepia-panel);
}

/* --- Videos page ---------------------------------------------------------- */

.video-toolbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--sepia-main);
    border-bottom: 1px solid var(--sepia-border-soft);
}

.video-folders {
    scrollbar-width: thin;
}

.video-card {
    background: var(--sepia-surface);
    border: 1px solid var(--sepia-border);
    border-radius: 0.6rem;
    transition: box-shadow 0.15s, transform 0.15s;
}

.video-card:hover {
    box-shadow: 0 4px 14px rgba(88, 110, 117, 0.15);
}

.video-thumb {
    display: block;
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    background: var(--sepia-panel);
    cursor: pointer;
    overflow: hidden;
    border-radius: 0.6rem 0.6rem 0 0;
}

.video-thumb img,
.video-thumb .video-thumb-empty {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
}

.video-thumb-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.75rem;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
    opacity: 0;
    transition: opacity 0.15s;
    background: rgba(0, 0, 0, 0.25);
}

.video-thumb:hover .video-thumb-play {
    opacity: 1;
}

.video-thumb-badge {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    font-size: 0.7rem;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    color: #fff;
    background: rgba(0, 43, 54, 0.7);
}

.video-thumb-meta {
    position: absolute;
    right: 0.5rem;
    bottom: 0.5rem;
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    border-radius: 0.3rem;
    color: #fff;
    background: rgba(0, 43, 54, 0.7);
}

.video-thumb-busy {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(244, 239, 225, 0.75);
    color: var(--sol-base01);
}

.video-playlist-item {
    width: 76px;
}

.video-playlist-item .video-playlist-thumb {
    width: 76px;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    object-position: top;
    border-radius: 0.4rem;
    background: var(--sepia-panel);
}

.video-playlist-item .video-playlist-actions {
    opacity: 0;
    transition: opacity 0.15s;
}

.video-playlist-item:hover .video-playlist-actions,
.video-playlist-item:focus-within .video-playlist-actions {
    opacity: 1;
}

.rename-form .rename-save {
    opacity: 0;
}

.rename-form:focus-within .rename-save,
.rename-form:hover .rename-save {
    opacity: 1;
}

/* --- Chat ---------------------------------------------------------------- */

.chat-pane {
    flex: 1 1 50%;
    min-width: 0;
    background: var(--sepia-main);
}

.chat-header {
    background: var(--sepia-main);
    border-bottom: 1px solid var(--sepia-border-soft);
}

.summary-panel {
    background: var(--sepia-panel);
    border-bottom: 1px solid var(--sepia-border-soft);
}

.chat-thread {
    max-width: 1100px;
}

.msg-row {
    padding: 1rem;
    border-radius: 0.75rem;
}

/* Each speaker owns a background: white for the user, one pale tint per
   character in order of first appearance (cycles past seven characters). */
.chat-thread .msg-user { background: #ffffff; }
.chat-thread .msg-char-0 { background: #fdf3e2; } /* cream */
.chat-thread .msg-char-1 { background: #e8f1fa; } /* pale blue */
.chat-thread .msg-char-2 { background: #e9f5ea; } /* pale green */
.chat-thread .msg-char-3 { background: #fdeaf1; } /* pale pink */
.chat-thread .msg-char-4 { background: #efeafa; } /* pale lavender */
.chat-thread .msg-char-5 { background: #e4f5f2; } /* pale aqua */
.chat-thread .msg-char-6 { background: #fbe9dc; } /* pale peach */

.msg-time {
    color: var(--sol-base1);
    font-size: 0.78rem;
}

/* Icon toolbar shown on message hover */
.msg-tool {
    border: 0;
    background: none;
    padding: 0.1rem 0.3rem;
    color: var(--sol-base1);
    font-size: 0.85rem;
    line-height: 1;
}

.msg-tool:hover {
    color: var(--sol-base01);
}

.msg-tool-danger:hover {
    color: var(--sol-red);
}

.msg-content {
    white-space: pre-wrap;
    line-height: 1.6;
    margin-top: 0.15rem;
}

.msg-narrator .msg-content {
    font-style: italic;
    color: var(--sol-base01);
}

/* Story notes: out-of-fiction information, centered and dimmed */
.msg-note {
    padding: 0.75rem 0;
}

.msg-note .note-block {
    background: rgba(88, 110, 117, 0.06);
    border: 1px dashed var(--sol-base1);
    border-radius: 0.6rem;
    padding: 0.4rem 0.9rem;
    max-width: 75%;
    color: var(--sol-base01);
    font-size: 0.9em;
    white-space: pre-wrap;
    line-height: 1.5;
}

/* A story beat's rendered content: preserve the line breaks the writer puts
   between paragraphs — without this, a beat covering a whole scene (several
   speakers, description, thought, dialogue) collapses into one wall of text. */
.rp-content {
    white-space: pre-wrap;
    line-height: 1.5;
}

/* Roleplay style-guide markup inside messages */
.rp-action {
    /* *actions*: lighter and grayer than spoken dialogue */
    font-style: italic;
    color: var(--sol-base0);
}

.rp-thought {
    /* **thoughts**: bolder */
    font-style: italic;
    font-weight: 700;
    color: var(--sol-cyan);
}

.rp-meta {
    color: var(--sol-base1);
    font-size: 0.85em;
}

.speaker-user { color: var(--sol-yellow); }
.speaker-character { color: var(--sol-blue); }
.speaker-narrator { color: var(--sol-green); }
.speaker-writer { color: var(--sol-violet); }

.avatar {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.3rem;
}

.avatar-user { background: rgba(181, 137, 0, 0.16); color: var(--sol-yellow); }
.avatar-character { background: rgba(38, 139, 210, 0.13); color: var(--sol-blue); }
.avatar-narrator { background: rgba(133, 153, 0, 0.16); color: var(--sol-green); }
.avatar-writer { background: rgba(108, 113, 196, 0.13); color: var(--sol-violet); }

/* --- Composer ----------------------------------------------------------- */

.composer {
    max-width: 1100px;
    background: var(--sepia-surface);
    border: 1px solid var(--sepia-border);
    border-radius: 1rem;
    padding: 0.65rem 0.75rem;
    box-shadow: 0 2px 12px rgba(88, 110, 117, 0.07);
}

.composer:focus-within {
    border-color: var(--sol-blue);
    box-shadow: 0 2px 12px rgba(38, 139, 210, 0.12);
}

.composer-input,
.composer-input:focus {
    border: 0;
    background: transparent;
    box-shadow: none;
    resize: none;
    padding: 0.25rem 0.35rem;
}

textarea.composer-input {
    min-height: 140px;
}

.composer-select {
    border: 0;
    background-color: transparent;
    color: var(--sol-base00);
    font-size: 0.82rem;
    cursor: pointer;
}

.composer-select:focus {
    background-color: transparent;
    box-shadow: none;
}

.composer-hint {
    color: var(--sol-base1);
    font-size: 0.76rem;
    min-width: 0;
}

/* The step's live status under the composer: no row at all between steps. */
#step-status:empty {
    display: none;
}

/* --- Conversation list (index page) -------------------------------------- */

.conv-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--sepia-surface);
    border: 1px solid var(--sepia-border);
    border-radius: 0.75rem;
    padding: 0.2rem 0.9rem;
}

.conv-row:hover {
    border-color: var(--sol-base1);
}

.conv-move {
    border: 0;
    background: none;
    padding: 0 0.2rem;
    font-size: 0.65rem;
    color: var(--sol-base1);
    line-height: 1.5;
}

.conv-move:hover {
    color: var(--sol-base01);
}

.conv-completed {
    opacity: 0.55;
}

.conv-completed:hover {
    opacity: 0.8;
}

.conv-complete-btn {
    border: 0;
    background: none;
    padding: 0.2rem 0.3rem;
    font-size: 0.8rem;
    color: var(--sol-base1);
}

.conv-complete-btn:hover {
    color: var(--sol-base01);
}

/* --- Misc --------------------------------------------------------------- */

.hover-reveal { visibility: hidden; }
.reveal-parent:hover .hover-reveal { visibility: visible; }

/* A beat's "edit" / "revise with AI" toggles: side by side while closed
   (compact), but a toggle forces itself onto its own full-width line once
   opened — and if both happen to be open, each gets its own line. */
.beat-toggle[open] { flex-basis: 100%; }

/* Beats alternate between the page and the chat's cream tint, so it's obvious
   at a glance where one beat ends and the next begins. */
.beat-row {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    padding-right: 0.75rem;
    border-radius: 0.5rem;
}

.beat-row-alt { background: #fdf3e2; } /* cream — same tint as a chat message */
.beat-row.beat-reading { border-left-color: #0dcaf0 !important; box-shadow: inset 3px 0 0 #0dcaf0; } /* the beat being read aloud */

.character-portrait {
    aspect-ratio: 3 / 2;
    width: 100%;
    object-fit: cover;
    background: var(--sepia-panel);
}

.gallery-item {
    aspect-ratio: 1 / 1;
    width: 100%;
    object-fit: cover;
}

/* Brief highlight on a message jumped to from the Things panel. */
.msg-jump { animation: msg-jump-flash 1.6s ease; }
@keyframes msg-jump-flash {
    0% { background: rgba(212, 166, 80, .3); }
    100% { background: transparent; }
}

/* Outlines sidebar: covers the whole media pane, next to the nav rail. */
.outlines-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 60px; /* nav rail width */
    width: 592px; /* media pane width */
    max-width: calc(100vw - 60px);
    background: var(--sepia-panel);
    border-right: 1px solid var(--sepia-border);
    box-shadow: 0.5rem 0 1.5rem rgba(0, 0, 0, .15);
    z-index: 1030; /* above the media pane, below the modals */
    overflow-y: auto;
}

/* Things sidebar: overlays the media pane on the left, next to the nav rail. */
.things-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 60px; /* nav rail width */
    width: 360px;
    max-width: calc(100vw - 60px);
    background: var(--sepia-panel);
    border-right: 1px solid var(--sepia-border);
    box-shadow: 0.5rem 0 1.5rem rgba(0, 0, 0, .15);
    z-index: 1030; /* above the media pane, below the modals */
    overflow-y: auto;
}

/* Agendas sidebar: overlays the media pane on the left, next to the nav rail.
   Matches the media pane's width exactly so it covers the video player edge to
   edge — a Standing is read and edited as prose, so it wants the full measure. */
.agendas-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 60px; /* nav rail width */
    width: 592px; /* = .media-pane width */
    max-width: calc(100vw - 60px);
    background: var(--sepia-panel);
    border-right: 1px solid var(--sepia-border);
    box-shadow: 0.5rem 0 1.5rem rgba(0, 0, 0, .15);
    z-index: 1030; /* above the media pane, below the modals */
    overflow-y: auto;
}

/* One row per character in the cast list. */
.agenda-row {
    color: inherit;
}

.agenda-row:hover {
    background: rgba(212, 166, 80, .12);
}

/* --- Instructions page --------------------------------------------------- */

.instructions-page code {
    background: var(--sepia-panel);
    color: var(--sol-base01);
    padding: 0.1rem 0.3rem;
    border-radius: 0.25rem;
    font-size: 0.875em;
}

.instructions-page pre.cmd {
    background: var(--sepia-panel);
    border: 1px solid var(--sepia-border);
    border-radius: 0.5rem;
    color: var(--sol-base01);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    overflow-x: auto;
    white-space: pre;
}

.instructions-page pre.cmd code {
    background: none;
    padding: 0;
}

/* Jump to the bottom of a long story (stories/show).

   Pinned to the top-right of the workshop pane rather than the usual
   bottom-right, because the bottom-right of this page is where the composer
   and its buttons already are. It sits over the story the whole time it is
   on screen, so it stays ghosted until it is pointed at — visible enough to
   find when wanted, quiet enough to forget otherwise — and hides completely
   when there is nothing below the fold to jump to. */
.jump-bottom {
    position: fixed;
    top: .8rem;
    right: 1.1rem;
    z-index: 1040;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 1px solid var(--sepia-border);
    border-radius: 50%;
    background: var(--sepia-panel);
    color: var(--sol-base1);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease, color .18s ease, box-shadow .18s ease;
}

.jump-bottom.is-visible {
    opacity: .28;
    pointer-events: auto;
}

.jump-bottom.is-visible:hover,
.jump-bottom.is-visible:focus-visible {
    opacity: 1;
    color: var(--sol-base01);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
}

/* --- The dice modal ------------------------------------------------------ */

/* The whole suggestion card is the button, so it has to read as one target
   without shouting: a quiet card that lifts under the pointer. */
.dice-pick {
    background: var(--sepia-surface);
    border-color: var(--sepia-border) !important;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.dice-pick:hover,
.dice-pick:focus-visible {
    background: var(--sepia-panel);
    border-color: var(--sol-base1) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .12);
    transform: translateY(-1px);
}

/* --- The prompts page ---------------------------------------------------- */

/* The instruction text is read far more often than it is edited, so the
   default state is a page of prose, not a page of inputs: the block renders as
   plain wrapped text on the card, and only turns into a control when Edit is
   pressed. <pre> for the whitespace — the paragraph breaks are part of the
   instruction — with the monospace and the horizontal scroll taken back off. */
.prompt-block-body {
    font-family: inherit;
    font-size: .85rem;
    line-height: 1.55;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: var(--sol-base00);
    background: var(--sepia-main);
    border: 1px solid var(--sepia-border-soft);
    border-radius: .375rem;
    padding: .75rem .85rem;
    max-height: 22rem;
    overflow-y: auto;
}

/* The box you edit in matches the box you were reading, so a save doesn't look
   like it reflowed the text. */
.prompt-block-edit {
    font-family: inherit;
    font-size: .85rem;
    line-height: 1.55;
}

/* --- The voice bank's keep-a-line gesture -------------------------------- */

/* Both of these follow the selection, so they are fixed and positioned from
   JS. They sit above the composer and the media pane but below the modals —
   the same band the agenda sidebar uses. */
.voice-keep-btn {
    position: fixed;
    z-index: 1035;
    background: var(--sepia-panel);
    border: 1px solid var(--sepia-border);
    color: var(--sol-base01, inherit);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
    white-space: nowrap;
}

.voice-keep-btn:hover,
.voice-keep-btn:focus-visible {
    border-color: var(--sol-base1);
    background: var(--sepia-surface);
}

.voice-keep-pop {
    position: fixed;
    z-index: 1036;
    width: 360px;
    max-width: calc(100vw - 1rem);
    background: var(--sepia-panel);
    border: 1px solid var(--sepia-border);
    border-radius: .375rem;
    box-shadow: 0 .5rem 1.5rem rgba(0, 0, 0, .22);
}

/* The confirmation. Bottom centre and gone in a couple of seconds: keeping a
   line is a small gesture and it should not take the writer's attention back. */
.voice-keep-flash {
    position: fixed;
    left: 50%;
    bottom: 1.25rem;
    transform: translateX(-50%);
    z-index: 1040;
    padding: .35rem .75rem;
    border-radius: 999px;
    background: var(--sepia-panel);
    border: 1px solid var(--sepia-border);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
}

/* Alpine: hide until the state that governs x-show has initialised, so a "stop" control never flashes on load. */
[x-cloak] { display: none !important; }

/* ======================================================================
 * v2 — everything above is v1's stylesheet, copied so that v2 looks the
 * same and can change without touching v1. Below: v2's own pages. They
 * were first written with their own variables; those now point at the
 * sepia palette, and bare elements take v1's Bootstrap look.
 * ====================================================================== */
:root {
    --ground: var(--sepia-main);
    --surface: var(--sepia-surface);
    --surface-2: var(--sepia-panel);
    --ink: var(--sol-base01);
    --muted: var(--sol-base0);
    --hair: var(--sepia-border);
    --jev: var(--sol-blue);
    --jev-soft: #e8f1fa;
    --warn: var(--sol-yellow);
    --warn-soft: #fdf3e2;
    --ok: var(--sol-green);
    --hand: var(--sol-violet);
    --hand-soft: #efeafa;
}

.v2-page h1 { font-size: 1.25rem; font-weight: 600; margin: 0 0 0.25rem; }
.v2-page h2 { font-size: 1rem; font-weight: 600; margin: 1.75rem 0 0.5rem; }
.v2-page p { max-width: 80ch; }
.v2-page .lede { color: var(--sol-base0); font-size: 0.875rem; margin-bottom: 1rem; }
.v2-page .mono { font-family: var(--bs-font-monospace); font-variant-numeric: tabular-nums; }
.v2-page code { color: var(--sol-base01); background: var(--sepia-panel); padding: 1px 5px; border-radius: 3px; }

/* A bare <button> on a v2 page is v1's small outline pill; .btn keeps Bootstrap's own look. */
.v2-page button:not(.btn):not(.btn-close):not(.playlist-thumb):not(.media-controls-toggle):not(.line-play) {
    font-size: 0.875rem;
    color: var(--sol-base01);
    background: var(--sepia-surface);
    border: 1px solid var(--sepia-border);
    border-radius: 50rem;
    padding: 0.25rem 0.9rem;
}
.v2-page button:not(.btn):not(.btn-close):not(.line-play):hover { background: var(--sepia-panel); }
.v2-page button.primary { color: #fff; background: var(--sol-blue); border-color: var(--sol-blue); }

.v2-page select:not(.form-select),
.v2-page input[type=text]:not(.form-control),
.v2-page input[type=number]:not(.form-control),
.v2-page textarea:not(.form-control) {
    font-size: 0.9rem;
    color: var(--sol-base01);
    background: var(--sepia-surface);
    border: 1px solid var(--sepia-border);
    border-radius: 0.5rem;
    padding: 0.3rem 0.6rem;
}
.v2-page select:focus, .v2-page input:not(.composer-input):focus, .v2-page textarea:not(.composer-input):focus { outline: 0; border-color: var(--sol-blue); box-shadow: 0 0 0 0.2rem rgba(38, 139, 210, 0.12); }

.v2-page .chip {
    display: inline-block; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase;
    padding: 0.15rem 0.55rem; border-radius: 50rem; background: var(--sepia-panel); color: var(--sol-base00); white-space: nowrap;
}
.v2-page .chip.jev { background: var(--jev-soft); color: var(--sol-blue); }
.v2-page .chip.warn { background: var(--warn-soft); color: var(--sol-yellow); }
.v2-page .chip.hand { background: var(--hand-soft); color: var(--sol-violet); }

/* What was going on in her, under a beat. */
.v2-inside > summary { cursor: pointer; list-style: none; color: var(--sol-violet); font-size: 0.85rem; font-weight: 600; }
.v2-inside > summary::-webkit-details-marker { display: none; }
.v2-inside .line { border-left: 3px solid var(--sol-violet); padding: 0.15rem 0 0.15rem 0.9rem; margin: 0.6rem 0; color: var(--sol-base01); max-width: 75ch; }
.v2-list-row { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; align-items: baseline; padding: 0.6rem 0; border-bottom: 1px solid var(--sepia-border-soft); }
.v2-list-row a { text-decoration: none; }
