/* ================================================================
   FLAIO Podcasts — App-Specific Styles
   Builds on flaio.css + flaio-admin.css design tokens.
   ================================================================ */

/* ── Brand Hue (red) ── */
:root { --fl-hue: 25; }

/* ── Sidebar Adjustments ── */
.pod-sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--fl-text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--fl-radius-sm);
    margin-right: var(--fl-sp-2);
}
.pod-sidebar-toggle:hover { color: var(--fl-text); background: var(--fl-bg-inset); }

@media (max-width: 768px) {
    .pod-sidebar-toggle { display: flex; }
}

/* ── Hero ── */
.pod-hero {
    padding: 64px 0 48px;
    text-align: center;
}

.pod-hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.035em;
    line-height: 1.1;
    margin-bottom: var(--fl-sp-4);
    color: var(--fl-text);
    text-wrap: balance;
}

.pod-hero h1 span { color: var(--fl-text-secondary); }

.pod-hero p {
    color: var(--fl-text-secondary);
    font-size: 16px;
    max-width: 480px;
    margin: 0 auto var(--fl-sp-6);
    line-height: 1.6;
    text-wrap: pretty;
}

.pod-hero-actions { display: flex; gap: 10px; justify-content: center; }

/* ── Section Heading ── */
.pod-section {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--fl-text-secondary);
    margin: var(--fl-sp-10) 0 var(--fl-sp-4);
    padding-bottom: var(--fl-sp-3);
    border-bottom: 1px solid var(--fl-border);
}

/* ── Podcast Grid ── */
.pod-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: var(--fl-sp-4);
    margin-bottom: var(--fl-sp-10);
}

.pod-card {
    display: flex;
    flex-direction: column;
    background: var(--fl-surface);
    border: 1px solid var(--fl-border);
    border-radius: var(--fl-radius-lg);
    overflow: hidden;
    transition: border-color var(--fl-duration), box-shadow var(--fl-duration);
    text-decoration: none;
    color: inherit;
}
.pod-card:hover {
    border-color: var(--fl-border-strong);
    box-shadow: var(--fl-shadow-sm);
}

.pod-card-art {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: var(--fl-bg-inset);
}

.pod-card-info { padding: var(--fl-sp-4); }
.pod-card-info h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--fl-text);
}
.pod-card-info p {
    font-size: 13px;
    color: var(--fl-text-secondary);
    margin-bottom: var(--fl-sp-2);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.pod-card-count {
    font-size: 12px;
    color: var(--fl-text-tertiary);
}

/* ── Podcast Detail Header ── */
.pod-detail-header {
    display: flex;
    gap: var(--fl-sp-8);
    align-items: flex-start;
    padding: var(--fl-sp-8) 0 var(--fl-sp-6);
}

.pod-detail-art {
    width: 180px;
    height: 180px;
    border-radius: var(--fl-radius-lg);
    object-fit: cover;
    flex-shrink: 0;
    background: var(--fl-bg-inset);
}

.pod-detail-author {
    font-size: 14px;
    color: var(--fl-text-secondary);
    margin-bottom: var(--fl-sp-2);
}

.pod-detail-desc {
    font-size: 15px;
    color: var(--fl-text-secondary);
    line-height: 1.6;
    margin-bottom: var(--fl-sp-4);
}

/* ── Episode List ── */
.pod-episodes {
    display: flex;
    flex-direction: column;
    gap: 1px;
    background: var(--fl-border-subtle);
    border-radius: var(--fl-radius-lg);
    overflow: hidden;
}

.pod-ep {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr) auto;
    gap: var(--fl-sp-4);
    align-items: start;
    padding: var(--fl-sp-4) var(--fl-sp-5);
    background: var(--fl-surface);
    transition: background var(--fl-duration);
    cursor: pointer;
}
.pod-ep:hover { background: var(--fl-surface-raised); }

.pod-ep-art-wrap {
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: var(--fl-radius);
    background: var(--fl-bg-inset);
    border: 1px solid var(--fl-border);
    overflow: visible;
    flex-shrink: 0;
}

.pod-ep-art,
.pod-ep-art-placeholder {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: calc(var(--fl-radius) - 1px);
}

.pod-ep-art {
    object-fit: cover;
    background: var(--fl-bg-inset);
    z-index: 1;
}

.pod-ep-art-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--fl-text-tertiary);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.pod-ep-num {
    position: absolute;
    right: -6px;
    bottom: -6px;
    z-index: 2;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--fl-radius-sm);
    background: var(--fl-surface);
    color: var(--fl-text-secondary);
    font-weight: 600;
    font-size: 11px;
    border: 1px solid var(--fl-border);
    box-shadow: var(--fl-shadow-sm);
}

.pod-ep-info {
    min-width: 0;
}

