* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    max-width: 100%;
    /* Keep viewport width stable when overlays toggle body overflow (prevents breakpoint flicker). */
    scrollbar-gutter: stable;
}

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

/* SNL typography: Oswald = Trade Gothic alternative (title graphics), Helvetica Neue = informational */
:root {
    --font-display: 'Oswald', 'League Gothic', sans-serif;
    --font-body: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    /* Sketch list: neat pen / school-hand — light weights only */
    --font-sketch-hand: 'Kalam', 'Segoe Print', 'Bradley Hand', cursive;
    --top-tray-height: 80px;
    /* Match search field to pill buttons on one tray row */
    --tray-control-height: 26px;
    /* WU anchor: steel-blue disc + cyan rim (lighter than near-black, still not “Office” pastel) */
    --wu-badge-bg: linear-gradient(165deg, #5a7a96 0%, #446888 42%, #355a74 100%);
    --wu-badge-border: rgba(56, 189, 248, 0.5);
    --wu-badge-text: #f8fafc;
    --wu-badge-shine: inset 0 1px 0 rgba(255, 255, 255, 0.22);
    --wu-badge-outer: 0 0 0 1px rgba(255, 255, 255, 0.16), 0 1px 4px rgba(15, 23, 42, 0.28),
        0 0 14px rgba(34, 211, 238, 0.16);
    --wu-medallion-px: 14px;
    --site-credit-height: 22px;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    background: #FFFFFF;
    overflow-x: hidden;
    max-width: 100%;
    padding: 20px;
    padding-bottom: calc(20px + var(--site-credit-height));
}

.site-credit {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: var(--site-credit-height);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    font-family: var(--font-body);
    font-size: 11px;
    letter-spacing: 0.02em;
    color: rgba(15, 23, 42, 0.55);
    pointer-events: auto;
    z-index: 1002;
    padding: 0 10px env(safe-area-inset-bottom, 0px);
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(10px);
}

.site-credit-link {
    color: inherit;
    text-decoration: none;
    font-weight: 600;
}

.site-credit-link:hover,
.site-credit-link:focus-visible {
    text-decoration: underline;
}

body.pref-night .site-credit {
    color: rgba(226, 232, 240, 0.55);
}

/* Desktop writers view: don't show DOB meta line in hover tooltips. */
@media (min-width: 769px) {
    body.writers-view .square-tooltip-meta {
        display: none !important;
    }
}

@media (max-width: 768px) {
    :root { --site-credit-height: 20px; }
    body { padding-bottom: calc(8px + var(--mobile-mode-dock-height) + var(--site-credit-height) + env(safe-area-inset-bottom, 0px)); }
    .site-credit {
        justify-content: flex-start;
        padding-left: 10px;
        padding-right: 10px;
    }
}

/* Top filter tray — full-bleed chrome; inner row is width-capped */
.filter-tray {
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    z-index: 1001;
    background: #ffffff;
    border-bottom: 1px solid rgba(15, 23, 42, 0.05);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.85) inset, 0 6px 20px rgba(15, 23, 42, 0.04);
    min-height: var(--top-tray-height);
}

/* Slim line above chrome: Wikipedia mini-portrait resolution (script.js injects #miniPortraitLoadBar) */
.mini-portrait-load-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    z-index: 1202;
    pointer-events: none;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.mini-portrait-load-bar.is-active {
    opacity: 1;
}

.mini-portrait-load-bar-fill {
    height: 100%;
    width: 0%;
    min-width: 0;
    border-radius: 0 1px 1px 0;
    background: linear-gradient(90deg, #b8860f, #0d9488);
    box-shadow: 0 0 12px rgba(13, 148, 136, 0.28);
    transform-origin: left center;
    transition: width 0.14s ease-out;
}

body.pref-night .mini-portrait-load-bar-fill {
    background: linear-gradient(90deg, #eab308, #22d3ee);
    box-shadow: 0 0 12px rgba(34, 211, 238, 0.22);
}

.filter-tray-inner {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: clamp(10px, 1.6vw, 20px);
    box-sizing: border-box;
    width: min(1180px, calc(100% - clamp(40px, 10vw, 120px)));
    max-width: 100%;
    min-height: var(--top-tray-height);
    height: var(--top-tray-height);
    margin-inline: auto;
    /* Reserve space for display menu burger (outside this row, top-right of tray) */
    padding: 6px 52px 6px 0;
    background: transparent;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
}

.filter-tray-inner::-webkit-scrollbar {
    height: 3px;
}

.filter-tray-inner::-webkit-scrollbar-thumb {
    background: rgba(15, 23, 42, 0.18);
    border-radius: 999px;
}

.tray-brand {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 4px;
    min-width: 0;
    flex-shrink: 0;
}

/* Chunky broadcast-style wordmark — tagline sits directly below (same visual unit) */
.tray-brand-snl {
    font-family: var(--font-display);
    font-size: clamp(28px, 3.5vw, 38px);
    font-weight: 700;
    line-height: 0.68;
    letter-spacing: -0.04em;
    color: #0a0a0a;
    text-transform: uppercase;
    text-decoration: none;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
    -webkit-font-smoothing: antialiased;
    cursor: pointer;
    transition: opacity 0.15s ease, color 0.15s ease;
}

.tray-brand-snl:hover {
    opacity: 1;
    color: #262626;
}

.tray-brand-snl:focus-visible {
    outline: 2px solid rgba(250, 204, 21, 0.9);
    outline-offset: 2px;
    border-radius: 2px;
}

.tray-brand-title {
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.04em;
    line-height: 1.2;
    color: #374151;
    margin-top: 0;
    white-space: nowrap;
}


.tray-controls {
    display: flex;
    align-items: center;
    margin-left: auto;
    padding-right: clamp(16px, 3.2vw, 40px);
    min-width: 0;
    flex-shrink: 0;
}

.tray-section {
    display: flex;
    flex-direction: column;
    gap: 0;
    align-items: flex-start;
}

.tray-section-label {
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(15, 23, 42, 0.48);
    user-select: none;
}

/* Inline search within tray */
.search-wrap-inline {
    margin: 0;
}

.tray-section-view {
    min-width: 0;
}

/* Search + Debut sit directly after the SNL block; center vs. taller stacked wordmark */
.filter-tray-inner > .tray-section-search {
    align-self: center;
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    max-width: min(280px, 34vw);
    align-items: center;
    justify-content: center;
}

.tray-search-stack {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
}

.tray-search-stack .search-wrap.search-wrap-inline {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 200px;
    margin: 0;
    margin-bottom: 0;
}

/* Compact field — same box height as view pills / Debut so one baseline row */
.tray-section-search .search-input {
    box-sizing: border-box;
    height: var(--tray-control-height);
    min-height: var(--tray-control-height);
    margin: 0;
    padding: 0 12px;
    font-size: 11px;
    line-height: 1.2;
    border-radius: 9999px;
    width: 100%;
    text-align: center;
    background: rgba(15, 23, 42, 0.07);
    border-color: rgba(15, 23, 42, 0.12);
    appearance: none;
    -webkit-appearance: none;
    display: block;
}

.tray-section-search .search-input::-webkit-search-decoration {
    -webkit-appearance: none;
}

.tray-section-search .search-input:hover {
    background: rgba(15, 23, 42, 0.09);
}

.tray-section-search .search-input:focus {
    background: #fff;
}

.tray-section-search .view-toggle-btn.debut-toggle-btn {
    flex-shrink: 0;
    box-sizing: border-box;
    height: var(--tray-control-height);
    min-height: var(--tray-control-height);
    padding: 0 14px;
    font-size: 10px;
    letter-spacing: 0.07em;
    line-height: 1;
    margin-top: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Same pill height as search + Debut so the tray reads as one horizontal band */
.filter-tray .tray-controls .view-toggle-btn {
    box-sizing: border-box;
    min-height: var(--tray-control-height);
    height: var(--tray-control-height);
    padding: 0 11px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Tray view pills: hover = text nudge only; selected tab unchanged on hover */
.filter-tray .tray-controls .view-toggle-btn:not(.active):not(:disabled):hover {
    background: #000;
    color: #e8e8e8;
    border-color: #000;
    box-shadow: none;
    outline: none;
}

.filter-tray .tray-controls .view-toggle-btn.active:not(:disabled):hover {
    background: #facc15;
    color: #000;
    border-color: #facc15;
    box-shadow: none;
    outline: none;
}

.cast-era-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
}

.era-reclick-hint-floating strong {
    font-weight: 700;
}

.era-reclick-hint-floating {
    position: fixed;
    z-index: 1200;
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    padding: 7px 12px;
    border-radius: 4px;
    font-family: var(--font-display);
    font-size: 11px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    background: #facc15;
    border: 1px solid #facc15;
    color: #000;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
    pointer-events: auto;
}

.era-reclick-hint-text {
    line-height: 1.25;
}

.era-reclick-hint-overlap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-body);
    font-size: 11px;
    letter-spacing: 0.01em;
    text-transform: none;
}

.era-reclick-hint-overlap select {
    border: 1px solid rgba(120, 53, 15, 0.4);
    border-radius: 3px;
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.9);
    color: #111827;
    font-size: 11px;
}

