/* ---------------------------------------------------------------------------
   General Conference feed builder.

   The content is sermons, so the page aims for a reading room rather than a
   dashboard: one quiet column, generous line length, restrained colour. The
   accent is used for links and focus only — every button earns its weight
   from type and border instead.
   --------------------------------------------------------------------------- */

:root {
    --bg: #f6f5f2;
    --surface: #ffffff;
    --surface-sunken: #faf9f7;
    --border: #e4e1da;
    --border-strong: #cfcabf;

    --text: #23211e;
    --text-soft: #6b665e;
    --text-faint: #979186;

    --accent: #6b5844;
    --accent-hover: #55452f;
    --accent-wash: #f0ebe3;

    --ok-bg: #edf4ee;
    --ok-border: #c3dbc8;
    --ok-text: #2f5d3a;
    --bad-bg: #fbeeec;
    --bad-border: #e6c4bd;
    --bad-text: #8a3524;

    --radius: 10px;
    --radius-sm: 7px;
    --shadow: 0 1px 2px rgba(35, 33, 30, 0.04);

    --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
            Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-display: ui-serif, Georgia, "Iowan Old Style", "Times New Roman", serif;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #161513;
        --surface: #1f1e1b;
        --surface-sunken: #1a1917;
        --border: #302e2a;
        --border-strong: #454139;

        --text: #eae7e1;
        --text-soft: #a8a299;
        --text-faint: #7b756b;

        --accent: #c9ac84;
        --accent-hover: #ddc39f;
        --accent-wash: #2a2620;

        --ok-bg: #1c2a1f;
        --ok-border: #325239;
        --ok-text: #a8d0b0;
        --bad-bg: #2d1c18;
        --bad-border: #5c3329;
        --bad-text: #e0a696;

        --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    }
}

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

body {
    margin: 0;
    padding: 0;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 760px;
    margin: 0 auto;
    padding: 48px 24px 96px;
}

/* --- header --------------------------------------------------------------- */

.masthead {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 28px;
}

.masthead-text { min-width: 0; }

.masthead-link {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: 4px;
    padding: 7px 13px;
    font-size: 0.85rem;
    font-weight: 550;
    color: var(--text);
    text-decoration: none;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    white-space: nowrap;
}

.masthead-link:hover {
    border-color: var(--accent);
    background: var(--accent-wash);
}

.pill {
    display: inline-block;
    min-width: 20px;
    padding: 1px 6px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--surface);
    font-size: 0.74rem;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .pill { color: #1a1917; }
}

header h1 {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.2;
    margin: 0 0 8px;
}

.subtitle {
    margin: 0;
    color: var(--text-soft);
    font-size: 1.02rem;
    max-width: 52ch;
}

/* --- sections ------------------------------------------------------------- */

.builder-section {
    margin-bottom: 36px;
}

.builder-section h2 {
    font-family: var(--font-display);
    font-size: 1.16rem;
    font-weight: 600;
    margin: 0 0 4px;
    color: var(--text);
}

.section-note {
    margin: 0 0 14px;
    color: var(--text-soft);
    font-size: 0.9rem;
    max-width: 58ch;
}

/* --- language bar --------------------------------------------------------- */

.prefs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 28px;
    margin-bottom: 22px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
}

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

.pref-row-wide { flex: 1 1 100%; align-items: flex-start; }

.player-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.player-tile {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px 6px 7px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    cursor: pointer;
    transition: border-color 0.12s, background 0.12s;
}

.player-tile:hover { border-color: var(--border-strong); }

.player-tile input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.player-tile:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-wash);
}

.player-tile:has(input:focus-visible) {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* One tile shape whether the mark is a real logo or an initial, so the two
   kinds sit together without one looking like a mistake. */
.player-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex: none;
    border-radius: 50%;
    background: var(--surface-sunken);
    border: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-soft);
}

.player-tile:has(input:checked) .player-badge {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--surface);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .player-tile:has(input:checked) .player-badge {
        color: #1a1917;
    }
}

.player-badge.is-lettermark { font-size: 0.68rem; font-weight: 700; }

.player-mark { letter-spacing: -0.02em; }

.player-name {
    font-size: 0.83rem;
    font-weight: 500;
    white-space: nowrap;
}

/* Spotify: present, selectable, and honest that it cannot take a link. */
.player-tile.is-unsupported .player-name { color: var(--text-faint); }