.pod-ep-info h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--fl-text);
    line-height: 1.35;
    margin-bottom: 4px;
}

.pod-ep-kicker {
    display: flex;
    flex-wrap: wrap;
    gap: var(--fl-sp-3);
    align-items: center;
    color: var(--fl-text-tertiary);
    font-size: 12px;
    margin-bottom: 3px;
}

.pod-ep-podcast {
    color: var(--fl-text-secondary);
    font-weight: 600;
    text-decoration: none;
}
.pod-ep-podcast:hover {
    color: var(--fl-text);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.pod-ep-summary {
    color: var(--fl-text-secondary);
    display: -webkit-box;
    font-size: 13px;
    line-height: 1.45;
    margin: 0;
    max-width: 900px;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.pod-ep-actions {
    display: flex;
    gap: var(--fl-sp-2);
    align-items: center;
    padding-top: 5px;
}

/* ── Play Button ── */
.pod-play {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--fl-accent);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: background var(--fl-duration), transform 80ms ease;
}
.pod-play:hover { background: var(--fl-accent-hover); transform: scale(1.05); }

/* ── Favorite Button ── */
.pod-fav {
    width: 32px;
    height: 32px;
    border-radius: var(--fl-radius);
    background: transparent;
    border: 1px solid var(--fl-border);
    color: var(--fl-text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--fl-duration);
}
.pod-fav:hover { color: var(--fl-red); border-color: var(--fl-red-border); }
.pod-fav.favorited { color: var(--fl-red); border-color: var(--fl-red-border); }

.pod-fav-lg { color: var(--fl-text-tertiary); }
.pod-fav-lg:hover { color: var(--fl-red); border-color: var(--fl-red-border); }
.pod-fav-lg.favorited { color: var(--fl-red); border-color: var(--fl-red-border); }

/* ── Episode Detail ── */
.pod-ep-detail { padding: var(--fl-sp-8) 0; }

.pod-ep-detail h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: var(--fl-sp-3);
    color: var(--fl-text);
    text-wrap: balance;
}

.pod-ep-detail .meta {
    color: var(--fl-text-secondary);
    font-size: 13px;
    margin-bottom: var(--fl-sp-6);
    display: flex;
    gap: var(--fl-sp-4);
}

.pod-ep-detail-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: var(--fl-sp-2);
}

.pod-detail-card,
.pod-transcript {
    margin-top: var(--fl-sp-6);
    background: var(--fl-surface);
    border: 1px solid var(--fl-border);
    border-radius: var(--fl-radius-lg);
    padding: var(--fl-sp-5);
}

.pod-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--fl-sp-4);
    margin: 0;
}

.pod-detail-grid div {
    min-width: 0;
}

.pod-detail-grid dt {
    color: var(--fl-text-dimmed);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    margin-bottom: var(--fl-sp-1);
    text-transform: uppercase;
}

.pod-detail-grid dd {
    color: var(--fl-text);
    font-size: 14px;
    line-height: 1.45;
    margin: 0;
    overflow-wrap: anywhere;
}

.pod-transcript-head {
    display: flex;
    justify-content: space-between;
    gap: var(--fl-sp-3);
    align-items: baseline;
    border-bottom: 1px solid var(--fl-border);
    padding-bottom: var(--fl-sp-3);
}

.pod-transcript-head .pod-section {
    margin: 0;
}

.pod-transcript-head span,
.pod-transcript-empty {
    color: var(--fl-text-secondary);
    font-size: 13px;
}

.pod-transcript-list {
    max-height: 560px;
    overflow: auto;
    padding-right: var(--fl-sp-2);
}

.pod-transcript-row {
    display: grid;
    grid-template-columns: 116px minmax(0, 1fr);
    gap: var(--fl-sp-4);
    padding: var(--fl-sp-3) 0;
    border-bottom: 1px solid var(--fl-border);
}

.pod-transcript-row:last-child {
    border-bottom: 0;
}