.view-toggle-wrap {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    column-gap: clamp(14px, 2vw, 22px);
    margin-bottom: 0;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 2px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.view-toggle-wrap::-webkit-scrollbar {
    height: 3px;
}

.view-toggle-wrap::-webkit-scrollbar-thumb {
    background: rgba(15, 23, 42, 0.18);
    border-radius: 999px;
}

.view-toggle-group {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.view-toggle-label {
    font-size: 12px;
    font-weight: 500;
    color: #666;
}

.view-toggle-btn {
    font-family: var(--font-display);
    font-size: 10px;
    padding: 5px 11px;
    border-radius: 9999px;
    flex-shrink: 0;
    border: 1px solid #000;
    background: #000;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.view-toggle-btn:not(:disabled):hover {
    transform: none;
}

.view-toggle-btn:disabled {
    opacity: 0.38;
    cursor: not-allowed;
    transform: none;
}

.view-toggle-btn.active {
    background: #facc15; /* bright SNL gold */
    color: #000;
    border-color: #facc15;
}

/* Debut: same family as view pills, but reads as a filter (outline off-state). */
.view-toggle-btn.debut-toggle-btn {
    letter-spacing: 0.07em;
    background: #f8fafc;
    color: #334155;
    border: 1px solid rgba(15, 23, 42, 0.18);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.view-toggle-btn.debut-toggle-btn:not(.active):not(:disabled):hover {
    background: #f8fafc;
    color: #1e293b;
    border-color: rgba(15, 23, 42, 0.18);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
    outline: none;
}

.view-toggle-btn.debut-toggle-btn.active {
    background: #facc15;
    color: #000;
    border-color: #ca8a04;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.45),
        0 1px 2px rgba(15, 23, 42, 0.08);
}

.view-toggle-btn.debut-toggle-btn.active:not(:disabled):hover {
    background: #facc15;
    color: #000;
    border-color: #ca8a04;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.45),
        0 1px 2px rgba(15, 23, 42, 0.08);
    outline: none;
}

/* Disabled Debut must not read as “on” (gold) even if .active were present */
.view-toggle-btn.debut-toggle-btn:disabled,
.view-toggle-btn.debut-toggle-btn.active:disabled {
    background: #e2e8f0;
    color: #64748b;
    border-color: rgba(15, 23, 42, 0.12);
    box-shadow: none;
    opacity: 0.72;
    cursor: not-allowed;
    transform: none;
}

.search-wrap {
    margin-bottom: 16px;
}

/* Wins over `.search-wrap` when both classes are present (e.g. tray search) */
.search-wrap.search-wrap-inline {
    margin-bottom: 0;
}

.search-input {
    width: 100%;
    padding: 9px 16px;
    font-family: var(--font-body);
    font-size: 14px;
    border: 1px solid rgba(15, 23, 42, 0.1);
    border-radius: 10px;
    color: #1a1a1a;
    background: rgba(248, 250, 252, 0.85);
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.search-input::placeholder {
    color: #888;
}

.search-input:hover {
    border-color: rgba(0, 0, 0, 0.12);
}

.search-input:focus {
    outline: none;
    border-color: rgba(201, 162, 39, 0.5);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.12);
}

.controls-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.control-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #555;
    cursor: pointer;
    user-select: none;
}

.control-toggle--tray {
    gap: 6px;
    font-size: 12px;
}

.info-cohort-overlap {
    margin-top: 0;
    margin-bottom: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #475569;
}

.info-cohort-overlap label {
    font-family: var(--font-display);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #64748b;
}

.info-cohort-overlap select {
    border: 1px solid rgba(15, 23, 42, 0.18);
    border-radius: 999px;
    padding: 2px 9px;
    background: #fff;
    font-size: 11px;
    color: #1f2937;
}

.info-header-meta .info-cohort-overlap {
    margin-top: 0;
}

.control-toggle input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.container {
    width: 100%;
    max-width: 100%;
    height: 100vh;
    position: relative;
    overflow-x: clip;
}

.timeline-container {
    width: 100%;
    height: 100%;
    overflow-x: visible;
    overflow-y: auto;
    position: relative;
    padding-top: calc(var(--top-tray-height) + 32px); /* Extra headroom so top-row circles never clip under tray */
    padding-bottom: 40px;
}

/* Fixed privacy bar (z-index 1150) sits above the timeline; reserve space so avatars are scrollable into view while the notice is open. */
body.privacy-storage-notice-visible .timeline-container {
    padding-bottom: calc(40px + clamp(96px, 22vh, 200px));
}

.timeline {
    position: relative;
    width: 100%;
    min-height: 2000px;
    padding: 64px 0 0 100px; /* Combined with container top padding for tray-safe tooltip room */
}

.line-segment {
    position: absolute;
    left: 40px;
    width: 1px;
    background: #2B2B2B;
    z-index: 1;
    opacity: 1;
}

.season-marker {
    font-family: var(--font-body);
    position: absolute;
    left: 0;
    width: 56px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1em;
    font-weight: 500;
    z-index: 4;
    color: #2B2B2B;
    line-height: 1;
    cursor: default;
    overflow: visible;
}

.season-marker:hover {
    z-index: 1301;
}

.season-marker:hover .season-marker-tooltip {
    opacity: 1;
}

.season-marker-tooltip {
    position: absolute;
    bottom: 100%;
    left: 40px;
    transform: translateX(-50%);
    margin-bottom: 4px;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    font-size: 11px;
    white-space: nowrap;
    border-radius: 4px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 1300;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.season-marker-num {
    position: absolute;
    left: 40px;
    transform: translateX(-50%);
    text-align: center;
}

/* Episodes view: de-emphasize timeline rails/season numbers so episode circles stand out */
body.episodes-view .line-segment {
    background: #e2e8f0;
    opacity: 0.6;
}

body.episodes-view .season-marker,
body.episodes-view .season-marker-num {
    color: #b6c0cf;
    font-weight: 400;
}

.square {
    position: absolute;
    width: 34px;
    height: 34px;
    cursor: pointer;
    z-index: 3;
    border-radius: 50%; /* Make circular */
    overflow: visible; /* Allow tooltip (and writer/WU dots) to show outside */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.square-photo-wrap {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    position: absolute;
    inset: 0;
    z-index: 1;
}

.square-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
}

/* Removed mini-head styling - now using photos */
/* Role-based backgrounds removed - now using photos with fallback colors */

.square:not(.dimmed):hover {
    transform: scale(1.15);
    z-index: 1301;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2);
}

.square.repertory:not(.dimmed):hover {
    box-shadow: 0 0 0 1px rgba(201, 162, 39, 0.75), 0 4px 12px rgba(0, 0, 0, 0.2);
}

.square.featured:not(.dimmed):hover {
    box-shadow: 0 0 0 1px rgba(5, 150, 105, 0.5);
}

.square.middle_group:not(.dimmed):hover {
    box-shadow: 0 0 0 1px rgba(5, 150, 105, 0.5);
}

.square.writer-square .writer-square-initials {
    position: absolute;
    inset: 0;
    z-index: 2;
    font-size: 11px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.98);
    text-shadow:
        0 2px 6px rgba(0, 0, 0, 0.85),
        0 0 2px rgba(0, 0, 0, 0.85),
        1px 0 0 rgba(0, 0, 0, 0.85),
        -1px 0 0 rgba(0, 0, 0, 0.85),
        0 1px 0 rgba(0, 0, 0, 0.85),
        0 -1px 0 rgba(0, 0, 0, 0.85);
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.square.writer-square.has-photo .writer-square-initials {
    display: none;
}

/* Performer timeline circles: initials when Wikipedia has no usable photo */
.square.square-initials-fallback .square-initials-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    font-size: 10px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.98);
    text-shadow:
        0 2px 6px rgba(0, 0, 0, 0.85),
        0 0 2px rgba(0, 0, 0, 0.85),
        1px 0 0 rgba(0, 0, 0, 0.85),
        -1px 0 0 rgba(0, 0, 0, 0.85),
        0 1px 0 rgba(0, 0, 0, 0.85),
        0 -1px 0 rgba(0, 0, 0, 0.85);
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.square.square-initials-fallback.has-photo .square-initials-overlay {
    display: none;
}

/* Writers view: one row, slightly smaller circles than performers (26px) */
.square.writer-view-circle {
    width: 26px;
    height: 26px;
}
.square.writer-view-circle .writer-square-initials {
    font-size: 9px;
}
.square.writer-view-circle.writer::after {
    width: 6px;
    height: 6px;
    bottom: -1px;
    right: -1px;
}
/* Writers view (toggled): hide Writer role dot only; WU uses same round medallion as cast view */
.square.writer-view-circle.writer::after {
    display: none;
}
.square.writer-view-circle .selected-instance-ring {
    border-width: 1px;
}

/* Episode squares (hosts / musical guests view): one circle per episode */
.square.episode-square .square-photo-wrap {
    display: none;
}

.square.episode-square.has-photo .square-photo-wrap {
    display: block;
}

.square.episode-square .episode-square-num {
    position: relative;
    z-index: 2;
    font-size: 10px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.98);
    text-shadow:
        0 2px 6px rgba(0, 0, 0, 0.85),
        0 0 2px rgba(0, 0, 0, 0.85),
        1px 0 0 rgba(0, 0, 0, 0.85),
        -1px 0 0 rgba(0, 0, 0, 0.85),
        0 1px 0 rgba(0, 0, 0, 0.85),
        0 -1px 0 rgba(0, 0, 0, 0.85);
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    line-height: 1;
}

/* Five+ episode appearances (hosts / musical guests): gold medallion with count (5+), bottom-right */
.square.episode-square.five-timer-host {
    overflow: visible;
}
.square.episode-square.five-timer-host::after {
    content: attr(data-appearance-count);
    position: absolute;
    bottom: -5px;
    right: -5px;
    box-sizing: border-box;
    min-width: 14px;
    height: 14px;
    padding: 0 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display), system-ui, sans-serif;
    font-size: 8px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.02em;
    color: #a16207;
    text-shadow:
        0 1px 0 rgba(255, 253, 231, 0.75),
        0 -1px 0 rgba(120, 53, 15, 0.22);
    border-radius: 999px;
    background: #facc15;
    border: 1px solid rgba(120, 53, 15, 0.55);
    z-index: 10;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.88),
        0 1px 3px rgba(120, 53, 15, 0.35);
}

.square.active {
    z-index: 4;
    transform: none;
    box-shadow: none;
}

.square.active.selected-performer {
    opacity: 1;
    transform: scale(1.15);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

/* Selected (clicked) instance: single black border. */
.square.active.selected-performer.selected-instance {
    box-shadow:
        0 0 0 3px #facc15,
        0 0 0 4px rgba(250, 204, 21, 0.32),
        0 4px 8px rgba(0, 0, 0, 0.4);
}

.square.active.selected-performer:not(.selected-instance):hover {
    box-shadow:
        0 0 0 3px #facc15,
        0 0 0 4px rgba(250, 204, 21, 0.32),
        0 4px 8px rgba(0, 0, 0, 0.4);
}

.square.active.cohort-member {
    opacity: 0.8;
    transform: scale(1.1);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.8), 0 4px 8px rgba(0, 0, 0, 0.4);
}

/* Writer marker stays hidden */
.square.writer::after {
    display: none;
}

/* Weekend Update anchors: round 14px medallion (five-timer footprint), bottom-left */
.square.weekend-update {
    overflow: visible;
}

.square.weekend-update::before {
    content: 'WU';
    position: absolute;
    bottom: -5px;
    left: -5px;
    box-sizing: border-box;
    width: var(--wu-medallion-px);
    height: var(--wu-medallion-px);
    min-width: unset;
    padding: 0;
    border-radius: 50%;
    background: var(--wu-badge-bg);
    border: 1px solid var(--wu-badge-border);
    color: var(--wu-badge-text);
    font-family: var(--font-body), system-ui, sans-serif;
    font-size: 5px;
    font-weight: 600;
    letter-spacing: -0.06em;
    line-height: 1;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.45);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    box-shadow: var(--wu-badge-shine), var(--wu-badge-outer);
    -webkit-font-smoothing: antialiased;
}

.square.dimmed {
    opacity: 0.08;
    pointer-events: none;
}

.square.filtered-out {
    opacity: 0.08;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

/* Tooltip for performer names on hover */
.square-tooltip {
    font-family: var(--font-body);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: normal;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease, background 0.2s ease, transform 0.2s ease;
    z-index: 1300;
    margin-bottom: 5px;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.square-tooltip-name {
    white-space: nowrap; /* never wrap names */
}

.square-tooltip-meta {
    white-space: nowrap;
}

.square:hover .square-tooltip {
    opacity: 1;
}

.square.dimmed:hover .square-tooltip {
    opacity: 0.8; /* Slightly less opaque tooltip for dimmed squares */
}

.square:not(.dimmed) {
    pointer-events: auto;
}

/* Sketches tab cards — compact hand-written list */
.sketches-tab-wrap {
    padding-top: 0;
}

.sketches-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 380px;
    overflow-y: auto;
    padding-right: 2px;
}

.sketches-empty {
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: #fafafa;
    border-radius: 6px;
    padding: 5px 7px;
    font-family: var(--font-sketch-hand);
    font-weight: 300;
    color: #64748b;
    font-size: 12px;
    line-height: 1.2;
}

.sketch-card {
    border: none;
    border-radius: 6px;
    background: transparent;
    box-shadow: none;
    overflow: visible;
    font-family: var(--font-sketch-hand);
}

.sketches-list.is-focused .sketch-card {
    display: none;
}

.sketches-list.is-focused .sketch-card.is-focused {
    display: block;
}

.sketch-card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px;
    padding: 3px 4px 2px 2px;
    background: transparent;
    cursor: pointer;
    list-style: none;
    border-radius: 4px;
    transition: background 0.12s ease;
}

.sketch-card-head:hover {
    background: rgba(248, 250, 252, 0.45);
}

.sketch-card-head::-webkit-details-marker {
    display: none;
}

.sketch-card-head::after {
    content: '+';
    flex-shrink: 0;
    font-family: var(--font-sketch-hand);
    font-weight: 300;
    font-size: 13px;
    line-height: 1;
    color: #94a3b8;
    margin-left: 2px;
}

.sketch-card[open] .sketch-card-head {
    border-bottom: none;
}

.sketch-card[open] .sketch-card-head::after {
    content: '−';
}

.sketch-title {
    font-family: var(--font-sketch-hand);
    font-size: 13px;
    font-weight: 300;
    letter-spacing: 0;
    line-height: 1.2;
    color: #334155;
    margin: 0;
    flex: 1 1 auto;
    min-width: 0;
}

.sketch-type {
    flex-shrink: 0;
    display: inline-flex;
    font-family: var(--font-sketch-hand);
    font-size: 11px;
    font-weight: 300;
    letter-spacing: 0;
    text-transform: none;
    color: #94a3b8;
    margin-left: auto;
    padding-left: 6px;
}

.sketch-card-body {
    padding: 0 2px 2px 8px;
}

.sketch-card-body-head {
    display: flex;
    justify-content: flex-end;
    margin: 0 0 1px 0;
}

.sketch-focus-close {
    display: none;
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 9999px;
    background: #f1f5f9;
    color: #475569;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
}

.sketch-focus-close:hover {
    background: #f1f5f9;
    color: #334155;
}

.sketches-list.is-focused .sketch-card.is-focused .sketch-focus-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sketch-roles-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.sketch-role-row.is-extra-role {
    display: none;
}

.sketch-card.show-all-roles .sketch-role-row.is-extra-role {
    display: flex;
}

.sketch-role-row {
    display: block;
    font-family: var(--font-sketch-hand);
    font-size: 12px;
    font-weight: 300;
    line-height: 1.2;
    overflow-wrap: anywhere;
    color: #475569;
    padding: 0;
    margin: 0;
}

.sketch-role-row > * {
    margin-right: 3px;
}

.sketch-role-person {
    font-family: var(--font-sketch-hand);
    font-size: inherit;
    font-weight: 400;
    color: #334155;
    max-width: 100%;
    overflow-wrap: anywhere;
}

button.sketch-role-person {
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
    font-family: var(--font-sketch-hand);
    font-size: inherit;
    font-weight: 400;
    color: inherit;
    text-align: left;
}

.sketch-role-person.is-clickable {
    color: #334155;
    cursor: pointer;
    text-decoration: none;
    border-radius: 2px;
    transition: color 0.12s ease, background 0.12s ease;
}

.sketch-role-person.is-clickable:hover {
    color: #0f172a;
    background: transparent;
}

.sketch-role-person.is-clickable:focus-visible {
    outline: 1px solid rgba(201, 162, 39, 0.5);
    outline-offset: 1px;
}

