/* =========================================================================
   Recall theme — 3 of 4: components
   First the Bootstrap components, themed through their own --bs-* variables;
   then Recall's shared components (the partials and repeated patterns).
   ========================================================================= */

/* =========================================================================
   Bootstrap components
   ========================================================================= */

/* ---- Buttons ------------------------------------------------------------- */

.btn {
    --bs-btn-font-family: var(--tvdb-font-ui);
    --bs-btn-font-size: var(--tvdb-text-sm);
    --bs-btn-font-weight: 500;
    --bs-btn-border-radius: var(--tvdb-radius-md);
    --bs-btn-disabled-opacity: 0.55;
}

.btn-sm {
    --bs-btn-font-size: var(--tvdb-text-xs);
    --bs-btn-border-radius: var(--tvdb-radius-md);
}

.btn-lg {
    --bs-btn-font-size: var(--tvdb-text-md);
    --bs-btn-border-radius: var(--tvdb-radius-md);
}

.btn:focus-visible {
    outline: 2px solid var(--tvdb-focus);
    outline-offset: 2px;
    box-shadow: none;
}

.btn-primary {
    --bs-btn-color: var(--tvdb-on-signal);
    --bs-btn-bg: var(--tvdb-signal);
    --bs-btn-border-color: var(--tvdb-signal);
    --bs-btn-hover-color: var(--tvdb-on-signal);
    --bs-btn-hover-bg: var(--tvdb-signal-hover);
    --bs-btn-hover-border-color: var(--tvdb-signal-hover);
    --bs-btn-active-color: var(--tvdb-on-signal);
    --bs-btn-active-bg: var(--tvdb-signal-hover);
    --bs-btn-active-border-color: var(--tvdb-signal-hover);
    --bs-btn-disabled-color: var(--tvdb-on-signal);
    --bs-btn-disabled-bg: var(--tvdb-signal);
    --bs-btn-disabled-border-color: var(--tvdb-signal);
}

.btn-outline-primary {
    --bs-btn-color: var(--tvdb-signal-ink);
    --bs-btn-border-color: var(--tvdb-signal);
    --bs-btn-hover-color: var(--tvdb-on-signal);
    --bs-btn-hover-bg: var(--tvdb-signal);
    --bs-btn-hover-border-color: var(--tvdb-signal);
    --bs-btn-active-color: var(--tvdb-on-signal);
    --bs-btn-active-bg: var(--tvdb-signal);
    --bs-btn-active-border-color: var(--tvdb-signal);
    --bs-btn-disabled-color: var(--tvdb-signal-ink);
    --bs-btn-disabled-border-color: var(--tvdb-signal);
}

.btn-outline-danger {
    --bs-btn-color: var(--tvdb-danger);
    --bs-btn-border-color: var(--tvdb-danger);
    --bs-btn-hover-color: var(--tvdb-on-danger);
    --bs-btn-hover-bg: var(--tvdb-danger);
    --bs-btn-hover-border-color: var(--tvdb-danger);
    --bs-btn-active-color: var(--tvdb-on-danger);
    --bs-btn-active-bg: var(--tvdb-danger);
    --bs-btn-active-border-color: var(--tvdb-danger);
    --bs-btn-disabled-color: var(--tvdb-danger);
    --bs-btn-disabled-border-color: var(--tvdb-danger);
}

.btn-dark {
    --bs-btn-color: var(--tvdb-on-ink);
    --bs-btn-bg: var(--tvdb-ink);
    --bs-btn-border-color: var(--tvdb-ink);
    --bs-btn-hover-color: var(--tvdb-on-ink);
    --bs-btn-hover-bg: var(--tvdb-ink-3);
    --bs-btn-hover-border-color: var(--tvdb-ink-3);
    --bs-btn-active-color: var(--tvdb-on-ink);
    --bs-btn-active-bg: var(--tvdb-ink-3);
    --bs-btn-active-border-color: var(--tvdb-ink-3);
}

.btn-outline-dark,
.btn-outline-secondary {
    --bs-btn-color: var(--tvdb-text);
    --bs-btn-border-color: var(--tvdb-ink-line-strong);
    --bs-btn-hover-color: var(--tvdb-on-ink);
    --bs-btn-hover-bg: var(--tvdb-ink);
    --bs-btn-hover-border-color: var(--tvdb-ink);
    --bs-btn-active-color: var(--tvdb-on-ink);
    --bs-btn-active-bg: var(--tvdb-ink);
    --bs-btn-active-border-color: var(--tvdb-ink);
    --bs-btn-disabled-color: var(--tvdb-text-muted);
    --bs-btn-disabled-border-color: var(--tvdb-ink-line);
}

.btn-outline-secondary {
    --bs-btn-color: var(--tvdb-text-muted);
}

.btn-link {
    --bs-btn-font-weight: 500;
}

/* Only ever inside a confirm modal: the button that actually removes. */
.btn-danger {
    --bs-btn-color: var(--tvdb-on-danger);
    --bs-btn-bg: var(--tvdb-danger);
    --bs-btn-border-color: var(--tvdb-danger);
    --bs-btn-hover-color: var(--tvdb-on-danger);
    --bs-btn-hover-bg: var(--tvdb-danger-ink);
    --bs-btn-hover-border-color: var(--tvdb-danger-ink);
    --bs-btn-active-color: var(--tvdb-on-danger);
    --bs-btn-active-bg: var(--tvdb-danger-ink);
    --bs-btn-active-border-color: var(--tvdb-danger-ink);
}

/* ---- Alerts ---------------------------------------------------------------- */

.alert {
    --bs-alert-border-radius: var(--tvdb-radius-md);
}

.alert-warning {
    --bs-alert-color: var(--tvdb-signal-ink);
    --bs-alert-bg: var(--tvdb-signal-tint);
    --bs-alert-border-color: var(--tvdb-signal-edge);
    --bs-alert-link-color: var(--tvdb-signal-ink);
}

.alert-info {
    --bs-alert-color: var(--tvdb-info-ink);
    --bs-alert-bg: var(--tvdb-info-tint);
    --bs-alert-border-color: var(--tvdb-info-edge);
    --bs-alert-link-color: var(--tvdb-info-ink);
}

.alert-success {
    --bs-alert-color: var(--tvdb-ok-ink);
    --bs-alert-bg: var(--tvdb-ok-tint);
    --bs-alert-border-color: var(--tvdb-ok-edge);
    --bs-alert-link-color: var(--tvdb-ok-ink);
}

.alert-danger {
    --bs-alert-color: var(--tvdb-danger-ink);
    --bs-alert-bg: var(--tvdb-danger-tint);
    --bs-alert-border-color: var(--tvdb-danger-edge);
    --bs-alert-link-color: var(--tvdb-danger-ink);
}

/* ---- List group (episode and search rows) ---------------------------------- */

.list-group {
    --bs-list-group-color: var(--tvdb-text);
    --bs-list-group-bg: transparent;
    --bs-list-group-border-color: var(--tvdb-ink-line);
    --bs-list-group-border-radius: var(--tvdb-radius-md);
    --bs-list-group-item-padding-x: var(--tvdb-space-4);
    --bs-list-group-item-padding-y: var(--tvdb-space-3);
}

.list-group-item:hover {
    background: var(--tvdb-wash);
}

.list-group-item.is-watched {
    background: var(--tvdb-ok-wash);
}

/* ---- Forms ------------------------------------------------------------------- */

.form-label {
    margin-bottom: var(--tvdb-space-1);
    font-size: var(--tvdb-text-sm);
    font-weight: 500;
    color: var(--bs-body-color);
}

.form-control {
    background-color: var(--tvdb-paper-dim);
    border-color: var(--tvdb-ink-line-strong);
    border-radius: var(--tvdb-radius-md);
}

.form-control:focus {
    color: var(--bs-body-color);
    background-color: var(--tvdb-paper-dim);
    border-color: var(--tvdb-focus);
    box-shadow: 0 0 0 0.2rem var(--tvdb-focus-halo);
}

.form-control::placeholder {
    color: var(--tvdb-text-muted);
    opacity: 1;
}

.form-control::file-selector-button {
    font-weight: 500;
    border-color: var(--tvdb-ink-line-strong);
}

.form-text {
    font-size: var(--tvdb-text-sm);
}

/* Validation: we draw our own status icon, so drop Bootstrap's background
   image and keep the border colour. */
.form-control.is-valid,
.form-control.is-invalid {
    background-image: none;
    padding-right: 2.5rem;
}

.form-control.is-valid,
.form-control.is-valid:focus {
    border-color: var(--tvdb-ok);
    box-shadow: none;
}

.form-control.is-invalid,
.form-control.is-invalid:focus {
    border-color: var(--tvdb-danger);
    box-shadow: none;
}

.form-control.is-valid:focus { box-shadow: 0 0 0 0.2rem var(--tvdb-ok-tint); }
.form-control.is-invalid:focus { box-shadow: 0 0 0 0.2rem var(--tvdb-danger-tint); }

.field-validation-error {
    display: block;
    margin-top: var(--tvdb-space-1);
    font-size: var(--tvdb-text-sm);
}

/* A form's buttons: one row, the action that saves on the right. */
.tvdb-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--tvdb-space-2);
    margin-top: var(--tvdb-space-5);
}