/* Only Spotify sets this, and only to explain why it has no link. */
.pref-note {
    flex: 1 1 100%;
    margin: 0;
    font-size: 0.78rem;
    color: var(--text-faint);
    max-width: 58ch;
    line-height: 1.45;
}

.pref-note:empty { display: none; }

.bar-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    font-weight: 600;
    color: var(--text-faint);
    flex: none;
}

.selector-grid.inline {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    background: none;
    border: none;
    padding: 0;
    max-height: none;
    overflow: visible;
}

.language-bar .selector-item {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 7px 16px;
    background: var(--surface);
    transition: border-color 0.12s, background 0.12s;
}

.language-bar .selector-item:hover { border-color: var(--border-strong); }

/* The radio itself is redundant once the pill reads as selected. */
.language-bar input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.language-bar .selector-item:has(input:checked) {
    background: var(--accent-wash);
    border-color: var(--accent);
    font-weight: 550;
}

.language-bar .selector-item:has(input:focus-visible) {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* --- ready-made feed cards ------------------------------------------------ */

.preset-list {
    display: grid;
    gap: 10px;
}

.preset-list.loading {
    color: var(--text-faint);
    padding: 20px 0;
    font-size: 0.92rem;
    /* Roughly what the ready-made list occupies once it arrives. */
    min-height: 420px;
}

.preset {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px 18px;
    display: grid;
    gap: 3px;
    transition: border-color 0.12s, transform 0.12s;
}

.preset:hover {
    border-color: var(--border-strong);
}

.preset-title {
    font-family: var(--font-display);
    font-size: 1.04rem;
    font-weight: 600;
    line-height: 1.3;
}

.preset-desc {
    color: var(--text-soft);
    font-size: 0.88rem;
}

.preset-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 12px;
    margin-top: 7px;
    font-size: 0.78rem;
}

.preset-count {
    color: var(--text);
    background: var(--surface-sunken);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 2px 9px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.preset-url {
    color: var(--text-faint);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.74rem;
    text-decoration: none;
    /* Feed URLs are long; they must wrap rather than widen the card. */
    word-break: break-all;
    overflow-wrap: anywhere;
}

.preset-url:hover {
    color: var(--accent);
    text-decoration: underline;
}

.preset-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.subscribe-btn {
    display: inline-flex;
    align-items: center;
    background: var(--accent);
    color: var(--surface);
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: 7px 14px;
    font-size: 0.84rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.12s;
}

.subscribe-btn:hover { background: var(--accent-hover); }

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .subscribe-btn { color: #1a1917; }
}

/* Spotify cannot take a feed by link, so the button says so rather than
   pretending it will work. */
.subscribe-btn.is-disabled {
    background: var(--surface-sunken);
    color: var(--text-faint);
    border-color: var(--border);
    font-weight: 500;
    cursor: not-allowed;
}

.subscribe-btn.is-disabled:hover { background: var(--surface-sunken); }

/* --- buttons -------------------------------------------------------------- */

button {
    font: inherit;
    cursor: pointer;
}

.btn-secondary,
.copy-btn {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 7px 13px;
    font-size: 0.84rem;
    font-weight: 500;
    transition: background 0.12s, border-color 0.12s;
}

.btn-secondary:hover,
.copy-btn:hover {
    background: var(--accent-wash);
    border-color: var(--accent);
}

.btn-generate {
    background: var(--accent);
    color: #fff;
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: 10px 20px;
    font-size: 0.94rem;
    font-weight: 600;
    transition: background 0.12s;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .btn-generate { color: #1a1917; }
}

.btn-generate:hover:not(:disabled) { background: var(--accent-hover); }

.btn-generate:disabled {
    opacity: 0.55;
    cursor: default;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 3px;
}

/* --- the builder, now the main event -------------------------------------- */

.build {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
    margin-bottom: 40px;
}

.build-head { margin-bottom: 18px; }

.build-head h2 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 600;
    margin: 0 0 4px;
}

/* Three columns so the choices read as one decision, not a long scroll. */
/* The three facets share row tracks, so their headings, buttons, search
   boxes and lists line up across the columns. Without this the conference
   column sits lower than the others: it has four shortcut buttons where
   they have one, so its button row wraps to two lines and pushes
   everything below it down. */
.facets {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: auto auto auto auto;
    column-gap: 18px;
    row-gap: 8px;
    align-items: start;
}

.facet {
    min-width: 0;
    display: grid;
    grid-template-rows: subgrid;
    grid-row: span 4;
    align-content: start;
}

/* Without subgrid the columns cannot share tracks, so reserve the two rows
   the conference buttons need and let the others carry the whitespace. */
@supports not (grid-template-rows: subgrid) {
    .facet { display: block; }
    .facet .filter-controls { min-height: 62px; align-content: flex-end; }
}

.facet-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin: 0;
}

