.episode-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    display: flex;
    flex-direction: column;
    will-change: transform;
}

.episode-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.episode-card-header {
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
}

/* Browse cards only. Episode detail reuses this class for a full-height hero. */
.episode-card .episode-card-header {
    height: 60px;
}

.episode-number {
    font-size: 1.1rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
}

.episode-watched-badge {
    background: rgba(255, 255, 255, 0.9);
    color: #27ae60;
    font-size: 0.8rem;
    font-weight: 700;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.episode-card--watched {
    border: 1px solid rgba(39, 174, 96, 0.25);
}

.episode-card-body {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.episode-title-heading {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
    line-height: 1.4;
}

.episode-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--brand-ink);
    text-decoration: none;
    transition: color 0.2s ease;
}

.episode-link:hover {
    color: var(--brand-cool);
}

.episode-link:hover .external-icon {
    transform: translateX(2px);
}

.external-icon {
    font-size: 0.85em;
    opacity: 0.7;
    transition: transform 0.2s ease;
}

.episode-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.meta-label {
    font-size: 0.85rem;
    color: var(--ink-muted);
    font-weight: 500;
}

.meta-value {
    font-size: 0.95rem;
    color: var(--ink-strong);
    font-weight: 600;
}

.episode-stats {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-soft);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.stat-icon {
    font-size: 1.2rem;
    opacity: 0.8;
}

.stat-text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.stat-subtext {
    font-size: 0.75rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.count-badge {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    background: var(--brand-accent);
    color: white;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
}

.count-badge-zero {
    color: #ccc;
    font-size: 0.9rem;
    font-weight: 600;
}

.date-text {
    font-size: 0.9rem;
    color: #333;
    font-weight: 600;
}

.date-text-empty {
    color: #999;
    font-style: italic;
    font-size: 0.9rem;
}

.episode-actions {
    display: flex;
    gap: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-soft);
    flex-wrap: wrap;
}