/* ---- Table --------------------------------------------------------------------- */

.table {
    --bs-table-color: var(--tvdb-text);
    --bs-table-bg: transparent;
    --bs-table-border-color: var(--tvdb-ink-line);
    --bs-table-striped-color: var(--tvdb-text);
    --bs-table-striped-bg: var(--tvdb-wash);
    --bs-table-hover-color: var(--tvdb-text);
    --bs-table-hover-bg: var(--tvdb-wash);

    font-size: var(--tvdb-text-sm);
}

.table > thead th {
    font-size: var(--tvdb-text-xs);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--tvdb-text-muted);
    border-bottom-color: var(--tvdb-ink-line-strong);
}

/* ---- Modal --------------------------------------------------------------------- */

.modal {
    --bs-modal-color: var(--tvdb-text);
    --bs-modal-bg: var(--tvdb-paper);
    --bs-modal-border-color: var(--tvdb-ink-line);
    --bs-modal-border-radius: var(--tvdb-radius-lg);
    --bs-modal-inner-border-radius: var(--tvdb-radius-lg);
    --bs-modal-header-border-color: var(--tvdb-ink-line);
    --bs-modal-footer-border-color: var(--tvdb-ink-line);
}

.modal-title {
    font-size: var(--tvdb-text-xl);
}

/* ---- Progress -------------------------------------------------------------------- */

.progress {
    --bs-progress-bg: var(--tvdb-paper-dim);
    --bs-progress-bar-bg: var(--tvdb-signal);
    --bs-progress-border-radius: var(--tvdb-radius-pill);
}

/* =========================================================================
   Recall components
   ========================================================================= */

/* ---- Close button: a Phosphor "x" (toasts and modals) --------------------- */

.tvdb-close {
    appearance: none;
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    margin-left: auto;
    padding: 0;
    border: 0;
    border-radius: var(--tvdb-radius-round);
    background: transparent;
    color: inherit;
    font-size: var(--tvdb-text-lg);
    opacity: 0.7;
    cursor: pointer;
    transition: opacity var(--tvdb-ease), background-color var(--tvdb-ease);
}

.tvdb-close:hover,
.tvdb-close:focus-visible {
    opacity: 1;
    background: var(--bs-secondary-bg);
}

/* ---- Round elements ---------------------------------------------------------
   Every circle in the app is one of two shared classes, in whole-pixel sizes,
   so its edge is drawn the same way everywhere.

   .tvdb-round-button: an icon button. 44px (--lg) for a primary action (a
   card's check, an episode row's control), 36px (--md) for a secondary one
   ("⋯", the heart). On a picture (--on-image): a dark, slightly blurred fill
   with a 2px light ring. On the cream panel (--on-paper): a 2px neutral ring;
   or, where a ring would crowd one beside it, no ring at all (--plain).
   A component class beside it (.tvdb-ep-mark, .tvdb-heart, ...) adds its
   states' colours; the shape and the ring width are always these.

   .tvdb-round-avatar: a photo (an <img>, object-fit: cover) or initials, in
   the sizes the app uses: 32px (--sm, the navbar), 40px (--md, people and the
   phone menu), 64px (--lg, Profile). Only initials have a fill: a fill under a
   photo would tint its anti-aliased edge. */

.tvdb-round-button {
    --tvdb-round-size: 36px;
    appearance: none;
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: var(--tvdb-round-size);
    height: var(--tvdb-round-size);
    padding: 0;
    border: 2px solid transparent;
    border-radius: var(--tvdb-radius-round);
    background: transparent;
    font-size: var(--tvdb-text-md);
    line-height: 1;
    cursor: pointer;
    transition: background-color var(--tvdb-ease), border-color var(--tvdb-ease), color var(--tvdb-ease);
}

.tvdb-round-button--lg {
    --tvdb-round-size: 44px;
    font-size: var(--tvdb-text-lg);
}

.tvdb-round-button--md {
    --tvdb-round-size: 36px;
}

.tvdb-round-button .ph,
.tvdb-round-button .ph-fill {
    font-size: 1em;
    vertical-align: 0;
}

.tvdb-round-button--on-image {
    border-color: var(--tvdb-round-on-image-ring);
    background: var(--tvdb-round-on-image-bg);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    color: var(--tvdb-on-ink);
}

.tvdb-round-button--on-image:hover,
.tvdb-round-button--on-image:focus-visible,
.tvdb-round-button--on-image.show {
    border-color: var(--tvdb-on-ink);
    background: var(--tvdb-scrim-strong);
}

.tvdb-round-button--on-image:focus-visible {
    outline-color: var(--tvdb-on-ink);
}

.tvdb-round-button--on-paper {
    border-color: var(--tvdb-text-muted);
    color: var(--tvdb-text);
}

.tvdb-round-button--on-paper:hover,
.tvdb-round-button--on-paper:focus-visible,
.tvdb-round-button--on-paper.show {
    border-color: var(--tvdb-text);
    background: var(--tvdb-paper-dim);
}

/* No ring and no fill (a phone row's "⋯", which sits beside a ringed
   check): only the icon, on a light circle on hover, with the same touch target. */
.tvdb-round-button--plain {
    color: var(--tvdb-text);
}

.tvdb-round-button--plain:hover,
.tvdb-round-button--plain:focus-visible,
.tvdb-round-button--plain.show {
    background: var(--tvdb-paper-dim);
}

.tvdb-round-avatar {
    --tvdb-round-size: 40px;
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: var(--tvdb-round-size);
    height: var(--tvdb-round-size);
    overflow: hidden;
    border-radius: var(--tvdb-radius-round);
    font-family: var(--tvdb-font-ui);
    font-size: var(--tvdb-text-sm);
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.02em;
    user-select: none;
}

img.tvdb-round-avatar {
    display: block;
    object-fit: cover;
    object-position: center 20%;
}

.tvdb-round-avatar--sm { --tvdb-round-size: 32px; }
.tvdb-round-avatar--md { --tvdb-round-size: 40px; }

.tvdb-round-avatar--lg {
    --tvdb-round-size: 64px;
    font-family: var(--tvdb-font-display);
    font-size: var(--tvdb-text-2xl);
    font-weight: 800;
}

/* Initials of a person (cast and crew). */
.tvdb-round-avatar--initials {
    background: var(--tvdb-ink-2);
    color: var(--tvdb-on-ink-muted);
}

/* The signed-in user's initials, on amber. */
.tvdb-round-avatar--user {
    background: var(--tvdb-signal);
    color: var(--tvdb-on-signal);
}

.tvdb-round-avatar--user.tvdb-round-avatar--md {
    font-size: var(--tvdb-text-md);
}

/* ---- Empty state (the _EmptyState partial) --------------------------------- */

.tvdb-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--tvdb-space-2);
    max-width: 30rem;
    margin-inline: auto;
    padding: var(--tvdb-space-6) var(--tvdb-space-4);
    text-align: center;
}

.tvdb-empty-state__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 4rem;
    height: 4rem;
    margin-bottom: var(--tvdb-space-2);
    border-radius: var(--tvdb-radius-round);
    background: var(--tvdb-paper-dim);
    border: 1px solid var(--tvdb-ink-line);
    color: var(--tvdb-text-muted);
    font-size: var(--tvdb-text-2xl);
}

.tvdb-empty-state__icon .ph,
.tvdb-empty-state__icon .ph-fill {
    font-size: 1em;
    vertical-align: 0;
}

.tvdb-empty-state__title {
    margin: 0;
    font-size: var(--tvdb-text-xl);
}

h1.tvdb-empty-state__title {
    font-size: var(--tvdb-text-2xl);
}

.tvdb-empty-state__text {
    margin: 0;
    line-height: var(--tvdb-leading-body);
    color: var(--tvdb-text-muted);
}

.tvdb-empty-state__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--tvdb-space-2);
    margin-top: var(--tvdb-space-3);
}

/* A compact one inside a section that already has a heading. */
.tvdb-empty-state--inline {
    padding-block: var(--tvdb-space-5);
}

/* ---- Media frame and status slate (posters and stills on detail pages) ----- */

.tvdb-media {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin-inline: auto;
    aspect-ratio: 2 / 3;
    min-height: 200px;
    overflow: hidden;
    background: var(--tvdb-media-bg);
    border-radius: var(--tvdb-radius-lg);
}

.tvdb-media img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    object-fit: cover;
}

/* Shared "nothing to show" placeholder for every artwork frame. */
.tvdb-media.is-empty::after,
.tvdb-series-poster.is-empty::after,
.tvdb-catchup-media.is-empty::after,
.tvdb-fav-episode-art.is-empty::after {
    content: "No image";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--tvdb-space-2);
    font-size: var(--tvdb-text-xs);
    color: var(--tvdb-on-ink-faint);
    text-align: center;
}

@media (max-width: 575.98px) {
    /* On a phone the aspect ratio alone decides the height. */
    .tvdb-media { min-height: 0; }
}