.facet-head h3 {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-soft);
}

.chip {
    background: var(--surface);
    color: var(--text-soft);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.76rem;
    font-weight: 500;
    transition: border-color 0.12s, color 0.12s;
}

.chip:hover {
    border-color: var(--accent);
    color: var(--text);
}

/* Row spacing inside a facet comes from the grid, not from margins, or the
   shared tracks get pushed apart unevenly. */
.facet .form-input.search { margin-bottom: 0; }

/* The shared button row is as tall as the conference column needs, which is
   two lines. A single Clear elsewhere would otherwise float in the middle of
   that space; sitting at the bottom puts every Clear on one line. */
.facet .filter-controls {
    margin-bottom: 0;
    align-content: flex-end;
    align-items: flex-end;
}
.form-input.search { margin-bottom: 8px; }

/* --- the summary bar ------------------------------------------------------ */

.summary {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.summary-main {
    flex: 1 1 auto;
    min-width: 0;
}

/* The name looks like text until you touch it: it is usually already right. */
.title-input {
    width: 100%;
    font-family: var(--font-display);
    font-size: 1.06rem;
    font-weight: 600;
    color: var(--text);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 5px 8px;
    margin-left: -8px;
}

.title-input:hover { border-color: var(--border); }

.title-input:focus {
    outline: none;
    background: var(--surface-sunken);
    border-color: var(--accent);
}

.summary-stat {
    margin: 2px 0 0 0;
    font-size: 0.85rem;
    color: var(--text-soft);
    font-variant-numeric: tabular-nums;
}

.summary-actions {
    flex: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.summary-toggle {
    font-size: 0.82rem;
    color: var(--text-soft);
    white-space: nowrap;
}

/* --- selectors ------------------------------------------------------------ */

.search-box { margin-bottom: 10px; }

.search-box input,
.form-input {
    width: 100%;
    padding: 9px 12px;
    font: inherit;
    font-size: 0.92rem;
    color: var(--text);
    background: var(--surface-sunken);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.search-box input:focus,
.form-input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--surface);
}

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

.selector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 2px;
    max-height: 330px;
    overflow-y: auto;
    padding: 8px;
    background: var(--surface-sunken);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.selector-grid.loading {
    display: block;
    color: var(--text-faint);
    font-size: 0.9rem;
    padding: 16px;
    /* Hold the height the filled list will take. Lists arrive after a fetch,
       and without this the page jumps as each one lands — the layout shift
       that scoring tools measure, and that moves a control out from under a
       finger mid-tap. */
    min-height: 330px;
    max-height: 330px;
}

.selector-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 9px;
    border-radius: var(--radius-sm);
    font-size: 0.89rem;
    cursor: pointer;
}

.selector-item:hover { background: var(--accent-wash); }

.selector-item input[type="checkbox"] {
    accent-color: var(--accent);
    width: 15px;
    height: 15px;
    flex: none;
    margin: 0;
}

.selector-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.selector-count {
    margin-left: auto;
    padding-left: 8px;
    color: var(--text-faint);
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
}

/* A conference with no audio can still be chosen; it just yields nothing. */
.selector-item.no-audio .selector-label { color: var(--text-faint); }

/* Nothing left under the other choices. Dimmed rather than hidden: options
   vanishing as you click is disorienting, and the count explains itself. */
.selector-item.is-empty {
    opacity: 0.4;
}

.selector-item.is-empty:hover { opacity: 0.65; }

.selector-item.is-empty .selector-count { color: var(--text-faint); }

.count-note {
    color: var(--text-faint);
    font-size: 0.82rem;
}

.decade-group { margin-bottom: 12px; }

.decade-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-faint);
    margin: 0 0 4px 9px;
    font-weight: 600;
}

.decade-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 2px;
}

/* --- form bits ------------------------------------------------------------ */

.form-group { margin-bottom: 14px; }

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.85rem;
    font-weight: 550;
    color: var(--text-soft);
}