.sketch-cameo-badge {
    display: inline;
    margin-left: 3px;
    padding: 0;
    font-family: var(--font-sketch-hand);
    font-size: 11px;
    font-weight: 300;
    letter-spacing: 0;
    text-transform: none;
    color: #94a3b8;
    background: transparent;
    border: none;
}

.sketch-role-sep {
    color: #94a3b8;
    font-weight: 300;
}

.sketch-role-name {
    font-family: var(--font-sketch-hand);
    font-size: inherit;
    font-weight: 300;
    color: #64748b;
    overflow-wrap: anywhere;
}

.sketch-roles-empty {
    font-family: var(--font-sketch-hand);
    font-weight: 300;
    color: #94a3b8;
    font-size: 12px;
    font-style: normal;
    line-height: 1.2;
}

.sketch-roles-more {
    margin-top: 2px;
    margin-left: 0;
    border: none;
    background: transparent;
    font-family: var(--font-sketch-hand);
    font-size: 12px;
    font-weight: 300;
    letter-spacing: 0;
    text-transform: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 1px 0;
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-color: rgba(148, 163, 184, 0.55);
    transition: color 0.12s ease, text-decoration-color 0.12s ease;
}

.sketch-roles-more:hover {
    color: #64748b;
    text-decoration-color: rgba(201, 162, 39, 0.65);
}

.info-box {
    position: fixed;
    top: calc(var(--top-tray-height) + 20px);
    right: 20px;
    width: 440px;
    max-width: 45vw;
    background: #FFFFFF;
    border: none;
    border-radius: 6px;
    border-left: 4px solid #C9A227;
    padding: 0;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.08);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    /* Only fade: avoid `transition: all` + parent transform so rotated stamp text stays crisp */
    transition: opacity 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: visible; /* Let content grow; page scrolls instead of inner scrollbars */
    display: flex;
    flex-direction: column;
}

.info-box.visible {
    opacity: 1;
    visibility: visible;
}

.close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #888;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
    z-index: 10;
}

.close-btn:hover {
    color: #5c5c5c;
}

.info-content {
    padding: 0;
    /* No internal scrolling; let the page handle overflow */
    overflow: visible;
    display: flex;
    flex-direction: column;
}

.info-tabs {
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid #e8e8e8;
    padding: 10px 28px 8px;
    margin-top: 0;
    background: #fafafa;
}

.info-tab {
    font-family: var(--font-body);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 9999px;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 500;
    color: #5b6470;
    cursor: pointer;
    margin-bottom: 0;
    line-height: 1.2;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.info-tab:hover:not(.active) {
    color: #2f3540;
    background: transparent;
    border-color: transparent;
}

.info-tab.active {
    color: #8a6f11;
    border-color: #e7d59a;
    background: #fff7dd;
}

.info-tab.active:hover {
    color: #8a6f11;
    border-color: #e7d59a;
    background: #fff7dd;
}

.info-tab-back {
    font-family: var(--font-body);
    background: #fff7dd;
    border: 1px solid #e7d59a;
    border-radius: 9999px;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 500;
    color: #8a6f11;
    margin-bottom: 0;
    line-height: 1.2;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
    cursor: pointer;
}

.info-tab[data-tab="overview"],
.info-tab[data-tab="seasons"],
.info-tab[data-tab="sketches"],
.info-tab-back {
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 9999px;
    line-height: normal;
    margin-bottom: 0;
    border: 1px solid rgba(15, 23, 42, 0.24);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.info-tab[data-tab="overview"] {
    color: #fff;
    border-color: #000;
    background: #000;
}

.info-tab[data-tab="seasons"] {
    color: #fff;
    border-color: #000;
    background: #000;
}

.info-tab[data-tab="sketches"] {
    color: #fff;
    border-color: #000;
    background: #000;
}

.info-tab[data-tab="overview"]:hover:not(.active) {
    color: #d4d4d4;
    border-color: #000;
    background: #000;
    transform: none;
}

.info-tab[data-tab="seasons"]:hover:not(.active) {
    color: #d4d4d4;
    border-color: #000;
    background: #000;
    transform: none;
}

.info-tab[data-tab="sketches"]:hover:not(.active) {
    color: #d4d4d4;
    border-color: #000;
    background: #000;
    transform: none;
}

.info-tab[data-tab="overview"].active:hover,
.info-tab[data-tab="seasons"].active:hover,
.info-tab[data-tab="sketches"].active:hover {
    color: #000;
    border-color: #facc15;
    background: #facc15;
    transform: none;
}

.info-tab[data-tab="overview"].active {
    color: #000;
    border-color: #facc15;
    background: #facc15;
}

.info-tab[data-tab="seasons"].active {
    color: #000;
    border-color: #facc15;
    background: #facc15;
}

.info-tab[data-tab="sketches"].active {
    color: #000;
    border-color: #facc15;
    background: #facc15;
}

.info-tab:focus-visible,
.info-tab-back:focus-visible {
    outline: 2px solid rgba(250, 204, 21, 0.65);
    outline-offset: 1px;
}

.info-tab-back {
    color: #000;
    border-color: #facc15;
    background: #facc15;
}

.info-tab-back:hover {
    color: #171717;
    border-color: #facc15;
    background: #facc15;
    transform: none;
}

.info-tab-content {
    flex: 1;
    padding: 24px 28px;
    overflow-y: auto; /* Seasons tab can scroll when long */
    min-height: 0;
    background: #FFFFFF;
}

#infoDetails {
    flex: 1;
    padding: 24px 28px;
    /* Overview should not scroll internally at all; let page/window handle overflow */
    overflow: visible;
    min-height: auto;
    background: #FFFFFF;
}

.info-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 18px;
}

.info-photo-wrap {
    position: relative;
    flex-shrink: 0;
}

/* Single 120×120 slot: image and initials must not stack in document flow
   (while a new URL preloads, both can be "shown" briefly — that used to push content down). */
.info-photo-link {
    display: inline-block;
    position: relative;
    width: 120px;
    height: 120px;
    vertical-align: top;
    text-decoration: none;
    overflow: hidden;
    border-radius: 6px;
}

.info-photo-link.is-clickable {
    cursor: pointer;
}

.info-initials {
    position: absolute;
    inset: 0;
    box-sizing: border-box;
    border-radius: 6px;
    border: 2px solid #e8e8e8;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    background: #f2f2f2;
    color: #4a4a4a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 36px;
    letter-spacing: 0.04em;
    user-select: none;
    z-index: 0;
}

.info-image {
    position: absolute;
    inset: 0;
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    border-radius: 6px;
    object-fit: cover;
    object-position: center top;
    border: 2px solid #e8e8e8;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    z-index: 1;
}

.info-name-section {
    flex: 1;
    padding-right: 40px;
}

.info-content h3 {
    font-family: var(--font-display);
    margin: 0 0 8px 0;
    font-size: 22px;
    font-weight: 400;
    letter-spacing: 0.02em;
    color: #2B2B2B;
    letter-spacing: -0.3px;
    line-height: 1.2;
}

.info-wiki-link {
    display: inline-block;
    font-size: 13px;
    color: #C9A227;
    text-decoration: none;
    transition: color 0.2s ease;
}

.info-wiki-link:hover {
    color: #d4b03a;
    text-decoration: underline;
}

.info-dob {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

.info-header-meta {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.info-header-meta-item {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 9999px;
    background: #f8fafc;
    border: 1px solid rgba(15, 23, 42, 0.1);
    font-size: 11px;
    color: #334155;
    max-width: 100%;
}

button.info-header-meta-item {
    appearance: none;
    -webkit-appearance: none;
    font: inherit;
    cursor: default;
    text-align: left;
    margin: 0;
}

.info-header-meta-label {
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-size: 10px;
}

.info-header-meta-value {
    color: #0f172a;
    overflow-wrap: anywhere;
}

.info-header-meta-item--host {
    background: #eef2ff;
    border-color: #c7d2fe;
}

.info-header-meta-item--mg {
    background: #ecfeff;
    border-color: #bae6fd;
}

.info-header-meta-item--air {
    background: #f8fafc;
    border-color: rgba(15, 23, 42, 0.12);
}

.info-header-meta-item.is-clickable {
    cursor: pointer;
    transition: color 0.12s ease;
}

.info-header-meta-item.is-clickable:hover {
    transform: none;
    box-shadow: none;
}

.info-header-meta-item.is-clickable:hover .info-header-meta-value {
    color: #020617;
}

.info-header-meta-item.is-clickable:hover .info-header-meta-label {
    color: #475569;
}

.episode-duty-list {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: flex-start;
    gap: 12px;
    margin-top: 12px;
    width: 100%;
}

.episode-duty-card {
    appearance: none;
    -webkit-appearance: none;
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    min-width: 102px;
    max-width: 128px;
    text-align: center;
    cursor: default;
}

.episode-duty-card.is-clickable {
    cursor: pointer;
}

.episode-duty-avatar-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.episode-duty-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    background: #e2e8f0;
    border: 1px solid rgba(15, 23, 42, 0.14);
    overflow: hidden;
    position: relative;
}

.episode-duty-icon {
    position: absolute;
    right: -5px;
    bottom: -4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.16);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-weight: 700;
    line-height: 1;
}

.episode-duty-icon--host {
    background: #e0ecff;
    border-color: #7aa6ff;
    color: #1d4ed8;
}

.episode-duty-icon--mg {
    background: #efe6ff;
    border-color: #b28cff;
    color: #6d28d9;
}

.episode-duty-icon svg {
    width: 15px;
    height: 15px;
    display: block;
    fill: currentColor;
}

.episode-duty-icon--mg svg {
    transform: translateX(1px);
}

.episode-duty-avatar-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}

.episode-duty-avatar-initials {
    position: relative;
    z-index: 1;
}

.episode-duty-name {
    font-size: 11px;
    line-height: 1.2;
    color: #334155;
    overflow-wrap: anywhere;
    max-width: 100px;
}

.episode-duty-card.is-clickable:hover .episode-duty-avatar {
    border-color: rgba(201, 162, 39, 0.65);
    box-shadow: 0 1px 6px rgba(201, 162, 39, 0.22);
}

/* Episode square popup: less air under host / MG row before sketch list */
.info-box--episode .info-header {
    margin-bottom: 10px;
}

.info-box--episode .info-header-meta:has(.episode-duty-list) {
    margin-top: 4px;
}

.info-box--episode .episode-duty-list {
    margin-top: 6px;
}

.info-box--episode .episode-duty-card {
    gap: 4px;
}

.info-box--episode .episode-duty-name {
    line-height: 1.12;
}

.info-box--episode #infoSketches.info-tab-content {
    padding-top: 10px;
}

.info-writer-list-link {
    margin-top: 10px;
    font-size: 12px;
}
.info-writer-list-link a {
    color: #C9A227;
    text-decoration: none;
}
.info-writer-list-link a:hover {
    text-decoration: underline;
}

.info-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 18px;
    margin-bottom: 18px;
    padding-bottom: 18px;
    border-bottom: 1px solid #e8e8e8;
}

.info-summary-item {
    display: flex;
    flex-direction: column;
}

.info-summary-item--badge {
    border: 1px solid rgba(117, 97, 62, 0.34);
    border-radius: 14px;
    background: #fffef9;
    padding: 10px 12px;
    align-items: center;
    text-align: center;
    min-height: 72px;
    justify-content: center;
}

.info-summary-item--badge .info-summary-label {
    margin-bottom: 5px;
    color: #6b5a39;
}

.info-summary-item--badge .info-summary-value {
    font-size: 17px;
    font-weight: 600;
    color: #2f2416;
    line-height: 1.2;
}

.info-summary-label {
    font-size: 10px;
    font-weight: 400;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.info-summary-value {
    font-size: 16px;
    font-weight: 400;
    color: #2B2B2B;
    line-height: 1.4;
}

.info-roles {
    margin-bottom: 18px;
    padding-bottom: 18px;
    border-bottom: 1px solid #e8e8e8;
}

.info-cast-era {
    margin-top: 24px;
    padding: 20px;
    background: #f8f8f8;
    border-radius: 8px;
    border: 1px solid #e8e8e8;
}

.info-cast-era-title {
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 500;
    color: #2B2B2B;
    margin-bottom: 12px;
}

.info-cast-era-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
}

.info-cast-era-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #555;
    cursor: pointer;
    user-select: none;
}

.info-cast-era-toggle input {
    cursor: pointer;
}

.info-cast-era-overlap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #555;
}

.info-cast-era-overlap select {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 6px 10px;
    background: #FFFFFF;
    font-size: 14px;
    color: #2B2B2B;
    cursor: pointer;
}

.info-cast-era-overlap select option:disabled {
    color: #999;
}