.tvdb-slate--inline {
    display: inline-flex;
    align-items: center;
    gap: var(--tvdb-space-2);
    padding: 0.1rem var(--tvdb-space-2);
    border: 1px solid var(--tvdb-signal-halo);
    border-radius: var(--tvdb-radius-sm);
    background: var(--tvdb-ink-2);
    font-family: var(--tvdb-font-mono);
    font-size: var(--tvdb-text-xs);
    letter-spacing: 0.04em;
    color: var(--tvdb-on-ink);
}

.tvdb-dot {
    flex: none;
    width: 7px;
    height: 7px;
    border-radius: var(--tvdb-radius-round);
    background: var(--tvdb-signal);
    box-shadow: 0 0 6px 1px var(--tvdb-signal-edge);
    animation: tvdb-pulse 2.2s ease-in-out infinite;
}

.tvdb-dot.is-ok {
    background: var(--tvdb-ok);
    box-shadow: 0 0 6px 1px var(--tvdb-ok-edge);
}

@keyframes tvdb-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

/* Small thumbnail in a list row. */
.tvdb-thumb {
    flex: none;
    width: 56px;
    height: 84px;
    border-radius: var(--tvdb-radius-sm);
    object-fit: cover;
    background: var(--tvdb-ink-2);
}

.tvdb-thumb.is-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--tvdb-text-xs);
    color: var(--tvdb-on-ink-faint);
    text-align: center;
}

/* A removal that is offered quietly: plain text, confirmed in a modal. */
.tvdb-quiet-action {
    appearance: none;
    padding: var(--tvdb-space-1) 0;
    border: 0;
    background: none;
    font-size: var(--tvdb-text-sm);
    color: var(--tvdb-text-muted);
    text-decoration: underline;
    text-decoration-color: var(--tvdb-ink-line-strong);
    text-underline-offset: 0.15em;
    cursor: pointer;
}

.tvdb-quiet-action:hover,
.tvdb-quiet-action:focus-visible {
    color: var(--tvdb-danger);
    text-decoration-color: currentColor;
}

/* A quiet action that destroys something: danger-coloured before it is touched. */
.tvdb-quiet-action--danger {
    color: var(--tvdb-danger);
    text-decoration-color: var(--tvdb-danger-edge);
}

.tvdb-quiet-action--danger:hover,
.tvdb-quiet-action--danger:focus-visible {
    color: var(--tvdb-danger-ink);
}

/* A setting in a facts list: what it is now, and the button that changes it. */
.tvdb-setting {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--tvdb-space-2) var(--tvdb-space-4);
}

.tvdb-setting__state {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

/* A row of quiet actions (Profile: Sign out, Delete my account). */
.tvdb-quiet-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--tvdb-space-2) var(--tvdb-space-5);
}

/* The last line of a detail page: where the data comes from. */
.tvdb-source-line {
    display: flex;
    flex-wrap: wrap;
    gap: var(--tvdb-space-2) var(--tvdb-space-5);
    margin: var(--tvdb-space-6) 0 0;
    padding-top: var(--tvdb-space-3);
    border-top: 1px solid var(--tvdb-ink-line);
    font-size: var(--tvdb-text-xs);
    color: var(--tvdb-text-muted);
}

/* ---- Badges ----------------------------------------------------------------- */

.tvdb-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--tvdb-space-1);
    padding: 0.2rem var(--tvdb-space-2);
    border: 1px solid transparent;
    border-radius: var(--tvdb-radius-pill);
    font-size: var(--tvdb-text-xs);
    font-weight: 600;
    letter-spacing: 0.04em;
    line-height: var(--tvdb-leading-snug);
    text-transform: uppercase;
}

.tvdb-badge--amber {
    color: var(--tvdb-signal-ink);
    background: var(--tvdb-signal-tint-strong);
    border-color: var(--tvdb-signal-edge);
}

.tvdb-badge--ok {
    color: var(--tvdb-ok-ink);
    background: var(--tvdb-ok-tint);
    border-color: var(--tvdb-ok-edge);
}

.tvdb-badge--info {
    color: var(--tvdb-info-ink);
    background: var(--tvdb-info-tint);
    border-color: var(--tvdb-info-edge);
}

.tvdb-badge--neutral {
    color: var(--tvdb-text-muted);
    background: var(--tvdb-paper-dim);
    border-color: var(--tvdb-ink-line);
}

.tvdb-badge--danger {
    color: var(--tvdb-danger-ink);
    background: var(--tvdb-danger-tint);
    border-color: var(--tvdb-danger-edge);
}

.tvdb-genre-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--tvdb-space-2);
}

/* Role pill on the profile page: neutral, amber for an admin. */
.tvdb-role-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--tvdb-space-2);
    padding: var(--tvdb-space-1) var(--tvdb-space-3);
    border-radius: var(--tvdb-radius-pill);
    font-size: var(--tvdb-text-sm);
    font-weight: 600;
    background: var(--tvdb-paper-dim);
    border: 1px solid var(--tvdb-ink-line);
    color: var(--tvdb-text);
}

.tvdb-role-badge--admin {
    background: var(--tvdb-signal-tint);
    border-color: var(--tvdb-signal-edge);
    color: var(--tvdb-signal-ink);
}

/* ---- Metadata list (dl.row) -------------------------------------------------- */

/* No gutter: the rule under each value then ends where the text column ends. */
dl.row {
    --bs-gutter-x: 0;
}

dl.row dt {
    padding-block: var(--tvdb-space-2);
    padding-right: var(--tvdb-space-3);
    font-size: var(--tvdb-text-xs);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--tvdb-text-muted);
}

dl.row dd {
    padding-block: var(--tvdb-space-2);
    font-size: var(--tvdb-text-sm);
    border-bottom: 1px solid var(--tvdb-ink-line);
}

/* Links. In running text a link is underlined (Bootstrap's default). A link
   that stands on its own in a list or a card (an episode title, a person's
   name, a card title) is .tvdb-link-plain: no underline until hover or focus. */
.tvdb-link-plain {
    color: inherit;
    text-decoration: none;
}

.tvdb-link-plain:hover,
.tvdb-link-plain:focus-visible {
    color: var(--tvdb-signal-text);
    text-decoration: underline;
}

/* A link that is part of a value: ink-coloured with a quiet underline. */
dl.row dd a,
.tvdb-metalink {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: var(--tvdb-ink-line-strong);
    text-underline-offset: 0.15em;
    transition: color var(--tvdb-ease), text-decoration-color var(--tvdb-ease);
}

dl.row dd a:hover,
dl.row dd a:focus-visible,
.tvdb-metalink:hover,
.tvdb-metalink:focus-visible {
    color: var(--tvdb-signal-text);
    text-decoration-color: currentColor;
}

/* Phosphor "arrow-up-right" after a link that leaves the site. */
dl.row dd a[target="_blank"]::after,
.tvdb-metalink[target="_blank"]::after {
    content: "\e092";
    display: inline-block;
    margin-left: 0.25em;
    font-family: "Phosphor";
    font-size: 0.9em;
    color: var(--tvdb-text-muted);
    text-decoration: none;
}

/* Small "Edit" chip next to a value. */
.tvdb-inline-edit {
    padding: 0.1rem var(--tvdb-space-2);
    border: 1px solid var(--tvdb-ink-line-strong);
    border-radius: var(--tvdb-radius-pill);
    font-size: var(--tvdb-text-xs);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-decoration: none;
}

dl.row dd a.tvdb-inline-edit {
    color: var(--tvdb-signal-text);
    text-decoration: none;
}

.tvdb-inline-edit:hover,
.tvdb-inline-edit:focus-visible {
    border-color: var(--tvdb-signal-text);
}

/* ---- Ratings ------------------------------------------------------------------ */

.tvdb-rating-star {
    align-self: center;
    color: var(--tvdb-signal);
}

/* "Your rating": ten pills, each a submit button (the _RatingWidget partial).
   One row of ten; two rows of five on a phone. "Clear" sits beside them. */
.tvdb-rating-picker {
    display: flex;
    flex-direction: column;
    gap: var(--tvdb-space-2);
}

.tvdb-rating-picker-label {
    font-size: var(--tvdb-text-xs);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--tvdb-text-muted);
}

.tvdb-rating-picker-row {
    display: flex;
    align-items: center;
    gap: var(--tvdb-space-3);
}

.tvdb-rating-pills {
    display: grid;
    grid-template-columns: repeat(10, 36px);
    gap: var(--tvdb-space-2);
}

@media (max-width: 575.98px) {
    .tvdb-rating-pills {
        grid-template-columns: repeat(5, 36px);
    }
}

/* A pill is a .tvdb-round-button--md: the shape is shared, the colours are its own. */
.tvdb-rating-pill {
    border-color: var(--tvdb-ink-line-strong);
    background: var(--tvdb-paper-dim);
    color: var(--tvdb-text-muted);
    font-family: var(--tvdb-font-mono);
    font-size: var(--tvdb-text-sm);
}

.tvdb-rating-pill:hover,
.tvdb-rating-pill:focus-visible {
    border-color: var(--tvdb-signal);
    color: var(--tvdb-signal-ink);
}

/* Every pill up to the current rating is tinted; the rating itself is solid. */
.tvdb-rating-pill.is-filled {
    background: var(--tvdb-signal-tint-strong);
    border-color: var(--tvdb-signal-edge);
    color: var(--tvdb-signal-ink);
}