textarea.form-input {
    resize: vertical;
    line-height: 1.5;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 0.9rem;
    cursor: pointer;
}

.checkbox-row input {
    accent-color: var(--accent);
    width: 15px;
    height: 15px;
    margin: 0;
}

/* --- results and preview -------------------------------------------------- */

.result-container {
    margin-top: 16px;
    padding: 16px 18px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.result-container h3 {
    margin: 0 0 10px;
    font-family: var(--font-display);
    font-size: 1.02rem;
}

.result-success {
    background: var(--ok-bg);
    border-color: var(--ok-border);
}

.result-success h3 { color: var(--ok-text); }

.result-error {
    background: var(--bad-bg);
    border-color: var(--bad-border);
}

.result-error h3 { color: var(--bad-text); }

.result-container .preset {
    box-shadow: none;
    margin-top: 4px;
}

.preview-container { margin-top: 18px; }

.preview-stat {
    font-size: 0.9rem;
    font-weight: 600;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}

.talks-list {
    max-height: 420px;
    overflow-y: auto;
}

.talk-preview {
    padding: 13px 0;
    border-bottom: 1px solid var(--border);
}

.talk-preview:last-child { border-bottom: none; }

.talk-preview h3 {
    margin: 0 0 3px;
    font-family: var(--font-display);
    font-size: 0.98rem;
    font-weight: 600;
    line-height: 1.3;
}

.talk-preview .speaker {
    font-size: 0.86rem;
    color: var(--text);
}

.talk-preview .conference {
    font-size: 0.76rem;
    color: var(--text-faint);
    font-variant-numeric: tabular-nums;
}

.talk-preview .description {
    margin-top: 5px;
    font-size: 0.86rem;
    color: var(--text-soft);
    max-width: 62ch;
}

.topics {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 8px;
}

.topic-tag {
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--accent-wash);
    color: var(--text-soft);
}

.loading { color: var(--text-faint); font-size: 0.9rem; }

.error {
    color: var(--bad-text);
    font-size: 0.9rem;
    padding: 10px 0;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    clip: rect(0 0 0 0);
    overflow: hidden;
    white-space: nowrap;
}

/* --- phones --------------------------------------------------------------- */

/* Three facet columns need the room; below that they stack. */
@media (max-width: 860px) {
    /* Shorter lists here, so reserve less. */
    .selector-grid.loading { min-height: 220px; max-height: 220px; }

    .facets {
        grid-template-columns: 1fr;
        grid-template-rows: none;
        gap: 20px;
    }

    /* One column, so there is nothing to align against. */
    .facet {
        display: block;
        grid-row: auto;
    }

    .facet .form-input.search,
    .facet .filter-controls { margin-bottom: 8px; }
    .selector-grid { max-height: 220px; }
}

@media (max-width: 640px) {
    .container { padding: 28px 16px 64px; }

    .masthead {
        flex-direction: column;
        gap: 12px;
    }

    .masthead-link { margin-top: 0; }

    .language-bar {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .build { padding: 16px; }

    /* Stacked so the name gets full width and the buttons a full row. */
    .summary {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .summary-actions > * { flex: 1 1 0; }

    header { margin-bottom: 28px; }
    header h1 { font-size: 1.6rem; }

    .selector-grid,
    .decade-grid { grid-template-columns: 1fr; }

    .selector-grid { max-height: 280px; }

    .preset-actions > * { flex: 1 1 auto; justify-content: center; }

    .btn-generate { width: 100%; }

    .filter-controls .btn-secondary { flex: 1 1 auto; }
}

/* Touch targets follow the input device, not the window width. A phone held
   sideways is 667-844px wide and was missing these while still being a
   thumb on glass. */
@media (pointer: coarse) {
    .btn-secondary,
    .btn-generate,
    .copy-btn,
    .subscribe-btn,
    .chip,
    .selector-item,
    .player-tile,
    .talk-row,
    .tray-item,
    .mode {
        min-height: 44px;
    }

    .tray-remove {
        width: 34px;
        height: 34px;
    }

    .selector-item { padding: 9px 10px; }

    /* Dragging the tray needs the page to stay put under the finger. */
    .tray-item { touch-action: none; }

    /* iOS zooms the whole page when a focused field is under 16px, so
       tapping a search box threw the layout about. Desktop keeps the
       smaller size, where there is no such behaviour. */
    .form-input,
    .search-box input,
    input[type="text"],
    textarea {
        font-size: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}

/* ---------------------------------------------------------------------------
   Talk picker and feed detail.
   --------------------------------------------------------------------------- */

.container-wide { max-width: 1060px; }

.back-link {
    display: inline-block;
    margin-bottom: 8px;
    font-size: 0.85rem;
    color: var(--text-soft);
    text-decoration: none;
}

.back-link:hover { color: var(--accent); }

/* Browse beside the tray, so adding a talk does not scroll the list away. */
.pick-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr);
    gap: 24px;
    align-items: start;
}

.pick-browse h2,
.pick-tray h2 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    margin: 0 0 8px;
}