.pod-transcript-row time {
    color: var(--fl-text-dimmed);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.pod-transcript-row p {
    color: var(--fl-text-secondary);
    font-size: 14px;
    line-height: 1.55;
    margin: 0;
}

@media (max-width: 640px) {
    .pod-transcript-row {
        grid-template-columns: 1fr;
        gap: var(--fl-sp-1);
    }
}

/* ── Show Notes ── */
.pod-notes {
    background: var(--fl-surface);
    padding: var(--fl-sp-6);
    border-radius: var(--fl-radius-lg);
    border: 1px solid var(--fl-border);
    line-height: 1.75;
    color: var(--fl-text-secondary);
    font-size: 15px;
}

.pod-notes h2, .pod-notes h3 {
    margin-top: var(--fl-sp-6);
    margin-bottom: var(--fl-sp-2);
    font-weight: 600;
    color: var(--fl-text);
    letter-spacing: -0.01em;
}
.pod-notes p { margin-bottom: var(--fl-sp-3); }
.pod-notes ul, .pod-notes ol { padding-left: var(--fl-sp-6); margin-bottom: var(--fl-sp-3); }
.pod-notes a {
    color: var(--fl-accent-text);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    text-decoration-color: var(--fl-accent-soft);
}
.pod-notes a:hover { text-decoration-color: var(--fl-accent-text); }

/* ── Comments ── */
.pod-comments { margin-top: var(--fl-sp-10); }

.pod-comment-form { margin-bottom: var(--fl-sp-6); }

.pod-comment-form textarea {
    width: 100%;
    padding: var(--fl-sp-3);
    background: var(--fl-surface);
    border: 1px solid var(--fl-border);
    border-radius: var(--fl-radius-lg);
    color: var(--fl-text);
    font-family: var(--fl-font);
    font-size: 14px;
    min-height: 80px;
    resize: vertical;
    outline: none;
    transition: border-color var(--fl-duration), box-shadow var(--fl-duration);
}
.pod-comment-form textarea:focus {
    border-color: var(--fl-accent);
    box-shadow: 0 0 0 2px var(--fl-accent-soft);
}
.pod-comment-form textarea::placeholder { color: var(--fl-text-dimmed); }

.pod-comment-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--fl-sp-2);
}

.pod-char-count { font-size: 12px; color: var(--fl-text-dimmed); }

.pod-comment-login {
    display: flex;
    align-items: center;
    gap: var(--fl-sp-2);
    padding: var(--fl-sp-4);
    color: var(--fl-text-secondary);
    font-size: 14px;
    margin-bottom: var(--fl-sp-4);
}

.pod-comment-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.pod-comment {
    padding: var(--fl-sp-4);
    background: var(--fl-surface);
    border: 1px solid var(--fl-border);
    border-radius: var(--fl-radius-lg);
    margin-bottom: var(--fl-sp-2);
}

.pod-comment-head {
    display: flex;
    align-items: center;
    gap: var(--fl-sp-2);
    margin-bottom: var(--fl-sp-2);
}

.pod-comment-author {
    font-size: 13px;
    font-weight: 600;
    color: var(--fl-text);
}

.pod-comment-tier {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.tier-free { background: var(--fl-bg-inset); color: var(--fl-text-secondary); }
.tier-supporter { background: var(--fl-accent-soft); color: var(--fl-accent-text); }
.tier-patron { background: rgba(125, 87, 193, 0.15); color: #a78bfa; }
.tier-champion { background: var(--fl-amber-soft); color: var(--fl-amber); }

.pod-comment-date {
    font-size: 12px;
    color: var(--fl-text-dimmed);
    margin-left: auto;
}

.pod-comment-actions { display: flex; gap: 4px; }

.pod-btn-icon {
    width: 28px;
    height: 28px;
    border-radius: var(--fl-radius-sm);
    background: transparent;
    border: none;
    color: var(--fl-text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--fl-duration);
}
.pod-btn-icon:hover { color: var(--fl-red); background: var(--fl-red-soft); }

.pod-comment-body {
    font-size: 14px;
    line-height: 1.6;
    color: var(--fl-text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
}

.pod-no-comments {
    text-align: center;
    padding: var(--fl-sp-8);
    color: var(--fl-text-secondary);
    font-size: 14px;
}

/* ── Audio Player Bar ── */
.pod-player {
    position: fixed;
    bottom: 0;
    left: 240px;
    right: 0;
    background: color-mix(in srgb, var(--fl-surface) 92%, transparent);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--fl-border);
    padding: 10px var(--fl-sp-6);
    display: none;
    z-index: 200;
}

.pod-player.active { display: block; }

.pod-player-inner {
    display: grid;
    grid-template-columns: 1fr auto 2fr auto;
    gap: var(--fl-sp-4);
    align-items: center;
}

.pod-player-info { overflow: hidden; }
.pod-player-info h4 {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--fl-text);
}
.pod-player-info span { font-size: 12px; color: var(--fl-text-secondary); }

.pod-player-controls { display: flex; gap: 10px; align-items: center; }

.pod-player-progress {
    display: flex;
    align-items: center;
    gap: var(--fl-sp-2);
    justify-content: flex-end;
}

.pod-player-progress time {
    font-size: 11px;
    color: var(--fl-text-secondary);
    font-family: var(--fl-font-mono);
    letter-spacing: -0.02em;
}

.pod-progress-bar {
    flex: 1;
    min-width: 100px;
    height: 3px;
    background: var(--fl-border);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
}
.pod-progress-bar::before {
    content: '';
    position: absolute;
    top: -10px;
    bottom: -10px;
    left: 0;
    right: 0;
}
.pod-progress-bar:hover { height: 5px; }

.pod-progress-fill {
    height: 100%;
    background: var(--fl-accent);
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s linear;
}

.pod-player-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* Push job bar up when player is active */
.pod-player.active ~ .job-bar { bottom: 54px; }

.pod-progress-bar {
    touch-action: none; /* Prevent scroll on touch drag */
}

@media (pointer: coarse) {
    .pod-progress-bar { height: 8px; }
    .pod-progress-bar:hover { height: 8px; }
}

/* ── Icon Buttons ── */
.pod-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    color: var(--fl-text-secondary);
    cursor: pointer;
    border-radius: var(--fl-radius);
    padding: 0;
    text-decoration: none;
    transition: color 0.15s, background 0.15s;
}
.pod-icon-btn:hover {
    color: var(--fl-text);
    background: var(--fl-bg-hover);
}
.pod-icon-btn svg { flex-shrink: 0; }