.tvdb-rating-pill.is-current {
    background: var(--tvdb-signal);
    border-color: var(--tvdb-signal);
    color: var(--tvdb-on-signal);
    font-weight: 500;
}

.tvdb-rating-clear {
    appearance: none;
    padding: var(--tvdb-space-1) 0;
    border: 0;
    background: none;
    font-size: var(--tvdb-text-xs);
    color: var(--tvdb-text-muted);
    text-decoration: underline;
    cursor: pointer;
}

.tvdb-rating-clear:hover,
.tvdb-rating-clear:focus-visible {
    color: var(--tvdb-danger);
}

/* ---- Like (the _LikeToggle partial) ---------------------------------------------- */

.tvdb-like-form {
    display: inline-flex;
}

/* The heart's colours. Its shape comes from where it is (LikeToggleModel.Placement):
   a .tvdb-round-button on paper or on a picture, or the action row's square. */
.tvdb-heart .ph,
.tvdb-heart .ph-fill {
    font-size: 1em;
    vertical-align: 0;
}

.tvdb-round-button--on-paper.tvdb-heart {
    color: var(--tvdb-text-muted);
}

.tvdb-heart:hover,
.tvdb-heart:focus-visible {
    color: var(--tvdb-like);
}

.tvdb-round-button--on-paper.tvdb-heart:hover,
.tvdb-round-button--on-paper.tvdb-heart:focus-visible {
    border-color: var(--tvdb-like);
}

.tvdb-round-button--on-paper.tvdb-heart--on {
    color: var(--tvdb-like);
    border-color: var(--tvdb-like-edge);
    background: var(--tvdb-like-tint);
}

.tvdb-round-button--on-image.tvdb-heart--on {
    color: var(--tvdb-like);
}

/* ---- Watched controls on a still ------------------------------------------------
   A Dashboard card's check is a .tvdb-round-button--on-image that turns green
   when it is about to mark (the "⋯" beside it does not: it marks nothing). */
.tvdb-catchup-check .tvdb-round-button:hover,
.tvdb-catchup-check .tvdb-round-button:focus-visible,
.tvdb-series-card-mark .tvdb-round-button:hover,
.tvdb-series-card-mark .tvdb-round-button:focus-visible {
    border-color: var(--tvdb-ok);
    background: var(--tvdb-ok);
    color: var(--tvdb-on-ok);
}

/* ---- Filter bar --------------------------------------------------------------------- */

/* A page heading with its one action on the same line, right-aligned. */
.tvdb-page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--tvdb-space-2) var(--tvdb-space-4);
    margin-bottom: var(--tvdb-space-4);
}

/* Phones: keep them on one line, so the button gives up its icon and some padding. */
@media (max-width: 575.98px) {
    .tvdb-page-head {
        flex-wrap: nowrap;
        gap: var(--tvdb-space-2);
    }

    .tvdb-page-head > h1 {
        min-width: 0;
    }

    .tvdb-page-head > .btn {
        flex: none;
        --bs-btn-padding-x: var(--tvdb-space-3);
    }

    .tvdb-page-head > .btn > i {
        display: none;
    }
}

/* One of a page's sections (an h2 and what belongs to it). Sections are a
   step of space-6 apart on every page; the heading sits space-3 above its
   content (the h2 rule in base.css). */
.tvdb-page-section {
    margin-bottom: var(--tvdb-space-6);
}

.tvdb-page-section:last-child {
    margin-bottom: 0;
}

/* A text page (Privacy): the same rhythm between its headed parts. */
.tvdb-text-page h2 {
    margin-top: var(--tvdb-space-6);
}

/* ---- Titles in lists and on cards ---------------------------------------------------
   Two styles and no others. A row in a list (episode, search result, import
   row, notification, push device) has a title at body size; a card (poster, upcoming,
   liked episode, person, Episode Details' Up next and previous/next) has one a step smaller. Both are the UI face,
   semibold. */
.tvdb-ep__title,
.tvdb-result__title,
.tvdb-import-row__title,
.tvdb-bar-list__name,
.tvdb-notification__title,
.tvdb-device__title {
    font-family: var(--tvdb-font-ui);
    font-size: var(--tvdb-text-md);
    font-weight: 600;
    letter-spacing: 0;
    line-height: var(--tvdb-leading-snug);
}

.tvdb-upcoming-series,
.tvdb-series-title,
.tvdb-fav-episode-show,
.tvdb-person__name,
.tvdb-up-next__title,
.tvdb-episode-nav__title {
    font-size: var(--tvdb-text-sm);
    font-weight: 600;
    line-height: var(--tvdb-leading-snug);
}

/* A group inside a section, under an h3 (the Library's "Haven't watched in a
   while" inside Watching). From 576px its body is a Bootstrap collapse behind
   the "Show N" button; on a phone it is always there, as a scrolling row.
   The Library's Stopped section uses the same toggle and body under its h2. */
.tvdb-subgroup {
    margin-top: var(--tvdb-space-5);
    padding-top: var(--tvdb-space-4);
    border-top: 1px solid var(--tvdb-ink-line);
    scroll-margin-top: var(--tvdb-space-4);
}

.tvdb-subgroup__toggle[aria-expanded="true"] .ph {
    transform: rotate(180deg);
}

@media (max-width: 575.98px) {
    .tvdb-subgroup__body.collapse:not(.show) {
        display: block;
    }
}

/* A one-time offer on a page (the Dashboard's weekly-email card): an icon,
   what is offered, and the two answers. */
.tvdb-offer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--tvdb-space-3) var(--tvdb-space-4);
    padding: var(--tvdb-space-3) var(--tvdb-space-4);
    background: var(--tvdb-signal-tint);
    border: 1px solid var(--tvdb-signal-edge);
    border-radius: var(--tvdb-radius-lg);
}

.tvdb-offer__icon {
    flex: none;
    font-size: var(--tvdb-text-xl);
    color: var(--tvdb-signal-ink);
}

.tvdb-offer__text {
    flex: 1 1 16rem;
    min-width: 0;
}

.tvdb-offer__title {
    margin: 0 0 var(--tvdb-space-1);
    font-family: var(--tvdb-font-ui);
    font-size: var(--tvdb-text-md);
    font-weight: 600;
    letter-spacing: 0;
    line-height: var(--tvdb-leading-snug);
}

.tvdb-offer__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--tvdb-space-2);
}

/* A section heading with a quiet link at the far end ("See all"). */
.tvdb-section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--tvdb-space-3);
    margin-bottom: var(--tvdb-space-3);
}

.tvdb-section-head__link {
    flex: none;
    font-size: var(--tvdb-text-sm);
    font-weight: 600;
    text-decoration: none;
}

.tvdb-section-head__link:hover,
.tvdb-section-head__link:focus-visible {
    text-decoration: underline;
}

/* The filter's own line under the page head, set apart by a rule. */
.tvdb-filter-row {
    margin-bottom: var(--tvdb-space-5);
    padding-bottom: var(--tvdb-space-3);
    border-bottom: 1px solid var(--tvdb-ink-line);
}

.tvdb-filter-bar {
    display: inline-flex;
    flex-wrap: wrap;
    gap: var(--tvdb-space-2);
}

.tvdb-filter-btn--series i { color: var(--tvdb-signal-text); }
.tvdb-filter-btn--movie i { color: var(--tvdb-info); }

/* ---- Poster card and grid (the _SeriesCard partial) --------------------------------- */

/* One row of posters and no more: six across on a desktop; narrower, a row
   that scrolls sideways with the next poster peeking in. */
.tvdb-poster-row {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: clamp(0.75rem, 2vw, 1.5rem);
}

@media (max-width: 991.98px) {
    .tvdb-poster-row {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x proximity;
        margin-inline: calc(-1 * var(--tvdb-shell-pad));
        padding-inline: var(--tvdb-shell-pad);
        scroll-padding-inline: var(--tvdb-shell-pad);
        /* Room for the cards' hover lift and focus ring inside the scroller. */
        padding-block: var(--tvdb-space-1);
    }

    .tvdb-poster-row > .tvdb-series-card-wrap {
        flex: 0 0 clamp(7rem, 30%, 9rem);
        scroll-snap-align: start;
    }
}

/* Two posters across on a phone: big enough to recognise, with room for the
   title and two short lines under each. */
.tvdb-series-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--tvdb-space-4) clamp(0.75rem, 2vw, 1.5rem);
}