.info-roles-label {
    font-size: 11px;
    font-weight: 400;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.info-roles-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.info-counterpart-wrap {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.info-counterpart-label {
    font-size: 11px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #64748b;
}

.info-counterpart-card {
    appearance: none;
    -webkit-appearance: none;
    border: none;
    background: transparent;
    border-radius: 0;
    padding: 0;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 102px;
    max-width: 128px;
    text-align: center;
    cursor: default;
}

.info-counterpart-card.is-clickable {
    cursor: pointer;
    transition: transform 0.1s ease;
}

.info-counterpart-card.is-clickable:hover {
    transform: none;
}

.info-counterpart-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 1px solid rgba(15, 23, 42, 0.14);
    background: #e2e8f0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    color: #0f172a;
    font-size: 13px;
    font-weight: 700;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.info-counterpart-card.is-clickable:hover .info-counterpart-avatar {
    transform: scale(1.15);
    z-index: 5;
    border-color: rgba(0, 0, 0, 0.3);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2);
}

.info-counterpart-avatar-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}

.info-counterpart-avatar-initials {
    position: relative;
    z-index: 1;
}

.info-counterpart-name {
    font-size: 12px;
    line-height: 1.2;
    color: #1f2937;
    max-width: 124px;
    overflow-wrap: anywhere;
}

.info-role-tag {
    font-family: var(--font-body);
    display: inline-block;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.04em;
    border: 1px solid rgba(15, 23, 42, 0.12);
    background: #f9fafb;
    color: #111827;
}

.info-role-tag--repertory {
    background: #fee2e2;
    border-color: rgba(220, 38, 38, 0.4);
    color: #b91c1c;
}

.info-role-tag--featured {
    background: #ffedd5;
    border-color: rgba(234, 88, 12, 0.4);
    color: #c2410c;
}

.info-role-tag--writer {
    background: #dcfce7;
    border-color: rgba(22, 101, 52, 0.35);
    color: #166534;
}

.info-role-tag--wu {
    font-family: var(--font-body), system-ui, sans-serif;
    font-size: 9px;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    background: var(--wu-badge-bg);
    border: 1px solid var(--wu-badge-border);
    color: var(--wu-badge-text);
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
    box-shadow: var(--wu-badge-shine), var(--wu-badge-outer);
}

/* Performer popup polish (scoped to performer overview content) */
.performer-overview {
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-items: center;
    text-align: center;
    width: 100%;
}

/* Stamps stay sans: contract-mode Palatino on overview blocks must not affect stamp metrics */
.info-box .performer-instance-badge,
.info-box .performer-instance-badge-label,
.info-box .performer-instance-badge-value {
    font-family: var(--font-body), system-ui, sans-serif;
}

.performer-spotlight {
    border: 1px solid rgba(15, 23, 42, 0.10);
    background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
    border-radius: 10px;
    padding: 10px 12px;
    width: 100%;
}

.performer-spotlight-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    margin-bottom: 4px;
}

.popup-episode-summary-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 8px;
}

.performer-spotlight-label--center {
    text-align: center;
}

.performer-spotlight-episode-text {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    text-align: center;
    margin-bottom: 8px;
}

.performer-spotlight--episode-box {
    text-align: center;
}

.performer-instance-badges--in-box {
    justify-content: center;
}

.popup-apps-badge-wrap {
    display: flex;
    justify-content: center;
    flex-shrink: 0;
}

.popup-header-apps-wrap {
    margin-top: 8px;
    display: flex;
    justify-content: flex-start;
}

.performer-instance-badge--apps-header {
    width: 56px;
    height: 56px;
}

.performer-instance-badges {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.performer-selected-roles {
    margin-top: 8px;
}

.performer-selected-roles-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    margin-bottom: 4px;
    text-align: center;
}

.performer-selected-roles-list {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    width: min(100%, 300px);
    margin: 0 auto;
}

/* ========== Popup stamps: cream paper, coloured dashed rim, inked type (revert: delete through “END popup stamp block”) ========== */

.performer-instance-badge--role-extra {
    width: 56px;
    height: 56px;
    margin: 0 auto;
    padding: 6px 4px;
    border: 2px dashed rgba(154, 52, 18, 0.52);
    background:
        radial-gradient(circle at 30% 26%, rgba(255, 255, 255, 0.98) 0%, rgba(255, 254, 249, 0.96) 55%, rgba(250, 248, 241, 0.94) 100%);
    box-shadow:
        inset 0 0 0 1px rgba(15, 23, 42, 0.08),
        0 1px 2px rgba(15, 23, 42, 0.08);
    transform: rotate(-2.15deg);
}

.performer-instance-badge--role-extra .performer-instance-badge-label {
    color: #9a3412;
}

.performer-instance-badge--role-extra .performer-instance-badge-value {
    color: #7c2d12;
}

.performer-selected-roles-list .performer-instance-badge--role-extra:nth-child(even) {
    transform: rotate(-1.65deg);
}

.performer-instance-badge {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    border: 2px dashed rgba(100, 116, 139, 0.42);
    background:
        radial-gradient(circle at 30% 26%, rgba(255, 255, 255, 0.98) 0%, rgba(255, 254, 249, 0.96) 55%, rgba(250, 248, 241, 0.94) 100%);
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 8px 6px;
    box-shadow:
        inset 0 0 0 1px rgba(15, 23, 42, 0.1),
        0 1px 3px rgba(15, 23, 42, 0.1);
    transform: rotate(-2deg);
}

button.performer-instance-badge {
    appearance: none;
    -webkit-appearance: none;
    font: inherit;
    cursor: default;
}

button.performer-instance-badge.is-clickable {
    cursor: pointer;
}

button.performer-instance-badge.is-clickable:hover {
    filter: brightness(1.04);
    z-index: 1;
}

/* Same paper inside; rim + “ink” identify the stamp */
.performer-instance-badge--apps {
    border: 2px dashed rgba(146, 64, 14, 0.55);
    transform: rotate(-2.35deg);
}

.performer-instance-badge--apps .performer-instance-badge-label {
    color: #a16207;
}

.performer-instance-badge--apps .performer-instance-badge-value {
    color: #713f12;
}

.performer-instance-badge--apps-gold {
    border: 2px dashed rgba(180, 83, 9, 0.72);
    box-shadow:
        inset 0 0 0 1px rgba(161, 98, 7, 0.18),
        0 1px 3px rgba(161, 98, 7, 0.14);
    transform: rotate(-2.45deg);
}

.performer-instance-badge--apps-gold .performer-instance-badge-label {
    color: #92400e;
}

.performer-instance-badge--apps-gold .performer-instance-badge-value {
    color: #78350f;
}

.performer-instance-badge--season {
    border: 2px dashed rgba(21, 128, 61, 0.52);
    transform: rotate(-1.88deg);
}

.performer-instance-badge--season .performer-instance-badge-label {
    color: #166534;
}

.performer-instance-badge--season .performer-instance-badge-value {
    color: #14532d;
}

.performer-instance-badge--episode {
    border: 2px dashed rgba(91, 33, 182, 0.5);
    transform: rotate(-2.05deg);
}

.performer-instance-badge--episode .performer-instance-badge-label {
    color: #6d28d9;
}

.performer-instance-badge--episode .performer-instance-badge-value {
    color: #4c1d95;
}

.performer-instance-badge--date {
    border: 2px dashed rgba(51, 65, 85, 0.5);
    transform: rotate(1.9deg);
}

.performer-instance-badge--date .performer-instance-badge-label {
    color: #64748b;
}

.performer-instance-badge--date .performer-instance-badge-value {
    color: #1e293b;
}

.performer-instance-badge--age {
    border: 2px dashed rgba(157, 23, 77, 0.48);
    transform: rotate(-2.38deg);
}

.performer-instance-badge--age .performer-instance-badge-label {
    color: #be185d;
}

.performer-instance-badge--age .performer-instance-badge-value {
    color: #831843;
}

.performer-instance-badge-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #475569;
    line-height: 1.1;
    margin-bottom: 4px;
}

.performer-instance-badge-label--compact {
    font-size: 8px;
    letter-spacing: 0.03em;
    line-height: 1.05;
}

.performer-instance-badge-value {
    font-size: 12px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.performer-instance-badge-value--role {
    font-size: 11px;
    overflow-wrap: normal;
    word-break: keep-all;
}

.performer-instance-badge--role-stamp {
    border: 2px dashed rgba(185, 28, 28, 0.62);
    background: #fffef9;
    box-shadow:
        inset 0 0 0 1px rgba(15, 23, 42, 0.1),
        0 1px 2px rgba(15, 23, 42, 0.08);
    transform: rotate(-2.6deg);
}

.performer-instance-badge--role-stamp.performer-instance-badge--role-repertory {
    border-color: rgba(202, 138, 4, 0.78);
    transform: rotate(-2.68deg);
}

.performer-instance-badge--role-stamp.performer-instance-badge--role-repertory .performer-instance-badge-label {
    color: #a16207;
    letter-spacing: 0.07em;
}

.performer-instance-badge--role-stamp.performer-instance-badge--role-repertory .performer-instance-badge-value {
    color: #78350f;
    font-weight: 700;
}

.performer-instance-badge--role-stamp.performer-instance-badge--role-featured {
    border-color: rgba(220, 90, 72, 0.62);
    transform: rotate(-2.22deg);
}

.performer-instance-badge--role-stamp.performer-instance-badge--role-featured .performer-instance-badge-label {
    color: #b45309;
    letter-spacing: 0.06em;
}

.performer-instance-badge--role-stamp.performer-instance-badge--role-featured .performer-instance-badge-value {
    color: #9f2d1f;
    font-weight: 700;
}

.performer-instance-badge--role-stamp.performer-instance-badge--role-middle-group {
    border-color: rgba(109, 40, 217, 0.52);
    transform: rotate(2.2deg);
}

.performer-instance-badge--role-stamp.performer-instance-badge--role-middle-group .performer-instance-badge-label {
    color: #6d28d9;
    letter-spacing: 0.05em;
}

.performer-instance-badge--role-stamp.performer-instance-badge--role-middle-group .performer-instance-badge-value {
    color: #4c1d95;
    font-weight: 700;
}

.performer-instance-badge--role-stamp.performer-instance-badge--role-writer {
    border-color: rgba(22, 163, 74, 0.68);
    transform: rotate(-2.08deg);
}

.performer-instance-badge--role-stamp.performer-instance-badge--role-writer .performer-instance-badge-label {
    color: #15803d;
    letter-spacing: 0.05em;
}

.performer-instance-badge--role-stamp.performer-instance-badge--role-writer .performer-instance-badge-value {
    color: #14532d;
    font-weight: 700;
}

.performer-instance-badge--role-stamp.performer-instance-badge--role-anchor {
    border-color: rgba(37, 99, 235, 0.62);
    transform: rotate(-2.65deg);
}

.performer-instance-badge--role-stamp.performer-instance-badge--role-anchor .performer-instance-badge-label {
    color: #1d4ed8;
    letter-spacing: 0.06em;
}

.performer-instance-badge--role-stamp.performer-instance-badge--role-anchor .performer-instance-badge-value {
    color: #1e40af;
    font-weight: 700;
}

.performer-instance-badge--role-stamp.performer-instance-badge--role-cast {
    border-color: rgba(71, 85, 105, 0.52);
    transform: rotate(1.6deg);
}

.performer-instance-badge--role-stamp.performer-instance-badge--role-cast .performer-instance-badge-label {
    color: #475569;
    letter-spacing: 0.06em;
}

.performer-instance-badge--role-stamp.performer-instance-badge--role-cast .performer-instance-badge-value {
    color: #1e293b;
    font-weight: 700;
}

.performer-instance-badge-value--compact {
    font-size: 10px;
    line-height: 1.1;
    overflow-wrap: anywhere;
}

.overview-summary-badges {
    display: flex;
    gap: 12px;
    justify-content: center;
    width: 100%;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.performer-instance-badge--overview-summary {
    width: 128px;
    min-height: 90px;
    height: auto;
    border-radius: 12px;
    border: 2px dashed rgba(117, 97, 62, 0.45);
    background: linear-gradient(180deg, rgba(255, 254, 249, 0.98) 0%, rgba(255, 252, 241, 0.98) 100%);
    box-shadow:
        inset 0 0 0 3px rgba(117, 97, 62, 0.08),
        0 1px 3px rgba(15, 23, 42, 0.08);
    transform: rotate(-1.15deg);
    padding: 10px 10px 9px;
    position: relative;
}

.performer-instance-badge--overview-summary::before {
    content: '';
    position: absolute;
    inset: 5px;
    border-radius: 8px;
    border: 1px dotted rgba(117, 97, 62, 0.32);
    pointer-events: none;
}

.performer-instance-badge--overview-summary .performer-instance-badge-label {
    color: #6b5a39;
    margin-bottom: 5px;
    font-size: 10px;
}

.performer-instance-badge-value--overview-main {
    font-size: 24px;
    font-weight: 700;
    color: #2f2416;
    line-height: 1.05;
}

.performer-instance-badge-value--overview-sub {
    font-size: 10px;
    color: #5c4a2c;
    line-height: 1.15;
    margin-top: 4px;
    letter-spacing: 0.02em;
}

.performer-instance-badge-value--overview-line {
    font-size: 12px;
    font-weight: 600;
    color: #2f2416;
    line-height: 1.2;
}

.performer-instance-badge--overview-summary.performer-instance-badge--overview-years {
    border: 2px dashed rgba(51, 65, 85, 0.5);
    transform: rotate(-1.55deg);
    box-shadow:
        inset 0 0 0 3px rgba(51, 65, 85, 0.08),
        0 1px 3px rgba(15, 23, 42, 0.08);
}

.performer-instance-badge--overview-summary.performer-instance-badge--overview-years::before {
    border: 1px dotted rgba(51, 65, 85, 0.32);
}

.performer-instance-badge--overview-summary.performer-instance-badge--overview-years .performer-instance-badge-label {
    color: #475569;
}

.performer-instance-badge--overview-summary.performer-instance-badge--overview-years .performer-instance-badge-value--overview-line {
    color: #1e293b;
}

.performer-instance-badge--overview-summary.performer-instance-badge--overview-seasons {
    border: 2px dashed rgba(146, 64, 14, 0.5);
    transform: rotate(1.15deg);
    box-shadow:
        inset 0 0 0 3px rgba(180, 83, 9, 0.08),
        0 1px 3px rgba(15, 23, 42, 0.08);
}

.performer-instance-badge--overview-summary.performer-instance-badge--overview-seasons::before {
    border: 1px dotted rgba(146, 64, 14, 0.34);
}

.performer-instance-badge--overview-summary.performer-instance-badge--overview-seasons .performer-instance-badge-label {
    color: #92400e;
}

.performer-instance-badge--overview-summary.performer-instance-badge--overview-seasons .performer-instance-badge-value--overview-main {
    color: #713f12;
}

.performer-instance-badge--overview-summary.performer-instance-badge--overview-seasons .performer-instance-badge-value--overview-sub {
    color: #854d0e;
}

/* ========== END popup stamp block ========== */

.performer-spotlight-empty {
    font-size: 12px;
    color: #64748b;
}

.performer-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
}

.performer-stat-card {
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: #ffffff;
    border-radius: 8px;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
    text-align: center;
}

.performer-stat-card--badge {
    border-color: rgba(117, 97, 62, 0.34);
    border-radius: 14px;
    background: #fffef9;
    min-height: 74px;
    justify-content: center;
}

.performer-stat-card--badge .performer-stat-label {
    color: #6b5a39;
}

.performer-stat-card--badge .performer-stat-value {
    color: #2f2416;
}

.performer-stat-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
}