/* ── Loading State ── */
.pod-loading {
    text-align: center;
    padding: var(--fl-sp-10);
    color: var(--fl-text-secondary);
    font-size: 13px;
}

/* ── Admin: Upload Drop Zone ── */
.pod-drop-zone {
    border: 1px dashed var(--fl-border-strong);
    border-radius: var(--fl-radius-lg);
    padding: var(--fl-sp-10);
    text-align: center;
    color: var(--fl-text-secondary);
    cursor: pointer;
    transition: all var(--fl-duration);
    background: var(--fl-bg-inset);
}
.pod-drop-zone:hover, .pod-drop-zone.dragover {
    border-color: var(--fl-accent);
    background: var(--fl-accent-soft);
}

/* ── Admin: Episode/Podcast Row ── */
.pod-admin-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--fl-sp-3) var(--fl-sp-4);
    background: var(--fl-surface);
    border: 1px solid var(--fl-border);
    border-radius: var(--fl-radius);
    margin-bottom: 6px;
    transition: background var(--fl-duration);
}
.pod-admin-row:hover { background: var(--fl-surface-raised); }

.pod-admin-actions { display: flex; gap: 6px; }

/* ── Generation Progress ── */
.gen-progress-bar {
    width: 100%;
    height: 6px;
    background: var(--fl-border);
    border-radius: 3px;
    overflow: hidden;
}