@media (min-width: 576px) { .tvdb-series-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 768px) { .tvdb-series-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (min-width: 992px) { .tvdb-series-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }

/* On a phone, a section of posters as one row that scrolls sideways, sized so
   the next poster peeks in at the edge (the cast row's pattern). From 576px it
   is the ordinary grid. */
@media (max-width: 575.98px) {
    .tvdb-series-grid--row-on-phone {
        display: flex;
        gap: var(--tvdb-space-3);
        overflow-x: auto;
        scroll-snap-type: x proximity;
        margin-inline: calc(-1 * var(--tvdb-shell-pad));
        padding-inline: var(--tvdb-shell-pad);
        scroll-padding-inline: var(--tvdb-shell-pad);
        /* Room for the cards' hover lift and focus ring inside the scroller. */
        padding-block: var(--tvdb-space-1);
    }

    .tvdb-series-grid--row-on-phone > .tvdb-series-card-wrap {
        flex: 0 0 calc((100% - 2 * var(--tvdb-space-3)) / 2.4);
        scroll-snap-align: start;
    }
}

/* In the narrow panel there is room for four. */
.tvdb-shell--narrow .tvdb-series-grid {
    grid-template-columns: repeat(3, 1fr);
}

@media (min-width: 576px) {
    .tvdb-shell--narrow .tvdb-series-grid { grid-template-columns: repeat(4, 1fr); }
}

.tvdb-series-card-wrap {
    position: relative;
    display: block;
}

.tvdb-series-card {
    display: flex;
    flex-direction: column;
    color: var(--tvdb-text);
    text-decoration: none;
}

.tvdb-series-card:hover,
.tvdb-series-card:focus-visible {
    color: var(--tvdb-text);
    text-decoration: none;
}

.tvdb-series-poster {
    position: relative;
    display: block;
    aspect-ratio: 2 / 3;
    overflow: hidden;
    background: var(--tvdb-media-bg);
    border: 1px solid var(--tvdb-ink-line);
    border-radius: var(--tvdb-radius-md);
    transition: transform var(--tvdb-ease), box-shadow var(--tvdb-ease), border-color var(--tvdb-ease);
}

.tvdb-series-card:hover .tvdb-series-poster,
.tvdb-series-card:focus-visible .tvdb-series-poster {
    transform: translateY(-2px);
    border-color: var(--tvdb-signal-edge);
    box-shadow: var(--tvdb-shadow-md);
}

.tvdb-series-poster img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Watch progress along the poster's bottom edge: amber in progress, green
   when every aired episode is watched. */
.tvdb-series-progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 4px;
    overflow: hidden;
    background: var(--tvdb-scrim);
}

.tvdb-series-progress-fill {
    display: block;
    height: 100%;
    min-width: 3px;
    background: var(--tvdb-signal);
}

.tvdb-series-progress.is-complete .tvdb-series-progress-fill {
    background: var(--tvdb-ok);
}

.tvdb-series-title {
    display: -webkit-box;
    margin-top: var(--tvdb-space-2);
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.tvdb-series-card:hover .tvdb-series-title,
.tvdb-series-card:focus-visible .tvdb-series-title {
    color: var(--tvdb-signal-text);
    text-decoration: underline;
}

/* "6 of 16 · S05": where the viewer is, in words (the bar on the poster is the glance). */
.tvdb-series-progress-text {
    display: block;
    margin-top: 0.15rem;
    font-family: var(--tvdb-font-mono);
    font-size: var(--tvdb-text-xs);
    color: var(--tvdb-text);
}

/* "Series · 2008", "Movie · watched Sep 25". */
.tvdb-series-year {
    display: block;
    margin-top: 0.15rem;
    font-size: var(--tvdb-text-xs);
    color: var(--tvdb-text-muted);
}

/* The heart overlaid on a poster's top-right corner. */
/* ---- Round buttons on a poster's corners ----------------------------------------------
   Every round --on-image button on a picture sits --tvdb-corner-inset (8px) from
   the picture's outer edges, in every engine: the heart and Discover's "×" top
   right, the add button and a Library Watching card's check bottom right (this
   block), and a Continue watching card's "⋯" and check (the catch-up card, below).
   Each is placed by insets only. Never through a box that gets its size from
   aspect-ratio while it has padding and left/right insets: WebKit (Safari) sizes
   such a box from the stretched width minus its padding, so it came out 16px
   narrower and 24px shorter than the poster, and the bottom-right button sat 24px
   in and 36px up, over the title, while Chromium had it right. The review's
   corner check (CheckCornerButtonsAsync) measures every one, in both engines. */

/* The heart (LikeToggleModel.Placement.Image) and Discover's "×": the poster's top-right corner. */
.tvdb-series-card-like,
.tvdb-discover-card-hide {
    position: absolute;
    top: var(--tvdb-corner-inset);
    right: var(--tvdb-corner-inset);
    z-index: 2;
}

/* The bottom-right one (a Library Watching card's check, Discover's add): an
   overlay the poster's size, with no padding, that lets clicks through to the
   card everywhere but the button, and the button's form pinned to its corner.
   The progress bar (4px) along the poster's bottom stays clear of it. */
.tvdb-series-card-mark {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    width: 100%;
    aspect-ratio: 2 / 3;
    pointer-events: none;
}

.tvdb-series-card-mark > form {
    position: absolute;
    right: var(--tvdb-corner-inset);
    bottom: var(--tvdb-corner-inset);
    margin: 0;
    pointer-events: auto;
}

/* ---- Catch-up card (the _CatchUpCard partial) ----------------------------------------- */

.tvdb-catchup-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: clamp(0.75rem, 2vw, 1.25rem);
}

@media (min-width: 576px) { .tvdb-catchup-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 992px) { .tvdb-catchup-grid { grid-template-columns: repeat(3, 1fr); } }

/* A mark returns to its place in the list (ListPosition): a little room above it. */
.tvdb-catchup-card,
.tvdb-catchup-row,
.tvdb-series-card-wrap[id] {
    scroll-margin-top: var(--tvdb-space-4);
}

/* ...and straight there. Bootstrap scrolls smoothly, which on a page that has
   just loaded is a glide down from the top after every tick. */
:root:has(.tvdb-catchup-card:target, .tvdb-catchup-row:target, .tvdb-series-card-wrap:target) {
    scroll-behavior: auto;
}

.tvdb-catchup-media {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--tvdb-media-bg);
    border: 1px solid var(--tvdb-ink-line);
    border-radius: var(--tvdb-radius-lg);
    transition: box-shadow var(--tvdb-ease), border-color var(--tvdb-ease);
}

.tvdb-catchup-card:hover .tvdb-catchup-media,
.tvdb-catchup-card:focus-within .tvdb-catchup-media {
    border-color: var(--tvdb-signal-edge);
    box-shadow: var(--tvdb-shadow-md);
}

.tvdb-catchup-media img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.tvdb-catchup-card:hover .tvdb-catchup-media img {
    transform: scale(1.03);
}

/* The whole still opens the episode; the caption and button sit above it. */
.tvdb-catchup-hit {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.tvdb-catchup-hit:focus-visible {
    outline-color: var(--tvdb-on-ink);
    outline-offset: -4px;
}

.tvdb-catchup-caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    /* The top padding is the fade; the right padding clears the round button.
       The shade only sits behind the text (a short fade above it), and stops
       short of black, so a dark still or dark background art keeps its detail;
       the text shadow carries the caption over a bright one. */
    padding: var(--tvdb-space-6) 3.5rem var(--tvdb-space-3) var(--tvdb-space-3);
    background: linear-gradient(to top, var(--tvdb-scrim-caption), var(--tvdb-scrim) 55%, transparent);
    text-shadow: var(--tvdb-text-shadow-on-art);
    pointer-events: none;
}

/* The dark placeholder is dark enough already. */
.tvdb-catchup-media.is-empty .tvdb-catchup-caption {
    background: none;
}

/* The caption names the episode; "No image" in the middle adds nothing. */
.tvdb-catchup-media.is-empty::after {
    content: none;
}

.tvdb-catchup-show {
    align-self: flex-start;
    max-width: 100%;
    overflow: hidden;
    font-size: var(--tvdb-text-md);
    font-weight: 600;
    line-height: var(--tvdb-leading-snug);
    color: var(--tvdb-on-ink);
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
    pointer-events: auto;
}

.tvdb-catchup-show:hover,
.tvdb-catchup-show:focus-visible {
    color: var(--tvdb-signal);
    text-decoration: underline;
}

.tvdb-catchup-slate {
    font-family: var(--tvdb-font-mono);
    font-size: var(--tvdb-text-xs);
    letter-spacing: 0.04em;
    color: var(--tvdb-on-ink);
}

.tvdb-catchup-ep {
    overflow: hidden;
    font-size: var(--tvdb-text-sm);
    line-height: var(--tvdb-leading-snug);
    color: var(--tvdb-on-ink);
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* The check and the "⋯" sit inside the still's frame, which has a 1px border, so
   they are placed 1px less than the corner inset: --tvdb-corner-inset from the
   frame's outer edge, like the buttons on a poster (see "Round buttons on a
   poster's corners"). */
.tvdb-catchup-check {
    position: absolute;
    right: calc(var(--tvdb-corner-inset) - 1px);
    bottom: calc(var(--tvdb-corner-inset) - 1px);
    z-index: 3;
    margin: 0;
}

/* The card's "⋯" menu, in the corner opposite the caption. One step above the
   other controls so its open menu covers the next card's button too. */
.tvdb-catchup-menu {
    position: absolute;
    top: calc(var(--tvdb-corner-inset) - 1px);
    right: calc(var(--tvdb-corner-inset) - 1px);
    z-index: 4;
}

/* ---- Upcoming card (the _UpcomingEpisodeCard partial) ----------------------------------
   Compact: a small poster, the episode, then the date with its countdown. Two
   columns of cards from tablet width up. */

.tvdb-upcoming-list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--tvdb-space-2);
}