.talk-results {
    /* A floor matters in landscape: 62vh of a 390px-tall phone is 240px,
       and 44vh is under 180px — three rows. Below the floor the panel
       keeps its height and the page scrolls, which reads better than a
       letterbox. dvh so the collapsing URL bar does not clip it. */
    max-height: max(260px, 62vh);
    max-height: max(260px, 62dvh);
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-sunken);
}

.talk-results.loading {
    padding: 16px;
    color: var(--text-faint);
    font-size: 0.9rem;
    min-height: 320px;
}

.talk-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}

.talk-row:last-child { border-bottom: none; }
.talk-row:hover { background: var(--accent-wash); }

.talk-row-body { flex: 1 1 auto; min-width: 0; }

.talk-row-title {
    font-size: 0.9rem;
    font-weight: 550;
    line-height: 1.3;
}

.talk-row-meta {
    font-size: 0.78rem;
    color: var(--text-soft);
    margin-top: 2px;
}

.add-btn { flex: none; }
.add-btn:disabled { opacity: 0.5; cursor: default; }

.pick-tray {
    position: sticky;
    top: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
}

.tray-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: max(220px, 46vh);
    max-height: max(220px, 46dvh);
    overflow-y: auto;
}

.tray-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    margin-bottom: 4px;
    background: var(--surface-sunken);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: grab;
}

.tray-item.is-dragging {
    opacity: 0.45;
    cursor: grabbing;
}

/* The detail page lists the same rows but they are not rearrangeable there. */
.tray-item.is-static { cursor: default; }

.tray-handle {
    flex: none;
    color: var(--text-faint);
    font-size: 0.8rem;
}

.tray-item-body { flex: 1 1 auto; min-width: 0; }

.tray-item-title {
    font-size: 0.87rem;
    font-weight: 550;
    line-height: 1.3;
}

.tray-remove {
    flex: none;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-soft);
    font-size: 1rem;
    line-height: 1;
}

.tray-remove:hover {
    border-color: var(--bad-border);
    color: var(--bad-text);
}