.gen-progress-fill {
    height: 100%;
    background: var(--fl-accent);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.gen-line {
    display: grid;
    grid-template-columns: 24px 100px 1fr auto;
    gap: var(--fl-sp-3);
    align-items: center;
    padding: var(--fl-sp-2) var(--fl-sp-3);
    background: var(--fl-surface);
    border: 1px solid var(--fl-border);
    border-radius: var(--fl-radius);
    margin-bottom: 3px;
    font-size: 13px;
}

.gen-line-status {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    flex-shrink: 0;
}

.gen-line-status.pending { background: var(--fl-bg-inset); color: var(--fl-text-tertiary); }
.gen-line-status.generating { background: var(--fl-accent-soft); color: var(--fl-accent-text); animation: gen-pulse 1.5s infinite; }
.gen-line-status.generated { background: rgba(74, 222, 128, 0.1); color: #4ade80; }
.gen-line-status.failed { background: rgba(248, 113, 113, 0.1); color: #f87171; }

@keyframes gen-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.gen-speaker {
    font-weight: 600;
    color: var(--fl-accent-text);
    font-size: 12px;
}

.gen-text {
    color: var(--fl-text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
}

.gen-line-actions {
    display: flex;
    gap: 4px;
}

/* ── Line Inline Editor ── */
.gen-line-edit-wrapper {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}

.gen-line-edit-input {
    width: 100%;
    min-height: 48px;
    resize: vertical;
    padding: 4px 6px;
    border: 1px solid var(--fl-accent);
    border-radius: 4px;
    background: var(--fl-bg-inset);
    font-family: inherit;
    font-size: 13px;
    color: var(--fl-text);
    outline: none;
    box-shadow: 0 0 0 2px var(--fl-accent-soft);
}

.gen-line-edit-actions {
    display: flex;
    gap: 4px;
}

/* ── Line Drag States ── */
.gen-line.dragging { opacity: 0.3; }
.gen-line.drag-above { box-shadow: 0 -2px 0 0 var(--fl-accent); }
.gen-line.drag-below { box-shadow: 0 2px 0 0 var(--fl-accent); }
.gen-line[draggable="true"] { cursor: grab; }

/* ── Double-click edit hint ── */
.gen-text[title]:hover {
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 3px;
    cursor: text;
}

.gen-clip-row {
    display: grid;
    grid-template-columns: 80px 1fr auto auto auto;
    gap: var(--fl-sp-3);
    align-items: center;
    padding: var(--fl-sp-3);
    background: var(--fl-surface-raised);
    border-radius: var(--fl-radius);
    margin-bottom: var(--fl-sp-2);
}

.gen-clip-label {
    font-weight: 600;
    font-size: 12px;
    color: var(--fl-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── Script Block Editor ── */
.script-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: var(--fl-sp-2);
    padding: var(--fl-sp-2);
    background: var(--fl-surface-raised);
    border-radius: var(--fl-radius);
    border: 1px solid var(--fl-border);
}

.script-blocks-container {
    min-height: 120px;
    border: 1px solid var(--fl-border);
    border-radius: var(--fl-radius);
    padding: var(--fl-sp-2);
    background: var(--fl-bg-inset);
    max-height: 500px;
    overflow-y: auto;
}

.script-block {
    display: grid;
    grid-template-columns: 20px auto 1fr 24px;
    gap: var(--fl-sp-2);
    align-items: start;
    padding: var(--fl-sp-2) var(--fl-sp-3);
    background: var(--fl-surface);
    border: 1px solid var(--fl-border);
    border-radius: var(--fl-radius);
    margin-bottom: 3px;
    transition: box-shadow 0.15s, opacity 0.15s;
    border-left: 3px solid var(--fl-border);
}

.script-block.dragging { opacity: 0.3; }
.script-block.drag-above { box-shadow: 0 -2px 0 0 var(--fl-accent); }
.script-block.drag-below { box-shadow: 0 2px 0 0 var(--fl-accent); }

.script-block-handle {
    cursor: grab;
    color: var(--fl-text-tertiary);
    font-size: 12px;
    padding-top: 4px;
    user-select: none;
}

.script-block-directive {
    font-family: var(--fl-font-mono);
    font-size: 11px;
    color: var(--fl-accent-text);
    font-weight: 600;
    padding: 2px 8px;
    background: var(--fl-accent-soft);
    border-radius: 4px;
    grid-column: 2 / 4;
    display: inline-flex;
    align-items: center;
    gap: var(--fl-sp-2);
}

.script-block-speaker {
    font-size: 12px;
    font-weight: 600;
    width: 120px;
    padding: 4px 6px;
}

.script-block-text {
    font-size: 13px;
    min-height: 32px;
    resize: vertical;
    padding: 4px 6px;
    border: 1px solid var(--fl-border);
    border-radius: 4px;
    background: var(--fl-bg-inset);
    font-family: inherit;
    color: var(--fl-text);
    width: 100%;
}
.script-block-text:focus {
    outline: none;
    border-color: var(--fl-accent);
}

.script-block-delete {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--fl-text-tertiary);
    font-size: 14px;
    padding: 2px;
    border-radius: 4px;
    align-self: center;
}
.script-block-delete:hover { color: #f87171; background: rgba(248,113,113,0.1); }

.ai-prompt-section {
    padding: var(--fl-sp-4);
    background: var(--fl-surface-raised);
    border: 1px solid var(--fl-border);
    border-radius: var(--fl-radius);
    margin-bottom: var(--fl-sp-4);
}

.ai-prompt-section .fl-textarea {
    min-height: 60px;
    margin-bottom: var(--fl-sp-3);
}

/* ── Pipeline Step Indicator ── */
.gen-pipeline {
    display: flex;
    gap: 4px;
    margin-bottom: var(--fl-sp-6);
}

.gen-step {
    flex: 1;
    text-align: center;
    padding: 10px 8px;
    font-size: 13px;
    font-weight: 500;
    background: var(--fl-bg-tertiary);
    border-radius: var(--fl-radius);
    color: var(--fl-text-tertiary);
    cursor: pointer;
    transition: all var(--fl-duration);
    user-select: none;
}

.gen-step:hover { background: var(--fl-bg-inset); }
.gen-step.active { background: var(--fl-accent); color: #fff; }
.gen-step.completed { background: var(--fl-bg-secondary); color: var(--fl-text-primary); }

/* ── Admin Dashboard Podcast Cards ── */
.pod-admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--fl-sp-4);
}

.pod-admin-card {
    background: var(--fl-surface);
    border: 1px solid var(--fl-border);
    border-radius: var(--fl-radius-lg);
    padding: var(--fl-sp-5);
    transition: border-color var(--fl-duration), box-shadow var(--fl-duration);
}
.pod-admin-card:hover {
    border-color: var(--fl-border-strong);
    box-shadow: var(--fl-shadow-sm);
}

.pod-admin-card-header {
    display: flex;
    gap: var(--fl-sp-4);
    align-items: center;
    margin-bottom: var(--fl-sp-3);
}

.pod-admin-card-art {
    width: 64px;
    height: 64px;
    border-radius: var(--fl-radius);
    object-fit: cover;
    flex-shrink: 0;
}

.pod-admin-card-art-placeholder {
    background: var(--fl-bg-inset);
    border: 1px solid var(--fl-border);
}

.pod-admin-card-meta {
    flex: 1;
    min-width: 0;
}

.pod-admin-card-meta h3 {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 4px;
    color: var(--fl-text);
}

.pod-admin-card-desc {
    font-size: 13px;
    color: var(--fl-text-secondary);
    line-height: 1.5;
    margin-bottom: var(--fl-sp-3);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pod-admin-card-stats {
    display: flex;
    gap: var(--fl-sp-4);
    font-size: 12px;
    color: var(--fl-text-tertiary);
    margin-bottom: var(--fl-sp-4);
}

.pod-admin-card-actions {
    display: flex;
    gap: var(--fl-sp-2);
}

/* ================================================================
   Dashboard Tree View
   ================================================================ */
.pod-tree {
    display: flex;
    flex-direction: column;
    gap: var(--fl-sp-4);
}

.pod-tree-podcast {
    background: var(--fl-surface);
    border: 1px solid var(--fl-border);
    border-radius: var(--fl-radius-lg);
    overflow: hidden;
}

.pod-tree-podcast-header {
    display: flex;
    align-items: center;
    gap: var(--fl-sp-4);
    padding: var(--fl-sp-4) var(--fl-sp-5);
    cursor: pointer;
    transition: background var(--fl-duration);
}
.pod-tree-podcast-header:hover { background: var(--fl-surface-raised); }

.pod-tree-art {
    width: 48px;
    height: 48px;
    border-radius: var(--fl-radius);
    object-fit: cover;
    flex-shrink: 0;
}
.pod-tree-art-placeholder {
    background: var(--fl-bg-inset);
    border: 1px solid var(--fl-border);
}

.pod-tree-podcast-info {
    flex: 1;
    min-width: 0;
}
.pod-tree-podcast-info h3 {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 2px;
    color: var(--fl-text);
}

.pod-tree-podcast-actions {
    flex-shrink: 0;
}

.pod-tree-body {
    border-top: 1px solid var(--fl-border);
}

/* Season row */
.pod-tree-season {
    border-bottom: 1px solid var(--fl-border-subtle);
}
.pod-tree-season:last-child { border-bottom: none; }

.pod-tree-season-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--fl-sp-3) var(--fl-sp-5) var(--fl-sp-3) var(--fl-sp-8);
    cursor: pointer;
    transition: background var(--fl-duration);
    font-size: 13px;
}
.pod-tree-season-header:hover { background: var(--fl-surface-raised); }

.pod-tree-season-title {
    font-weight: 500;
    color: var(--fl-text-secondary);
}

.pod-tree-season-count {
    font-size: 12px;
    color: var(--fl-text-tertiary);
}

/* Episode row */
.pod-tree-episodes {
    padding: 0 var(--fl-sp-3) var(--fl-sp-2);
}

.pod-tree-episode {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--fl-sp-2) var(--fl-sp-4);
    margin-left: var(--fl-sp-6);
    cursor: pointer;
    border-radius: var(--fl-radius);
    transition: background var(--fl-duration);
    font-size: 13px;
}
.pod-tree-episode:hover { background: var(--fl-bg-inset); }

.pod-tree-ep-left {
    display: flex;
    align-items: center;
    gap: var(--fl-sp-3);
    min-width: 0;
}

.pod-tree-ep-num {
    font-weight: 600;
    color: var(--fl-text-tertiary);
    font-size: 12px;
    min-width: 20px;
    text-align: right;
}

.pod-tree-ep-title {
    color: var(--fl-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pod-tree-ep-right {
    display: flex;
    align-items: center;
    gap: var(--fl-sp-3);
    flex-shrink: 0;
}

.pod-tree-ep-date {
    font-size: 11px;
    color: var(--fl-text-dimmed);
}

/* Standalone section */
.pod-tree-standalone-section {
    padding: var(--fl-sp-2) var(--fl-sp-3);
    border-top: 1px solid var(--fl-border-subtle);
}

/* ================================================================
   Phase Badges & Progress Micro-bars
   ================================================================ */
.pod-phase-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 1px 8px;
    border-radius: var(--fl-radius-full);
    white-space: nowrap;
    line-height: 1.6;
}

.pod-phase-draft { background: var(--fl-bg-inset); color: var(--fl-text-tertiary); }
.pod-phase-script { background: rgba(96, 165, 250, 0.12); color: #60a5fa; }
.pod-phase-voice { background: var(--fl-amber-soft); color: var(--fl-amber); }
.pod-phase-mix { background: rgba(167, 139, 250, 0.12); color: #a78bfa; }
.pod-phase-published { background: rgba(74, 222, 128, 0.1); color: #4ade80; }
.pod-phase-failed { background: rgba(248, 113, 113, 0.1); color: #f87171; }

.pod-phase-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}
.pod-phase-dot.pod-phase-draft { background: var(--fl-text-tertiary); }
.pod-phase-dot.pod-phase-script { background: #60a5fa; }
.pod-phase-dot.pod-phase-voice { background: var(--fl-amber); }
.pod-phase-dot.pod-phase-mix { background: #a78bfa; }
.pod-phase-dot.pod-phase-published { background: #4ade80; }
.pod-phase-dot.pod-phase-failed { background: #f87171; }

.pod-progress-micro {
    width: 40px;
    height: 3px;
    background: var(--fl-border);
    border-radius: 2px;
    overflow: hidden;
}

.pod-progress-micro-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s ease;
}
.pod-progress-micro-fill.pod-phase-draft { background: var(--fl-text-tertiary); }
.pod-progress-micro-fill.pod-phase-script { background: #60a5fa; }
.pod-progress-micro-fill.pod-phase-voice { background: var(--fl-amber); }
.pod-progress-micro-fill.pod-phase-mix { background: #a78bfa; }
.pod-progress-micro-fill.pod-phase-published { background: #4ade80; }
.pod-progress-micro-fill.pod-phase-failed { background: #f87171; }

/* ================================================================
   BGM Containment (Script Editor)
   ================================================================ */
.script-bgm-container {
    border: 1px solid rgba(96, 165, 250, 0.25);
    border-radius: var(--fl-radius);
    margin-bottom: 3px;
    background: rgba(96, 165, 250, 0.04);
    overflow: hidden;
}

.script-bgm-header {
    display: flex;
    align-items: center;
    gap: var(--fl-sp-2);
    padding: var(--fl-sp-2) var(--fl-sp-3);
    background: rgba(96, 165, 250, 0.08);
    border-bottom: 1px solid rgba(96, 165, 250, 0.15);
    font-size: 12px;
}

.script-bgm-label {
    font-weight: 700;
    color: #60a5fa;
    font-size: 11px;
    font-family: var(--fl-font-mono);
    letter-spacing: 0.04em;
}

.script-bgm-header .script-block-delete {
    margin-left: auto;
}

.script-bgm-body {
    padding: var(--fl-sp-2);
}

/* ================================================================
   Auto-Save Status Indicator
   ================================================================ */
.pod-autosave-status {
    font-size: 12px;
    color: var(--fl-text-tertiary);
    font-weight: 500;
    transition: color 0.2s;
}

/* ================================================================
   Job Bar (bottom overlay)
   ================================================================ */
.job-bar {
    position: fixed;
    bottom: 0;
    left: 240px;
    right: 0;
    background: var(--fl-surface);
    border-top: 1px solid var(--fl-border);
    z-index: 190;
    font-size: 13px;
}

.job-bar-collapsed {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--fl-sp-2) var(--fl-sp-4);
    cursor: pointer;
    transition: background var(--fl-duration);
}
.job-bar-collapsed:hover { background: var(--fl-surface-raised); }

.job-bar-toggle {
    color: var(--fl-text-tertiary);
    font-size: 10px;
}

.job-bar-expanded {
    max-height: 50vh;
    overflow-y: auto;
}

.job-bar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--fl-sp-2) var(--fl-sp-4);
    font-weight: 600;
    font-size: 12px;
    color: var(--fl-text-secondary);
    border-bottom: 1px solid var(--fl-border);
}

.job-item {
    padding: var(--fl-sp-3) var(--fl-sp-4);
    border-bottom: 1px solid var(--fl-border-subtle);
}
.job-item:last-child { border-bottom: none; }

.job-item-header {
    display: flex;
    align-items: center;
    gap: var(--fl-sp-2);
}

.job-item-title {
    font-weight: 500;
    color: var(--fl-text);
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.job-item-detail {
    margin-top: 2px;
    display: flex;
    gap: var(--fl-sp-2);
}

.job-status-active {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--fl-accent);
    animation: gen-pulse 1.5s infinite;
    flex-shrink: 0;
}

.job-status-complete {
    color: #4ade80;
    font-weight: 700;
    font-size: 12px;
}

.job-status-failed {
    color: #f87171;
    font-weight: 700;
    font-size: 12px;
}

.job-progress {
    height: 4px;
    background: var(--fl-border);
    border-radius: 2px;
    margin-top: 4px;
    overflow: hidden;
}

.job-progress-fill {
    height: 100%;
    background: var(--fl-accent);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.job-item-complete { opacity: 0.65; }
.job-item-failed { border-left: 2px solid #f87171; }

/* ================================================================
   Sidebar Nested Nav Items (seasons/episodes in sidebar)
   ================================================================ */
.fl-nav-season-group {
    margin-bottom: 2px;
}

.fl-nav-item-season {
    font-size: 12px;
    padding: 4px var(--fl-sp-4) 4px var(--fl-sp-6);
}

.fl-nav-item-ep {
    font-size: 11px;
    padding: 3px var(--fl-sp-4) 3px var(--fl-sp-10);
    color: var(--fl-text-tertiary);
}
.fl-nav-item-ep:hover { color: var(--fl-text-secondary); }
.fl-nav-item-ep.active { color: var(--fl-accent-text); }

.fl-nav-item-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ================================================================
   Pipeline Stepper (within SPA)
   ================================================================ */
.gen-stepper {
    display: flex;
    gap: 4px;
    margin-bottom: var(--fl-sp-6);
}

.gen-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    margin-right: 4px;
    background: rgba(255,255,255,0.12);
}
.gen-step.active .gen-step-num { background: rgba(255,255,255,0.25); }
.gen-step.completed .gen-step-num { background: var(--fl-accent-soft); color: var(--fl-accent-text); }

/* ================================================================
   Script Toolbar (block editor)
   ================================================================ */
.script-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: var(--fl-sp-2);
    background: var(--fl-surface-raised);
    border-radius: var(--fl-radius);
    border: 1px solid var(--fl-border);
}

/* ================================================================
   Generation Lines Container
   ================================================================ */
.gen-lines-container {
    max-height: 500px;
    overflow-y: auto;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .pod-player { left: 0; }
    .job-bar { left: 0; }
}

@media (max-width: 640px) {
    .pod-hero { padding: 48px 0 32px; }
    .pod-hero h1 { font-size: 1.75rem; }
    .pod-hero p { font-size: 15px; }
    .pod-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
    .pod-detail-header { flex-direction: column; align-items: center; text-align: center; }
    .pod-detail-art { width: 140px; height: 140px; }
    .pod-ep {
        grid-template-columns: 52px minmax(0, 1fr) auto;
        gap: var(--fl-sp-3);
        padding: 14px 16px;
    }
    .pod-ep-art-wrap {
        width: 50px;
        height: 50px;
    }
    .pod-ep-kicker {
        gap: var(--fl-sp-2);
    }
    .pod-ep-summary {
        -webkit-line-clamp: 3;
    }
    .pod-ep .pod-play { display: none; }
    .pod-ep-detail-actions { flex-wrap: wrap; }
    .pod-player-inner { grid-template-columns: 1fr auto auto; }
    .pod-player-progress { display: none; }
    .pod-section { margin: var(--fl-sp-8) 0 var(--fl-sp-3); }
    .gen-stepper { flex-wrap: wrap; }
}

/* ================================================================
   Library Page — Tabs, Folders
   ================================================================ */

.lib-tabs {
    display: flex;
    align-items: center;
    gap: var(--fl-sp-1);
    border-bottom: 1px solid var(--fl-border);
    margin-bottom: var(--fl-sp-5);
    padding-bottom: 0;
}
.lib-tab {
    padding: var(--fl-sp-2) var(--fl-sp-4);
    border: none;
    background: none;
    color: var(--fl-text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s;
}
.lib-tab:hover { color: var(--fl-text); }
.lib-tab.active {
    color: var(--fl-accent);
    border-bottom-color: var(--fl-accent);
}

.lib-view-toggle {
    display: flex;
    gap: 2px;
    margin-left: var(--fl-sp-3);
    margin-bottom: var(--fl-sp-1);
}
.lib-view-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid var(--fl-border);
    background: none;
    color: var(--fl-text-tertiary);
    cursor: pointer;
    border-radius: var(--fl-radius);
    transition: all 0.15s;
}
.lib-view-btn:first-child { border-radius: var(--fl-radius) 0 0 var(--fl-radius); }
.lib-view-btn:last-child { border-radius: 0 var(--fl-radius) var(--fl-radius) 0; }
.lib-view-btn:hover { color: var(--fl-text); background: var(--fl-bg-hover); }
.lib-view-btn.active { color: var(--fl-accent); border-color: var(--fl-accent); background: color-mix(in srgb, var(--fl-accent) 8%, transparent); }

.lib-folder-bar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--fl-sp-2);
}
.lib-folder-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid var(--fl-border);
    border-radius: 999px;
    background: none;
    color: var(--fl-text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
}
.lib-folder-chip:hover { border-color: var(--fl-text-tertiary); color: var(--fl-text); }
.lib-folder-chip.active { border-color: var(--fl-accent); color: var(--fl-accent); background: color-mix(in srgb, var(--fl-accent) 8%, transparent); }