@media (min-width: 768px) {
    .tvdb-upcoming-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Left edge: green when the viewer is caught up on the series, amber otherwise. */
.tvdb-upcoming-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--tvdb-space-3);
    padding: var(--tvdb-space-2);
    background: var(--tvdb-paper-dim);
    border: 1px solid var(--tvdb-ink-line);
    border-left: 3px solid var(--tvdb-signal);
    border-radius: var(--tvdb-radius-md);
    transition: box-shadow var(--tvdb-ease);
}

.tvdb-upcoming-card.is-current {
    border-left-color: var(--tvdb-ok);
}

.tvdb-upcoming-card:hover,
.tvdb-upcoming-card:focus-within {
    box-shadow: var(--tvdb-shadow-sm);
}

.tvdb-upcoming-hit {
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: inherit;
}

.tvdb-upcoming-card .tvdb-thumb {
    position: relative;
    z-index: 0;
    width: 40px;
    height: 60px;
}

/* The date comes after the episode it belongs to, as a secondary line:
   right-aligned and stacked on wide cards, the last line of the text column
   on a phone (see the media query below). */
.tvdb-upcoming-when {
    flex: none;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.15rem;
    text-align: right;
    pointer-events: none;
}

.tvdb-upcoming-date {
    font-size: var(--tvdb-text-sm);
    line-height: var(--tvdb-leading-snug);
    color: var(--tvdb-text-muted);
    white-space: nowrap;
}

.tvdb-upcoming-sep {
    display: none;
}

.tvdb-upcoming-countdown {
    font-family: var(--tvdb-font-mono);
    font-size: var(--tvdb-text-xs);
    line-height: var(--tvdb-leading-snug);
    color: var(--tvdb-text-muted);
    white-space: nowrap;
}

/* Clicks fall through the text to the card link; the series name opts back in. */
.tvdb-upcoming-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    pointer-events: none;
}

.tvdb-upcoming-series {
    position: relative;
    z-index: 2;
    align-self: flex-start;
    max-width: 100%;
    overflow: hidden;
    color: var(--tvdb-text);
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
    pointer-events: auto;
}

.tvdb-upcoming-series:hover,
.tvdb-upcoming-series:focus-visible {
    color: var(--tvdb-signal-text);
    text-decoration: underline;
}

/* "S02 • E06  Episode name" on one line; the name gives way first. */
.tvdb-upcoming-episode {
    display: flex;
    align-items: baseline;
    gap: var(--tvdb-space-2);
    min-width: 0;
    font-size: var(--tvdb-text-sm);
    line-height: var(--tvdb-leading-snug);
}

.tvdb-upcoming-episode .tvdb-slate--inline {
    flex: none;
}

.tvdb-upcoming-epname {
    min-width: 0;
    overflow: hidden;
    color: var(--tvdb-text-muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tvdb-upcoming-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--tvdb-space-1);
    padding-top: 0.15rem;
}

/* Phones: everything beside the poster is one text column, the date line last
   ("Sun, Oct 4 · in 2 days"). */
@media (max-width: 575.98px) {
    .tvdb-upcoming-card {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        align-content: center;
        column-gap: var(--tvdb-space-3);
        row-gap: 0.15rem;
    }

    .tvdb-upcoming-card .tvdb-thumb {
        grid-row: 1 / span 2;
        align-self: center;
    }

    .tvdb-upcoming-body {
        align-self: end;
    }

    .tvdb-upcoming-card > .tvdb-upcoming-body:last-child {
        grid-row: 1 / span 2;
        align-self: center;
    }

    .tvdb-upcoming-when {
        grid-column: 2;
        align-self: start;
        flex-direction: row;
        align-items: baseline;
        gap: var(--tvdb-space-1);
        text-align: left;
    }

    .tvdb-upcoming-sep {
        display: inline;
        color: var(--tvdb-text-muted);
    }
}

/* ---- Liked-episode card (the _FavoriteEpisodeCard partial) ---------------------------- */

.tvdb-fav-episode-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--tvdb-space-4) clamp(0.75rem, 2vw, 1.25rem);
}

@media (min-width: 576px) { .tvdb-fav-episode-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 992px) { .tvdb-fav-episode-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.tvdb-fav-episode {
    display: flex;
    flex-direction: column;
    min-width: 0;
    color: var(--tvdb-text);
    text-decoration: none;
}

.tvdb-fav-episode:hover,
.tvdb-fav-episode:focus-visible {
    color: var(--tvdb-text);
    text-decoration: none;
}

.tvdb-fav-episode-art {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    margin-bottom: var(--tvdb-space-2);
    overflow: hidden;
    background: var(--tvdb-media-bg);
    border: 1px solid var(--tvdb-ink-line);
    border-radius: var(--tvdb-radius-md);
    transition: border-color var(--tvdb-ease), box-shadow var(--tvdb-ease);
}

.tvdb-fav-episode:hover .tvdb-fav-episode-art,
.tvdb-fav-episode:focus-visible .tvdb-fav-episode-art {
    border-color: var(--tvdb-signal-edge);
    box-shadow: var(--tvdb-shadow-sm);
}

.tvdb-fav-episode-art img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tvdb-fav-episode-show {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tvdb-fav-episode:hover .tvdb-fav-episode-show,
.tvdb-fav-episode:focus-visible .tvdb-fav-episode-show {
    color: var(--tvdb-signal-text);
    text-decoration: underline;
}

.tvdb-fav-episode-meta {
    display: -webkit-box;
    overflow: hidden;
    margin-top: 0.15rem;
    font-size: var(--tvdb-text-sm);
    line-height: var(--tvdb-leading-snug);
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.tvdb-fav-episode-date {
    margin-top: 0.15rem;
    font-size: var(--tvdb-text-xs);
    color: var(--tvdb-text-muted);
}

/* ---- Title hero (the _TitleHero partial) ------------------------------------------------
   The top of a detail page, on the dark frame and as wide as the page (it
   reaches the container's edges, so on a phone the screen's). The background
   art is an <img> under --tvdb-hero-shade; without art the hero is
   --tvdb-hero-bg. The content lines up with the panel below it. */

.tvdb-hero {
    position: relative;
    isolation: isolate;
    margin-inline: calc(var(--bs-gutter-x) * -0.5);
    margin-bottom: var(--tvdb-space-4);
    overflow: hidden;
    background: var(--tvdb-hero-bg);
    color: var(--tvdb-on-ink);
}

.tvdb-hero__art {
    position: absolute;
    inset: 0;
    z-index: -2;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 20%;
}

/* Three shades over the art (see --tvdb-hero-shade in tokens.css), all at
   z-index -1 in the hero's stacking context, painted in this order: the top
   shade, the heading block's (.tvdb-hero__head::before, from the title down,
   whatever the title's height in the hero), and the end shade. */
.tvdb-hero.has-art::before,
.tvdb-hero.has-art::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}

.tvdb-hero.has-art::before {
    background: var(--tvdb-hero-shade);
}

.tvdb-hero.has-art::after {
    background: var(--tvdb-hero-end-shade);
}

/* From the heading block down, across the whole hero (its overflow clips it). */
.tvdb-hero.has-art .tvdb-hero__head::before {
    content: "";
    position: absolute;
    z-index: -1;
    top: calc(var(--tvdb-space-6) * -1);
    right: -100vw;
    bottom: -100vh;
    left: -100vw;
    background: var(--tvdb-hero-text-shade);
    pointer-events: none;
}

/* With art, a band between the way back and the title where the picture shows:
   on a phone only when there is no poster (a poster's row is that band). */
.tvdb-hero--no-poster.has-art .tvdb-hero__back {
    margin-bottom: var(--tvdb-space-7);
}

@media (min-width: 576px) {
    .tvdb-hero.has-art .tvdb-hero__back {
        margin-bottom: calc(var(--tvdb-space-7) * 2);
    }
}

.tvdb-hero__inner {
    display: flex;
    flex-direction: column;
    gap: var(--tvdb-space-4);
    max-width: var(--tvdb-width-full);
    margin: 0 auto;
    padding: var(--tvdb-space-4) var(--tvdb-shell-pad) var(--tvdb-space-5);
}

.tvdb-hero__back {
    align-self: flex-start;
    max-width: 100%;
    margin-bottom: 0;
    color: var(--tvdb-on-ink-muted);
}

/* One line, so it stays on the shade behind it (an episode's way back is its series' name). */
.tvdb-hero__back-text {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.tvdb-hero__back:hover,
.tvdb-hero__back:focus-visible {
    color: var(--tvdb-on-ink);
}

/* Poster beside the heading block; on a phone the block wraps under it. */
.tvdb-hero__title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--tvdb-space-4) var(--tvdb-space-5);
}

.tvdb-hero__poster {
    flex: 0 0 var(--tvdb-width-hero-poster);
    width: var(--tvdb-width-hero-poster);
    min-height: 0;
    margin-inline: 0;
    border-radius: var(--tvdb-radius-md);
    box-shadow: var(--tvdb-shadow-lg);
}

.tvdb-hero__head {
    position: relative;
    flex: 1 1 18rem;
    min-width: 0;
}

/* No poster (an episode): the heading block keeps the poster's height, so the
   hero is as tall as a series' and the title sits at the same place. */
.tvdb-hero--no-poster .tvdb-hero__title-row {
    min-height: calc(var(--tvdb-width-hero-poster) * 3 / 2);
}

/* What the title belongs to (an episode's series), above it. */
.tvdb-hero__parent {
    display: inline-block;
    margin-bottom: var(--tvdb-space-1);
    font-size: var(--tvdb-text-md);
    font-weight: 600;
    color: var(--tvdb-on-ink);
    text-shadow: var(--tvdb-text-shadow-on-art);
}

.tvdb-hero__parent:hover,
.tvdb-hero__parent:focus-visible {
    color: var(--tvdb-signal);
}

.tvdb-hero__chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--tvdb-space-2);
    margin: 0 0 var(--tvdb-space-2);
}