.performer-stat-value {
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
}

.performer-roles-block {
    margin-top: 2px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
}

.performer-seasons .info-seasons-label {
    text-align: center;
}

.performer-seasons .info-seasons-list {
    margin-top: 10px;
}

/* Performer-only experimental look: contract paper style runs continuously */
#infoBox.performer-contract-style .info-content {
    background:
        linear-gradient(180deg, rgba(120, 95, 46, 0.08) 0%, rgba(120, 95, 46, 0) 14%),
        repeating-linear-gradient(
            to bottom,
            #fffdf7 0px,
            #fffdf7 27px,
            rgba(145, 126, 84, 0.18) 28px
        );
    border-top: 1px solid rgba(117, 97, 62, 0.24);
    border-left: 3px solid rgba(117, 97, 62, 0.24);
    border-radius: 6px;
}

#infoBox.performer-contract-style .info-header {
    background: transparent;
    border: none;
    padding: 12px 14px;
    margin-bottom: 8px;
}

/*
 * Episode modal + contract: symmetric horizontal padding matches the × reserve so the block
 * centers in the viewport (only padding-end made host/MG look left-shifted).
 */
#infoBox.performer-contract-style.info-box--episode .info-header {
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    padding-top: 12px;
    padding-bottom: 8px;
    padding-inline-start: calc(12px + 44px + 22px + env(safe-area-inset-left, 0px));
    padding-inline-end: calc(12px + 44px + 22px + env(safe-area-inset-right, 0px));
}

#infoBox.performer-contract-style.info-box--episode .info-name-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
    max-width: 100%;
    flex: 1 1 auto;
    min-width: 0;
}

#infoBox.performer-contract-style.info-box--episode #infoHeaderMeta.info-header-meta {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

#infoBox.performer-contract-style.info-box--episode .episode-duty-list {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: flex-start;
    gap: 12px;
    width: fit-content;
    max-width: 100%;
    margin-inline: auto;
}

#infoBox.performer-contract-style.info-box--episode .episode-duty-card {
    flex: 0 0 auto;
}

#infoBox.performer-contract-style .info-tabs,
#infoBox.performer-contract-style .info-tab-content,
#infoBox.performer-contract-style #infoDetails {
    background: transparent;
}

#infoBox.performer-contract-style #infoDetails,
#infoBox.performer-contract-style #infoSeasons {
    background: transparent;
    border-top: none;
}

#infoBox.performer-contract-style #infoDetails {
    border-left: none;
}

#infoBox.performer-contract-style .performer-overview,
#infoBox.performer-contract-style .info-seasons {
    font-family: "Palatino Linotype", "Book Antiqua", Georgia, serif;
}

/* Keep season-row pills on UI sans; Palatino + all-caps + tracking reads stretched on phones. */
#infoBox.performer-contract-style .info-season-badge,
#infoBox.performer-contract-style .info-season-role {
    font-family: var(--font-body), system-ui, sans-serif;
}

#infoBox.performer-contract-style .performer-spotlight {
    background: rgba(255, 254, 248, 0.9);
    border: 1px solid rgba(117, 97, 62, 0.26);
    border-radius: 6px;
    box-shadow: 0 1px 0 rgba(117, 97, 62, 0.08);
}

#infoBox.performer-contract-style .performer-spotlight-label,
#infoBox.performer-contract-style .performer-stat-label {
    font-family: var(--font-display);
    color: #6b5a39;
    letter-spacing: 0.08em;
}

/* Contract mode: light ruling on cream; rim colour still from stamp classes */

#infoBox.performer-contract-style .performer-instance-badge--overview-summary.performer-instance-badge--overview-years {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.4) 0%, transparent 26%),
        repeating-linear-gradient(
            to bottom,
            transparent 0px,
            transparent 14px,
            rgba(51, 65, 85, 0.035) 15px
        ),
        linear-gradient(180deg, rgba(255, 254, 249, 0.99) 0%, rgba(248, 250, 252, 0.97) 100%);
}

#infoBox.performer-contract-style .performer-instance-badge--overview-summary.performer-instance-badge--overview-seasons {
    background:
        repeating-linear-gradient(
            to bottom,
            transparent 0px,
            transparent 14px,
            rgba(120, 95, 46, 0.055) 15px
        ),
        linear-gradient(180deg, rgba(255, 254, 249, 0.99) 0%, rgba(255, 252, 241, 0.98) 100%);
}

#infoBox.performer-contract-style .performer-stat-value {
    color: #2f2416;
    font-weight: 600;
}


#infoBox.performer-contract-style .performer-stat-card {
    background: rgba(255, 254, 249, 0.88);
    border: 1px dashed rgba(117, 97, 62, 0.32);
    border-radius: 6px;
}

#infoBox.performer-contract-style .info-cohort-overlap {
    color: #5f4a2a;
}

#infoBox.performer-contract-style .info-cohort-overlap label {
    color: #6b5a39;
}

#infoBox.performer-contract-style .info-cohort-overlap select {
    border-color: rgba(117, 97, 62, 0.34);
    background: rgba(255, 252, 241, 0.95);
    color: #3f3220;
}

#infoBox.performer-contract-style .info-seasons-list {
    border: 1px solid rgba(117, 97, 62, 0.22);
    border-radius: 6px;
    background: rgba(255, 254, 249, 0.85);
    padding-left: 12px;
    padding-right: 10px;
}

#infoBox.performer-contract-style .info-season-item {
    border-bottom-color: rgba(117, 97, 62, 0.22);
}

#infoBox.performer-contract-style .info-season-number,
#infoBox.performer-contract-style .info-season-year {
    font-family: "Courier New", Courier, monospace;
    letter-spacing: 0.01em;
}

#infoBox.performer-contract-style .info-season-role,
#infoBox.performer-contract-style .info-season-badge {
    border-radius: 999px;
    border-color: rgba(117, 97, 62, 0.26);
    background: rgba(255, 252, 241, 0.95);
    box-shadow: none;
}

#infoBox.performer-contract-style .info-season-role--repertory {
    border: 1px solid rgba(202, 138, 4, 0.72);
    background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 100%);
    color: #92400e;
}

#infoBox.performer-contract-style .info-season-role--featured {
    border: 1px solid rgba(225, 70, 72, 0.52);
    background: linear-gradient(180deg, #fff1f2 0%, #ffe4e6 100%);
    color: #b91c1c;
}

#infoBox.performer-contract-style .info-season-badge--writer {
    border: 1px solid rgba(22, 163, 74, 0.55);
    background: linear-gradient(180deg, #f0fdf4 0%, #dcfce7 100%);
    color: #166534;
}

#infoBox.performer-contract-style .info-season-badge--wu {
    border: 1px solid rgba(37, 99, 235, 0.58);
    background: var(--wu-badge-bg);
    color: var(--wu-badge-text);
    box-shadow: var(--wu-badge-shine), var(--wu-badge-outer);
}

#infoBox.performer-contract-style .info-counterpart-label {
    color: #6b5a39;
}

#infoBox.performer-contract-style .info-counterpart-card {
    background: transparent;
    border: none;
}

#infoBox.performer-contract-style .info-counterpart-avatar {
    border-color: rgba(117, 97, 62, 0.28);
}

.info-seasons-back {
    border: 1px solid rgba(15, 23, 42, 0.16);
    background: #f8fafc;
    color: #334155;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    cursor: pointer;
}

.info-seasons-back:hover {
    background: #f8fafc;
    color: #0f172a;
}

.info-seasons {
    margin-top: 0;
}

.info-seasons-label {
    font-size: 11px;
    font-weight: 400;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.info-seasons-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-height: 300px;
    overflow-y: auto;
    padding: 4px 8px 4px 10px;
}

.info-season-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 2px;
    border-bottom: 1px solid #eee;
    font-size: 13px;
    line-height: 1.35;
}

.info-season-item:last-child {
    border-bottom: none;
}

.info-season-item--episode-link {
    cursor: pointer;
}

.info-season-item--episode-link:hover {
    background: rgba(15, 23, 42, 0.035);
}

.info-season-left {
    display: flex;
    align-items: baseline;
    gap: 12px;
    min-width: 0;
}

.info-season-number {
    font-family: var(--font-body);
    font-weight: 500;
    color: #2B2B2B;
    min-width: 50px;
    font-variant-numeric: tabular-nums;
}

.info-season-year {
    color: #888;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.info-season-episode {
    display: inline-block;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 10px;
    background: #111111;
    color: #facc15;
    font-family: var(--font-display);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.info-season-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: flex-end;
    row-gap: 3px;
}

/* Cast season role labels (Repertory / Featured / Middle Group) */
.info-season-role {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1px 6px;
    margin-right: 1px;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border: 1px solid rgba(15, 23, 42, 0.18);
    background: linear-gradient(180deg, #f9fafb 0%, #f1f5f9 100%);
    color: #0f172a;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.info-season-role--repertory {
    background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 100%);
    border: 1px solid rgba(202, 138, 4, 0.72);
    color: #92400e;
}

.info-season-role--featured {
    background: linear-gradient(180deg, #fff1f2 0%, #ffe4e6 100%);
    border: 1px solid rgba(225, 70, 72, 0.52);
    color: #b91c1c;
}

.info-season-role--middle-group {
    background: linear-gradient(180deg, #ede9fe 0%, #ddd6fe 100%);
    border-color: rgba(124, 58, 237, 0.42);
    color: #6d28d9;
}

/* Writer / WU / other credit badges */
.info-season-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1px 5px;
    border: 1px solid rgba(15, 23, 42, 0.16);
    background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 999px;
    font-size: 9px;
    font-weight: 600;
    color: #334155;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.info-season-badge--writer {
    background: linear-gradient(180deg, #f0fdf4 0%, #dcfce7 100%);
    border: 1px solid rgba(22, 163, 74, 0.55);
    color: #166534;
}

.info-season-badge--wu {
    box-sizing: border-box;
    width: var(--wu-medallion-px);
    height: var(--wu-medallion-px);
    min-width: var(--wu-medallion-px);
    padding: 0;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--wu-badge-bg);
    border: 1px solid rgba(37, 99, 235, 0.58);
    color: var(--wu-badge-text);
    font-family: var(--font-body), system-ui, sans-serif;
    font-size: 5px;
    font-weight: 600;
    letter-spacing: -0.06em;
    text-transform: uppercase;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.45);
    box-shadow: var(--wu-badge-shine), var(--wu-badge-outer);
    -webkit-font-smoothing: antialiased;
}