.btn-view-episode {
    flex: 1;
    background: transparent;
    color: var(--brand-ink);
    border: 1.5px solid var(--brand-ink);
    padding: 0.65rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-view-episode:hover {
    background: rgba(27, 26, 23, 0.07);
    color: var(--brand-ink);
}

.btn-watch-episode {
    flex: 1;
    background: var(--brand-cool);
    color: white;
    border: none;
    padding: 0.65rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.2s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-watch-episode:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.btn-watch-episode:active {
    transform: translateY(0);
}

.btn-watch-episode:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-watch-episode--confirmed {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
}

.btn-watch-episode--confirmed:hover {
    filter: brightness(1.08);
}

.btn-watch-episode--signin {
    background: transparent;
    color: var(--brand-ink);
    border: 1.5px solid var(--brand-ink);
    text-decoration: none;
}

.btn-watch-episode--signin:hover {
    background: rgba(27, 26, 23, 0.07);
    color: var(--brand-ink);
    transform: translateY(0);
}

.btn-watch-next {
    flex: 1;
    background: #fff;
    color: var(--brand-ink);
    border: 1.5px solid #cbd5e1;
    padding: 0.65rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-watch-next:hover:not(:disabled) {
    background: #f8fafc;
    border-color: var(--brand-cool);
    color: #0f4b46;
}

.btn-watch-next--queued {
    background: #ecfdf5;
    border-color: #86efac;
    color: #166534;
}

.btn-watch-next--queued:hover:not(:disabled) {
    background: #dcfce7;
    border-color: #4ade80;
}

.btn-watch-next--signin {
    font-size: 0.82rem;
}

.btn-watch-next:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-spinner-sm--dark {
    border-color: rgba(15, 75, 70, 0.25);
    border-top-color: #0f4b46;
}

.btn-spinner-sm {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: white;
    border-radius: 50%;
    animation: ea-spin 0.7s linear infinite;
}

.episode-card-footer {
    padding: 1rem 1.25rem 1.25rem;
    display: flex;
    gap: 0.75rem;
    border-top: 1px solid var(--border-soft);
}

/* Share panel shown after marking as watched */
.episode-share-panel {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 8px;
    margin-top: 0.25rem;
}

.episode-share-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: #166534;
}

.episode-share-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.episode-share-btn-twitter {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.75rem;
    background: #000;
    color: #fff;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.2s;
    white-space: nowrap;
}

.episode-share-btn-twitter:hover {
    opacity: 0.85;
    color: #fff;
}

.episode-share-btn-bluesky {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.75rem;
    background: #1185fe;
    color: #fff;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.2s;
    white-space: nowrap;
}

.episode-share-btn-bluesky:hover {
    opacity: 0.85;
    color: #fff;
}

.episode-share-btn-copy {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.75rem;
    border: 1px solid #86efac;
    border-radius: 6px;
    background: white;
    color: #166534;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    white-space: nowrap;
}

.episode-share-btn-copy:hover {
    background: #dcfce7;
}

.episode-share-btn-copy--success {
    background: #dcfce7;
    color: #166534;
    border-color: #4ade80;
}

.episode-share-btn-dismiss {
    margin-left: auto;
    background: none;
    border: none;
    color: #888;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0.25rem 0.4rem;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
    line-height: 1;
}

.episode-share-btn-dismiss:hover {
    color: #333;
    background: rgba(0, 0, 0, 0.06);
}

@media (max-width: 768px) {
    .episode-card-body {
        padding: 1rem;
    }

    .episode-title-heading {
        font-size: 1.15rem;
    }

    .episode-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .episode-card,
    .episode-link,
    .external-icon,
    .btn-view-episode,
    .btn-watch-episode,
    .btn-watch-next,
    .episode-share-btn-twitter,
    .episode-share-btn-bluesky,
    .episode-share-btn-copy,
    .episode-share-btn-dismiss {
        transition: none !important;
    }

    .episode-card:hover,
    .btn-view-episode:hover,
    .btn-watch-episode:hover {
        transform: none;
    }

    .btn-spinner-sm {
        animation: none;
    }
}


.feedback-fab {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 1000;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #1f7a76 0%, #2a948f 100%);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(31, 122, 118, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.feedback-fab:hover {
    transform: translateY(-2px) scale(1.06);
    box-shadow: 0 6px 18px rgba(31, 122, 118, 0.5);
}

.feedback-fab:focus-visible {
    outline: 3px solid #2a948f;
    outline-offset: 3px;
}

.feedback-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1001;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 1rem 1rem 5rem 1rem;
}

.feedback-modal {
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-soft, #e0e7e6);
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    width: 100%;
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.feedback-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1.25rem 1.25rem 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border-soft, #e0e7e6);
}

.feedback-modal-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0 0 0.25rem 0;
    color: var(--brand-ink, #1f7a76);
}

.feedback-modal-subtitle {
    margin: 0;
    font-size: 0.875rem;
    color: var(--ink-muted, #6b7b7a);
}

.feedback-close-btn {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--ink-muted, #6b7b7a);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease;
}

.feedback-close-btn:hover {
    background: var(--border-soft, #e0e7e6);
    color: var(--ink-strong, #1a2a29);
}

.feedback-close-btn:focus-visible {
    outline: 2px solid var(--brand-cool, #2a948f);
    outline-offset: 2px;
}

.feedback-modal-body {
    padding: 1.25rem;
    animation: fade-slide-up 300ms ease;
}

.feedback-modal-body form {
    display: grid;
    gap: 1rem;
}

.input-label {
    display: grid;
    gap: 0.45rem;
}

.field-label {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--ink-strong, #1a2a29);
}

.feedback-modal-body textarea,
.feedback-modal-body input[type="email"] {
    width: 100%;
    border: 1px solid #c8d4d2;
    border-radius: 10px;
    background: #fff;
    color: var(--ink-strong, #1a2a29);
    font-size: 0.95rem;
    padding: 0.65rem 0.85rem;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.feedback-modal-body textarea::placeholder {
    color: #7f8f8c;
}

.feedback-modal-body textarea {
    min-height: 120px;
    resize: vertical;
}

.feedback-modal-body textarea[aria-invalid="true"] {
    border-color: #be2840;
}

.feedback-modal-body textarea:focus,
.feedback-modal-body input[type="email"]:focus {
    outline: none;
    border-color: var(--brand-cool, #2a948f);
    box-shadow: 0 0 0 3px rgba(31, 122, 118, 0.18);
}

.feedback-modal-body button[type="submit"] {
    justify-self: start;
    min-width: 150px;
    border: none;
    border-radius: 10px;
    padding: 0.6rem 1.1rem;
    font-weight: 700;
    font-size: 0.9rem;
    color: #fff;
    background: linear-gradient(135deg, #1f7a76 0%, #2a948f 100%);
    box-shadow: 0 2px 10px rgba(31, 122, 118, 0.3);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.feedback-modal-body button[type="submit"]:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(31, 122, 118, 0.35);
}

.feedback-modal-body button[type="submit"]:disabled {
    opacity: 0.66;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.char-counter {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.8rem;
    color: var(--ink-muted, #6b7b7a);
    text-align: right;
    font-weight: normal;
}

.field-hint {
    display: block;
    font-size: 0.85rem;
    color: var(--ink-muted, #6b7b7a);
    font-weight: normal;
}

.validation-error {
    padding: 0.65rem 0.82rem;
    background: #ffe9ec;
    border: 1px solid #f0a3af;
    border-radius: 10px;
    color: #7d1b2b;
    font-size: 0.85rem;
}

.validation-error:focus {
    outline: 2px solid #7d1b2b;
    outline-offset: 2px;
}

.feedback-status-message {
    margin: 0 1.25rem 1.25rem 1.25rem;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    border: 1px solid;
    font-size: 0.9rem;
    animation: fade-slide-up 280ms ease;
}

.feedback-status-message.success {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.feedback-status-message.error {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.feedback-status-message p {
    margin: 0;
}

.widget-notes {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid rgba(18, 63, 58, 0.14);
    border-radius: 10px;
    background: linear-gradient(175deg, #f9fcfb, #f4f8f7);
}

.widget-notes .notes-title {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--brand-ink, #1f7a76);
}

.widget-notes .notes-list {
    margin: 0.6rem 0 0;
    padding-left: 1.1rem;
    display: grid;
    gap: 0.4rem;
}

.widget-notes .notes-list li {
    font-size: 0.85rem;
    color: var(--ink-muted, #6b7b7a);
    line-height: 1.5;
}

.widget-notes .notes-list strong {
    color: var(--ink-strong, #1a2a29);
}

.widget-notes .notes-footer {
    margin: 0.65rem 0 0;
    font-size: 0.85rem;
    color: var(--brand-ink, #1f7a76);
    font-weight: 600;
}

@keyframes fade-slide-up {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@media (max-width: 480px) {
    .feedback-modal-overlay {
        align-items: flex-end;
        justify-content: stretch;
        padding: 0;
    }

    .feedback-modal {
        max-width: 100%;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
        max-height: 85vh;
    }

    .feedback-fab {
        bottom: 1rem;
        right: 1rem;
    }
}


/* Guided first-time tour overlay — follows FeedbackWidget patterns */

/* -------------------------------------------------------------------------
   Backdrop
   ------------------------------------------------------------------------- */

.tour-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.52);
    z-index: 1100;
    cursor: pointer;
    animation: tour-fade-in 220ms ease;
}

/* -------------------------------------------------------------------------
   Tooltip card
   ------------------------------------------------------------------------- */

.tour-tooltip {
    position: fixed;
    z-index: 1101;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-soft, rgba(20, 20, 20, 0.08));
    border-radius: 14px;
    box-shadow: var(--shadow-strong, 0 18px 40px rgba(15, 18, 19, 0.14));
    width: calc(100vw - 2rem);
    max-width: 340px;
    animation: tour-slide-up 250ms ease;
}

/* -------------------------------------------------------------------------
   Header row (step counter + close)
   ------------------------------------------------------------------------- */

.tour-tooltip__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 0.9rem 0 1rem;
}

.tour-tooltip__counter {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--ink-muted, #4b4b4b);
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.tour-tooltip__close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--ink-muted, #4b4b4b);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease;
}

.tour-tooltip__close:hover {
    background: var(--border-soft, rgba(20, 20, 20, 0.08));
    color: var(--ink-strong, #1b1a17);
}

.tour-tooltip__close:focus-visible {
    outline: 2px solid var(--brand-cool, #1f7a76);
    outline-offset: 2px;
}

/* -------------------------------------------------------------------------
   Body
   ------------------------------------------------------------------------- */

.tour-tooltip__body {
    padding: 0.75rem 1rem 0.5rem 1rem;
}

.tour-tooltip__title {
    margin: 0 0 0.35rem 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--brand-ink, #123f3a);
    line-height: 1.3;
}

.tour-tooltip__description {
    margin: 0;
    font-size: 0.875rem;
    color: var(--ink-muted, #4b4b4b);
    line-height: 1.5;
}

/* -------------------------------------------------------------------------
   Footer row (skip + next)
   ------------------------------------------------------------------------- */

.tour-tooltip__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.75rem 1rem 1rem 1rem;
    border-top: 1px solid var(--border-soft, rgba(20, 20, 20, 0.08));
    margin-top: 0.5rem;
}

.tour-tooltip__skip {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ink-muted, #4b4b4b);
    padding: 0.3rem 0.5rem;
    border-radius: 6px;
    transition: color 0.15s ease;
}

.tour-tooltip__skip:hover {
    color: var(--ink-strong, #1b1a17);
}

.tour-tooltip__skip:focus-visible {
    outline: 2px solid var(--brand-cool, #1f7a76);
    outline-offset: 2px;
}

.tour-tooltip__next {
    border: none;
    border-radius: 8px;
    padding: 0.45rem 1rem;
    font-size: 0.875rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--brand-ink, #123f3a) 0%, var(--brand-cool, #1f7a76) 100%);
    cursor: pointer;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.tour-tooltip__next:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.tour-tooltip__next:focus-visible {
    outline: 2px solid var(--brand-cool, #1f7a76);
    outline-offset: 3px;
}

/* -------------------------------------------------------------------------
   Animations
   ------------------------------------------------------------------------- */

@keyframes tour-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes tour-slide-up {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* -------------------------------------------------------------------------
   Mobile: always render as a bottom sheet
   ------------------------------------------------------------------------- */

@media (max-width: 600px) {
    .tour-tooltip {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        top: auto !important;
        transform: none !important;
        width: 100%;
        max-width: 100%;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
        z-index: 1101;
        animation: tour-sheet-up 280ms ease;
    }
}

@keyframes tour-sheet-up {
    from {
        opacity: 0;
        transform: translateY(100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