.tvdb-hero-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--tvdb-space-1);
    padding: 0.2rem var(--tvdb-space-2);
    border: 1px solid var(--tvdb-on-ink-line);
    border-radius: var(--tvdb-radius-pill);
    background: var(--tvdb-on-ink-wash);
    font-size: var(--tvdb-text-xs);
    font-weight: 600;
    line-height: var(--tvdb-leading-snug);
    color: var(--tvdb-on-ink);
}

.tvdb-hero-chip--status {
    color: var(--tvdb-on-ink-muted);
}

.tvdb-hero-chip--status.is-active {
    border-color: var(--tvdb-ok-edge);
    color: var(--tvdb-ok-on-ink);
}

.tvdb-hero__title {
    margin: 0 0 var(--tvdb-space-1);
    font-size: clamp(var(--tvdb-text-2xl), 5vw, var(--tvdb-text-3xl));
    overflow-wrap: anywhere;
    text-shadow: var(--tvdb-text-shadow-on-art);
}

.tvdb-hero__meta {
    margin: 0 0 var(--tvdb-space-2);
    font-size: var(--tvdb-text-sm);
    color: var(--tvdb-on-ink-muted);
}

.tvdb-hero__ratings {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--tvdb-space-2);
    font-size: var(--tvdb-text-sm);
}

.tvdb-hero__rating {
    display: inline-flex;
    align-items: baseline;
    gap: var(--tvdb-space-1);
    white-space: nowrap;
}

.tvdb-hero__rating .ph-fill,
.tvdb-hero-chip--button .ph-fill {
    align-self: center;
    color: var(--tvdb-signal);
}

.tvdb-hero__sep {
    color: var(--tvdb-on-ink-faint);
}

/* "Your rating 9" / "Rate": a disclosure with the 1-10 pills on paper. Open,
   it takes the whole line, so the pills never squeeze beside the ratings. */
.tvdb-rating-disclosure[open] {
    flex-basis: 100%;
}

.tvdb-hero-chip--button {
    min-height: 36px;
    padding-inline: var(--tvdb-space-3);
    cursor: pointer;
    list-style: none;
    transition: border-color var(--tvdb-ease), background var(--tvdb-ease);
}

.tvdb-hero-chip--button::-webkit-details-marker {
    display: none;
}

.tvdb-hero-chip--button:hover,
.tvdb-rating-disclosure[open] > .tvdb-hero-chip--button {
    border-color: var(--tvdb-on-ink);
}

.tvdb-hero-chip--button.is-rated {
    border-color: var(--tvdb-signal-edge);
}

/* Closed, the panel is not laid out at all (some browsers measure the hidden content). */
.tvdb-rating-disclosure:not([open]) > .tvdb-rating-disclosure__panel {
    display: none;
}

.tvdb-rating-disclosure__panel {
    width: fit-content;
    max-width: 100%;
    margin-top: var(--tvdb-space-2);
    padding: var(--tvdb-space-3) var(--tvdb-space-4);
    border-radius: var(--tvdb-radius-md);
    background: var(--tvdb-paper);
    box-shadow: var(--tvdb-shadow-md);
}

/* Progress through the series: counts, a bar, the last watch. */
.tvdb-hero__progress {
    padding: var(--tvdb-space-3) var(--tvdb-space-4);
    border: 1px solid var(--tvdb-line);
    border-radius: var(--tvdb-radius-md);
    background: var(--tvdb-on-ink-wash);
}

/* Words people read, so the UI face, not mono; the count is the figure that matters. */
.tvdb-hero__progress-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: var(--tvdb-space-1) var(--tvdb-space-3);
    font-family: var(--tvdb-font-ui);
    font-size: var(--tvdb-text-sm);
}

.tvdb-hero__progress-count {
    font-weight: 600;
}

.tvdb-hero__bar {
    --bs-progress-height: 6px;
    --bs-progress-bg: var(--tvdb-on-ink-line);
    margin-block: var(--tvdb-space-2);
}

.tvdb-hero__bar .progress-bar {
    width: var(--tvdb-bar, 0%);
}

.tvdb-hero__last {
    margin: 0;
    font-size: var(--tvdb-text-xs);
    color: var(--tvdb-on-ink-muted);
}

/* ---- Up next (the _UpNextCard partial) -------------------------------------------------
   Episode Details' next episode, under the action row: on paper like the
   sign-in card. The still, the text (one line for the title, with an
   ellipsis), then the 44px control of Series Details' rows (.tvdb-ep-mark). */

.tvdb-up-next {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--tvdb-space-3);
    padding: var(--tvdb-space-2) var(--tvdb-space-3) var(--tvdb-space-2) var(--tvdb-space-2);
    border: 1px solid var(--tvdb-ink-line);
    border-radius: var(--tvdb-radius-md);
    background: var(--tvdb-paper);
    color: var(--tvdb-text);
}

.tvdb-up-next__still {
    position: relative;
    width: 112px;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: var(--tvdb-radius-sm);
    background: var(--tvdb-media-bg);
}

.tvdb-up-next__still img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tvdb-up-next__text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.tvdb-up-next__eyebrow {
    margin: 0;
}

.tvdb-up-next__title {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.tvdb-up-next__date {
    font-size: var(--tvdb-text-sm);
}

.tvdb-up-next__control {
    display: flex;
}

@media (max-width: 575.98px) {
    .tvdb-up-next__still {
        width: 88px;
    }
}

/* ---- Title actions (the _TitleActions partial) -------------------------------------------
   One full-width primary button (or the quiet status box), then three 56px
   square icon buttons: "⋯", the heart and Share. On the dark frame. */

.tvdb-title-actions {
    display: flex;
    flex-direction: column;
    gap: var(--tvdb-space-2);
}

.tvdb-title-actions__notice {
    display: flex;
    align-items: center;
    gap: var(--tvdb-space-2);
    margin: 0;
    font-size: var(--tvdb-text-sm);
    color: var(--tvdb-on-ink-muted);
}

.tvdb-title-actions__row {
    display: flex;
    align-items: stretch;
    gap: var(--tvdb-space-2);
}

.tvdb-title-actions__primary {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
}

.tvdb-primary-action {
    --bs-btn-font-size: var(--tvdb-text-md);
    --bs-btn-font-weight: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 56px;
    line-height: var(--tvdb-leading-snug);
}

.tvdb-primary-action__label {
    display: inline-flex;
    align-items: center;
    gap: var(--tvdb-space-2);
}

.tvdb-primary-action__detail {
    font-size: var(--tvdb-text-xs);
    font-weight: 400;
}

.tvdb-status-box {
    align-items: center;
    gap: var(--tvdb-space-3);
    min-height: 56px;
    padding: var(--tvdb-space-2) var(--tvdb-space-4);
    border: 1px solid var(--tvdb-ok-edge);
    border-radius: var(--tvdb-radius-md);
    background: var(--tvdb-ok-tint);
}

/* Something still to come, not something done: the frame's quiet colours. */
.tvdb-status-box--neutral {
    border-color: var(--tvdb-on-ink-line);
    background: var(--tvdb-on-ink-wash);
}

.tvdb-status-box--neutral .tvdb-status-box__icon {
    color: var(--tvdb-on-ink-muted);
}

.tvdb-status-box__icon {
    flex: none;
    font-size: var(--tvdb-text-xl);
    color: var(--tvdb-ok-on-ink);
}

.tvdb-status-box__text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: var(--tvdb-leading-snug);
}

.tvdb-status-box__label {
    font-weight: 600;
}

.tvdb-status-box__detail {
    font-size: var(--tvdb-text-sm);
    color: var(--tvdb-on-ink-muted);
}

.tvdb-square-button,
.tvdb-title-actions .tvdb-heart {
    appearance: none;
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    padding: 0;
    border: 1px solid var(--tvdb-on-ink-line);
    border-radius: var(--tvdb-radius-md);
    background: var(--tvdb-on-ink-wash);
    color: var(--tvdb-on-ink);
    font-size: var(--tvdb-text-xl);
    cursor: pointer;
    transition: border-color var(--tvdb-ease), background var(--tvdb-ease), color var(--tvdb-ease);
}

.tvdb-square-button .ph {
    font-size: 1em;
    vertical-align: 0;
}

.tvdb-square-button:hover,
.tvdb-square-button:focus-visible,
.tvdb-square-button.show {
    border-color: var(--tvdb-on-ink);
    background: var(--tvdb-ink-3);
}

/* A square toggle that is on (a movie on the watchlist). */
.tvdb-square-button[aria-pressed="true"] {
    border-color: var(--tvdb-signal-edge);
    background: var(--tvdb-signal-tint);
    color: var(--tvdb-signal);
}