.info-season-badge--more {
    background: #111827;
    border-color: #111827;
    color: #facc15;
    font-family: var(--font-display);
    letter-spacing: 0.06em;
    min-width: 20px;
}

.info-season-badge--episode {
    background: #111111;
    color: #facc15;
    font-family: var(--font-display);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.info-season-label {
    display: inline-block;
    padding: 2px 6px;
    margin-left: 4px;
    border-radius: 2px;
    font-size: 10px;
    letter-spacing: 0.2px;
}

/* Cast role labels (Repertory / Featured / Middle Group) */
.info-season-label.role-cast {
    background: #111827;
    color: #f9fafb;
}

/* Writer / WU / other credit labels */
.info-season-label.role-writer {
    background: #e8e8f0;
    color: #444;
}

/* Writers view: one-season writers hidden behind "+" circle until expanded */
.square.writer-view-circle.one-season-writer.hidden {
    display: none;
}

.square.writer-view-circle.writers-plus-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 800;
    color: #ffffff; /* white plus for maximum contrast */
    background: #111827; /* very dark slate */
    box-shadow:
        0 0 0 2px rgba(15, 23, 42, 0.9),
        0 0 8px 3px rgba(15, 23, 42, 0.7);
    cursor: pointer;
}

.writers-plus-label {
    pointer-events: none;
}


/* Custom scrollbar */
.info-seasons-list::-webkit-scrollbar {
    width: 4px;
}

.info-seasons-list::-webkit-scrollbar-track {
    background: #f5f5f5;
}

.info-seasons-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

.info-seasons-list::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* -------------------------------------------------------------------------- */
/* Display menu — top-right: dark mode + deutan-friendly bar / page split    */
/* -------------------------------------------------------------------------- */

.tray-display-menu {
    position: absolute;
    top: 0;
    right: clamp(10px, 2.5vw, 24px);
    height: var(--top-tray-height);
    display: flex;
    align-items: center;
    z-index: 1003;
    pointer-events: none;
}

.tray-display-menu > * {
    pointer-events: auto;
}

.display-menu-burger {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    background: rgba(248, 250, 252, 0.95);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, border-color 0.15s ease;
    box-shadow: none;
}

.display-menu-burger:hover {
    background: rgba(248, 250, 252, 0.95);
    border-color: rgba(15, 23, 42, 0.12);
}

.display-menu-burger:hover .display-menu-gear {
    color: #334155;
}

.display-menu-burger:focus-visible {
    outline: 2px solid #facc15;
    outline-offset: 2px;
}

.display-menu-burger.is-open {
    border-color: rgba(250, 204, 21, 0.85);
}

.display-menu-gear {
    display: block;
    color: #0f172a;
}

.display-menu-panel {
    position: absolute;
    top: calc(var(--top-tray-height) + 6px);
    right: 0;
    width: min(300px, calc(100vw - 24px));
    padding: 14px 16px 16px;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.15), 0 2px 8px rgba(15, 23, 42, 0.08);
    text-align: left;
}

.display-menu-panel[hidden] {
    display: none !important;
}

.display-menu-panel-head {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.display-menu-panel-title {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #0f172a;
    line-height: 1.1;
    margin: 0;
}

.display-menu-panel-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.display-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    margin-top: 0;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(15, 23, 42, 0.1);
    background: #f8fafc;
    cursor: pointer;
    text-align: left;
    font: inherit;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.display-menu-toggle:hover:not(.is-on) .display-menu-toggle-label {
    color: #334155;
}

.display-menu-toggle.is-on:hover .display-menu-toggle-label {
    color: #1e293b;
}

.display-menu-toggle:focus-visible {
    outline: 2px solid #facc15;
    outline-offset: 2px;
}

.display-menu-toggle-label {
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #1e293b;
    transition: color 0.15s ease;
}

.display-menu-toggle-ui {
    position: relative;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
    border-radius: 999px;
    background: #cbd5e1;
    transition: background 0.2s ease;
}

.display-menu-toggle-knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: none;
    border: 1px solid rgba(15, 23, 42, 0.12);
    transition: transform 0.2s ease;
}

.display-menu-toggle.is-on .display-menu-toggle-ui {
    background: #ca8a04;
}

.display-menu-toggle.is-on .display-menu-toggle-knob {
    transform: translateX(18px);
}

/* High visibility: only page vs top bar tint + subtle separator (no timeline changes) */
body.pref-deutan {
    background: #f2f5fa;
}

body.pref-deutan .filter-tray {
    background: #ffffff;
    border-bottom: 1px solid rgba(100, 116, 139, 0.28);
    box-shadow: none;
}

/* --- Dark mode (flat controls, brighter glyphs on episode icons) --- */
body.pref-night {
    color-scheme: dark;
    background: #0b1020;
    color: #e2e8f0;
}

body.pref-night .filter-tray {
    background: #0f172a;
    border-bottom: 1px solid #334155;
    box-shadow: none;
}

/* Dark + high visibility: slightly lighter page, softer bar edge */
body.pref-night.pref-deutan {
    background: #141c2e;
}

body.pref-night.pref-deutan .filter-tray {
    border-bottom-color: rgba(148, 163, 184, 0.22);
}

body.pref-night .tray-brand-snl {
    color: #f8fafc;
    text-shadow: none;
}

body.pref-night .tray-brand-snl:hover {
    color: #ffffff;
}

body.pref-night .tray-brand-title {
    color: #94a3b8;
}

body.pref-night .display-menu-burger {
    background: #1e293b;
    border-color: #64748b;
    box-shadow: none;
}

body.pref-night .display-menu-burger:hover {
    background: #1e293b;
    border-color: #64748b;
    outline: none;
}

body.pref-night .display-menu-burger:hover .display-menu-gear {
    color: #ffffff;
}

body.pref-night .display-menu-gear {
    color: #f8fafc;
}

body.pref-night .tray-section-search .search-input {
    background: #1e293b;
    color: #f1f5f9;
    border-color: #64748b;
    box-shadow: none;
}

body.pref-night .tray-section-search .search-input::placeholder {
    color: #94a3b8;
}

body.pref-night .tray-section-search .search-input:focus {
    background: #0f172a;
    border-color: #facc15;
    box-shadow: none;
}

body.pref-night .view-toggle-btn.debut-toggle-btn {
    background: #1e293b;
    color: #f1f5f9;
    border-color: #64748b;
    box-shadow: none;
}

body.pref-night .view-toggle-btn.debut-toggle-btn:not(.active):not(:disabled):hover {
    background: #1e293b;
    color: #ffffff;
    border-color: #64748b;
    box-shadow: none;
    outline: none;
}

body.pref-night .view-toggle-btn.debut-toggle-btn.active:not(:disabled):hover {
    background: #facc15;
    color: #0a0a0a;
    border-color: #a16207;
    box-shadow: none;
    outline: none;
}

body.pref-night .view-toggle-btn.debut-toggle-btn.active {
    box-shadow: none;
}

body.pref-night .view-toggle-btn.debut-toggle-btn:disabled,
body.pref-night .view-toggle-btn.debut-toggle-btn.active:disabled {
    background: #0f172a;
    color: #94a3b8;
    border-color: #334155;
    opacity: 1;
    box-shadow: none;
}

body.pref-night .filter-tray .tray-controls .view-toggle-btn {
    box-shadow: none;
    text-shadow: none;
}

body.pref-night .filter-tray .tray-controls .view-toggle-btn:not(.active) {
    background: #1e293b;
    color: #f1f5f9;
    border-color: #64748b;
}

body.pref-night .filter-tray .tray-controls .view-toggle-btn:not(.active):not(:disabled):hover {
    background: #1e293b;
    color: #ffffff;
    border-color: #64748b;
    box-shadow: none;
    outline: none;
}

body.pref-night .filter-tray .tray-controls .view-toggle-btn.active {
    background: #facc15;
    color: #0a0a0a;
    border-color: #a16207;
    box-shadow: none;
}

body.pref-night .filter-tray .tray-controls .view-toggle-btn.active:not(:disabled):hover {
    background: #facc15;
    color: #0a0a0a;
    border-color: #a16207;
    box-shadow: none;
    outline: none;
}

body.pref-night .line-segment {
    background: #64748b;
}

body.pref-night .season-marker,
body.pref-night .season-marker-num {
    color: #cbd5e1;
}

body.pref-night.episodes-view .line-segment {
    background: #475569;
    opacity: 1;
}

body.pref-night.episodes-view .season-marker,
body.pref-night.episodes-view .season-marker-num {
    color: #94a3b8;
}

/* Timeline mini circles: light ring on dark page (replaces near-black ring from light theme) */
body.pref-night .square:not(.dimmed):not(.active) {
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.42);
}

body.pref-night .square:not(.dimmed):hover {
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.92), 0 4px 12px rgba(0, 0, 0, 0.35);
}

body.pref-night .square.repertory:not(.dimmed):hover,
body.pref-night .square.featured:not(.dimmed):hover,
body.pref-night .square.middle_group:not(.dimmed):hover {
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.92), 0 4px 12px rgba(0, 0, 0, 0.35);
}

body.pref-night .square.active.cohort-member {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.88), 0 4px 8px rgba(0, 0, 0, 0.4);
}

/* Active timeline dots that are not the gold “selected performer” stack (search / first-instance / etc.) */
body.pref-night .square.active:not(.selected-performer):not(.cohort-member) {
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5), 0 4px 8px rgba(0, 0, 0, 0.35);
}

/* Popup / profile card: always same light chrome as daytime (ignore site dark theme inside) */
body.pref-night .info-box {
    color-scheme: light;
    background: #ffffff;
    color: #1a1a1a;
    border-left: 4px solid #c9a227;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.08);
}

body.pref-night .era-reclick-hint-floating {
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}

body.pref-night .filter-tray .view-toggle-btn:not(:disabled):hover,
body.pref-night .filter-tray .view-toggle-btn.debut-toggle-btn:not(:disabled):hover {
    transform: none;
}

body.pref-night .display-menu-panel {
    background: #111827;
    border-color: #334155;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

body.pref-night .display-menu-panel-head {
    border-bottom-color: #334155;
}

body.pref-night .display-menu-panel-title {
    color: #f8fafc;
}

body.pref-night .display-menu-toggle {
    background: #1e293b;
    border-color: #475569;
}

body.pref-night .display-menu-toggle:hover:not(.is-on) .display-menu-toggle-label {
    color: #ffffff;
}

body.pref-night .display-menu-toggle.is-on:hover .display-menu-toggle-label {
    color: #e2e8f0;
}

body.pref-night .display-menu-toggle-label {
    color: #e2e8f0;
}

body.pref-night .display-menu-toggle-ui {
    background: #475569;
}

body.pref-night .display-menu-toggle.is-on .display-menu-toggle-ui {
    background: #ca8a04;
}

body.pref-night .display-menu-toggle.is-on .display-menu-toggle-knob {
    background: #f8fafc;
    border-color: #0f172a;
    box-shadow: none;
}

/* -------------------------------------------------------------------------- */
/* Responsive: ≤768px — compact tray + slide-out nav, timeline viewport,     */
/* full-screen info modal                                                     */
/* -------------------------------------------------------------------------- */

.tray-view-orbit {
    display: none;
}

.info-popup-chrome {
    position: static;
}

@media (min-width: 769px) {
    .info-popup-chrome {
        height: 0;
        margin: 0;
        padding: 0;
    }

    .info-popup-chrome-fill {
        position: absolute;
        width: 0;
        height: 0;
        left: 0;
        top: 0;
        overflow: visible;
        pointer-events: none;
    }

    #eraReclickHint {
        pointer-events: auto;
    }

    .info-popup-chrome .close-btn {
        position: absolute;
        top: 16px;
        right: 16px;
        pointer-events: auto;
    }
}

.tray-mobile-top,
.tray-nav-backdrop {
    display: none;
}

.tray-mobile-only {
    display: none !important;
}

/* Fixed bottom dock: Era + Debut (≤768px only; shown via media query). */
.mobile-mode-dock {
    display: none;
}