.tray-footer {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.tray-footer .btn-generate { width: 100%; margin-top: 8px; }

/* Synthetic dates are a real trade-off, so it is stated before creating. */
.pubdate-warning {
    background: var(--surface-sunken);
    border-left: 2px solid var(--border-strong);
    padding: 8px 10px;
    margin: 8px 0 0;
    font-size: 0.79rem;
}

.tray-footer .result-container { margin-top: 12px; }
.tray-footer .result-container .btn-generate { margin-top: 10px; display: block; text-align: center; text-decoration: none; }

@media (max-width: 860px) {
    .pick-layout { grid-template-columns: 1fr; }
    .pick-tray { position: static; }
    .talk-results {
        max-height: max(240px, 44vh);
        max-height: max(240px, 44dvh);
    }
}

.preset-title-link {
    color: inherit;
    text-decoration: none;
}

.preset-title-link:hover {
    color: var(--accent);
    text-decoration: underline;
}

/* The two ways to make a feed, offered as a choice. The hand-picker used to
   be a sentence inside the builder's own description, which made the only
   other route look like a footnote. */
.modes {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

/* Three across needs more room than two; below this they stack rather than
   squeeze the descriptions into slivers. */
@media (max-width: 880px) {
    .modes { grid-template-columns: 1fr; }
}

.mode {
    display: block;
    width: 100%;
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    text-align: left;
    font: inherit;
    color: inherit;
    cursor: pointer;
    transition: border-color 0.12s, background 0.12s;
}

.mode:hover { border-color: var(--border-strong); }

.mode-title { display: block; }
.mode-desc { display: block; }

/* The selected mode reads as chosen, not merely hovered. */
.mode.is-current {
    border-color: var(--accent);
    background: var(--accent-wash);
}

.mode.is-current .mode-title { color: var(--accent); }

/* Widening for the picker should not feel like a jump. */
.container { transition: max-width 0.18s ease; }

.mode-title {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0 0 5px;
}

.mode-desc {
    margin: 0 0 10px;
    font-size: 0.86rem;
    color: var(--text-soft);
    line-height: 1.45;
}

.mode-tag {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-faint);
}

.mode.is-current {
    border-color: var(--border-strong);
    background: var(--surface-sunken);
}

.mode-link {
    transition: border-color 0.12s, background 0.12s;
}

.mode-link:hover {
    border-color: var(--accent);
    background: var(--accent-wash);
}

.mode-link:hover .mode-title { color: var(--accent); }

.mode-tag-go { color: var(--accent); }

/* Shown in a tray only once it actually holds more than one language. */
.lang-badge {
    display: inline-block;
    margin-left: 7px;
    padding: 1px 6px;
    border-radius: 999px;
    background: var(--accent-wash);
    border: 1px solid var(--border);
    font-size: 0.68rem;
    color: var(--text-soft);
}

@media (max-width: 640px) {
    .modes { grid-template-columns: 1fr; }
}

/* Stated on every feed page: these are permanent by design. */
.permanence-note {
    border-left: 2px solid var(--border-strong);
    background: var(--surface-sunken);
    padding: 10px 12px;
    max-width: 64ch;
}

/* Reorder controls. Drag is the nicer gesture and the only one on desktop;
   these are the same action for anyone who cannot drag — HTML5 drag events
   never fire on iOS Safari — and they are keyboard-reachable besides. */
.tray-move {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: none;
}

.tray-move-btn {
    width: 22px;
    height: 17px;
    padding: 0;
    line-height: 1;
    font-size: 0.7rem;
    color: var(--text-soft);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
}

.tray-move-btn:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
}

.tray-move-btn:disabled { opacity: 0.35; cursor: default; }

@media (pointer: coarse) {
    /* The drag handle is decorative where dragging does not work. */
    .tray-handle { display: none; }

    .tray-move { flex-direction: row; gap: 6px; }

    .tray-move-btn {
        width: 38px;
        height: 38px;
        font-size: 0.95rem;
    }
}

/* ---------------------------------------------------------------------------
   About page and the site footer.
   --------------------------------------------------------------------------- */

.prose {
    max-width: 62ch;
}

.prose h2 {
    font-family: var(--font-display);
    font-size: 1.12rem;
    font-weight: 600;
    margin: 28px 0 8px;
}

.prose p {
    margin: 0 0 12px;
    line-height: 1.6;
}

.prose ul {
    margin: 0 0 12px;
    padding-left: 20px;
    line-height: 1.6;
}

.prose li { margin-bottom: 8px; }

.prose a { color: var(--accent); }

.nowrap { white-space: nowrap; }

.site-footer {
    margin-top: 48px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    color: var(--text-faint);
    font-size: 0.8rem;
    line-height: 1.55;
}

.site-footer p { margin: 0 0 6px; max-width: 70ch; }
.site-footer strong { color: var(--text-soft); font-weight: 600; }
.site-footer a { color: var(--text-soft); }
.site-footer a:hover { color: var(--accent); }

/* The verse the site is named for. Long enough to need room, so it sits on
   its own line above the tool rather than crowding the masthead. */
.verse {
    margin: 0 0 24px;
    padding: 0 0 0 16px;
    border-left: 2px solid var(--border-strong);
    max-width: 64ch;
}

.verse p {
    margin: 0;
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-style: italic;
    line-height: 1.65;
    color: var(--text-soft);
    /* Scripture reads better with a slightly looser measure. */
    text-wrap: pretty;
}

.verse cite {
    display: block;
    margin-top: 8px;
    font-style: normal;
    font-size: 0.74rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-faint);
}

@media (max-width: 640px) {
    .verse {
        padding-left: 12px;
        margin-bottom: 20px;
    }
    .verse p { font-size: 0.9rem; }
}

/* Inline SVG icons, sized to the text beside them. */
.icon {
    width: 1em;
    height: 1em;
    display: block;
    flex: none;
}

.player-badge .icon { width: 0.85em; height: 0.85em; }
.tray-handle .icon { width: 0.8em; height: 0.8em; }