.tvdb-square-form {
    display: flex;
}

.tvdb-title-actions .tvdb-heart:hover,
.tvdb-title-actions .tvdb-heart:focus-visible {
    border-color: var(--tvdb-like);
    color: var(--tvdb-like);
}

.tvdb-title-actions .tvdb-heart--on {
    border-color: var(--tvdb-like-edge);
    background: var(--tvdb-like-tint);
    color: var(--tvdb-like);
}

/* On a phone the primary takes the whole line, and the squares sit under it,
   sharing that line equally (each still at least 56px tall). */
@media (max-width: 575.98px) {
    .tvdb-title-actions__row {
        flex-wrap: wrap;
    }

    .tvdb-title-actions__primary {
        flex-basis: 100%;
    }

    .tvdb-title-actions__row > :not(.tvdb-title-actions__primary):not(template) {
        display: flex;
        flex: 1 1 0;
        min-width: 0;
    }

    .tvdb-title-actions__row .tvdb-square-button,
    .tvdb-title-actions__row .tvdb-heart {
        width: 100%;
        height: auto;
        min-height: 56px;
    }
}

/* ---- Cast and crew (the _CastList partial) ---------------------------------------------
   A list of people: a 40px round photo (or initials) with the name and the
   character or jobs beside it. In two columns from 576px, or in one at every
   width (--column, a side column). Collapsed until "Show all" is pressed,
   by count, never by height: the first six people in one column, the first
   eight in two (full rows), and the rest not rendered at all. tvdb-cast.js
   offers the button only when someone is hidden. */

.tvdb-cast {
    margin-top: var(--tvdb-space-6);
}

.tvdb-cast__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--tvdb-space-3);
    margin-bottom: var(--tvdb-space-3);
}

.tvdb-cast__list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    column-gap: var(--tvdb-space-5);
    margin: 0;
}

@media (min-width: 576px) {
    .tvdb-cast:not(.tvdb-cast--column) .tvdb-cast__list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* The collapse: six in one column... */
.tvdb-cast:not(.is-expanded) .tvdb-person:nth-child(n + 7) {
    display: none;
}

/* ...eight (four full rows) in two. */
@media (min-width: 576px) {
    .tvdb-cast:not(.tvdb-cast--column):not(.is-expanded) .tvdb-person:nth-child(7),
    .tvdb-cast:not(.tvdb-cast--column):not(.is-expanded) .tvdb-person:nth-child(8) {
        display: grid;
    }
}

.tvdb-cast.is-expanded .tvdb-cast__toggle .ph {
    transform: rotate(180deg);
}

.tvdb-person {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    column-gap: var(--tvdb-space-3);
    align-content: center;
    align-items: center;
    min-width: 0;
    padding-bottom: var(--tvdb-space-3);
}

/* A .tvdb-round-avatar--md: a photo, or initials. */
.tvdb-person__photo {
    grid-row: 1 / span 2;
}

.tvdb-person__name,
.tvdb-person__detail {
    grid-column: 2;
    overflow-wrap: anywhere;
}

.tvdb-person__detail {
    font-size: var(--tvdb-text-xs);
    line-height: var(--tvdb-leading-snug);
    color: var(--tvdb-text-muted);
}

/* A person with no character or job listed: the name centres on the avatar. */
.tvdb-person__name:last-child {
    grid-row: 1 / span 2;
}

/* ---- Toasts (the _ToastMessages partial) --------------------------------------------------
   A fixed stack at the bottom right, dark so it reads over any page. A toast
   that closes itself has a countdown bar along its bottom edge; the bar's
   animation is the timer (js/tvdb-toasts.js closes the toast when it ends). */

.tvdb-toast-stack {
    position: fixed;
    z-index: 1080;
    right: var(--tvdb-space-4);
    bottom: var(--tvdb-space-4);
    display: flex;
    flex-direction: column;
    gap: var(--tvdb-space-2);
    width: min(380px, calc(100vw - 2rem));
    pointer-events: none;
}

.tvdb-toast-stack .alert {
    --bs-alert-color: var(--tvdb-on-ink);
    --bs-alert-bg: var(--tvdb-ink-2);
    --bs-alert-border-color: var(--tvdb-line);
    --bs-alert-padding-x: var(--tvdb-space-3);
    --bs-alert-padding-y: var(--tvdb-space-3);
    --bs-alert-margin-bottom: 0;
    --bs-secondary-bg: var(--tvdb-ink-3);
    --tvdb-focus: var(--tvdb-signal);

    display: flex;
    align-items: center;
    gap: var(--tvdb-space-3);
    border-left-width: 4px;
    font-size: var(--tvdb-text-sm);
    box-shadow: var(--tvdb-shadow-lg);
    pointer-events: auto;
    animation: tvdb-toast-in 0.25s ease-out;

    /* The countdown bar is clipped to the rounded corners. */
    overflow: hidden;
    border-left-color: var(--tvdb-toast-accent);
}

/* The countdown: full width at the start, nothing when the time is up. It only
   runs once the script has taken charge (data-toast-running), so a page
   without script keeps its toasts. */
.tvdb-toast-timer {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--tvdb-toast-accent);
    transform-origin: left center;
}

.tvdb-toast[data-toast-running] .tvdb-toast-timer {
    animation: tvdb-toast-countdown var(--tvdb-toast-duration) linear forwards;
}

/* Paused while the toast is being read or used, and while the tab is hidden. */
.tvdb-toast:hover .tvdb-toast-timer,
.tvdb-toast:focus-within .tvdb-toast-timer,
.tvdb-toast-stack[data-toast-paused] .tvdb-toast-timer {
    animation-play-state: paused;
}

@keyframes tvdb-toast-countdown {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

.tvdb-toast-icon {
    flex: none;
    font-size: var(--tvdb-text-lg);
}

.tvdb-toast-text {
    flex: 1 1 auto;
    min-width: 0;
}

/* The accent of each kind: its left edge and its countdown bar. */
.tvdb-toast-stack .alert-success { --tvdb-toast-accent: var(--tvdb-ok); }
.tvdb-toast-stack .alert-success .tvdb-toast-icon { color: var(--tvdb-ok); }
/* "You've finished ..." gets the trophy in amber. */
.tvdb-toast-stack .alert-success .tvdb-toast-icon--finished { color: var(--tvdb-signal); }
.tvdb-toast-stack .alert-danger { --tvdb-toast-accent: var(--tvdb-danger); }
.tvdb-toast-stack .alert-danger .tvdb-toast-icon { color: var(--tvdb-danger-on-ink); }
.tvdb-toast-stack .alert-warning { --tvdb-toast-accent: var(--tvdb-signal); }
.tvdb-toast-stack .alert-warning .tvdb-toast-icon { color: var(--tvdb-signal); }
.tvdb-toast-stack .alert-info { --tvdb-toast-accent: var(--tvdb-info); }
.tvdb-toast-stack .alert-info .tvdb-toast-icon { color: var(--tvdb-info-on-ink); }

/* "Undo" and friends: amber, so it stands out on the dark toast. */
.tvdb-toast-action {
    appearance: none;
    flex: none;
    padding: var(--tvdb-space-1) var(--tvdb-space-3);
    border: 1px solid var(--tvdb-signal);
    border-radius: var(--tvdb-radius-md);
    background: transparent;
    color: var(--tvdb-signal);
    font-size: var(--tvdb-text-sm);
    font-weight: 600;
    text-decoration: none;   /* it is a link in the "Rate it" toast */
    cursor: pointer;
    transition: background var(--tvdb-ease), color var(--tvdb-ease);
}

.tvdb-toast-action:hover,
.tvdb-toast-action:focus-visible {
    background: var(--tvdb-signal);
    color: var(--tvdb-on-signal);
}

@keyframes tvdb-toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

@media (max-width: 480px) {
    .tvdb-toast-stack {
        left: var(--tvdb-space-4);
        width: auto;
    }

    /* A caught-up toast with actions ("Rate it", "Undo") says more than fits
       beside them on a phone: the sentence gets the first line to itself and
       the actions go under it. */
    .tvdb-toast-stack .alert[data-toast-kind][data-toast-actions] {
        flex-wrap: wrap;
    }

    .tvdb-toast-stack .alert[data-toast-kind][data-toast-actions] .tvdb-toast-text {
        flex-basis: calc(100% - 3rem);
    }

    .tvdb-toast-stack .alert[data-toast-kind][data-toast-actions] .tvdb-close {
        margin-left: auto;
    }
}

/* ---- Motion ------------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    .tvdb-dot,
    .tvdb-toast-stack .alert {
        animation: none;
    }

    /* The bar is not shown, but it still keeps the time: its animation runs
       (and pauses) as usual, and the toast closes when it ends. */
    .tvdb-toast-timer {
        opacity: 0;
    }

    .tvdb-series-poster,
    .tvdb-catchup-media img {
        transition: none;
    }

    .tvdb-series-card:hover .tvdb-series-poster,
    .tvdb-series-card:focus-visible .tvdb-series-poster,
    .tvdb-catchup-card:hover .tvdb-catchup-media img {
        transform: none;
    }
}