@media (max-width: 768px) {
    :root {
        --top-tray-height: 56px;
        --mobile-mode-dock-height: 128px;
    }

    body {
        padding: 8px;
        display: flex;
        flex-direction: column;
        min-height: 100dvh;
        /* Mobile uses an internal scroller for the season/era panel; avoid nested page scrollbars. */
        overflow: hidden;
    }

    .container {
        display: flex;
        flex-direction: column;
        flex: 1 1 0;
        min-height: 0;
        overflow: hidden;
    }

    body:has(.filter-tray.tray-nav-open) {
        overflow: hidden;
    }

    body:has(#infoBox.visible) {
        overflow: hidden;
    }

    /* Mobile: keep the info popup fully below the top tray. */
    .info-box {
        top: calc(var(--top-tray-height) + 8px);
        left: 8px;
        right: 8px;
        width: auto;
        max-width: none;
        /* Leave tappable space below to dismiss the popup. */
        bottom: calc(var(--mobile-mode-dock-height) + var(--site-credit-height) + env(safe-area-inset-bottom, 0px) + 14px);
        max-height: calc(100dvh - var(--top-tray-height) - var(--mobile-mode-dock-height) - var(--site-credit-height) - env(safe-area-inset-bottom, 0px) - 22px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Mobile: the close (×) button is enough; hide the large “Back to profile” tab button. */
    #infoBackToProfile {
        display: none !important;
    }

    .tray-mobile-top {
        display: flex;
        align-items: center;
        flex-wrap: nowrap;
        gap: 6px;
        min-height: var(--top-tray-height);
        padding: 4px 8px;
        flex-shrink: 0;
        border-bottom: 1px solid rgba(15, 23, 42, 0.08);
        background: inherit;
        max-width: 100%;
        min-width: 0;
        overflow-x: clip;
    }

    .tray-view-orbit {
        display: flex !important;
        flex: 1 1 auto;
        min-width: 0;
        justify-content: center;
        align-items: center;
        gap: 5px;
    }

    .view-orbit-btn {
        width: 30px;
        height: 30px;
        min-width: 30px;
        min-height: 30px;
        padding: 0;
        border-radius: 999px;
        font-size: 11px;
        font-weight: 700;
        letter-spacing: 0;
        line-height: 1;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    .filter-tray-inner .tray-controls {
        display: none !important;
    }

    .tray-nav-burger {
        width: 44px;
        height: 44px;
        border-radius: 10px;
        border: 1px solid rgba(15, 23, 42, 0.14);
        background: rgba(248, 250, 252, 0.95);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        flex-shrink: 0;
        padding: 0;
    }

    .tray-nav-burger-lines {
        display: block;
        width: 20px;
        height: 2px;
        background: #0a0a0a;
        border-radius: 1px;
        box-shadow: 0 -6px 0 #0a0a0a, 0 6px 0 #0a0a0a;
    }

    /* Make the burger icon feel less cramped/uneven. */
    .tray-nav-burger {
        border-radius: 12px;
    }
    .tray-nav-burger-lines {
        width: 18px;
        box-shadow: 0 -5px 0 #0a0a0a, 0 5px 0 #0a0a0a;
    }

    .tray-brand-snl--compact {
        font-size: 26px;
        line-height: 1;
        letter-spacing: -0.03em;
        text-decoration: none;
        color: #0a0a0a;
        font-family: var(--font-display);
        font-weight: 700;
        text-transform: uppercase;
    }

    .filter-tray {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        flex-shrink: 0;
        min-height: var(--top-tray-height);
        max-width: 100%;
        overflow-x: clip;
    }

    .tray-display-menu {
        display: none !important;
    }

    .filter-tray-inner {
        position: fixed;
        left: 0;
        right: 0;
        top: var(--top-tray-height);
        bottom: 0;
        width: 100%;
        max-width: none;
        height: auto;
        min-height: 0;
        margin: 0;
        padding: 14px 14px 18px;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 12px;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        z-index: 1004;
        background: #ffffff;
        transform: translateX(-105%);
        transition: transform 0.22s ease, visibility 0.22s ease;
        visibility: hidden;
        pointer-events: none;
        box-shadow: 6px 0 28px rgba(15, 23, 42, 0.12);
        border-top: 1px solid rgba(15, 23, 42, 0.06);
    }

    .filter-tray.tray-nav-open .filter-tray-inner {
        transform: translateX(0);
        visibility: visible;
        pointer-events: auto;
    }

    .tray-nav-backdrop {
        display: block;
        position: fixed;
        left: 0;
        right: 0;
        top: var(--top-tray-height);
        bottom: 0;
        z-index: 1003;
        background: rgba(15, 23, 42, 0.42);
        border: none;
        padding: 0;
        margin: 0;
    }

    .tray-nav-backdrop[hidden] {
        display: none !important;
    }

    .filter-tray-inner > .tray-section-search {
        max-width: none;
        width: 100%;
        align-self: stretch;
    }

    .tray-search-stack {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    /* Mobile burger menu: focus on Search + Dark mode only. */
    .filter-tray-inner .tray-brand,
    .filter-tray-inner > .tray-section:not(.tray-section-search) {
        display: none !important;
    }

    .filter-tray-inner > .tray-section-search {
        order: 1;
    }

    .filter-tray-inner .tray-mobile-settings {
        order: 2;
        display: flex !important;
    }

    /* Ensure the mobile dark mode toggle is always visible. */
    .tray-mobile-settings,
    .tray-mobile-settings .tray-mobile-night,
    #displayNightBtnMobile {
        display: inline-flex !important;
    }

    .tray-mobile-settings .tray-mobile-night {
        width: 100%;
    }

    .tray-search-stack .search-wrap.search-wrap-inline {
        max-width: none;
    }

    .tray-search-stack .debut-toggle-btn {
        display: none !important;
    }

    .tray-section-search .search-input {
        max-width: none;
        width: 100%;
        min-height: 44px;
        padding: 10px 12px;
        font-size: 16px; /* iOS: prevent zoom + improve readability */
        border-radius: 12px;
    }

    .tray-mobile-only {
        display: flex !important;
        flex-direction: column;
        gap: 8px;
        width: 100%;
        margin-top: 0;
        padding-top: 0;
        border-top: none;
    }

    .tray-mobile-settings-label {
        display: none;
    }

    .timeline-container {
        display: flex;
        flex-direction: column;
        flex: 1 1 auto;
        min-height: 0;
        /* Fixed `.filter-tray` still covers the top; reserve its height (+ notch) so the season grid is not hidden under it. */
        padding-top: calc(var(--top-tray-height) + env(safe-area-inset-top, 0px) + 10px);
        padding-bottom: calc(var(--mobile-mode-dock-height) + env(safe-area-inset-bottom, 0px));
        height: auto;
        max-height: none;
        overflow-x: hidden;
        overflow-y: hidden;
        overscroll-behavior: contain;
        scroll-snap-type: none;
        max-width: 100%;
        min-width: 0;
    }

    /* Mobile Era view: reserve room for the fixed credit line above the dock (avoid overlap without adding scroll). */
    .timeline-container:has(#timeline.timeline--mobile-cohort) {
        padding-bottom: calc(var(--mobile-mode-dock-height) + var(--site-credit-height) + env(safe-area-inset-bottom, 0px));
    }

    /* Notice sits above the mobile dock; pad for both so the last season row stays clear. */
    body.privacy-storage-notice-visible .timeline-container {
        padding-bottom: calc(
            var(--mobile-mode-dock-height) + env(safe-area-inset-bottom, 0px) + clamp(96px, 28vh, 240px)
        );
    }

    .mobile-mode-dock {
        display: flex;
        flex-direction: column;
        position: fixed;
        left: 0;
        right: 0;
        bottom: var(--site-credit-height);
        z-index: 1002;
        padding: 0 8px calc(8px + env(safe-area-inset-bottom, 0px));
        background: linear-gradient(to top, rgba(248, 250, 252, 0.98) 70%, rgba(248, 250, 252, 0));
        pointer-events: none;
    }

    .mobile-mode-dock-hint-wrap,
    .mobile-mode-dock-bar {
        pointer-events: auto;
    }

    .mobile-mode-dock-hint-wrap {
        margin-bottom: 6px;
    }

    .mobile-mode-dock .era-reclick-hint-floating {
        position: relative;
        left: auto;
        top: auto;
        width: 100%;
        max-width: 100%;
        z-index: 1;
        box-shadow: 0 2px 10px rgba(15, 23, 42, 0.12);
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 6px;
    }

    .mobile-mode-dock-bar {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 12px;
    }

    .mobile-mode-dock-btn {
        min-height: 44px;
        min-width: 72px;
        padding: 10px 18px;
        font-size: 11px;
        letter-spacing: 0.12em;
    }

    .timeline-season-page-title--cohort {
        color: #854d0e;
    }

    .timeline-season-page-sub--cohort {
        color: #64748b;
        font-weight: 600;
    }

    /* (Mobile Era) Cohort view now reuses the normal portrait grid; no extra “roster chips” UI. */

    /* Fill `.timeline-container` flex area; avoid `height:100%` (often resolves to 0 with `height:auto` parents). */
    .timeline-container > #timeline.timeline--mobile-pages {
        flex: 1 1 0;
        min-height: 0;
        min-width: 0;
        align-self: stretch;
    }

    /* Mobile Seasons view: remove the extra middle header box text (Season/years/subline). */
    #timeline.timeline--mobile-pages:not(.timeline--mobile-cohort) .timeline-mobile-season-head-slot {
        display: none;
    }

    /* Mobile: season list role/badge tags should wrap and fit without pushing layout wider. */
    .info-season-item {
        align-items: flex-start;
    }

    .info-season-right {
        max-width: 52%;
        flex: 0 1 auto;
    }

    .info-season-role,
    .info-season-badge {
        font-size: 8px;
        padding: 1px 4px;
    }

    /* Drop desktop rail padding (64px top / 100px left) so the season grid uses full width. */
    .timeline.timeline--mobile-pages {
        display: flex;
        flex-direction: column;
        flex: 1 1 0;
        min-height: 0 !important;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        padding: 0 0 12px !important;
        overflow: hidden;
    }

    .timeline-mobile-sticky-stack {
        flex: 0 0 auto;
        z-index: 3;
        background: #f8fafc;
        border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    }

    .timeline-mobile-season-head-slot {
        padding: 0 4px 8px;
    }

    .timeline-mobile-season-scroll {
        flex: 1 1 0;
        min-height: 0;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        padding: 4px 4px 12px;
        scroll-snap-align: unset;
        scroll-snap-stop: normal;
    }

    /* Mobile Era "Cohort" view: fit content (avoid big empty scroll area). */
    .timeline.timeline--mobile-pages.timeline--mobile-cohort .timeline-mobile-season-scroll {
        /* Give portraits their own scroll area; keep them clear of the fixed credit line. */
        flex: 1 1 0;
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        /* Use container padding (above) to avoid overlap without creating extra scroll space. */
        padding-bottom: 12px;
    }

    /* Mobile Era: dense cohort (≥28 peers) uses smaller circles. */
    .timeline.timeline--mobile-pages.timeline--mobile-cohort.timeline--mobile-cohort-dense .square.square--timeline-mobile {
        width: 28px !important;
        height: 28px !important;
    }

    .timeline-mobile-season-nav {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: center;
        gap: 10px;
        margin-bottom: 0;
        padding: 6px 4px 10px;
        position: static;
        top: auto;
        z-index: auto;
        background: transparent;
        border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    }

    .timeline-mobile-season-prev,
    .timeline-mobile-season-next {
        flex: 0 0 auto;
        min-width: 44px;
        min-height: 44px;
        padding: 0 12px;
        border-radius: 10px;
        border: 1px solid #cbd5e1;
        background: #fff;
        font-family: var(--font-display);
        font-size: 16px;
        font-weight: 700;
        color: #0f172a;
        cursor: pointer;
    }

    .timeline-mobile-season-prev:disabled,
    .timeline-mobile-season-next:disabled {
        opacity: 0.35;
        cursor: default;
    }

    .timeline-mobile-season-select {
        flex: 1 1 160px;
        min-width: 0;
        max-width: 220px;
        min-height: 44px;
        padding: 8px 12px;
        border-radius: 10px;
        border: 1px solid #cbd5e1;
        background: #fff;
        font-family: var(--font-body);
        font-size: 15px;
        font-weight: 600;
        color: #0f172a;
    }

    .timeline-season-page {
        min-height: calc(100dvh - var(--top-tray-height) - 20px);
        scroll-snap-align: start;
        scroll-snap-stop: always;
        box-sizing: border-box;
        padding: 10px 4px 20px;
        border-bottom: 1px solid rgba(15, 23, 42, 0.1);
    }

    /* Mobile Era (single “Era” page): don't force a full-viewport page height (creates empty scroll space). */
    #timeline.timeline--mobile-cohort .timeline-season-page {
        min-height: auto;
        scroll-snap-align: unset;
        scroll-snap-stop: normal;
        border-bottom: none;
        padding-bottom: 12px;
    }

    .timeline-season-page-head {
        display: flex;
        flex-wrap: wrap;
        align-items: baseline;
        gap: 6px 10px;
        margin-bottom: 12px;
        font-family: var(--font-display);
    }

    .timeline-season-page-title {
        font-size: 15px;
        font-weight: 700;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        color: #0f172a;
    }

    .timeline-season-page-years {
        font-size: 12px;
        font-weight: 600;
        color: #64748b;
    }

    .timeline-season-page-sub {
        font-size: 11px;
        width: 100%;
        color: #94a3b8;
        font-family: var(--font-body);
    }

    .timeline-season-cast {
        display: grid;
        /* Bigger circles: fewer per row when space is tight. */
        grid-template-columns: repeat(auto-fit, minmax(clamp(40px, 13vw, 72px), 1fr));
        gap: clamp(8px, 2vw, 12px);
        width: 100%;
        max-width: 100%;
        min-width: 0;
        /* Center episode / host / MG circles in each cell (stretch looked off-center on narrow rows). */
        justify-items: center;
        align-items: start;
    }

    body.mobile-cohort-active .timeline-season-cast {
        grid-template-columns: repeat(auto-fit, minmax(clamp(48px, 16vw, 84px), 1fr));
        gap: clamp(10px, 3vw, 18px);
    }

    body.mobile-cohort-active.writers-view .timeline-season-cast {
        grid-template-columns: repeat(auto-fit, minmax(clamp(36px, 12vw, 58px), 1fr));
    }

    body.writers-view .timeline-season-cast {
        grid-template-columns: repeat(auto-fit, minmax(clamp(28px, 8vw, 46px), 1fr));
    }

    /*
     * Grid: photo/initials are position:absolute, so height:auto collapses to 0 — use explicit
     * circle size and center in the cell (same footprint as desktop timeline dots).
     */
    .square.square--timeline-mobile {
        position: relative !important;
        left: auto !important;
        top: auto !important;
        margin: 0 auto;
        /* Match the grid cell's minmax so circles grow when space allows. */
        width: clamp(40px, 13vw, 72px) !important;
        height: clamp(40px, 13vw, 72px) !important;
        min-width: 28px;
        min-height: 28px;
        max-width: 100%;
        justify-self: center;
        align-self: center;
    }

    .square.square--timeline-mobile.writer-view-circle {
        width: clamp(26px, 8vw, 46px) !important;
        height: clamp(26px, 8vw, 46px) !important;
        min-width: 22px;
        min-height: 22px;
    }

    .square.square--timeline-mobile.writer-view-circle .writer-square-initials {
        font-size: clamp(8px, 2.6vmin, 12px);
    }

    .square.square--timeline-mobile.square-initials-fallback .square-initials-overlay {
        font-size: clamp(9px, 2.8vmin, 15px);
    }

    .square.square--timeline-mobile.episode-square .episode-square-num {
        font-size: clamp(9px, 3.2vmin, 15px);
    }

    .square.square--timeline-mobile.five-timer-host::after {
        right: -1px;
        bottom: -1px;
        transform: scale(0.88);
        transform-origin: bottom right;
    }

    /* Episode index / host–guest circles: lock a square box so grid stretch cannot make ovals. */
    .square.square--timeline-mobile.episode-square {
        width: 34px !important;
        height: 34px !important;
        max-width: 34px !important;
        max-height: 34px !important;
        box-sizing: border-box;
        flex-shrink: 0;
        justify-self: center !important;
        align-self: center !important;
    }

    .square.square--timeline-mobile .square-tooltip {
        left: 50%;
        transform: translateX(calc(-50% + var(--tt-shift, 0px)));
        max-width: min(280px, calc(100vw - 24px));
        box-sizing: border-box;
    }

    /* Mobile: show tooltip below circles so it never tucks under the top tray. */
    .timeline.timeline--mobile-pages .square.square--timeline-mobile .square-tooltip {
        bottom: auto;
        top: calc(100% + 8px);
        margin-bottom: 0;
    }

    /*
     * Hidden profile must not stay in the flex column: `visibility:hidden` still reserves layout
     * space, which was squeezing `#timeline` / the cast grid to zero height.
     */
    .info-box:not(.visible) {
        display: none !important;
    }

    /* Full-screen modal when open (out of document flow like desktop). */
    .info-box.visible {
        display: flex !important;
        flex-direction: column;
        position: fixed;
        inset: 0;
        top: 0 !important;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: none;
        height: 100%;
        max-height: none;
        border-radius: 0;
        border-left: none;
        border-top: 4px solid #c9a227;
        z-index: 1100;
    }

    .info-popup-chrome {
        display: contents;
    }

    .info-popup-chrome-fill {
        display: none;
    }

    .info-popup-chrome .close-btn {
        position: absolute;
        top: 12px;
        right: 12px;
        z-index: 12;
        width: 44px;
        height: 44px;
        font-size: 26px;
        line-height: 1;
        border-radius: 999px;
        background: rgba(248, 250, 252, 0.92);
        border: 1px solid rgba(15, 23, 42, 0.12);
        box-shadow: 0 2px 10px rgba(15, 23, 42, 0.08);
    }

    .info-content {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-top: 4px;
    }

    /* Episode popup: sketch list must shrink inside the modal flex column (not height 0). */
    .info-box--episode #infoSketches.info-tab-content {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .info-header {
        align-items: flex-start;
        /* Only the header needs clearance for the fixed ×; keep tabs/details/stamps full width below. */
        padding-inline-end: calc(12px + 44px + 22px + env(safe-area-inset-right, 0px));
    }

    /*
     * Contract paper mode uses `padding: 12px 14px` on `.info-header` (higher specificity than the rule
     * above), which was resetting the right inset — long names (e.g. Andrew Dismukes) drew under the ×.
     */
    #infoBox.performer-contract-style .info-header {
        padding-inline-end: calc(12px + 44px + 22px + env(safe-area-inset-right, 0px));
    }

    .info-name-section {
        padding-right: 0;
        min-width: 0;
        max-width: 100%;
    }

    .info-header-meta {
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    .info-content .info-name-section h3 {
        max-width: 100%;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    /* Seasons list: long writer credits (e.g. Writing Supervisor) — no all-caps; don’t grow pills in flex row. */
    .info-season-right {
        flex: 0 1 auto;
        min-width: 0;
    }

    .info-season-badge:not(.info-season-badge--wu),
    .info-season-role {
        flex: 0 0 auto;
        width: fit-content;
        max-width: 100%;
    }

    .info-season-badge--writer {
        text-transform: none;
        letter-spacing: 0.02em;
    }

    body.pref-night .tray-mobile-top {
        border-bottom-color: #334155;
    }

    body.pref-night .tray-nav-burger {
        background: #1e293b;
        border-color: #64748b;
    }

    body.pref-night .tray-nav-burger-lines {
        background: #f8fafc;
        box-shadow: 0 -6px 0 #f8fafc, 0 6px 0 #f8fafc;
    }

    body.pref-night .tray-brand-snl--compact {
        color: #f8fafc;
    }

    body.pref-night .filter-tray-inner {
        background: #0f172a;
        border-top-color: #334155;
        box-shadow: 6px 0 32px rgba(0, 0, 0, 0.45);
    }

    body.pref-night .tray-mobile-settings-label {
        color: #94a3b8;
    }

    body.pref-night .tray-mobile-only {
        border-top-color: #334155;
    }

    body.pref-night .close-btn {
        background: rgba(248, 250, 252, 0.12);
        color: #e2e8f0;
    }

    body.pref-night .info-popup-chrome .close-btn {
        background: rgba(30, 41, 59, 0.95);
        border-color: #475569;
        color: #f8fafc;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
    }

    body.pref-night .timeline-mobile-sticky-stack {
        background: #0f172a;
        border-bottom-color: #334155;
    }

    body.pref-night .timeline-mobile-season-nav {
        background: transparent;
        border-bottom-color: #334155;
    }

    body.pref-night .timeline-mobile-season-prev,
    body.pref-night .timeline-mobile-season-next,
    body.pref-night .timeline-mobile-season-select {
        background: #1e293b;
        border-color: #475569;
        color: #f8fafc;
    }

    body.pref-night .timeline-season-page {
        border-bottom-color: #334155;
    }

    body.pref-night .timeline-season-page-title {
        color: #f8fafc;
    }

    body.pref-night .timeline-season-page-years {
        color: #94a3b8;
    }

    body.pref-night .timeline-season-page-sub {
        color: #64748b;
    }

    body.pref-night .info-popup-chrome {
        border-bottom-color: #334155;
    }

    body.pref-night .view-orbit-btn.view-toggle-btn:not(.active) {
        background: #1e293b;
        color: #f1f5f9;
        border-color: #64748b;
    }

    body.pref-night .view-orbit-btn.view-toggle-btn.active {
        background: #facc15;
        color: #0a0a0a;
        border-color: #a16207;
    }

    body.pref-night .mobile-mode-dock {
        background: linear-gradient(to top, rgba(15, 23, 42, 0.98) 70%, rgba(15, 23, 42, 0));
    }

    body.pref-night .timeline-season-page-title--cohort {
        color: #facc15;
    }

    body.pref-night .timeline-season-page-sub--cohort {
        color: #94a3b8;
    }
}

/* Mobile landscape: reclaim vertical space for portrait viewport. */
@media (max-width: 768px) and (max-height: 480px) and (orientation: landscape) {
    :root {
        --top-tray-height: 44px;
        --mobile-mode-dock-height: 76px;
    }

    .tray-mobile-top {
        padding: 2px 8px;
        min-height: var(--top-tray-height);
    }

    .mobile-mode-dock {
        padding: 0 8px calc(6px + env(safe-area-inset-bottom, 0px));
    }

    /* Keep the hint available but less tall in landscape. */
    .mobile-mode-dock .era-reclick-hint-floating {
        font-size: 10px;
        padding: 5px 10px;
    }

    .mobile-mode-dock-btn {
        min-height: 36px;
        padding: 7px 12px;
    }
}

/* iPhone-ish widths: allow slightly larger portrait grid (more space available). */
@media (max-width: 768px) and (min-width: 390px) {
    /* iPhone-ish widths: prefer 4 per row (bigger circles, fewer columns). */
    body:not(.writers-view) .timeline-season-cast {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: clamp(8px, 2.2vw, 14px);
    }
    body:not(.writers-view) .square.square--timeline-mobile {
        width: clamp(56px, 18vw, 86px) !important;
        height: clamp(56px, 18vw, 86px) !important;
        min-width: 44px;
        min-height: 44px;
    }
}

/* --- Browser storage notice (localStorage; no first-party HTTP cookies) --- */
.privacy-storage-notice {
    position: fixed;
    z-index: 1150;
    left: 0;
    right: 0;
    bottom: 0;
    /* Bar must not steal clicks/drags from the timeline behind it — only the inner controls react. */
    pointer-events: none;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    background: rgba(15, 23, 42, 0.96);
    color: #f1f5f9;
    border-top: 1px solid rgba(248, 250, 252, 0.12);
    font-family: var(--font-body), system-ui, sans-serif;
    font-size: 13px;
    line-height: 1.45;
    box-shadow: 0 -6px 28px rgba(0, 0, 0, 0.22);
    box-sizing: border-box;
}

.privacy-storage-notice[hidden] {
    display: none !important;
}

.privacy-storage-notice-inner {
    position: relative;
    max-width: min(920px, 100%);
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    justify-content: space-between;
    /* Let clicks reach the timeline behind the bar; only buttons opt back in. */
    pointer-events: none;
    padding-right: 40px;
}

.privacy-storage-notice-close {
    position: absolute;
    top: 2px;
    right: 0;
    pointer-events: auto;
    appearance: none;
    -webkit-appearance: none;
    margin: 0;
    padding: 4px 10px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #94a3b8;
    font: inherit;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 36px;
}

.privacy-storage-notice-close:hover {
    color: #f1f5f9;
    background: rgba(248, 250, 252, 0.08);
}

.privacy-storage-notice-close:focus-visible {
    outline: 2px solid #fde047;
    outline-offset: 2px;
}

.privacy-storage-notice-text {
    margin: 0;
    flex: 1 1 220px;
    color: #e2e8f0;
}

.privacy-storage-notice-text strong {
    color: #fff;
    font-weight: 600;
}

.privacy-storage-notice-actions {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    pointer-events: auto;
}

.privacy-storage-notice-btn {
    flex: 0 0 auto;
    appearance: none;
    -webkit-appearance: none;
    font: inherit;
    cursor: pointer;
    padding: 10px 18px;
    border-radius: 10px;
    border: 1px solid #facc15;
    background: #facc15;
    color: #0f172a;
    font-weight: 600;
    font-size: 13px;
}

.privacy-storage-notice-btn:hover {
    filter: brightness(1.05);
}

.privacy-storage-notice-btn:focus-visible {
    outline: 2px solid #fde047;
    outline-offset: 2px;
}

.privacy-storage-notice-btn--secondary {
    border-color: rgba(248, 250, 252, 0.35);
    background: transparent;
    color: #f1f5f9;
}

.privacy-storage-notice-btn--secondary:hover {
    filter: brightness(1.08);
    background: rgba(248, 250, 252, 0.08);
}

body.pref-night .privacy-storage-notice {
    background: rgba(2, 6, 23, 0.97);
    border-top-color: rgba(71, 85, 105, 0.5);
}

body.pref-night .privacy-storage-notice-close {
    color: #64748b;
}

body.pref-night .privacy-storage-notice-close:hover {
    color: #e2e8f0;
}

@media (max-width: 768px) {
    .privacy-storage-notice {
        bottom: calc(var(--mobile-mode-dock-height, 128px) + 8px + env(safe-area-inset-bottom, 0px));
    }
}
