/* Inter 5.3.0, variable (weight + optical size), from @fontsource-variable/inter (SIL OFL,
   fonts/LICENSE-inter.txt). Hosted here instead of Google Fonts: no visitor IP goes to Google.
   latin-ext only loads for titles that need it (ō, ū, ...). New version = new file names. */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('../fonts/inter-latin-opsz-5.3.0.woff2') format('woff2');
    unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('../fonts/inter-latin-ext-opsz-5.3.0.woff2') format('woff2');
    unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

:root {
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-mono: 'Courier New', 'Consolas', monospace;
    --black: #0a0a0a;
    --white: #ffffff;
    --gray-50: #fafafa;
    --gray-100: #f5f5f5;
    --gray-200: #e5e5e5;
    --gray-300: #d4d4d4;
    --gray-400: #a3a3a3;
    --gray-500: #737373;
    --gray-600: #525252;
    --gray-700: #404040;
    --gray-800: #262626;
    --gray-900: #171717;

    --user-accent: #d13438;
    --user-accent-dim: rgba(209, 52, 56, 0.12);

    --bg: var(--white);
    --bg-secondary: var(--gray-50);
    --surface: var(--white);
    --surface-hover: var(--gray-100);
    --border: var(--gray-200);
    --border-subtle: var(--gray-100);
    --text: var(--black);
    /* One step darker than gray-500: 4.5:1 also on hover backgrounds (--surface-hover) */
    --text-secondary: #707070;
    /* Decoration only (icons, borders, markers): below 4.5:1 on purpose. Text uses --text-secondary */
    --text-tertiary: var(--gray-400);
    --accent: var(--black);
    --accent-hover: var(--gray-800);
    --accent-text: var(--white);
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #f59e0b;
    /* Status colours for small text: the ones above are too light for it on white (2.1:1, 3.3:1) */
    --text-warning: #b45309;
    --text-success: #15803d;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-2xl: 28px;
    --radius-full: 9999px;

    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 40px;
    --space-2xl: 64px;
    --space-3xl: 96px;
    --space-4xl: 140px;
    --space-section: 120px;

    --nav-height: 72px;
    --content-max: 1200px;

    --ease: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-out: cubic-bezier(0.33, 1, 0.68, 1);
    --ease-in-out: cubic-bezier(0.76, 0, 0.24, 1);
    --duration: 0.6s;
    --duration-fast: 0.3s;

    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: var(--black);
        --bg-secondary: var(--gray-900);
        --surface: var(--gray-900);
        --surface-hover: var(--gray-800);
        --border: var(--gray-800);
        --border-subtle: var(--gray-900);
        --text: var(--gray-100);
        --text-secondary: var(--gray-400);
        --text-tertiary: var(--gray-600);
        --text-warning: #fbbf24;
        --text-success: #4ade80;
        --accent: var(--white);
        --accent-hover: var(--gray-200);
        --accent-text: var(--black);
    }
}

:root[data-theme="dark"] {
    --bg: var(--black);
    --bg-secondary: var(--gray-900);
    --surface: var(--gray-900);
    --surface-hover: var(--gray-800);
    --border: var(--gray-800);
    --border-subtle: var(--gray-900);
    --text: var(--gray-100);
    --text-secondary: var(--gray-400);
    --text-tertiary: var(--gray-600);
    --text-warning: #fbbf24;
    --text-success: #4ade80;
    --accent: var(--white);
    --accent-hover: var(--gray-200);
    --accent-text: var(--black);
}

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

html {
    font-family: var(--font);
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
    overflow-x: hidden;
    cursor: none;
}

@media (pointer: coarse) {
    body { cursor: auto; }
}

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: none; border: none; background: none; color: inherit; }
@media (pointer: coarse) { button { cursor: auto; } }
img { display: block; max-width: 100%; }
input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ===== Custom Cursor ===== */
.cursor {
    position: fixed;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    pointer-events: none;
    z-index: 9999;
    mix-blend-mode: difference;
    transform: translate(-50%, -50%);
    will-change: transform, width, height;
    transition: width 0.4s var(--ease), height 0.4s var(--ease);
    top: 0;
    left: 0;
}

.cursor.grow {
    width: 64px;
    height: 64px;
}

.cursor.hide {
    width: 0;
    height: 0;
}

@media (pointer: coarse) {
    .cursor { display: none; }
}

/* ===== Navigation (Minimal) ===== */
.glass-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    z-index: 100;
    background: transparent;
    mix-blend-mode: normal;
    pointer-events: none;
}

/* Once the page scrolls, the bar gets a frosted backdrop so content passes underneath softly (js/app.js) */
.glass-nav::before {
    content: '';
    position: absolute;
    inset: 0;
    background: color-mix(in srgb, var(--bg) 70%, transparent);
    -webkit-backdrop-filter: blur(18px) saturate(1.4);
    backdrop-filter: blur(18px) saturate(1.4);
    border-bottom: 1px solid var(--border-subtle);
    opacity: 0;
    transition: opacity 0.3s var(--ease);
}
.glass-nav.is-scrolled::before { opacity: 1; }

.nav-inner {
    position: relative;
    max-width: var(--content-max);
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-xl);
    pointer-events: auto;
}

.nav-logo {
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: -0.03em;
    flex-shrink: 0;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex-shrink: 0;
}

.nav-icon-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    aspect-ratio: 1;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    position: relative;
    transition: opacity var(--duration-fast) ease;
}

.nav-icon-btn svg { width: 20px; height: 20px; }
.nav-icon-btn:hover { opacity: 0.6; }

.user-avatar-btn {
    overflow: hidden;
    padding: 0;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
    position: relative;
}

.user-avatar-btn svg {
    width: 20px;
    height: 20px;
}

.avatar-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-full);
}

/* ===== Nav Links (Cuberto hover) ===== */
.nav-links {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.nav-link {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    overflow: hidden;
    height: 1.3em;
    position: relative;
    transition: color var(--duration-fast) ease;
}

.nav-link.active { color: var(--text); font-weight: 600; }

.nav-link-inner {
    display: flex;
    flex-direction: column;
    transition: transform 0.4s var(--ease);
}

.nav-link-inner > span {
    display: block;
    line-height: 1.3;
    white-space: nowrap;
}

.nav-link-inner > span:last-child {
    color: var(--text);
    font-weight: 600;
}

.nav-link:hover .nav-link-inner {
    transform: translateY(-50%);
}

.nav-link:hover {
    color: var(--text-secondary);
}

/* ===== Buttons ===== */
.glass-icon-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    aspect-ratio: 1;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    transition: opacity var(--duration-fast) ease;
    position: relative;
}

.glass-icon-btn svg { width: 20px; height: 20px; }
.glass-icon-btn:hover { opacity: 0.6; }

.glass-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 12px var(--space-xl);
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 0.9rem;
    transition: all var(--duration) var(--ease);
    white-space: nowrap;
}

.glass-btn-primary {
    background: var(--accent);
    color: var(--accent-text);
}

.glass-btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

.glass-btn-secondary {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.glass-btn-secondary:hover {
    border-color: var(--text);
}

.glass-btn-sm { padding: 8px var(--space-md); font-size: 0.8rem; }

/* ===== Badge ===== */
.badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 8px;
    height: 8px;
    background: var(--user-accent);
    border-radius: var(--radius-full);
    font-size: 0;
}

/* ===== Dropdown ===== */
.user-menu { position: relative; }

.glass-dropdown {
    position: absolute;
    top: calc(100% + var(--space-sm));
    right: 0;
    min-width: 200px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 16px 48px rgba(0,0,0,0.12);
    padding: var(--space-xs);
    z-index: 200;
}

.glass-dropdown:not([hidden]) {
    animation: dropIn 0.3s var(--ease);
}

@keyframes dropIn {
    from { opacity: 0; transform: translateY(-8px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.dropdown-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    transition: background var(--duration-fast) ease;
}

.dropdown-item:hover { background: var(--surface-hover); }
.dropdown-item.danger { color: var(--danger); }

.dropdown-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: var(--space-xs) 0;
}

/* ===== Main Content ===== */
.main-content {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: calc(var(--nav-height) + var(--space-xl)) var(--space-xl) var(--space-4xl);
    min-height: 100dvh;
}

/* ===== Search Overlay ===== */
.glass-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 100px;
    animation: fadeIn 0.2s ease;
}

.overlay-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.search-container {
    position: relative;
    width: 90%;
    max-width: 600px;
    max-height: 65vh;
    display: flex;
    flex-direction: column;
    z-index: 1;
    background: var(--bg);
    border-radius: var(--radius-2xl);
    box-shadow: 0 32px 80px rgba(0,0,0,0.2);
    overflow: hidden;
    animation: scaleIn 0.4s var(--ease);
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95) translateY(-16px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.search-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border);
}

.search-icon {
    width: 20px;
    height: 20px;
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.search-header input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    font-size: 1rem;
    padding: 0;
}

.search-results {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-sm);
}

.search-result-item {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-md);
    border-radius: var(--radius-lg);
    transition: background var(--duration-fast) ease;
    cursor: none;
}

@media (pointer: coarse) { .search-result-item { cursor: pointer; } }

.search-result-item:hover { background: var(--surface-hover); }

.search-result-img {
    width: 52px;
    height: 72px;
    border-radius: var(--radius-md);
    object-fit: cover;
    flex-shrink: 0;
}

.search-result-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    min-width: 0;
}

.search-result-title {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ===== Cards (Borderless, Gallery-like) ===== */
.media-card {
    position: relative;
    width: 100%;
    border-radius: var(--radius-xl);
    overflow: hidden;
    cursor: none;
    transition: transform 0.5s var(--ease);
}

@media (pointer: coarse) { .media-card { cursor: pointer; } }

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

.media-card:active {
    transform: scale(0.98);
    transition-duration: 0.15s;
}

.media-card-img {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    display: block;
}

.media-card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--space-2xl) var(--space-md) var(--space-md);
    background: linear-gradient(to top, rgba(0,0,0,0.92) 0%, rgba(0,0,0,0.6) 50%, rgba(0,0,0,0.1) 80%, transparent 100%);
    color: white;
    text-shadow: 0 1px 4px rgba(0,0,0,0.7);
}

.media-card-title {
    font-weight: 600;
    font-size: 0.85rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.media-card-sub {
    font-size: 0.75rem;
    opacity: 0.6;
    margin-top: 2px;
}

.cw-inc {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    z-index: 3;
    min-width: 38px;
    height: 28px;
    padding: 0 10px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: none;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.2s, transform 0.2s var(--ease), background 0.2s;
}

.media-card:hover .cw-inc,
.cw-inc:focus-visible {
    opacity: 1;
    transform: scale(1);
}

.cw-inc:hover {
    background: var(--user-accent);
    border-color: transparent;
}

.cw-inc:active { transform: scale(0.85); }

@media (hover: none) {
    .cw-inc { opacity: 1; transform: none; }
}

.media-card-score {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    display: flex;
    align-items: center;
    gap: 3px;
    z-index: 2;
}

.media-card-score::before {
    content: '\2605';
    color: var(--warning);
    font-size: 0.7rem;
}

.media-card-status {
    position: absolute;
    top: var(--space-sm);
    left: var(--space-sm);
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    z-index: 2;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* Taste match on recommendation cards — deliberately unlike the ★ AniList score badge */
.media-card-match {
    position: absolute;
    top: var(--space-sm);
    left: var(--space-sm);
    z-index: 2;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background: var(--user-accent);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.35);
}

.media-card-because {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    opacity: 0.75;
}

.status-watching { background: rgba(209,52,56,0.8); color: white; }
.status-completed { background: rgba(22,163,74,0.8); color: white; }
.status-planning { background: rgba(115,115,115,0.8); color: white; }
.status-dropped { background: rgba(220,38,38,0.8); color: white; }
.status-paused { background: rgba(245,158,11,0.8); color: #111; }
.status-airing { background: rgba(22,163,74,0.8); color: white; }

/* ===== Grid Layouts ===== */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: var(--space-lg);
}

.media-grid-lg { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.media-grid-sm { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }

/* ===== Section Headers (Massive) ===== */
.section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: var(--space-xl);
}

.section-title {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.1;
}

.section-link {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    transition: color var(--duration-fast) ease;
}

.section-link:hover { color: var(--text); }

/* ===== Horizontal Scroll ===== */
.scroll-row {
    display: flex;
    gap: var(--space-md);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding-bottom: var(--space-sm);
}

.scroll-row::-webkit-scrollbar { display: none; }

.scroll-row > .media-card {
    flex: 0 0 160px;
    scroll-snap-align: start;
}

/* ===== Activity Feed ===== */
.activity-card {
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-xl);
    transition: background var(--duration-fast) ease;
    margin-bottom: 2px;
}

.activity-card:hover { background: var(--surface-hover); }

.activity-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.activity-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    object-fit: cover;
    flex-shrink: 0;
}

.activity-user { font-weight: 600; font-size: 0.9rem; }
.activity-time { font-size: 0.8rem; color: var(--text-secondary); }
.activity-user { font-size: 0.85rem; }
.activity-time { font-size: 0.7rem; }
.activity-text { font-size: 0.85rem; line-height: 1.6; white-space: pre-line; }
.activity-mention { color: var(--primary); text-decoration: none; font-weight: 500; }
.activity-mention:hover { text-decoration: underline; }

.activity-media {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-sm);
    padding: var(--space-sm);
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    cursor: none;
    transition: background var(--duration-fast) ease;
}

@media (pointer: coarse) { .activity-media { cursor: pointer; } }

.activity-media:hover { background: var(--surface-hover); }

.activity-media-img {
    width: 44px;
    height: 62px;
    border-radius: var(--radius-md);
    object-fit: cover;
    flex-shrink: 0;
}

.activity-media-info { display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.activity-media-title { font-weight: 600; font-size: 0.8rem; }
.activity-media-progress { font-size: 0.7rem; color: var(--text-secondary); }

.activity-actions {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-top: var(--space-sm);
}

.liker-avatars {
    display: flex;
    align-items: center;
}
.liker-avatar {
    display: block;
    width: 22px;
    height: 22px;
    border-radius: var(--radius-full);
    overflow: hidden;
    border: 2px solid var(--bg);
    margin-left: -6px;
    transition: transform var(--duration-fast) ease;
}
.liker-avatar:first-child { margin-left: 0; }
.liker-avatar:hover { transform: scale(1.15); z-index: 1; }
.liker-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.liker-extra {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-left: var(--space-xs);
}

.activity-action-btn {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: 0.8rem;
    color: var(--text-secondary);
    transition: color var(--duration-fast) ease;
}

.activity-action-btn svg { width: 16px; height: 16px; }
.activity-action-btn:hover { color: var(--text); }
.activity-action-btn.liked { color: var(--danger); }

/* ===== List Table ===== */
.list-controls {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
}

.list-tab {
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--duration-fast) ease;
    background: transparent;
    border: none;
}

.list-tab:hover { color: var(--text); }

.list-tab.active {
    background: var(--accent);
    color: var(--accent-text);
}

.list-entry {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-xl);
    transition: background var(--duration-fast) ease;
}

.list-entry:hover { background: var(--surface-hover); }

.list-entry-img {
    width: 48px;
    height: 68px;
    border-radius: var(--radius-md);
    object-fit: cover;
    flex-shrink: 0;
    cursor: none;
}

@media (pointer: coarse) { .list-entry-img { cursor: pointer; } }

.list-entry-info { flex: 1; min-width: 0; }

.list-entry-title {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: none;
}

@media (pointer: coarse) { .list-entry-title { cursor: pointer; } }

.list-entry-title:hover { opacity: 0.6; }

.list-entry-meta { font-size: 0.8rem; color: var(--text-secondary); margin-top: 2px; }

.list-entry-progress {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-shrink: 0;
}

.progress-text {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    min-width: 60px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.progress-btn {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    color: var(--text);
    font-size: 1rem;
    font-weight: 700;
    transition: all var(--duration-fast) ease;
}

.progress-btn:hover {
    background: var(--accent);
    color: var(--accent-text);
}

.progress-btn:active { transform: scale(0.85); }

.list-entry-score {
    font-weight: 700;
    min-width: 32px;
    text-align: center;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

/* ===== Compare FAB ===== */
.compare-fab {
    position: fixed;
    bottom: 100px;
    right: var(--space-xl);
    z-index: 50;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--accent-text);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    overflow: hidden;
    box-shadow: none;
    cursor: pointer;
    will-change: opacity;
    transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
                border-radius 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
                gap 0.4s ease;
    animation: fabPulse 1.6s ease-in-out 1.5s 3;
}

.compare-fab::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    pointer-events: none;
}

@keyframes fabPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

.compare-fab-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.compare-fab-label {
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
    width: 0;
    opacity: 0;
    overflow: hidden;
    transition: width 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

.compare-fab:hover {
    width: 148px;
    gap: var(--space-sm);
    border-radius: 26px;
    animation: none;
    transition: width 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
                border-radius 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.compare-fab:hover::after {
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}

.compare-fab:hover .compare-fab-icon {
    transform: rotate(15deg) scale(1.1);
}

.compare-fab:hover .compare-fab-label {
    width: 72px;
    opacity: 1;
}

.compare-fab.active {
    background: var(--text-tertiary);
    animation: none;
}

/* ===== Watch Party FAB ===== */
.wp-fab {
    position: fixed;
    bottom: 100px;
    left: var(--space-xl);
    z-index: 50;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--accent-text);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    overflow: hidden;
    cursor: pointer;
    will-change: opacity;
    transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
                border-radius 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
                gap 0.4s ease;
    animation: fabPulse 1.6s ease-in-out 1.5s 3;
}

.wp-fab::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    pointer-events: none;
}

.wp-fab-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.wp-fab-label {
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
    width: 0;
    opacity: 0;
    overflow: hidden;
    transition: width 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

.wp-fab:hover {
    width: 172px;
    gap: var(--space-sm);
    border-radius: 26px;
    animation: none;
}

.wp-fab:hover::after { box-shadow: 0 8px 32px rgba(0,0,0,0.25); }
.wp-fab:hover .wp-fab-icon { transform: rotate(15deg) scale(1.1); }
.wp-fab:hover .wp-fab-label { width: 96px; opacity: 1; }

@media (max-width: 768px) {
    .wp-fab { bottom: 80px; left: var(--space-md); width: 46px; height: 46px; }
    .wp-fab-icon { width: 20px; height: 20px; }
}

@media (max-width: 768px) {
    .compare-fab { bottom: 80px; right: var(--space-md); width: 46px; height: 46px; }
    .compare-fab-icon { width: 20px; height: 20px; }
}

/* ===== Compare View ===== */
.compare-summary {
    display: flex;
    gap: var(--space-lg);
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
}

.compare-stat {
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: var(--radius-lg);
    transition: background 0.2s ease, color 0.2s ease;
}

.compare-stat:hover {
    background: var(--glass-bg);
}

.compare-stat.active {
    background: var(--accent);
    color: var(--accent-text);
}

.compare-stat.active .compare-stat-num {
    color: var(--accent-text);
}

.compare-stat-num {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
    margin-right: 4px;
}

.compare-row {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-xl);
    transition: background var(--duration-fast) ease;
}

.compare-row:hover { background: var(--surface-hover); }

.compare-row-info { flex: 1; min-width: 0; }

.compare-row-users {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    margin-top: 4px;
}

.compare-user-col {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.compare-mini-avatar {
    width: 20px;
    height: 20px;
    border-radius: var(--radius-full);
    object-fit: cover;
    flex-shrink: 0;
}

.compare-status { min-width: 56px; }
.compare-progress { font-variant-numeric: tabular-nums; min-width: 44px; }
.compare-score { font-weight: 700; color: var(--text); min-width: 20px; }

.compare-diff {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.compare-diff.pos { color: var(--success); background: rgba(34,197,94,0.1); }
.compare-diff.neg { color: var(--danger); background: rgba(239,68,68,0.1); }

/* ===== Progress Bar ===== */
.progress-bar {
    height: 3px;
    background: var(--border);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--user-accent);
    border-radius: var(--radius-full);
    transition: width 0.6s var(--ease);
}

/* ===== Detail Page ===== */
.detail-banner {
    position: relative;
    height: 340px;
    margin: calc(-1 * var(--space-xl)) calc(-1 * var(--space-xl)) 0;
    overflow: hidden;
    border-radius: 0 0 var(--radius-2xl) var(--radius-2xl);
}

.detail-banner-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 20%;
    background: var(--bg);
}

.detail-banner-gradient {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70%;
    background: linear-gradient(to top, var(--bg) 0%, rgba(0,0,0,0.3) 60%, transparent 100%);
}

.detail-header {
    display: flex;
    gap: var(--space-xl);
    margin-top: -100px;
    position: relative;
    z-index: 2;
}
.detail-header.no-banner { margin-top: 0; }

.detail-cover { width: 200px; flex-shrink: 0; }

.detail-cover img {
    width: 100%;
    border-radius: var(--radius-xl);
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.detail-info { flex: 1; padding-top: 32px; }

.detail-title {
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.03em;
    margin-bottom: var(--space-sm);
}

.detail-sub {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.detail-tag {
    padding: 4px 14px;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 500;
    background: var(--bg-secondary);
}

/* The facts under the score (js/pages/detail.js detailFactsHtml): one line of text, a thin dot between them */
.detail-facts {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 20px;
    margin-bottom: var(--space-md);
    font-size: 0.875rem;
    color: var(--text-secondary);
}
.detail-facts > .detail-fact-next { color: var(--user-accent); font-weight: 600; }
/* Progress and score as one group: both are what you track for this show */
.detail-entry { display: inline-flex; align-items: center; gap: var(--space-md); padding: 4px 6px 4px 4px; border-radius: var(--radius-full); background: var(--bg-secondary); }
.detail-entry-score { display: inline-flex; align-items: center; gap: var(--space-sm); font-size: 0.85rem; color: var(--text-secondary); }
.detail-ext-info { display: flex; flex-wrap: wrap; gap: var(--space-xs) var(--space-md); font-size: 0.85rem; }
.detail-ext-info a { color: var(--text-secondary); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); }
.detail-ext-info a:hover { color: var(--text); }
.detail-links { display: grid; gap: var(--space-sm); margin: var(--space-lg) 0 var(--space-xl); }
.detail-links-label { color: var(--text-secondary); opacity: .75; }

.detail-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-xl);
    flex-wrap: wrap;
}

.detail-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: var(--space-md);
    padding: var(--space-xl);
    background: var(--bg-secondary);
    border-radius: var(--radius-2xl);
}

.detail-stat { text-align: center; }

.detail-stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.detail-stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 4px;
}

.detail-description {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-secondary);
}

/* ===== Friends Status ===== */
/* Compact pills that sit side by side and wrap */
.friends-status-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.friend-status-card {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex: 0 1 auto;
    max-width: 260px;
    padding: 5px 14px 5px 5px;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    transition: border-color var(--duration-fast) ease;
    text-decoration: none;
    color: inherit;
}
.friend-status-card:hover { border-color: var(--text-tertiary); }
.friend-status-name, .friend-status-meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.friend-status-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    object-fit: cover;
    flex-shrink: 0;
}

.friend-status-info { flex: 1; min-width: 0; }
.friend-status-name { font-weight: 600; font-size: 0.85rem; }
.friend-status-meta { font-size: 0.75rem; color: var(--text-secondary); }

.friend-status-score {
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

/* ===== Profile ===== */
.profile-header {
    position: relative;
    margin: calc(-1 * var(--space-xl)) calc(-1 * var(--space-xl)) var(--space-xl);
}

.profile-banner {
    height: 280px;
    overflow: hidden;
    border-radius: 0 0 var(--radius-2xl) var(--radius-2xl);
    position: relative;
}

.profile-banner::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70%;
    /* Into the page's own background, like the detail page: the name on it reads in light and dark */
    background: linear-gradient(to top, var(--bg) 0%, rgba(0,0,0,0.3) 60%, transparent 100%);
    pointer-events: none;
}
/* No banner of their own: a plain surface needs no shading */
.profile-banner:not(:has(img))::after { display: none; }

.profile-banner img { width: 100%; height: 100%; object-fit: cover; }
.profile-banner.is-avatar { height: 150px; background: var(--bg-secondary); }
.profile-banner.is-avatar img { filter: blur(48px) saturate(1.4); transform: scale(1.6); opacity: .7; }

.profile-info {
    display: flex;
    align-items: flex-end;
    gap: var(--space-lg);
    padding: 0 var(--space-xl);
    margin-top: -60px;
    position: relative;
    z-index: 2;
}

.profile-avatar {
    width: 120px;
    height: 120px;
    aspect-ratio: 1;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 4px solid var(--bg);
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

.profile-name {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    padding-bottom: var(--space-md);
}

.profile-stats-row {
    display: flex;
    gap: var(--space-xl);
    padding-bottom: var(--space-md);
}

.profile-stat { text-align: center; }
.profile-stat-num { font-size: 1.3rem; font-weight: 800; }
.profile-stat-label { font-size: 0.8rem; color: var(--text-secondary); }

/* ===== Stats Charts ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-lg);
}

.stat-chart {
    padding: var(--space-xl);
    background: var(--bg-secondary);
    border-radius: var(--radius-2xl);
}

.stat-chart-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: var(--space-lg);
    color: var(--text-secondary);
}

.stat-bar-chart { display: flex; flex-direction: column; gap: var(--space-sm); }

.stat-bar-row { display: flex; align-items: center; gap: var(--space-md); }

.stat-bar-label {
    font-size: 0.8rem;
    width: 80px;
    flex-shrink: 0;
    text-align: right;
    color: var(--text-secondary);
}

.stat-bar-track {
    flex: 1;
    height: 6px;
    background: var(--border);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.stat-bar-fill {
    height: 100%;
    border-radius: var(--radius-full);
    background: var(--text);
    transition: width 0.8s var(--ease);
}

.stat-bar-value {
    font-size: 0.8rem;
    font-weight: 600;
    width: 40px;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

/* ===== Season Page ===== */
.season-controls {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-2xl);
    flex-wrap: wrap;
}

.season-nav-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    transition: all var(--duration-fast) ease;
}

.season-nav-btn:hover { background: var(--surface-hover); }
.season-nav-btn:active { transform: scale(0.9); }
.season-nav-btn svg { width: 16px; height: 16px; }

.season-label {
    font-size: 1.2rem;
    font-weight: 700;
    min-width: 180px;
    text-align: center;
}

/* ===== Schedule ===== */
.schedule-day { margin-bottom: var(--space-2xl); }

.schedule-day-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: var(--space-md);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.schedule-day-title.today { color: var(--user-accent); }

.schedule-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-xl);
    transition: background var(--duration-fast) ease;
    cursor: none;
}

@media (pointer: coarse) { .schedule-item { cursor: pointer; } }

.schedule-item:hover { background: var(--surface-hover); }

.schedule-time {
    font-size: 0.9rem;
    font-weight: 700;
    min-width: 56px;
    font-variant-numeric: tabular-nums;
}

.schedule-ep {
    font-size: 0.8rem;
    color: var(--text-secondary);
    min-width: 50px;
}

/* ===== Notifications ===== */
.notif-item {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-xl);
    transition: background var(--duration-fast) ease;
    cursor: none;
}

@media (pointer: coarse) { .notif-item { cursor: pointer; } }

.notif-item:hover { background: var(--surface-hover); }
.notif-item.unread { border-left: 3px solid var(--user-accent); }

.notif-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.notif-icon svg { width: 18px; height: 18px; }
.notif-text { font-size: 0.9rem; line-height: 1.5; }
.notif-time { font-size: 0.8rem; color: var(--text-secondary); margin-top: 4px; }

/* ===== Tabs ===== */
.tab-group {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-xl);
    width: fit-content;
}

.tab-btn {
    padding: var(--space-sm) var(--space-lg);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--duration-fast) ease;
    position: relative;
    border-radius: var(--radius-full);
}

.tab-btn:hover { color: var(--text); }

.tab-btn.active {
    color: var(--text);
    background: var(--bg-secondary);
    font-weight: 600;
}

/* ===== Filters ===== */
.filter-row {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
    margin-bottom: var(--space-xl);
}

.glass-select {
    padding: var(--space-sm) var(--space-lg);
    padding-right: var(--space-2xl);
    border-radius: var(--radius-full);
    background: var(--bg-secondary);
    border: none;
    font-size: 0.9rem;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23737373' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    outline: none;
    transition: box-shadow var(--duration-fast) ease;
}

.glass-select:focus { box-shadow: 0 0 0 2px var(--text); }

.glass-input {
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-full);
    background: var(--bg-secondary);
    border: none;
    font-size: 0.9rem;
    outline: none;
    transition: box-shadow var(--duration-fast) ease;
}

.glass-input:focus { box-shadow: 0 0 0 2px var(--text); }

.glass-input[type="number"]::-webkit-inner-spin-button,
.glass-input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.glass-input[type="number"] { -moz-appearance: textfield; }

/* ===== Toast ===== */
.toast-container {
    position: fixed;
    bottom: var(--space-xl);
    right: var(--space-xl);
    z-index: 600;
    display: flex;
    flex-direction: column-reverse;
    gap: var(--space-sm);
}

.toast {
    padding: var(--space-md) var(--space-xl);
    border-radius: var(--radius-full);
    background: var(--accent);
    color: var(--accent-text);
    font-size: 0.9rem;
    font-weight: 500;
    animation: toastIn 0.5s var(--ease);
    max-width: 360px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.15);
}

.toast.error { background: var(--danger); color: white; }
.toast.success { background: var(--accent); }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(16px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ===== Page Loader ===== */
.page-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
}

.loader-spinner {
    width: 32px;
    height: 32px;
    border: 2px solid var(--border);
    border-top-color: var(--text);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: var(--space-4xl) var(--space-xl);
    color: var(--text-secondary);
}

.empty-state-icon { font-size: 3rem; margin-bottom: var(--space-md); }
.empty-state-text { font-size: 1.1rem; font-weight: 500; color: var(--text-secondary); }
.empty-state-sub { font-size: 0.9rem; margin-top: var(--space-sm); }

/* ===== Login Page ===== */
.login-page {
    max-width: 480px;
    margin: 0 auto;
    padding: var(--space-2xl) 0;
}

.login-hero { text-align: center; margin-bottom: var(--space-2xl); }

.login-title {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: var(--space-sm);
}

.login-sub {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.login-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-2xl);
    padding: var(--space-xl);
    display: flex;
    flex-direction: column;
    gap: var(--space-xl);
}

.login-step {
    display: flex;
    gap: var(--space-md);
}

.login-step-num {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    background: var(--accent);
    color: var(--accent-text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.login-url-box {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-top: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: background var(--duration-fast) ease;
}

.login-url-box:hover { background: var(--surface-hover); }
.login-url-box code { font-size: 0.7rem; color: var(--text-secondary); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.login-url-copy {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--accent);
    flex-shrink: 0;
}

.login-url-copied {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--success);
    flex-shrink: 0;
}

/* ===== Modal ===== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    width: 90%;
    max-width: 480px;
    max-height: 80vh;
    overflow-y: auto;
    padding: var(--space-2xl);
    background: var(--bg);
    border-radius: var(--radius-2xl);
    box-shadow: 0 32px 80px rgba(0,0,0,0.2);
    animation: scaleIn 0.4s var(--ease);
}

.modal-title {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: var(--space-lg);
}

.modal-close { position: absolute; top: var(--space-md); right: var(--space-md); z-index: 2; }

/* ===== Score ===== */
.score-stars { display: flex; gap: 4px; }
.score-star {
    font-size: 1.5rem;
    color: var(--border);
    transition: color 0.15s ease, transform 0.15s ease;
}
.score-star:hover { transform: scale(1.2); }
.score-star.filled { color: var(--warning); }

/* ===== Genre Chips ===== */
.genre-chips { display: flex; flex-wrap: wrap; gap: var(--space-sm); }

.genre-chip {
    padding: 6px 16px;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 500;
    background: var(--bg-secondary);
    transition: all var(--duration-fast) ease;
}

.genre-chip:hover { background: var(--surface-hover); }
.genre-chip.active { background: var(--accent); color: var(--accent-text); }

/* ===== Character Grid ===== */
.char-grid {
    display: grid;
    /* Wide enough for a character and their voice actor side by side */
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr));
    gap: var(--space-md);
}

.char-card {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-sm);
    border-radius: var(--radius-lg);
    transition: background var(--duration-fast) ease;
}

.char-card:hover { background: var(--surface-hover); }

.char-img {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-full);
    object-fit: cover;
    flex-shrink: 0;
}

.char-info { display: flex; flex-direction: column; justify-content: center; min-width: 0; }

.char-name {
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.char-role { font-size: 0.75rem; color: var(--text-secondary); }

/* Spoiler tags, once shown: dashed, so they read as "careful" */
.spoiler-tag { border-style: dashed !important; }
.spoiler-toggle { cursor: pointer; font: inherit; color: var(--text-secondary); background: none; }
.spoiler-toggle:hover { color: var(--text); }

/* The voice actor on the right of their character: a link to all their roles. Character and voice
   actor get half the card each; long names end in an ellipsis instead of running into each other */
.char-card { display: grid; grid-template-columns: 50px minmax(0, 1fr) minmax(0, 1fr); align-items: center; }
.char-role { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.char-va {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-sm);
    min-width: 0;
    padding: 4px;
    border-radius: var(--radius-full);
    text-align: right;
    color: inherit;
    text-decoration: none;
    transition: background var(--duration-fast) ease;
}
.char-va:hover { background: var(--surface-hover); }
.char-va .char-img { width: 42px; height: 42px; }
.char-va .char-info { align-items: flex-end; }
.char-va .char-name, .char-va .char-role { max-width: 100%; }

/* ===== Landing (Cinematic Hero) ===== */
.landing-hero {
    text-align: center;
    padding: var(--space-3xl) 0 var(--space-2xl);
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.landing-title {
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.05em;
    margin-bottom: var(--space-lg);
}

.landing-sub {
    font-size: 1.15rem;
    color: var(--text-secondary);
    max-width: 480px;
    margin: 0 auto var(--space-xl);
    line-height: 1.6;
}

/* Headline words: each in a clipping box so it can rise out of it (js/landing.js) */
.landing-title .lw { display: inline-block; }
.landing-title .lw > span { display: inline-block; }
.landing-title .lw-accent { color: var(--user-accent); }

/* The big clip under the hero: a framed window that tilts upright while scrolling in */
.landing-stage {
    position: relative;
    margin: var(--space-xl) auto 0;
    max-width: 1120px;
    perspective: 1400px;
}
.landing-stage-glow {
    position: absolute;
    inset: 12% 8% -6%;
    background: radial-gradient(60% 60% at 50% 55%, color-mix(in srgb, var(--user-accent) 45%, transparent), transparent 70%);
    filter: blur(60px);
    opacity: 0.55;
    pointer-events: none;
}
.landing-stage-frame {
    position: relative;
    border-radius: var(--radius-2xl);
    overflow: hidden;
    border: 1px solid var(--border);
    background: #000;
    box-shadow: 0 40px 120px -30px rgba(0, 0, 0, 0.8);
    transform-origin: 50% 100%;
    aspect-ratio: 16 / 9;
}
.landing-video { display: block; width: 100%; height: 100%; object-fit: cover; }

/* Feature tour: pick a feature on the left, its clip plays on the right; one after another */
.landing-tour { margin-top: calc(var(--space-3xl) * 1.5); }
.landing-tour-head { max-width: 640px; margin-bottom: var(--space-2xl); }
.landing-tour-title {
    font-size: clamp(2rem, 4.5vw, 3.4rem);
    font-weight: 900;
    line-height: 1.05;
    letter-spacing: -0.04em;
    margin-bottom: var(--space-md);
}
.landing-tour-sub { color: var(--text-secondary); font-size: 1.05rem; line-height: 1.6; }
.landing-tour-grid {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) 2fr;
    gap: var(--space-2xl);
    align-items: center;
}
.landing-tour-list { display: flex; flex-direction: column; gap: var(--space-sm); }
.landing-tour-item {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
    padding: var(--space-lg);
    border-radius: var(--radius-xl);
    color: var(--text-secondary);
    transition: background var(--duration) var(--ease), color var(--duration) var(--ease);
    overflow: hidden;
}
.landing-tour-item:hover { color: var(--text); }
.landing-tour-item.active { background: var(--bg-secondary); color: var(--text); }
.landing-tour-item-title { font-size: 1.15rem; font-weight: 700; color: var(--text); }
.landing-tour-item-text { font-size: 0.92rem; line-height: 1.5; }
.landing-tour-item:not(.active) .landing-tour-item-text { display: none; }
.landing-tour-bar {
    position: absolute;
    left: var(--space-lg);
    right: var(--space-lg);
    bottom: 10px;
    height: 2px;
    border-radius: 2px;
    background: var(--border);
    overflow: hidden;
}
.landing-tour-item:not(.active) .landing-tour-bar { display: none; }
.landing-tour-bar span {
    display: block;
    height: 100%;
    background: var(--user-accent);
    transform-origin: 0 50%;
    transform: scaleX(0);
}
.landing-tour-frame {
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-2xl);
    overflow: hidden;
    border: 1px solid var(--border);
    background: #000;
}
.landing-tour-frame video {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.5s var(--ease);
}
.landing-tour-frame video.active { opacity: 1; }
.landing-more-title {
    font-size: clamp(1.6rem, 3.5vw, 2.4rem);
    font-weight: 900;
    letter-spacing: -0.04em;
    margin-top: calc(var(--space-3xl) * 1.5);
}
.landing-more-title + .landing-features { margin-top: var(--space-xl); }
@media (max-width: 899px) {
    .landing-tour-grid { grid-template-columns: 1fr; gap: var(--space-lg); }
    .landing-tour-frame { order: -1; }
    .landing-tour-list { flex-direction: row; overflow-x: auto; }
    .landing-tour-item { flex: 1 0 200px; padding: var(--space-md); }
    .landing-tour-bar { left: var(--space-md); right: var(--space-md); bottom: 6px; }
}
@media (prefers-reduced-motion: reduce) {
    .landing-tour-frame video { transition: none; }
}

.landing-features {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-xl);
    margin-top: var(--space-3xl);
}

.landing-features .landing-feature:not(.landing-feature-highlight) {
    /* bottom row: 3 columns via subgrid fallback */
}

/* Below the 6-column layout: fit as many cards as 260px allows — 1 on phones, 2 on tablets */
@media (max-width: 799px) {
    .landing-features {
        grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
        gap: var(--space-lg);
        margin-top: var(--space-2xl);
    }
    .landing-feature { padding: var(--space-xl); }
    .landing-feature-icon {
        width: 48px;
        height: 48px;
        margin-bottom: var(--space-md);
    }
    .landing-hero {
        padding: var(--space-2xl) 0 var(--space-xl);
        min-height: auto;
    }
}

@media (min-width: 800px) {
    .landing-features {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
    /* 3 highlighted features on top, 3 regular ones below */
    .landing-features .landing-feature-highlight {
        grid-column: span 2;
    }
    .landing-features .landing-feature:not(.landing-feature-highlight) {
        grid-column: span 2;
    }
}

.landing-feature {
    padding: var(--space-2xl);
    border-radius: var(--radius-2xl);
    background: var(--bg-secondary);
    transition: transform var(--duration) var(--ease);
}

.landing-feature:hover {
    transform: translateY(-8px);
}

.landing-feature-icon {
    width: 56px;
    height: 56px;
    margin-bottom: var(--space-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    background: var(--accent);
    color: var(--accent-text);
}

.landing-feature-icon svg { width: 24px; height: 24px; }

.landing-feature-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: var(--space-sm);
}

.landing-feature-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* ===== Landing Showcase (Watch Party) ===== */
.landing-showcase {
    margin-top: var(--space-2xl);
    display: flex;
    justify-content: center;
}

.landing-showcase-card {
    position: relative;
    max-width: 560px;
    width: 100%;
    padding: var(--space-2xl) var(--space-2xl) var(--space-xl);
    border-radius: var(--radius-2xl);
    background: var(--bg-secondary);
    border: 1px solid var(--accent);
    text-align: center;
    transition: transform var(--duration) var(--ease);
    box-shadow: 0 0 40px rgba(255,255,255,0.03);
}

.landing-showcase-card:hover { transform: translateY(-4px); }

.landing-showcase-badge {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    background: var(--accent);
    color: var(--accent-text);
}

.landing-showcase-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--space-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-xl);
    background: var(--accent);
    color: var(--accent-text);
}

.landing-showcase-icon svg { width: 28px; height: 28px; }

.landing-showcase-title {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: var(--space-sm);
}

.landing-showcase-text {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: var(--space-lg);
}

.landing-showcase-steps {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
    flex-wrap: wrap;
}

.landing-showcase-step {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.landing-step-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--accent-text);
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .landing-showcase-card { padding: var(--space-xl) var(--space-lg); }
    .landing-showcase-steps { flex-direction: column; align-items: flex-start; margin: 0 auto; width: fit-content; }
}

/* ===== Watch Party Picker ===== */
.wp-picker-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.wp-picker-overlay.open { opacity: 1; }

.wp-picker-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
}

.wp-picker-panel {
    position: relative;
    width: 90%;
    max-width: 640px;
    max-height: 80vh;
    background: var(--bg-secondary);
    border-radius: var(--radius-2xl);
    padding: var(--space-xl);
    overflow-y: auto;
    overscroll-behavior: contain; /* scrolling the picker never scrolls the page behind it */
    transform: translateY(20px);
    transition: transform 0.2s ease;
}

.wp-picker-overlay.open .wp-picker-panel { transform: translateY(0); }

.wp-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-xs);
}

.wp-picker-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
}

.wp-picker-sub {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
}

.wp-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: var(--space-md);
}

.wp-picker-card {
    cursor: pointer;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-primary);
    transition: transform var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}

.wp-picker-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.wp-picker-card img {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    display: block;
}

.wp-picker-card-info {
    padding: var(--space-sm);
}

.wp-picker-card-title {
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wp-picker-card-ep {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

@media (max-width: 768px) {
    .wp-picker-panel { width: 95%; padding: var(--space-lg); }
    .wp-picker-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
}

/* ===== Landing Feature Highlight ===== */
.landing-feature-highlight {
    border: 1px solid var(--accent);
}

.landing-feature-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    background: var(--accent);
    color: var(--accent-text);
    margin-bottom: var(--space-md);
}

/* ===== Clickable Feature Cards ===== */
.landing-feature-clickable {
    cursor: pointer;
    position: relative;
}

@media (pointer: coarse) { .landing-feature-clickable { cursor: pointer; } }

.landing-feature-cta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: var(--space-md);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: color var(--duration-fast) ease, gap var(--duration-fast) ease;
}

.landing-feature-cta svg { transition: transform var(--duration-fast) ease; }

.landing-feature-clickable:hover .landing-feature-cta {
    color: var(--text);
    gap: 10px;
}

.landing-feature-clickable:hover .landing-feature-cta svg {
    transform: translateX(2px);
}

/* ===== Feature Detail Overlay ===== */
.feature-detail-overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.feature-detail-overlay.open { opacity: 1; }

.feature-detail-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.feature-detail-panel {
    position: relative;
    width: 90%;
    max-width: 640px;
    max-height: 85vh;
    overflow-y: auto;
    border-radius: var(--radius-2xl);
    background: var(--bg-secondary);
    transform: translateY(24px) scale(0.96);
    transition: transform 0.4s var(--ease);
    overflow: hidden;
}

.feature-detail-overlay.open .feature-detail-panel {
    transform: translateY(0) scale(1);
}

.feature-detail-mockup {
    padding: var(--space-xl) var(--space-2xl) 0;
    position: relative;
    z-index: 1;
}

.feature-detail-content {
    position: relative;
    z-index: 1;
    padding: var(--space-xl) var(--space-2xl) var(--space-2xl);
}

/* ===== Feature Mockup Shared ===== */
.fm-cover-img {
    width: 40px;
    height: 56px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--gray-700);
}

.fm-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
}

.fm-a1 { background: linear-gradient(135deg, #d13438, #e8585b); }
.fm-a2 { background: linear-gradient(135deg, #6366f1, #818cf8); }
.fm-a3 { background: linear-gradient(135deg, #16a34a, #4ade80); }

/* ===== Watch Party Mockup ===== */
.fm-wp {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    animation: fmFadeUp 0.6s var(--ease) 0.2s both;
}

.fm-wp-header {
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.fm-wp-badge {
    font-size: 0.7rem;
    font-weight: 800;
    color: #ef4444;
    letter-spacing: 0.05em;
    animation: fmPulse 2s ease-in-out infinite;
}

.fm-wp-title-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.fm-wp-name { font-weight: 700; font-size: 0.95rem; }
.fm-wp-ep { font-size: 0.75rem; color: var(--text-secondary); }

.fm-wp-progress { padding: 0 var(--space-md) var(--space-sm); }
.fm-wp-bar { height: 4px; background: var(--border); border-radius: 9999px; overflow: hidden; }
.fm-wp-fill { height: 100%; width: 0; background: var(--user-accent); border-radius: 9999px; animation: fmFillWp 2s var(--ease) 0.5s forwards; }

.fm-wp-members {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: var(--space-sm) var(--space-md);
    border-top: 1px solid var(--border);
}

.fm-wp-member {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.8rem;
    font-weight: 500;
}

.fm-wp-ep-tag {
    margin-left: auto;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--success);
    background: rgba(22,163,74,0.1);
    padding: 2px 8px;
    border-radius: 9999px;
}

.fm-wp-ep-tag.fm-behind {
    color: var(--warning);
    background: rgba(245,158,11,0.1);
}

.fm-wp-link {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.fm-wp-link-url { flex: 1; font-family: var(--font-mono); }
.fm-wp-copy { font-weight: 600; color: var(--text-secondary); }

/* ===== Jellyfin Mockup: the real "Now watching" card, the bar runs past 90% and it gets saved ===== */
.fm-jf { animation: fmFadeUp 0.6s var(--ease) 0.2s both; }
.fm-jf .jf-now-card { margin: 0; }
.fm-jf .jf-now-bar span { width: 72%; animation: fmJfBar 5s linear infinite; }
.fm-jf-state { display: inline-grid; }
.fm-jf-state > span { grid-area: 1 / 1; }
.fm-jf-saved { color: var(--success); font-weight: 600; opacity: 0; animation: fmJfSaved 5s steps(1) infinite; }
.fm-jf-wait { animation: fmJfWait 5s steps(1) infinite; }
@keyframes fmJfBar { 0% { width: 72%; } 70% { width: 93%; } 100% { width: 97%; } }
/* The bar crosses the 90% mark at ~60% of the loop */
@keyframes fmJfWait { 0% { opacity: 1; } 60% { opacity: 0; } }
@keyframes fmJfSaved { 0% { opacity: 0; } 60% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
    .fm-jf .jf-now-bar span { animation: none; width: 93%; }
    .fm-jf-wait { animation: none; opacity: 0; }
    .fm-jf-saved { animation: none; opacity: 1; }
}

/* ===== Social Feed Mockup ===== */
.fm-social {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    animation: fmFadeUp 0.6s var(--ease) 0.2s both;
}

.fm-social-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--border-subtle);
}

.fm-si-anim1 { animation: fmSlideIn 0.5s var(--ease) 0.3s both; }
.fm-si-anim2 { animation: fmSlideIn 0.5s var(--ease) 0.5s both; }
.fm-si-anim3 { animation: fmSlideIn 0.5s var(--ease) 0.7s both; }

.fm-social-body { flex: 1; min-width: 0; font-size: 0.8rem; color: var(--text-secondary); }
.fm-social-user { font-weight: 600; color: var(--text); margin-right: 4px; }
.fm-social-body strong { color: var(--text); font-weight: 600; }

.fm-social-cover {
    width: 36px;
    height: 50px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--gray-700);
}

.fm-social-actions {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.fm-like-btn, .fm-compare-btn { font-weight: 500; }

@keyframes fmFadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fmSlideIn {
    from { opacity: 0; transform: translateX(-12px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes fmFillWp {
    to { width: 61%; }
}

@keyframes fmPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.feature-detail-close {
    position: absolute;
    top: var(--space-lg);
    right: var(--space-lg);
    z-index: 2;
    background: var(--surface-hover);
}

.feature-detail-icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-xl);
    background: var(--accent);
    color: var(--accent-text);
    margin-bottom: var(--space-lg);
}

.feature-detail-icon svg { width: 28px; height: 28px; }

.feature-detail-title {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: var(--space-sm);
}

.feature-detail-headline {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-xl);
    line-height: 1.5;
}

.feature-detail-desc {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: var(--space-lg);
}

.feature-detail-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.feature-detail-list li {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text);
}

.feature-detail-list li::before {
    content: '';
    flex-shrink: 0;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--user-accent);
    margin-top: 8px;
}

@media (max-width: 768px) {
    .feature-detail-panel { width: 95%; max-height: 90vh; }
    .feature-detail-mockup { padding: var(--space-lg) var(--space-lg) 0; }
    .feature-detail-content { padding: var(--space-xl) var(--space-lg); }
    .feature-detail-title { font-size: 1.4rem; }
}

.home-section .section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
}

.home-section .section-link {
    font-size: 0.85rem;
    color: var(--accent);
    text-decoration: none;
}

.home-section .section-link:hover {
    text-decoration: underline;
}

/* ===== Popular with Friends ===== */
.section-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    transition: color var(--duration-fast) ease;
}
.section-toggle:hover { color: var(--text); }

/* ===== Friends: Right now / Popular this week ===== */
.friends-head { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-md); min-width: 0; }
.friends-head-actions { display: flex; align-items: center; gap: var(--space-sm); flex-shrink: 0; }

.friends-tabs {
    display: inline-flex;
    padding: 3px;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--bg-secondary);
}

.friends-tab {
    padding: 5px 12px;
    border: none;
    border-radius: var(--radius-full);
    background: transparent;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: background var(--duration-fast) ease, color var(--duration-fast) ease;
}
.friends-tab:hover { color: var(--text); }
.friends-tab.active { background: var(--accent); color: var(--accent-text); }

.fr-avatars { display: flex; margin-bottom: 6px; }
.fr-avatar {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    object-fit: cover;
    margin-left: -7px;
    border: 2px solid rgba(255,255,255,0.7);
    background: var(--gray-700);
}
.fr-avatar:first-child { margin-left: 0; }
.fr-avatar.fr-watching, .fr-avatar.fr-repeating { border-color: var(--user-accent); }
.fr-avatar.fr-completed { border-color: var(--success); }
.fr-avatar.fr-paused { border-color: var(--warning); }
.fr-avatar.fr-dropped { border-color: var(--danger); }

.fr-line { display: flex; align-items: center; gap: 4px; min-width: 0; margin-top: 3px; font-size: 0.72rem; opacity: 0.85; }
.fr-line-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fr-line strong { font-weight: 700; }
.fr-line-icon { display: inline-flex; flex-shrink: 0; width: 12px; height: 12px; }
.fr-line-icon svg { width: 100%; height: 100%; }
.fr-line-icon.fr-watching, .fr-line-icon.fr-repeating { color: var(--user-accent); }
.fr-line-icon.fr-completed { color: var(--success); }
.fr-line-icon.fr-paused { color: var(--warning); }
.fr-line-icon.fr-dropped { color: var(--danger); }
.fr-time { margin-top: 2px; font-size: 0.65rem; opacity: 0.5; }

/* Your own relation to the show (top right), or a quick "+ Plan" */
.fr-mine, .fr-plan {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    z-index: 3;
    padding: 4px 9px;
    border-radius: var(--radius-full);
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: white;
    font-size: 0.68rem;
    font-weight: 700;
    white-space: nowrap;
}
.fr-plan {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 1px solid rgba(255,255,255,0.2);
    font-family: inherit;
    cursor: none;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.2s, transform 0.2s var(--ease), background 0.2s;
}
.fr-plan svg { width: 11px; height: 11px; }
.media-card:hover .fr-plan, .fr-plan:focus-visible { opacity: 1; transform: scale(1); }
.fr-plan:hover { background: var(--user-accent); border-color: transparent; }
@media (hover: none) { .fr-plan { opacity: 1; transform: none; } }

.friends-posts-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    margin-top: var(--space-md);
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: border-color var(--duration-fast) ease, color var(--duration-fast) ease;
}
.friends-posts-link:hover { color: var(--text); border-color: var(--text-tertiary); }
.friends-posts-link svg { width: 16px; height: 16px; flex-shrink: 0; }

@media (max-width: 480px) {
    .friends-tab { padding: 5px 10px; font-size: 0.75rem; }
}

/* ===== Calendar ===== */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--border);
    border-radius: var(--radius-2xl);
    overflow: hidden;
    width: 100%;
}

.calendar-grid > * {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.calendar-header-cell {
    padding: var(--space-md);
    text-align: center;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    background: var(--bg-secondary);
}

.calendar-cell {
    min-height: 140px;
    min-width: 0;
    padding: var(--space-sm);
    background: var(--surface);
    vertical-align: top;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 220px;
    transition: background var(--duration-fast) ease;
}

.calendar-cell:hover { background: var(--surface-hover); }
.calendar-cell.today { background: var(--bg-secondary); }
.calendar-cell.other-month { opacity: 0.3; }

.calendar-date {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: var(--space-xs);
    font-variant-numeric: tabular-nums;
}

.calendar-date.today {
    background: var(--accent);
    color: var(--accent-text);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
}

.calendar-entry {
    font-size: 0.7rem;
    padding: 2px 4px;
    border-radius: var(--radius-sm);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: none;
    transition: background var(--duration-fast) ease;
}

@media (pointer: coarse) { .calendar-entry { cursor: pointer; } }

.calendar-entry:hover { background: var(--surface-hover); }
.calendar-entry.on-list { font-weight: 600; background: var(--bg-secondary); }
.calendar-entry.forecast,
.calendar-entry-img.forecast { opacity: 0.6; border-left: 2px dashed var(--text-tertiary); padding-left: 4px; }
.schedule-item.forecast { opacity: 0.7; border-left: 2px dashed var(--text-tertiary); }

.calendar-controls {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-2xl);
}

.calendar-month {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    min-width: 220px;
}

.calendar-filters {
    display: flex;
    gap: var(--space-sm);
    margin-left: auto;
}

/* ===== Calendar Images ===== */
.calendar-toggle {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-left: auto;
}

.calendar-toggle-switch {
    width: 40px;
    height: 22px;
    border-radius: var(--radius-full);
    background: var(--border);
    position: relative;
    cursor: none;
    transition: background 0.3s ease;
    border: none;
}

@media (pointer: coarse) { .calendar-toggle-switch { cursor: pointer; } }

.calendar-toggle-switch.on {
    background: var(--user-accent);
}

.calendar-toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: var(--radius-full);
    background: var(--white);
    transition: transform 0.3s var(--ease);
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.calendar-toggle-switch.on::after {
    transform: translateX(18px);
}

.calendar-entry-img {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 0;
    cursor: none;
    min-width: 0;
    overflow: hidden;
    font-size: 0.7rem;
    border-radius: var(--radius-sm);
    margin-bottom: 2px;
    transition: background var(--duration-fast) ease;
}

@media (pointer: coarse) { .calendar-entry-img { cursor: pointer; } }

.calendar-entry-img:hover { background: var(--surface-hover); }

.calendar-entry-img img {
    width: 22px;
    height: 30px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    flex-shrink: 0;
}

.calendar-entry-img span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 0; }

/* ===== Page Transition ===== */
.page-enter { animation: pageIn 0.5s var(--ease); }

@keyframes pageIn {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== Accent Color Picker ===== */
.accent-picker {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.accent-swatch {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    border: 3px solid transparent;
    cursor: none;
    transition: transform 0.3s var(--ease), border-color 0.3s ease;
    position: relative;
}

@media (pointer: coarse) { .accent-swatch { cursor: pointer; } }

.accent-swatch:hover {
    transform: scale(1.15);
}

.accent-swatch.active {
    border-color: var(--text);
}

.accent-swatch.active::after {
    content: '\2713';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* ===== Detail Panel (Full Overlay) ===== */
/* Detail Panel — desktop: right-side drawer, mobile: fullscreen */
.detail-panel-overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.detail-panel-overlay.open {
    pointer-events: auto;
    opacity: 1;
}

.detail-panel-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.detail-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(560px, 100%);
    background: var(--bg);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.5s var(--ease);
    box-shadow: -8px 0 40px rgba(0,0,0,0.15);
}

.detail-panel-overlay.open .detail-panel {
    transform: translateX(0);
}

.detail-panel-actions {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    gap: var(--space-xs);
    justify-content: flex-end;
    padding: var(--space-md) var(--space-md) 0;
}

.detail-panel-action-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s var(--ease), background var(--duration-fast) ease;
}

.detail-panel-action-btn svg { width: 18px; height: 18px; }
.detail-panel-action-btn:hover { transform: scale(1.1); background: var(--surface-hover); }

.detail-panel-body {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: var(--space-lg) var(--space-xl) var(--space-4xl);
}

.detail-panel-body .detail-banner {
    border-radius: var(--radius-xl);
    margin: 0 0 var(--space-lg);
    height: 240px;
}

.detail-panel-body .detail-header {
    margin-top: -80px;
    flex-direction: row;
    gap: var(--space-lg);
}
.detail-panel-body .detail-header.no-banner { margin-top: 0; }

.detail-panel-body .detail-cover { width: 130px; }

.detail-panel-body .detail-title { font-size: 1.3rem; }

@media (max-width: 768px) {
    .detail-panel {
        width: 100%;
        transform: translateY(100%);
        box-shadow: none;
    }

    .detail-panel-overlay.open .detail-panel {
        transform: translateY(0);
    }

    .detail-panel-actions {
        position: fixed;
        top: var(--space-md);
        right: var(--space-md);
        padding: 0;
        z-index: 20;
    }

    .detail-panel-action-btn {
        background: var(--bg);
        box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    }

    .detail-panel-body {
        padding-top: var(--space-xl);
    }

    .detail-panel-body .detail-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .detail-panel-body .detail-banner { height: 280px; }
    .detail-panel-body .detail-header { margin-top: -100px; }
    .detail-panel-body .detail-header.no-banner { margin-top: 0; }
    .detail-panel-body .detail-actions { justify-content: center; }
    .detail-panel-body :is(.detail-meta, .detail-facts) { justify-content: center; }
}

/* ===== Skeleton ===== */
.skeleton {
    background: linear-gradient(90deg, var(--border-subtle) 25%, var(--border) 50%, var(--border-subtle) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-card { aspect-ratio: 2/3; border-radius: var(--radius-xl); }
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-text-sm { height: 10px; width: 60%; }

/* ===== Dot Label (kept for compat) ===== */
.dot-label {
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 600;
}

/* ===== Comparison / Recs ===== */
.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-md); }
.rec-card { display: flex; gap: var(--space-md); padding: var(--space-md); }
.rec-arrow { display: flex; align-items: center; color: var(--text-tertiary); }

/* ===== Glass panel (compat) ===== */
.glass-panel {
    background: var(--bg-secondary);
    border-radius: var(--radius-2xl);
    overflow: hidden;
    position: relative;
}
.glass-panel::before { display: none; }

/* ===== Stagger animation ===== */
.stagger-in > * {
    opacity: 0;
    transform: translateY(32px);
    animation: staggerUp 0.7s var(--ease) forwards;
}

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

.stagger-in > *:nth-child(1) { animation-delay: 0s; }
.stagger-in > *:nth-child(2) { animation-delay: 0.08s; }
.stagger-in > *:nth-child(3) { animation-delay: 0.16s; }
.stagger-in > *:nth-child(4) { animation-delay: 0.24s; }
.stagger-in > *:nth-child(5) { animation-delay: 0.32s; }
.stagger-in > *:nth-child(6) { animation-delay: 0.4s; }

/* ===== Mobile Tab Bar ===== */
.mobile-tabbar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--bg);
    border-top: 1px solid var(--border);
    height: 56px;
    align-items: center;
    justify-content: space-around;
    padding: 0 var(--space-sm);
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.mobile-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color var(--duration-fast) ease;
    -webkit-tap-highlight-color: transparent;
}

.mobile-tab svg { width: 22px; height: 22px; }
.mobile-tab.active { color: var(--text); }

/* Season | Calendar switch: both share one tab on phones, the desktop nav links each */
.page-switch { display: flex; gap: var(--space-xs); margin-bottom: var(--space-lg); }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .main-content { padding-left: var(--space-lg); padding-right: var(--space-lg); padding-bottom: calc(var(--space-4xl) + 60px); }
    .nav-inner { padding: 0 var(--space-lg); }
    .nav-links { display: none; }

    .detail-header { flex-direction: column; align-items: center; text-align: center; }
    .detail-cover { width: 150px; }
    .detail-info { padding-top: var(--space-md); }
    .detail-actions { justify-content: center; }
    :is(.detail-meta, .detail-facts) { justify-content: center; }

    .profile-info { flex-direction: column; align-items: center; text-align: center; }
    .media-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: var(--space-md); }
    .compare-grid { grid-template-columns: 1fr; }

    .toast-container { left: var(--space-md); right: var(--space-md); bottom: 80px; }
    .toast { max-width: none; }

    .calendar-controls { flex-wrap: wrap; }
    .calendar-grid { grid-template-columns: 1fr; }
    .calendar-header-cell { display: none; }
    .calendar-cell { min-height: auto; padding: var(--space-md); border-bottom: 1px solid var(--border); }

    .mobile-tabbar { display: flex; }
    .season-title { display: none; }
}

@media (max-width: 480px) {
    :root { --space-lg: 16px; --space-xl: 24px; }
    .landing-feature { padding: var(--space-lg); }
    .landing-sub { font-size: 1rem; }
    .section-title { font-size: 1.5rem; }
    .detail-title { font-size: 1.5rem; }
    .profile-banner { height: 180px; }
    .profile-avatar { width: 90px; height: 90px; }
    .landing-title { font-size: clamp(2.2rem, 10vw, 3rem); }
}

/* ===== Roll ===== */
.roll-head { margin-bottom: var(--space-lg); }
.roll-sub { color: var(--text-secondary); margin-top: var(--space-xs); }

.roll-stage {
    display: flex;
    align-items: center;
    gap: var(--space-xl);
    flex-wrap: wrap;
    margin-bottom: var(--space-xl);
}

.roll-machine {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
}

.roll-window {
    position: relative;
    width: 200px;
    height: 300px;
    overflow: hidden;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    box-shadow: 0 20px 50px rgba(0,0,0,0.35);
}

/* Slot-machine shading at the reel edges */
.roll-window::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    background: linear-gradient(to bottom, rgba(0,0,0,0.45), transparent 20%, transparent 80%, rgba(0,0,0,0.45));
}

.roll-reel { will-change: transform; }
.roll-item { height: 300px; }
.roll-item img { width: 100%; height: 100%; object-fit: cover; display: block; }

.roll-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
}

.roll-btn { min-width: 200px; padding: 14px 32px; font-size: 1rem; }
.roll-btn:disabled { opacity: 0.5; pointer-events: none; }
.roll-count { font-size: 0.8rem; color: var(--text-secondary); }

.roll-result { flex: 1 1 280px; min-width: 0; }
.roll-result-kicker {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--user-accent);
    margin-bottom: var(--space-xs);
}
.roll-result-title { font-size: 1.8rem; font-weight: 800; line-height: 1.15; margin-bottom: var(--space-sm); }
.roll-result-meta { color: var(--text-secondary); margin-bottom: var(--space-md); }
.roll-result-because { font-size: 0.9rem; color: var(--text-secondary); margin: calc(-1 * var(--space-sm)) 0 var(--space-md); }
.roll-result-because strong { color: var(--text); font-weight: 600; }
.roll-result-genres { margin-bottom: var(--space-lg); }
.roll-result-actions { display: flex; flex-wrap: wrap; gap: var(--space-sm); }

/* Friends who also have the rolled show on their list */
.roll-result-friends {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-sm);
    min-height: 28px;
    margin: calc(-1 * var(--space-sm)) 0 var(--space-lg);
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.roll-friends-avatars { display: flex; }
.roll-friends-avatars img {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 2px solid var(--bg);
    margin-left: -8px;
    background: var(--bg-secondary);
}
.roll-friends-avatars img:first-child { margin-left: 0; }
.roll-friends-text strong { color: var(--text); font-weight: 600; }

.roll-filters {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    padding: var(--space-lg);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
}

.roll-filter-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}
.roll-filter-hint { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--text-secondary); }
.roll-segment { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.roll-filters .genre-chip { border: none; color: var(--text); font-family: inherit; }
.roll-check { display: flex; align-items: center; gap: var(--space-sm); font-size: 0.9rem; color: var(--text-secondary); }

/* Roll together (Watch Party) */
.wp-roll-section { padding: var(--space-lg); border-top: 1px solid var(--border); }
.wp-roll-body { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-lg); margin-top: var(--space-sm); }
.wp-roll-window { width: 140px; height: 210px; flex-shrink: 0; }
.wp-roll-window .roll-item { height: 210px; }
.wp-roll-window .roll-placeholder { font-size: 3rem; }
.wp-roll-side { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-md); }
.wp-roll-title { font-size: 1.3rem; font-weight: 800; line-height: 1.2; }
.wp-roll-planners { font-size: 0.85rem; color: var(--text-secondary); margin-top: var(--space-xs); }
.wp-roll-waiting { font-size: 0.9rem; color: var(--text-secondary); }

@media (max-width: 768px) {
    .roll-stage { flex-direction: column; }
    .roll-result { text-align: center; }
    .roll-result-genres, .roll-result-actions, .roll-result-friends { justify-content: center; }
}

/* ===== Watch Party ===== */
/* The show's banner behind the page: only Material 3 shows it (css/m3.css) */
.wp-backdrop { display: none; }
/* The people, the invite and the actions: a side column in Material 3, part of the card otherwise;
   there the actions stay last, after Roll together */
.wp-side { display: contents; }
.wp-card { display: flex; flex-direction: column; }
.wp-card .wp-actions { order: 1; }
.wp-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-2xl);
    overflow: hidden;
}

.wp-header {
    display: flex;
    gap: var(--space-lg);
    padding: var(--space-lg);
    background: var(--bg-secondary);
}

.wp-cover {
    width: 100px;
    height: 140px;
    border-radius: var(--radius-lg);
    object-fit: cover;
    flex-shrink: 0;
}

.wp-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: var(--space-sm);
    min-width: 0;
}

.wp-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: var(--user-accent);
    color: #fff;
    width: fit-content;
    animation: wpPulse 2s ease-in-out infinite;
}

.wp-status-badge::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fff;
    animation: wpDot 2s ease-in-out infinite;
}

@keyframes wpPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes wpDot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.wp-title {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.wp-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* "Play episode N" from the viewer's Jellyfin, right in the party */
.wp-play-slot:not([hidden]) {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-top: var(--space-md);
}

.wp-progress-section,
.wp-invite-section,
.wp-members-section,
.wp-sync-section,
.wp-host-section,
.wp-login-prompt {
    padding: var(--space-lg);
    border-top: 1px solid var(--border);
}

.wp-progress-label,
.wp-invite-label,
.wp-members-label,
.wp-sync-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.wp-progress-bar-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.wp-progress-text {
    font-size: 0.9rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.wp-invite-link-box {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

.wp-invite-input {
    flex: 1;
    font-size: 0.8rem;
    min-width: 0;
}

.wp-members-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.wp-member {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 6px 12px;
    border-radius: var(--radius-full);
    background: var(--bg-secondary);
    font-size: 0.85rem;
    font-weight: 500;
}

.wp-member-avatar {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    object-fit: cover;
}

.wp-host-card {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
}

.wp-host-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    object-fit: cover;
    flex-shrink: 0;
}

.wp-host-info { flex: 1; min-width: 0; }

.wp-host-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.wp-host-progress {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    margin-top: 2px;
}

.wp-host-badge {
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: var(--accent);
    color: var(--accent-text);
    flex-shrink: 0;
}

.wp-sync-status {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.wp-sync-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wp-sync-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: none;
    letter-spacing: normal;
    margin-bottom: 0;
}

.wp-sync-value {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.wp-sync-diff {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--warning);
    padding: var(--space-sm) var(--space-md);
    background: rgba(245, 158, 11, 0.1);
    border-radius: var(--radius-lg);
    text-align: center;
}

.wp-sync-diff.wp-sync-even {
    color: var(--success);
    background: rgba(22, 163, 74, 0.1);
}

.wp-sync-diff.wp-sync-ahead {
    color: var(--user-accent);
    background: var(--user-accent-dim);
}

.wp-sync-actions {
    display: flex;
    gap: var(--space-sm);
}

.wp-actions {
    display: flex;
    gap: var(--space-sm);
    justify-content: flex-end;
    padding: var(--space-lg);
    border-top: 1px solid var(--border);
}

.wp-poll-info {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg) var(--space-lg);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.wp-auto-sync-note {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    text-align: center;
}

.wp-login-prompt {
    text-align: center;
    padding: var(--space-xl);
}

@media (max-width: 768px) {
    .wp-header { flex-direction: column; align-items: center; text-align: center; }
    .wp-cover { width: 80px; height: 112px; }
    .wp-title { font-size: 1.1rem; }
    .wp-invite-link-box { flex-direction: column; }
    .wp-invite-input { width: 100%; }
    .wp-actions { flex-direction: column; }
    .wp-actions .glass-btn { width: 100%; justify-content: center; }
}

/* ===== Watch Party: host counter, member progress, guest sync pill ===== */
.wp-host-counter {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.wp-host-counter-value {
    font-size: 2rem;
    font-weight: 800;
    min-width: 90px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.wp-host-counter-value small {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.wp-host-counter .glass-btn-primary { margin-left: auto; }
.wp-host-counter button:disabled { opacity: 0.4; cursor: default; }

.wp-member-ep {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.wp-member-synced .wp-member-ep { color: var(--success); }
.wp-member-behind .wp-member-ep { color: var(--warning); }

.wp-sync-pill {
    position: fixed;
    bottom: var(--space-xl);
    left: 50%;
    transform: translateX(-50%);
    z-index: 60;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    max-width: min(90vw, 360px);
    padding: 8px 16px;
    border-radius: var(--radius-full);
    background: var(--bg);
    border: 1px solid var(--border);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
}

.wp-sync-pill-dot {
    width: 8px;
    height: 8px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--success);
    animation: wp-pill-pulse 2s ease-in-out infinite;
}

.wp-sync-pill-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

@media (max-width: 768px) {
    .wp-sync-pill { bottom: 68px; }
    .wp-host-counter { flex-wrap: wrap; }
}

/* ===== Jellyfin ===== */
.jf-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    align-items: flex-start;
}
.jf-form .glass-input { width: 100%; max-width: 420px; }
.jf-hint { margin-top: var(--space-sm); max-width: 420px; line-height: 1.5; }

.jf-row { display: flex; align-items: center; gap: var(--space-sm); font-size: 0.9rem; font-weight: 600; }
.jf-meta { margin-top: 4px; font-size: 0.8rem; color: var(--text-secondary); word-break: break-all; }
.jf-actions { display: flex; flex-wrap: wrap; gap: var(--space-sm); margin-top: var(--space-md); }

.jf-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    background: var(--text-tertiary);
    flex-shrink: 0;
}
.jf-dot-on { background: var(--success); box-shadow: 0 0 0 3px rgba(22,163,74,0.18); }
.jf-dot-off { background: var(--danger); box-shadow: 0 0 0 3px rgba(220,38,38,0.18); }
.jf-dot-checking { background: var(--warning); animation: fmPulse 1.2s ease-in-out infinite; }

/* ===== Jellyfin live tracking: navbar chip, Home card, setup steps ===== */
.jf-now-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 220px;
    padding: 5px 12px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text);
    font: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
}
.jf-now-chip[hidden] { display: none; }
.jf-now-chip-dot,
.jf-now-dot {
    width: 8px;
    height: 8px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--success);
    animation: wp-pill-pulse 2s ease-in-out infinite;
}
.jf-now-chip.paused .jf-now-chip-dot,
.jf-now-card.paused .jf-now-dot { background: var(--warning); animation: none; }
.jf-now-card.done .jf-now-dot { background: var(--success); animation: none; }
.jf-now-chip-text { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

.jf-now-section { margin-bottom: var(--space-xl); }
.jf-now-section[hidden] { display: none; }
.jf-now-card {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    max-width: 640px;
    padding: var(--space-md);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background: var(--bg-secondary);
}
.jf-now-card[data-media-id] { cursor: pointer; }
.jf-now-card[data-media-id]:hover { background: var(--surface-hover); }
.jf-now-cover {
    width: 64px;
    aspect-ratio: 2 / 3;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: var(--radius-md);
    object-fit: cover;
    background: var(--surface-hover);
    color: var(--text-tertiary);
}
.jf-now-cover svg { width: 24px; height: 24px; }
.jf-now-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.jf-now-kicker {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
}
.jf-now-title { font-size: 1.05rem; font-weight: 700; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.jf-now-sub,
.jf-now-meta { font-size: 0.8rem; color: var(--text-secondary); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.jf-now-meta { color: var(--text-secondary); }
.jf-now-bar { position: relative; height: 4px; margin: 4px 0 2px; border-radius: 2px; background: var(--border); }
.jf-now-bar span { position: absolute; inset: 0 auto 0 0; width: var(--p); border-radius: 2px; background: var(--user-accent); }
.jf-now-bar i { position: absolute; top: -3px; width: 2px; height: 10px; border-radius: 1px; background: var(--text-tertiary); }

.jf-live {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
    margin-top: var(--space-lg);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border);
}
.jf-live-title { font-size: 1rem; }
.jf-live .jf-meta,
.bg-access .jf-meta { word-break: normal; }
.jf-steps {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    max-width: 600px;
    margin: var(--space-sm) 0 0;
    padding-left: 1.2rem;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-secondary);
}
.jf-steps b { color: var(--text); font-weight: 600; }
.jf-copy { display: flex; align-items: flex-start; gap: var(--space-sm); width: 100%; margin-top: 6px; }
.jf-copy .glass-input,
.jf-copy textarea {
    flex: 1;
    min-width: 0;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 0.75rem;
}
.jf-copy textarea {
    padding: var(--space-sm) var(--space-md);
    border: none;
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
    color: var(--text);
    resize: vertical;
}

/* A framed area (description, stats, lists of rows). Its own class, so each design can shape it */
.box { border: 1px solid var(--border); border-radius: var(--radius-xl); }
.box-note { border-radius: var(--radius-lg); }

/* ===== Settings: tabs + cards ===== */
.settings-title { margin-bottom: var(--space-lg); }
.settings-tabs { margin-bottom: var(--space-lg); }
.settings-panel[hidden] { display: none; }
.settings-card[hidden] { display: none; }
.settings-card {
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
}
.settings-card-title { margin-bottom: var(--space-sm); }
.settings-card-title:last-child, .settings-card-title + .settings-choices { margin-top: var(--space-sm); }
.settings-card-sub { margin-bottom: var(--space-md); }
.settings-choices { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-sm); }
.settings-link { font-size: 0.75rem; color: var(--text-secondary); }
.settings-sub-block { margin-top: var(--space-lg); }
.settings-sub-block[hidden] { display: none; }
.settings-sub-label { font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); margin-bottom: var(--space-sm); }

/* The score field on an entry: 0–100 with its scale written next to it */
.score-field { display: inline-flex; align-items: baseline; gap: 4px; }
.score-scale { font-size: 0.85rem; color: var(--text-secondary); }
/* M3 design: nothing shows until its stylesheet is in (js/design.js), so AniRoll's look never flashes */
html.m3-loading body { visibility: hidden; }

.settings-choice { display: flex; align-items: flex-start; gap: var(--space-sm); padding: 6px 0; font-size: 0.9rem; cursor: pointer; }
.settings-choice input { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; accent-color: var(--user-accent); }
.settings-choice small { display: block; margin-top: 2px; font-size: 0.8rem; color: var(--text-secondary); }
.bg-access { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-sm); margin-top: var(--space-sm); }

.wp-bg-question { margin-bottom: var(--space-sm); padding: var(--space-md); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.wp-bg-question-title { margin-bottom: 4px; font-weight: 600; }
.wp-bg-question p { margin: 0; font-size: 0.85rem; line-height: 1.5; color: var(--text-secondary); }
/* Live line while Jellyfin plays the party's show, and a flash when the counter jumps by itself */
.wp-jf-now {
    margin-top: var(--space-sm);
    font-size: 0.8rem;
    color: var(--user-accent);
    font-weight: 500;
}
.wp-jf-now[hidden] { display: none; }
.wp-counter-flash { animation: wp-counter-flash 1.2s ease; }
@keyframes wp-counter-flash {
    0% { color: var(--user-accent); transform: scale(1.12); }
    100% { color: inherit; transform: scale(1); }
}
.wp-rewatch-choice { margin-bottom: var(--space-sm); }
.wp-rewatch-tag {
    display: inline-block;
    margin-left: var(--space-xs);
    padding: 1px 8px;
    border-radius: var(--radius-full);
    background: var(--user-accent-dim);
    color: var(--user-accent);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: none;
    vertical-align: middle;
}
.wp-rewatch-tag[hidden] { display: none; }
.wp-rewatch-btn { margin-top: var(--space-sm); }
.wp-rewatch-btn[hidden] { display: none; }
.wp-join-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--space-sm); margin-top: var(--space-md); }

@media (max-width: 768px) {
    .jf-now-chip { max-width: 130px; }
}
@media (max-width: 480px) {
    .jf-now-chip { padding: 7px; }
    .jf-now-chip-text { display: none; }
}

/* Guest sync pill while syncing is paused (rate limit or repeated failures) */
.wp-sync-pill-paused { opacity: 0.7; }
.wp-sync-pill-paused .wp-sync-pill-dot { background: var(--warning); animation: none; }
/* Host variant: nothing is syncing on this device, it only leads back to the running party */
.wp-sync-pill-host .wp-sync-pill-dot { background: var(--user-accent); }

/* Floats under the fixed navbar so it never shifts the page layout */
/* Keeps the list actions in the same flex row while refreshActions() replaces them */
.detail-actions-inner { display: contents; }
/* The Play button's slot too, else its link sits in a line box of its own and rides higher than the rest */
.detail-play-slot:not([hidden]) { display: contents; }

.maintenance-banner {
    position: fixed;
    top: calc(var(--nav-height) + 6px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 99;
    max-width: min(92vw, 720px);
    padding: 8px var(--space-lg);
    border: 1px solid var(--warning);
    border-radius: var(--radius-full);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-align: center;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}

.jf-pull-toggle { margin-top: var(--space-md); }

.jf-status-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Party picker sections (Watching / Planning) and the narutomaki reel placeholder */
.wp-picker-section {
    grid-column: 1 / -1;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-top: var(--space-sm);
}
.wp-picker-section:first-child { margin-top: 0; }
.roll-placeholder svg { width: 4rem; height: 4rem; color: var(--text-tertiary); }
.wp-roll-window .roll-placeholder svg { width: 3rem; height: 3rem; }
.empty-state-icon svg { width: 3rem; height: 3rem; }
.media-card-status svg { width: 12px; height: 12px; display: block; }
/* Host header: "Live" badge and the switch action share one row, same pill shape */
.wp-badges { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-sm); }
.wp-switch-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 12px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: color var(--duration-fast) ease, border-color var(--duration-fast) ease;
}
.wp-switch-pill svg { width: 12px; height: 12px; flex-shrink: 0; }
.wp-switch-pill:hover, .wp-switch-pill:focus-visible { color: var(--text); border-color: var(--text); }
@media (max-width: 768px) {
    .wp-badges { justify-content: center; }
}

/* ===== Glass menu: styled replacement for native selects (js/select.js) ===== */
.glass-menu { position: relative; display: inline-flex; }
.glass-menu-trigger {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md) var(--space-sm) var(--space-lg);
    border-radius: var(--radius-full);
    background: var(--bg-secondary);
    border: 1px solid transparent;
    color: var(--text);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    transition: background var(--duration-fast) ease, border-color var(--duration-fast) ease;
}
.glass-menu-trigger:hover { background: var(--surface-hover); }
.glass-menu-trigger:focus-visible { outline: 3px solid var(--md-secondary, var(--text)); outline-offset: 2px; border-color: var(--text); }
.glass-menu.open .glass-menu-trigger { border-color: var(--border); background: var(--surface-hover); }
.glass-menu-label { flex: 1; text-align: left; }
.glass-menu-chevron {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: var(--text-tertiary);
    transition: transform var(--duration-fast) var(--ease);
}
.glass-menu.open .glass-menu-chevron { transform: rotate(180deg); }
.glass-menu-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.glass-menu-list {
    position: fixed;
    z-index: 550; /* above the detail panel (500), below toasts (600) */
    padding: var(--space-xs);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
    max-height: min(320px, 60vh);
    overflow-y: auto;
    scrollbar-width: thin;
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
    transform-origin: top center;
    transition: opacity 0.18s ease, transform 0.3s var(--ease);
}
.glass-menu-list.up { transform: translateY(6px) scale(0.98); transform-origin: bottom center; }
.glass-menu-list.show { opacity: 1; transform: none; }
.glass-menu-option {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 9px var(--space-sm) 9px var(--space-md);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    color: var(--text-secondary);
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.glass-menu-option.active { background: var(--surface-hover); color: var(--text); }
.glass-menu-option.selected { color: var(--text); font-weight: 600; }
.glass-menu-option-label { flex: 1; }
.glass-menu-check { width: 14px; height: 14px; margin-left: var(--space-md); flex-shrink: 0; color: var(--user-accent); opacity: 0; }
.glass-menu-option.selected .glass-menu-check { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
    .glass-menu-list, .glass-menu-chevron { transition: none; }
}

/* ===== Calendar: episode number and finale marker next to each title ===== */
.calendar-entry { display: flex; align-items: center; gap: 4px; }
.calendar-entry-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calendar-entry-img span { flex: 1; }
.calendar-ep {
    flex-shrink: 0;
    margin-left: auto;
    padding-right: 4px;
    font-style: normal;
    font-size: 0.62rem;
    font-weight: 600;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}
.calendar-entry.finale .calendar-ep,
.calendar-entry-img.finale .calendar-ep { color: var(--user-accent); }
.schedule-ep { font-size: 0.75rem; color: var(--text-secondary); }
.schedule-ep.finale { color: var(--user-accent); font-weight: 600; }

/* ===== Social: AniList media links in text posts render as a card, like on AniList ===== */
.activity-embed { max-width: 420px; margin: var(--space-sm) 0 2px; }
.activity-embed .activity-media { margin-top: 0; align-items: center; }
.activity-embed-title { font-weight: 600; font-size: 0.85rem; color: var(--user-accent); }
.activity-embed-meta { font-size: 0.72rem; color: var(--text-secondary); }
.activity-embed.loading .activity-media-img { background: var(--surface-hover); }
.activity-embed.loading .activity-embed-title { color: var(--text-tertiary); }
.activity-link { color: var(--user-accent); text-decoration: none; word-break: break-word; }
.activity-link:hover { text-decoration: underline; }

/* ===== Social: AniList markdown (spoilers, images) and reply threads ===== */
.activity-spoiler {
    background: var(--text-tertiary);
    color: transparent;
    border-radius: var(--radius-sm);
    padding: 0 3px;
    cursor: pointer;
    transition: background var(--duration-fast) ease, color var(--duration-fast) ease;
}
.activity-spoiler:not(.revealed) * { visibility: hidden; }
.activity-spoiler.revealed { background: var(--bg-secondary); color: inherit; cursor: auto; }
.activity-img { display: block; max-width: min(100%, 420px); max-height: 420px; border-radius: var(--radius-md); margin: var(--space-xs) 0; }
.reply-toggle { background: none; border: none; color: inherit; font: inherit; }
/* Same tone as the reply button; .liked (more specific) still turns it red */
.like-btn { color: inherit; }
.reply-toggle[aria-expanded="true"] { color: var(--user-accent); }
.activity-replies {
    margin-top: var(--space-sm);
    padding-left: var(--space-md);
    border-left: 2px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}
.activity-replies[hidden] { display: none; }
.activity-reply { display: flex; gap: var(--space-sm); }
.activity-reply-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.activity-reply-body { min-width: 0; flex: 1; }
.activity-reply-head { display: flex; align-items: baseline; gap: var(--space-sm); }
.activity-reply-head .activity-user { font-size: 0.8rem; }
.activity-replies-status { font-size: 0.8rem; color: var(--text-secondary); }
.activity-reply-form { display: flex; gap: var(--space-sm); align-items: center; }
.activity-reply-form .glass-input { flex: 1; min-width: 0; }
.activity-reply-form :disabled { opacity: 0.6; }

/* ===== Home covers: lift like the Watch Party picker =====
   `translate`, not `transform`: the scroll reveal (GSAP) leaves an inline transform on every
   card, which would silently override a :hover transform. */
.home-section .media-card,
.list-card {
    transition: translate var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}
.home-section .media-card:hover,
.list-card:hover {
    transform: none;
    translate: 0 -4px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}
.home-section .media-card:active,
.list-card:active { translate: 0 -2px; transition-duration: 0.15s; }
/* Horizontal rows clip vertically — room for the lifted card and its shadow, layout unchanged */
.home-section .scroll-row {
    padding-top: 8px;
    margin-top: -8px;
    padding-bottom: 28px;
    margin-bottom: -20px;
}

/* ===== My List: toolbar (search, sort, airing filter, view) and cover grid ===== */
.list-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin: calc(-1 * var(--space-sm)) 0 var(--space-md);
}
.list-toolbar[hidden] { display: none; }
.list-search { flex: 1 1 220px; min-width: 0; }
.list-search::-webkit-search-cancel-button { filter: grayscale(1); opacity: 0.6; }
.list-chip {
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    transition: color var(--duration-fast) ease, border-color var(--duration-fast) ease, background var(--duration-fast) ease;
}
.list-chip:hover { color: var(--text); border-color: var(--text-tertiary); }
.list-chip.active { background: var(--accent); color: var(--accent-text); border-color: transparent; }
.list-chip[hidden] { display: none; }
.list-formats { display: flex; flex-wrap: wrap; gap: 6px; }
.list-formats[hidden] { display: none; }
.list-view-toggle {
    display: inline-flex;
    padding: 3px;
    border-radius: var(--radius-full);
    background: var(--bg-secondary);
}
.list-view-btn {
    width: 34px;
    height: 30px;
    display: grid;
    place-items: center;
    border: none;
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--text-secondary);
    transition: background var(--duration-fast) ease, color var(--duration-fast) ease;
}
.list-view-btn svg { width: 16px; height: 16px; }
.list-view-btn:hover { color: var(--text); }
.list-view-btn.active { background: var(--surface-hover); color: var(--text); }

.list-content {
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-sm);
}
.list-content.is-grid { border: none; padding: 0; }
.list-grid { padding-top: 6px; }
.list-card-actions {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    z-index: 3;
    display: flex;
    gap: 4px;
}
.list-card-actions .cw-inc { position: static; }
.list-card-actions .cw-inc[hidden] { display: none; }
.list-card-progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 0;
    z-index: 2;
}
@media (hover: none) {
    .list-card-actions .cw-inc { opacity: 1; transform: none; }
}
@media (max-width: 768px) {
    .list-search { flex-basis: 100%; }
}
/* Grid cards: −/+1 live top right, so the own score moves to the top left */
.list-card .media-card-score { right: auto; left: var(--space-sm); }

/* ===== Detail panel: taste match (js/taste.js) ===== */
.taste-match {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin: calc(-1 * var(--space-xs)) 0 var(--space-md);
}
.taste-match[hidden] { display: none; }
.taste-match-badge {
    padding: 4px 12px;
    border-radius: var(--radius-full);
    background: var(--user-accent);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.taste-match-why { font-size: 0.8rem; color: var(--text-secondary); }

/* Friends tab: whole tile opens the profile */
.friend-tile {
    padding: var(--space-md);
    cursor: pointer;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    transition: border-color 0.2s ease;
}
.friend-tile:hover, .friend-tile:focus-visible { border-color: var(--text-secondary); }

/* Cards and rows opened by keyboard (data-open / data-go, js/a11y.js) */
[data-open]:focus-visible, [data-go]:focus-visible, .landing-feature-clickable:focus-visible {
    outline: 2px solid var(--text);
    outline-offset: 2px;
}

/* Social: AniList markdown blocks (formatActivityLines) */
.activity-heading { font-weight: 700; line-height: 1.3; margin: var(--space-sm) 0 var(--space-xs); }
.activity-h1 { font-size: 1.25rem; }
.activity-h2 { font-size: 1.1rem; }
.activity-h3, .activity-h4, .activity-h5 { font-size: 0.95rem; }
.activity-list { margin: var(--space-xs) 0; padding-left: 1.4em; white-space: normal; }
.activity-list li { margin: 2px 0; }
.activity-quote {
    margin: var(--space-xs) 0;
    padding: 2px 0 2px var(--space-md);
    border-left: 3px solid var(--border);
    color: var(--text-secondary);
}
.activity-rule { border: none; border-top: 1px solid var(--border); margin: var(--space-sm) 0; }
.activity-center { text-align: center; }
.activity-center .activity-img { margin-left: auto; margin-right: auto; }
.activity-code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    padding: 1px 5px;
    border-radius: var(--radius-sm);
    background: var(--surface-hover);
}
.activity-reply-to {
    margin-left: auto;
    padding: 0 4px;
    border: none;
    background: none;
    font: inherit;
    font-size: 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
}
.activity-reply-to:hover, .activity-reply-to:focus-visible { color: var(--text); text-decoration: underline; }

/* "Reduce motion" in the system settings: transitions and animations finish at once.
   The loading spinner keeps turning, otherwise a loading page looks frozen.
   JS-driven motion (smooth scrolling, reveals, parallax) is switched off in js/animations.js. */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .loader-spinner {
        animation-duration: 0.8s !important;
        animation-iteration-count: infinite !important;
    }
}

/* My List → Planning: the way into Roll */
.list-roll {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    flex-wrap: wrap;
    margin-bottom: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.list-roll[hidden] { display: none; }

/* Calendar: Week / Month switch and the week view (calendar.js, v84, wider in v86) */
.calendar-views { display: flex; gap: var(--space-xs); }
/* Discover (Browse, Season, Calendar) may use more than the 1200px page on big screens: the
   week needs seven columns, the cover grids simply get more. All three alike, so switching
   between them does not shift anything. */
@media (min-width: 1265px) {
    .discover-page {
        --wide: min(1600px, calc(100vw - 2 * var(--space-xl)));
        width: var(--wide);
        margin-left: calc((100% - var(--wide)) / 2);
    }
}
.calendar-week {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: var(--space-sm);
    align-items: stretch;
    /* Down to the bottom of the screen: a week reads as one plan, not seven lists of different length */
    min-height: calc(100dvh - var(--nav-height) - 300px);
}
.calendar-week-day {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: var(--space-sm);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.calendar-week-day.today { border-color: var(--user-accent); background: var(--bg-secondary); }
.calendar-week-day.past { opacity: 0.55; }
.calendar-week-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding-bottom: var(--space-sm);
    margin-bottom: var(--space-xs);
    border-bottom: 1px solid var(--border);
}
.calendar-week-name {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
}
.calendar-week-count { display: block; font-size: 0.7rem; color: var(--text-secondary); margin-top: 1px; }
.calendar-week-head strong { font-size: 1.35rem; line-height: 1; color: var(--text); }
.calendar-week-day.today .calendar-week-name,
.calendar-week-day.today .calendar-week-head strong { color: var(--user-accent); }
.calendar-week-item {
    display: flex;
    gap: var(--space-sm);
    align-items: flex-start;
    padding: 6px;
    margin: 0 -6px;
    border-radius: var(--radius-md);
    cursor: pointer;
}
.calendar-week-item:hover { background: var(--surface-hover); }
.calendar-week-item.forecast { opacity: 0.7; }
.calendar-week-cover { width: 44px; height: 62px; border-radius: var(--radius-sm); object-fit: cover; flex-shrink: 0; }
.calendar-week-info { min-width: 0; flex: 1; }
.calendar-week-time { font-size: 0.72rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }
.calendar-week-title {
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
}
.calendar-week-item.on-list .calendar-week-title::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    margin: 0 5px 1px 0;
    border-radius: 50%;
    background: var(--user-accent);
}
.calendar-week-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 2px var(--space-xs);
    margin-top: 3px;
    font-size: 0.72rem;
    color: var(--text-secondary);
}
.calendar-week-item.finale .calendar-week-ep { color: var(--user-accent); font-weight: 600; }
.calendar-week-you { font-weight: 600; }
.calendar-week-you.next { color: var(--user-accent); }
.calendar-week-you.behind { color: var(--text-warning); }
.calendar-week-you.done { color: var(--text-success); }
.calendar-week-empty { margin: auto 0; text-align: center; font-size: 0.75rem; color: var(--text-secondary); }
.calendar-more {
    border: none;
    background: none;
    padding: 2px 0;
    font: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
}
.calendar-more:hover, .calendar-more:focus-visible { color: var(--text); text-decoration: underline; }
.schedule-cover { width: 40px; height: 56px; border-radius: var(--radius-sm); object-fit: cover; flex-shrink: 0; }
.schedule-onlist {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: var(--radius-full);
    background: var(--user-accent-dim);
    color: var(--user-accent);
    font-weight: 600;
}

/* What's new (js/whatsnew.js): changelog + one-time notice about the moved tabs */
.whatsnew { max-width: 520px; }
.whatsnew-kicker {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--user-accent);
    margin-bottom: var(--space-xs);
}
.whatsnew .modal-title { margin-bottom: var(--space-md); }
.whatsnew-demo {
    margin: 0 0 var(--space-lg);
    padding: var(--space-md);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background: var(--bg-secondary);
}
.whatsnew-bar {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-content: center;
    gap: 6px;
    min-height: 34px;
}
.whatsnew-tab {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    background: var(--bg);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}
.whatsnew-tab.is-leaving { border-style: dashed; }
.whatsnew-tab.is-new {
    color: var(--accent-text);
    background: var(--user-accent);
    border-color: var(--user-accent);
    box-shadow: 0 0 0 4px var(--user-accent-dim);
}
.whatsnew-tab.is-moved { color: var(--text); border-color: var(--text); }
.whatsnew-ghost { position: absolute; margin: 0; pointer-events: none; }
.whatsnew-demo-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--space-sm);
    font-size: 0.72rem;
    color: var(--text-secondary);
}
.whatsnew-stage { font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.whatsnew-replay {
    border: none;
    background: none;
    padding: 0;
    font: inherit;
    color: var(--text-secondary);
    cursor: pointer;
    text-decoration: underline;
}
.whatsnew-replay[hidden] { display: none; }
.whatsnew-replay:hover { color: var(--text); }
.whatsnew-list { margin: 0 0 var(--space-md); padding-left: 1.2em; font-size: 0.88rem; line-height: 1.55; color: var(--text-secondary); }
.whatsnew-list li { margin: 4px 0; }
.whatsnew-list strong { color: var(--text); font-weight: 600; }
.whatsnew-entry + .whatsnew-entry { margin-top: var(--space-lg); padding-top: var(--space-lg); border-top: 1px solid var(--border); }
.whatsnew-date { font-size: 0.75rem; font-weight: 700; color: var(--text-secondary); margin-bottom: var(--space-sm); }
.whatsnew-note { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: var(--space-lg); }
.whatsnew-actions { display: flex; justify-content: flex-end; }
/* The changelog as a page: a way back to where it was opened, then every entry in one box */
/* Wide: the day and its headline on the left, what changed on the right; stacked on phones */
.whatsnew-page .whatsnew, .whatsnew-page .whatsnew.is-wide { max-width: none; padding: var(--space-xl); }
.whatsnew-page .whatsnew-entry { display: grid; grid-template-columns: minmax(180px, 260px) 1fr; gap: var(--space-xl); }
.whatsnew-page .whatsnew-side { position: sticky; top: calc(var(--space-xl) + 64px); align-self: start; }
.whatsnew-page .whatsnew-date { margin-bottom: 4px; }
.whatsnew-title { margin: 0; font-size: 1.05rem; font-weight: 600; line-height: 1.35; color: var(--text); }
.whatsnew-page .whatsnew-list { font-size: 0.95rem; margin-bottom: 0; }
.whatsnew-page .whatsnew-watch, .whatsnew-page .whatsnew-video { max-width: 640px; }
@media (max-width: 760px) {
    .whatsnew-page .whatsnew { padding: var(--space-lg); }
    .whatsnew-page .whatsnew-entry { grid-template-columns: 1fr; gap: var(--space-sm); }
    .whatsnew-page .whatsnew-side { position: static; }
}
.whatsnew-page .section-title { margin: var(--space-lg) 0; }
.whatsnew-back { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.whatsnew-back svg { width: 18px; height: 18px; }

/* The entry points: quiet, with a small dot while something is unread */
.whatsnew-unread .whatsnew-link::after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-left: 6px;
    vertical-align: middle;
    border-radius: 50%;
    background: var(--user-accent);
}
.landing-foot { display: flex; justify-content: center; margin: var(--space-3xl) 0 var(--space-xl); }
.landing-foot .whatsnew-link {
    border: none;
    background: none;
    font: inherit;
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
}
.landing-foot .whatsnew-link:hover { color: var(--text); text-decoration: underline; }
.landing-foot { align-items: center; gap: var(--space-lg); }
.landing-foot-link { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--text-secondary); text-decoration: none; }
.landing-foot-link:hover { color: var(--text); text-decoration: underline; }
.landing-foot-link svg { width: 14px; height: 14px; }
/* The source on GitHub in the avatar menu: a quiet entry with the mark */
.dropdown-item.github-link { display: flex; align-items: center; gap: 8px; }
.dropdown-item.github-link svg { width: 15px; height: 15px; flex-shrink: 0; }
.m3-rail-github { display: none; }

/* After closing: the real tabs that moved light up for a moment */
.whatsnew-hint { animation: whatsnewHint 1.3s var(--ease) 2; border-radius: var(--radius-full); }
@keyframes whatsnewHint {
    0%, 100% { box-shadow: 0 0 0 0 transparent; }
    40% { box-shadow: 0 0 0 4px var(--user-accent-dim), 0 0 0 1px var(--user-accent); }
}
@media (max-width: 480px) {
    .whatsnew.modal-content { width: 94%; padding: var(--space-lg); }
    .whatsnew-demo { padding: var(--space-sm); }
    .whatsnew-bar { gap: 4px; }
    .whatsnew-tab { padding: 5px 9px; font-size: 0.72rem; }
}
.whatsnew-heading { font-size: 0.95rem; font-weight: 700; margin-bottom: var(--space-sm); }
.schedule-item .calendar-week-you { font-size: 0.72rem; white-space: nowrap; }


/* Colour by hex code (Settings → Appearance): the swatch opens the system picker, the field takes a code */
.settings-hint { margin: -2px 0 var(--space-sm); font-size: 0.85rem; color: var(--text-secondary); }
.hex-field { display: flex; align-items: center; gap: var(--space-sm); margin-top: var(--space-md); }
.hex-swatch {
    position: relative;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: var(--radius-md);
    background:
        linear-gradient(var(--c), var(--c)),
        conic-gradient(#ff5f6d, #ffc371, #4ade80, #22d3ee, #818cf8, #f472b6, #ff5f6d);
    box-shadow: inset 0 0 0 1px var(--border);
    cursor: pointer;
    overflow: hidden;
}
.hex-swatch input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }
.hex-swatch:focus-within { outline: 2px solid var(--text); outline-offset: 2px; }
.hex-input { width: 130px; font-family: ui-monospace, 'SF Mono', Menlo, monospace; text-transform: lowercase; letter-spacing: .02em; }
.hex-input.invalid { box-shadow: inset 0 0 0 1px var(--danger); }

/* What's new: a clip behind "See it in action"; the dialog widens to play it */
.whatsnew { transition: max-width 0.55s cubic-bezier(0.2, 0, 0, 1); }
.whatsnew.is-wide { max-width: min(900px, 94vw); }
.whatsnew-watch {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    margin: 0 0 var(--space-md);
    padding: 0;
    border: 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-secondary);
    cursor: pointer;
}
.whatsnew-watch img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s var(--ease-out), filter 0.3s; filter: brightness(0.75); }
.whatsnew-watch:hover img { transform: scale(1.04); filter: brightness(0.6); }
.whatsnew-watch-label {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px 10px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.95);
    color: #111;
    font-weight: 700;
    font-size: 0.95rem;
    white-space: nowrap;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    transition: transform 0.4s var(--ease-out);
}
.whatsnew-watch:hover .whatsnew-watch-label { transform: translate(-50%, -50%) scale(1.05); }
.whatsnew-watch-play { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: var(--user-accent); color: #fff; }
.whatsnew-watch-play svg { width: 18px; height: 18px; }
.whatsnew-video { display: block; width: 100%; aspect-ratio: 16 / 9; margin: 0 0 var(--space-md); border-radius: var(--radius-lg); background: #000; animation: whatsnewVideoIn 0.5s cubic-bezier(0.2, 0, 0, 1); }
@keyframes whatsnewVideoIn { from { opacity: 0; transform: scale(0.97); } }
@media (prefers-reduced-motion: reduce) { .whatsnew { transition: none; } .whatsnew-video { animation: none; } }

/* Landing: the two designs side by side (js/landing.js renderDesigns) */
.landing-designs { margin-top: calc(var(--space-3xl) * 1.5); }
.landing-designs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-xl); }
.landing-design { margin: 0; }
.landing-design-frame {
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-xl);
    overflow: hidden;
    border: 1px solid var(--border);
    background: #000;
    box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.7);
    transition: transform 0.6s cubic-bezier(0.2, 0, 0, 1);
}
.landing-design:hover .landing-design-frame { transform: translateY(-6px); }
/* Material's frame is rounder and lit in its own colours, so the two read differently at a glance */
.landing-design-m3 .landing-design-frame {
    border-radius: 36px;
    border-color: transparent;
    box-shadow: 0 30px 90px -30px rgba(0, 150, 220, 0.55), 0 0 0 1px rgba(160, 200, 255, 0.18);
}
.landing-design figcaption { display: flex; flex-direction: column; gap: 6px; margin-top: var(--space-md); }
.landing-design figcaption strong { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.02em; color: var(--text); }
.landing-design figcaption span { color: var(--text-secondary); line-height: 1.55; }
@media (max-width: 900px) { .landing-designs-grid { grid-template-columns: 1fr; } }

/* Switching designs (js/design.js switchDesign): the new look spreads as a circle, the old one stays still */
.design-swap::view-transition-old(root),
.design-swap::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
.design-swap::view-transition-new(root) { z-index: 2; }

/* Landing: try either design right on the card */
.landing-design-try {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    align-self: flex-start;
    margin-top: var(--space-sm);
}
.landing-design-try[aria-pressed="true"] { pointer-events: none; }
.landing-design-try[aria-pressed="true"]::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

/* Home (js/home-cinema.js): the show you're on, built from the detail page's pieces (banner, cover, info,
   stats box) and Roll's kicker, so it reads like the rest of the app. Only what Home needs on top is here. */
.ar-home { margin-bottom: var(--space-2xl); }
.ar-home-banner {
    position: relative;
    height: 300px;
    overflow: hidden;
    border-radius: var(--radius-2xl);
}
.ar-home-banner-img { width: 100%; height: 100%; object-fit: cover; object-position: center 25%; background: var(--bg); }
.ar-home-head { display: flex; gap: var(--space-xl); margin-top: -110px; position: relative; z-index: 2; padding: 0 var(--space-lg); }
.ar-home-head.no-banner { margin-top: 0; padding: 0; }
.ar-home-cover { width: 180px; }
.ar-home-info { padding-top: 56px; min-width: 0; }
.ar-home-info .detail-title { font-size: clamp(1.8rem, 3.4vw, 2.6rem); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ar-home-head.no-banner .ar-home-info { padding-top: 0; }
.ar-home-progress { max-width: 360px; height: 3px; margin: 0 0 var(--space-lg); border-radius: 3px; background: var(--border); overflow: hidden; }
.ar-home-progress span { display: block; height: 100%; background: var(--user-accent); }
.ar-home .detail-actions { margin-bottom: 0; }
.ar-home-stats { margin-top: var(--space-xl); padding: var(--space-md) var(--space-lg); align-items: center; gap: var(--space-sm); }
.ar-home-stats .detail-stat-value { font-size: 1.25rem; }
.ar-home-stats .detail-stat-label { font-size: 0.68rem; margin-top: 2px; }
.ar-home-stat { display: block; color: inherit; font: inherit; border-radius: var(--radius-lg); padding: var(--space-xs) var(--space-sm); transition: background-color var(--duration-fast) var(--ease-out); }
.ar-home-stat:hover { background: var(--surface-hover); }
.ar-home-stat-title {
    margin-top: 2px;
    font-size: 0.75rem;
    line-height: 1.35;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.ar-clock { font-variant-numeric: tabular-nums; }
/* Phone: centred like the detail page */
@media (max-width: 768px) {
    .ar-home-banner { height: 200px; }
    .ar-home-head { flex-direction: column; align-items: center; text-align: center; gap: var(--space-md); margin-top: -90px; padding: 0; }
    .ar-home-cover { width: 130px; }
    .ar-home-info { padding-top: 0; width: 100%; }
    .ar-home-progress { margin-left: auto; margin-right: auto; }
    .ar-home-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: var(--space-lg) var(--space-md); gap: var(--space-md) var(--space-sm); }
    .ar-home-stat-title { -webkit-line-clamp: 3; }
}
.ar-home-stat { min-width: 0; }

/* ===== Detail: studios as cards, related as a row of covers ===== */
.detail-studios { display: flex; gap: var(--space-sm); overflow-x: auto; margin-bottom: var(--space-lg); padding-bottom: 2px; scrollbar-width: none; }
.detail-studios::-webkit-scrollbar { display: none; }
.detail-studio {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
    min-width: 200px;
    padding: 12px 14px;
    color: var(--text);
    text-decoration: none;
    background: var(--bg-secondary);
    transition: border-color var(--duration-fast) ease;
}
.detail-studio:hover { border-color: var(--text-secondary); }
.detail-studio-icon { width: 20px; height: 20px; flex-shrink: 0; color: var(--text-secondary); }
.detail-studio-text { display: flex; flex-direction: column; min-width: 0; margin-right: auto; }
.detail-studio-name { font-weight: 700; font-size: 0.9rem; white-space: nowrap; }
.detail-studio-role { font-size: 0.75rem; color: var(--text-secondary); }
.detail-studio-arrow { width: 16px; height: 16px; flex-shrink: 0; color: var(--text-secondary); transition: transform var(--duration-fast) ease; }
.detail-studio:hover .detail-studio-arrow { transform: translateX(3px); color: var(--text); }

.detail-related { margin-bottom: var(--space-xl); }
.detail-related-title { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-secondary); margin-bottom: var(--space-sm); }
.detail-related-row { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.detail-related-row::-webkit-scrollbar { display: none; }
.detail-related-item { flex: 0 0 84px; display: flex; flex-direction: column; gap: 6px; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.detail-related-item img { width: 84px; height: 120px; object-fit: cover; border-radius: var(--radius-md); transition: transform var(--duration-fast) ease, box-shadow var(--duration-fast) ease; }
.detail-related-item:hover img { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0,0,0,.25); }
.detail-related-kind { font-size: 0.72rem; color: var(--text-secondary); line-height: 1.2; }

/* ===== Home: shows from Planning that start soon ===== */
.starting-soon-when { display: flex; align-items: center; gap: 4px; }
.starting-soon-when svg { width: 12px; height: 12px; flex-shrink: 0; }
.starting-soon-when strong { font-weight: 700; }

/* ===== Voice actor page ===== */
.staff-head { display: flex; align-items: center; gap: var(--space-lg); margin-bottom: var(--space-lg); }
.staff-photo { width: 128px; height: 128px; border-radius: var(--radius-full); object-fit: cover; flex-shrink: 0; background: var(--surface); }
.staff-native { color: var(--text-secondary); margin-top: 2px; }
.staff-facts { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: var(--space-sm); color: var(--text-secondary); font-size: 0.875rem; }
.staff-head .studio-title { margin: 4px 0 0; }
@media (max-width: 600px) { .staff-head { flex-direction: column; text-align: center; } .staff-facts { justify-content: center; } .staff-photo { width: 112px; height: 112px; } }

/* ===== Studio page ===== */
.studio-title { margin: 4px 0 var(--space-lg); }
.studio-more { display: flex; justify-content: center; margin-top: var(--space-xl); }
.studio-more[hidden] { display: none; }


/* ===== Player (#/play/<id>/<episode>) — Material 3 Expressive in both designs =====
   A video is always dark: the player takes the scheme's fixed roles (the same in light and dark mode),
   with AniRoll's accent where no M3 scheme is loaded. */
body.player-open { overflow: hidden; }
/* The pointer in the player: Material 3 keeps its own cursor (js/m3.js moves it into the player in full
   screen; its rule on :root outranks the ones below). AniRoll's trailing cursor would sit on the picture,
   so there the system pointer comes back — AniRoll hides it everywhere else (cursor: none) */
body.player-open .cursor { display: none !important; }
:root:has(.player.is-idle) .m3-cursor { opacity: 0 !important; }
.player, .player * { cursor: default !important; }
.player :is(button, a, input, .pl-seek, .pl-menu-item) { cursor: pointer !important; }
.player.is-idle, .player.is-idle * { cursor: none !important; }
.player {
    --pl-primary: var(--md-primary-fixed-dim, var(--user-accent, #a8c7fa));
    --pl-on-primary: var(--md-on-primary-fixed, #0b1b33);
    --pl-tonal: color-mix(in srgb, var(--pl-primary) 22%, rgba(30,30,34,0.72));
    --pl-track: rgba(255,255,255,0.28);
    --pl-surface: rgba(28,28,32,0.94);
    --pl-ease: var(--m3-gentle, cubic-bezier(.2,0,0,1));
    --pl-bounce: var(--m3-bouncy, cubic-bezier(.34,1.56,.64,1));
    position: fixed;
    inset: 0;
    z-index: 700;
    background: #000;
    color: #fff;
    font-family: var(--font);
    overflow: hidden;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.player-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.player-video::cue { font-family: var(--font); font-size: clamp(18px, 3.2vw, 34px); line-height: 1.3; color: #fff; background: rgba(0,0,0,0.55); }
.player.is-idle { cursor: none; }
/* JASSUB draws ASS subtitles on a canvas it lays over the video */
.player .pl-subs-canvas { pointer-events: none; }
.player .pl-subs-canvas[hidden] { display: none; }

.pl-icon { width: 24px; height: 24px; fill: currentColor; display: block; }
.pl-btn {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: #fff;
    background: transparent;
    cursor: pointer;
    transition: background-color .2s, border-radius .35s var(--pl-bounce), transform .35s var(--pl-bounce);
}
.pl-btn:hover { background: rgba(255,255,255,0.1); }
.pl-btn:active { transform: scale(.92); }
.pl-btn:focus-visible, .pl-seek:focus-visible, .pl-menu-item:focus-visible, .pl-pill:focus-visible { outline: 3px solid var(--pl-primary); outline-offset: 2px; }
.pl-btn[hidden], .pl-menu-wrap[hidden] { display: none; }
.pl-btn.is-on { color: var(--pl-on-primary); background: var(--pl-primary); }

/* Top: back, title, what the server does */
.player-top {
    position: absolute;
    inset: 0 0 auto 0;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 16px max(16px, env(safe-area-inset-left));
}
.player-back, .player-party { background: rgba(255,255,255,0.12); }
.player-title { min-width: 0; flex: 1; }
.player-show { font-weight: 700; font-size: 1.15rem; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-episode { font-size: 0.875rem; color: rgba(255,255,255,0.75); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-method {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
    background: rgba(255,255,255,0.12);
    white-space: nowrap;
}
.player-method[hidden] { display: none; }

/* Dim the picture behind the controls, top and bottom */
.pl-scrim {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(rgba(0,0,0,0.6), transparent 22%, transparent 62%, rgba(0,0,0,0.75));
}

/* Centre: back 10, play/pause, forward 10. Play is a big FAB that turns from a squircle into a
   circle while playing, like M3 Expressive's shape morph */
.pl-center {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(20px, 6vw, 56px);
}
.pl-center > * { pointer-events: auto; }
.pl-btn-tonal { width: 64px; height: 64px; background: var(--pl-tonal); backdrop-filter: blur(8px); }
.pl-btn-tonal .pl-icon { width: 32px; height: 32px; }
.pl-btn-tonal:hover { background: color-mix(in srgb, var(--pl-primary) 32%, rgba(30,30,34,0.72)); }
.pl-play {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    color: var(--pl-on-primary);
    background: var(--pl-primary);
    box-shadow: 0 6px 24px rgba(0,0,0,0.35);
}
.pl-play:hover { background: var(--pl-primary); filter: brightness(1.06); }
.pl-play .pl-icon { width: 48px; height: 48px; }
.player.is-paused .pl-play { border-radius: 28px; }

/* Bottom: the wave, time, and the rest */
.pl-bottom {
    position: absolute;
    inset: auto 0 0 0;
    z-index: 3;
    padding: 0 max(20px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
}
.pl-row { display: flex; align-items: center; gap: 4px; }
.pl-time { font-size: 0.9rem; font-weight: 600; font-variant-numeric: tabular-nums; padding-left: 4px; }
.pl-total { color: rgba(255,255,255,0.65); font-weight: 500; }
.pl-spacer { flex: 1; }

/* The wave: up to where you are, then the handle, then the flat track (as .progress-bar in m3.css) */
.pl-seek {
    position: relative;
    height: 40px;
    margin: 0 4px;
    cursor: pointer;
    touch-action: none;
    outline: none;
    border-radius: 8px;
}
.pl-seek > div { position: absolute; top: 50%; pointer-events: none; }
.pl-seek-track {
    left: calc(var(--pl-pos, 0%) + 8px);
    right: 0;
    height: 4px;
    margin-top: -2px;
    border-radius: 2px;
    background: var(--pl-track);
}
.pl-seek-buffer {
    left: calc(var(--pl-pos, 0%) + 8px);
    width: max(0px, calc(var(--pl-buf, 0%) - var(--pl-pos, 0%) - 8px));
    height: 4px;
    margin-top: -2px;
    border-radius: 2px;
    background: rgba(255,255,255,0.5);
}
.pl-seek-wave {
    left: 0;
    width: max(0px, calc(var(--pl-pos, 0%) - 6px));
    height: 12px;
    margin-top: -6px;
    background: var(--pl-primary);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 12'%3E%3Cpath d='M0 6 Q6 1 12 6 T24 6' fill='none' stroke='black' stroke-width='4' stroke-linecap='round'/%3E%3C/svg%3E") 0 0 / 24px 12px repeat-x;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 12'%3E%3Cpath d='M0 6 Q6 1 12 6 T24 6' fill='none' stroke='black' stroke-width='4' stroke-linecap='round'/%3E%3C/svg%3E") 0 0 / 24px 12px repeat-x;
    animation: plWave 1.8s linear infinite;
}
/* Paused, the wave lies flat — as on Android */
.player.is-paused .pl-seek-wave, .player.is-seeking .pl-seek-wave {
    animation: none;
    height: 4px;
    margin-top: -2px;
    border-radius: 2px;
    -webkit-mask: none;
    mask: none;
}
@keyframes plWave { to { -webkit-mask-position: 24px 0; mask-position: 24px 0; } }
.pl-seek-handle {
    left: var(--pl-pos, 0%);
    width: 4px;
    height: 24px;
    margin: -12px 0 0 -2px;
    border-radius: 2px;
    background: var(--pl-primary);
    transition: height .25s var(--pl-bounce), margin .25s var(--pl-bounce), width .25s var(--pl-bounce);
}
.pl-seek:hover .pl-seek-handle, .player.is-seeking .pl-seek-handle { width: 6px; height: 32px; margin: -16px 0 0 -3px; }
.pl-seek-mark {
    width: 4px;
    height: 4px;
    margin: -2px 0 0 -2px;
    border-radius: 50%;
    background: var(--pl-primary);
}
.pl-seek-hover {
    bottom: 100%;
    top: auto !important;
    transform: translateX(-50%);
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: #fff;
    background: var(--pl-surface);
    opacity: 0;
    transition: opacity .15s;
}
.pl-seek:hover .pl-seek-hover, .player.is-seeking .pl-seek-hover { opacity: 1; }
/* The label is a column: a preview picture can sit above the time (slot stays empty until there is one) */
.pl-seek-hover { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 4px 10px; }
.pl-seek-hover:has(.pl-seek-thumb:not([hidden])) { padding: 4px; }
.pl-seek-thumb { width: 160px; aspect-ratio: 16 / 9; border-radius: 6px; background: #111 center / cover no-repeat; overflow: hidden; }
.pl-seek-thumb[hidden] { display: none; }
.pl-seek-hover-row { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.pl-seek-hover-seg { font-weight: 700; color: var(--pl-primary); }
.pl-seek-hover-seg::after { content: '·'; margin-left: 8px; color: rgba(255,255,255,0.5); font-weight: 600; }
.pl-seek-hover-seg[hidden] { display: none; }
/* Intro, recap and credits as lighter stretches on the track */
.pl-seek-segments { left: 0; right: 0; height: 4px; margin-top: -2px; }
/* Only on the part still to come: under the wave a stretch read as a second, straight line */
.pl-seek-segments { clip-path: inset(-4px 0 -4px calc(var(--pl-pos, 0%) + 8px)); }
.pl-seek-seg { position: absolute; top: 0; height: 100%; border-radius: 2px; background: rgba(255,255,255,0.42); }
.pl-seek-seg[data-type="Outro"], .pl-seek-seg[data-type="Preview"] { background: color-mix(in srgb, var(--pl-primary) 45%, transparent); }
.pl-seek:hover .pl-seek-segments, .player.is-seeking .pl-seek-segments { height: 6px; margin-top: -3px; transition: height .2s var(--pl-bounce), margin .2s var(--pl-bounce); }

/* A short word in the middle for keys whose effect the controls do not show (volume, speed, subtitle timing) */
.pl-osd {
    position: absolute;
    left: 50%;
    top: 18%;
    z-index: 4;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    border-radius: 24px;
    background: var(--pl-surface);
    color: #fff;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    box-shadow: 0 6px 24px rgba(0,0,0,0.4);
    opacity: 0;
    transform: translate(-50%, -8px) scale(.92);
    transition: opacity .18s var(--pl-ease), transform .35s var(--pl-bounce);
    pointer-events: none;
}
.pl-osd.is-in { opacity: 1; transform: translate(-50%, 0) scale(1); pointer-events: auto; }
.pl-osd[hidden] { display: none; }
.pl-osd-act { min-height: 36px; padding: 0 14px; border: 0; border-radius: 18px; background: var(--pl-primary); color: var(--pl-on-primary); font: inherit; font-weight: 700; }

/* Up next with the episode's picture and length; held (no countdown) when it asks first */
.pl-next-thumb { flex: none; width: 112px; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; background: #111; margin-left: -8px; }
.pl-next-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pl-next-thumb[hidden] { display: none; }
.pl-next-meta { font-size: 0.8rem; color: rgba(255,255,255,0.65); }
.pl-next-meta[hidden] { display: none; }
.pl-next.is-held .pl-next-play::before { width: 100% !important; }

/* Speed, subtitle timing and size: chips in a row inside the menu */
.pl-menu-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 12px 8px; }
.pl-menu-chip {
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid rgba(255,255,255,0.22);
    border-radius: 10px;
    background: none;
    color: #fff;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    transition: border-radius .25s var(--pl-bounce), background .15s;
}
.pl-menu-chip:hover, .pl-menu-chip:focus-visible { background: rgba(255,255,255,0.08); }
.pl-menu-chip.is-on { border-color: transparent; border-radius: 18px; background: var(--pl-primary); color: var(--pl-on-primary); }

/* Score on the last episode's end card */
.pl-rate { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px 12px; width: 100%; padding-bottom: 4px; }
.pl-rate-label { grid-column: 1 / -1; font-size: 0.85rem; color: rgba(255,255,255,0.75); }
.pl-rate-value { margin-left: 6px; font-weight: 800; color: var(--pl-primary); font-variant-numeric: tabular-nums; }
.pl-rate-input { width: 100%; accent-color: var(--pl-primary); min-height: 32px; }
.pl-rate-save.is-saved { background: transparent; color: var(--pl-primary); }

/* Text subtitles in four sizes (ASS and PGS keep the size their release gave them) */
.player[data-sub-size="s"] .player-video::cue { font-size: clamp(14px, 2.4vw, 26px); }
.player[data-sub-size="l"] .player-video::cue { font-size: clamp(22px, 4vw, 44px); }
.player[data-sub-size="xl"] .player-video::cue { font-size: clamp(26px, 4.8vw, 54px); }

/* Skip intro / credits: an extended FAB above the bar, on the right. It stays while the controls hide */
.pl-skip-segment {
    position: absolute;
    right: max(24px, env(safe-area-inset-right));
    bottom: calc(100% + 16px);
    height: 56px;
    padding: 0 24px;
    border: 0;
    border-radius: 16px;
    font: inherit;
    font-size: 1rem;
    font-weight: 700;
    color: var(--pl-on-primary);
    background: var(--pl-primary);
    box-shadow: 0 6px 24px rgba(0,0,0,0.4);
    animation: plSkipIn .45s var(--pl-bounce);
    transition: transform .35s var(--pl-bounce), border-radius .35s var(--pl-bounce);
}
.pl-skip-segment:hover { border-radius: 28px; }
/* Up next: from the credits on, in Skip credits' place; the play button fills as the countdown runs */
.pl-next {
    position: absolute;
    right: max(24px, env(safe-area-inset-right));
    bottom: calc(100% + 16px);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 12px 12px 20px;
    border-radius: 28px;
    background: var(--pl-surface);
    box-shadow: 0 6px 24px rgba(0,0,0,0.4);
    animation: plSkipIn .45s var(--pl-bounce);
}
.pl-next[hidden] { display: none; }
.pl-next-text { display: flex; flex-direction: column; min-width: 0; max-width: 260px; }
.pl-next-kicker { font-size: 0.75rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: rgba(255,255,255,0.65); }
.pl-next-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-next-play {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 48px;
    padding: 0 20px 0 14px;
    border: 0;
    border-radius: 16px;
    font: inherit;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--pl-on-primary);
    background: var(--pl-primary);
    isolation: isolate;
    transition: border-radius .35s var(--pl-bounce), transform .35s var(--pl-bounce);
}
/* What is left of the countdown: a shade over the right part, shrinking */
.pl-next-play::before {
    content: '';
    position: absolute;
    inset: 0 0 0 auto;
    width: calc(100% - var(--pl-next-done, 0%));
    background: rgba(0,0,0,0.22);
    z-index: -1;
    transition: width .25s linear;
}
.pl-next-play .pl-icon { width: 22px; height: 22px; fill: currentColor; }
.pl-next-stay {
    height: 48px;
    padding: 0 16px;
    border: 0;
    border-radius: 16px;
    font: inherit;
    font-weight: 600;
    color: #fff;
    background: rgba(255,255,255,0.1);
    transition: background-color .2s, border-radius .35s var(--pl-bounce);
}
.pl-next-stay:hover { background: rgba(255,255,255,0.16); border-radius: 24px; }
.pl-next-play:hover { border-radius: 24px; }
.pl-next-play:active { transform: scale(.95); }
/* No next episode: the same card, with what is next for the show and where to go */
.pl-end {
    position: absolute;
    right: max(24px, env(safe-area-inset-right));
    bottom: calc(100% + 16px);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    max-width: min(640px, calc(100% - 48px));
    padding: 12px 12px 12px 20px;
    border-radius: 28px;
    background: var(--pl-surface);
    box-shadow: 0 6px 24px rgba(0,0,0,0.4);
    animation: plSkipIn .45s var(--pl-bounce);
}
.pl-end[hidden] { display: none; }
.pl-end-title { font-weight: 700; }
.pl-end-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pl-end-actions a { display: inline-flex; align-items: center; text-decoration: none; }
.pl-end-actions .pl-next-play { padding: 0 20px; }
.player.is-idle .pl-bottom:has(.pl-end:not([hidden])) { opacity: 1; transform: none; }
.player.is-idle .pl-bottom:has(.pl-end:not([hidden])) > :not(.pl-end) { opacity: 0; }
.player.is-idle .pl-end { pointer-events: auto; }
.player.is-idle .pl-end :is(a, button) { cursor: pointer !important; }
.player.has-next .pl-skip-segment[data-type="Outro"] { display: none; }
.player.is-idle .pl-bottom:has(.pl-next:not([hidden])) { opacity: 1; transform: none; }
.player.is-idle .pl-bottom:has(.pl-next:not([hidden])) > :not(.pl-next, .pl-skip-segment, .pl-subs-note) { opacity: 0; }
.player.is-idle .pl-next { pointer-events: auto; }
.player.is-idle .pl-next :is(button) { cursor: pointer !important; }

/* Stats for nerds (I): top left under the title, stays while the controls hide; never catches the pointer
   except on its close button */
.pl-stats {
    position: absolute;
    top: 76px;
    left: max(16px, env(safe-area-inset-left));
    z-index: 4;
    width: min(360px, calc(100% - 32px));
    max-height: calc(100% - 200px);
    overflow-y: auto;
    padding: 10px 14px 12px;
    border-radius: 16px;
    background: rgba(12,12,16,0.78);
    backdrop-filter: blur(12px);
    color: #fff;
    font-size: 0.75rem;
    line-height: 1.45;
    pointer-events: none;
}
.pl-stats[hidden] { display: none; }
.pl-stats-head { display: flex; align-items: center; justify-content: space-between; font-weight: 700; font-size: 0.8rem; margin-bottom: 4px; }
.pl-stats-close { pointer-events: auto; width: 32px; height: 32px; margin-right: -8px; }
.pl-stats-close .pl-icon { width: 18px; height: 18px; }
.pl-stats-sec + .pl-stats-sec { margin-top: 8px; }
.pl-stats-title { font-size: 0.68rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--pl-primary); margin-bottom: 2px; }
.pl-stats-row { display: grid; grid-template-columns: 92px 1fr; gap: 8px; }
.pl-stats-row span:first-child { color: rgba(255,255,255,0.6); }
.pl-stats-row span:last-child { font-variant-numeric: tabular-nums; word-break: break-word; }
.player.is-idle .pl-stats { opacity: .85; }

/* Loading subtitles: a quiet chip on the left, opposite Skip intro; also stays while the controls hide */
.pl-subs-note {
    position: absolute;
    left: max(24px, env(safe-area-inset-left));
    bottom: calc(100% + 16px);
    display: flex;
    align-items: center;
    gap: 10px;
    height: 40px;
    padding: 0 16px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #fff;
    background: rgba(20,20,24,0.72);
    backdrop-filter: blur(12px);
    animation: plSkipIn .45s var(--pl-bounce);
}
.pl-subs-note[hidden] { display: none; }
.pl-subs-note-dot { width: 16px; height: 16px; border: 2.5px solid rgba(255,255,255,0.2); border-top-color: var(--pl-primary); border-radius: 50%; animation: spin .9s linear infinite; }
.player.is-idle .pl-bottom:has(.pl-subs-note:not([hidden])) { opacity: 1; transform: none; }
.player.is-idle .pl-bottom:has(.pl-subs-note:not([hidden])) > :not(.pl-subs-note, .pl-skip-segment) { opacity: 0; }
.pl-skip-segment:active { transform: scale(.95); }
.pl-skip-segment[hidden] { display: none; }
@keyframes plSkipIn { from { opacity: 0; transform: translateY(16px) scale(.9); } }
.player.is-idle:not(.skip-faded) .pl-bottom:has(.pl-skip-segment:not([hidden])) { opacity: 1; transform: none; }
.player.is-idle:not(.skip-faded) .pl-bottom:has(.pl-skip-segment:not([hidden])) > :not(.pl-skip-segment) { opacity: 0; }
.player.is-idle .pl-skip-segment { pointer-events: auto; cursor: pointer !important; }
/* After its first seconds it goes with the controls (see SKIP_SHOW_S in js/player/controls.js) */
.player.is-idle.skip-faded .pl-skip-segment { opacity: 0; pointer-events: none; transition: opacity .4s; }

/* Volume: the slider opens next to its button */
.pl-volume { display: flex; align-items: center; }
.pl-volume-slider {
    width: 0;
    opacity: 0;
    height: 24px;
    margin: 0;
    appearance: none;
    background: transparent;
    cursor: pointer;
    transition: width .3s var(--pl-ease), opacity .2s, margin .3s var(--pl-ease);
}
.pl-volume:hover .pl-volume-slider, .pl-volume:focus-within .pl-volume-slider { width: 96px; opacity: 1; margin: 0 8px 0 4px; }
.pl-volume-slider::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(var(--pl-primary) 0 0) 0 0 / var(--pl-vol, 100%) 100% no-repeat, var(--pl-track); }
.pl-volume-slider::-moz-range-track { height: 4px; border-radius: 2px; background: linear-gradient(var(--pl-primary) 0 0) 0 0 / var(--pl-vol, 100%) 100% no-repeat, var(--pl-track); }
.pl-volume-slider::-webkit-slider-thumb { appearance: none; width: 4px; height: 20px; margin-top: -8px; border-radius: 2px; background: var(--pl-primary); }
.pl-volume-slider::-moz-range-thumb { width: 4px; height: 20px; border: 0; border-radius: 2px; background: var(--pl-primary); }

/* Subtitle menu: an M3 menu, opening upwards */
.pl-menu-wrap { position: relative; display: flex; align-items: center; gap: 4px; }
.pl-menu {
    position: absolute;
    right: 0;
    bottom: calc(100% + 8px);
    min-width: 220px;
    max-height: 50vh;
    overflow-y: auto;
    padding: 8px 0;
    border-radius: 16px;
    background: var(--pl-surface);
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    transform-origin: bottom right;
    animation: plMenuIn .3s var(--pl-bounce);
}
.pl-menu[hidden] { display: none; }
@keyframes plMenuIn { from { opacity: 0; transform: scale(.9) translateY(8px); } }
.pl-menu-divider { height: 1px; margin: 8px 16px; background: rgba(255,255,255,0.12); }
.pl-menu-title { padding: 8px 16px 6px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: rgba(255,255,255,0.6); }
.pl-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 44px;
    padding: 0 16px 0 12px;
    border: 0;
    color: #fff;
    background: none;
    font: inherit;
    font-size: 0.95rem;
    text-align: left;
    cursor: pointer;
}
.pl-menu-item:hover, .pl-menu-item:focus-visible { background: rgba(255,255,255,0.08); }
.pl-menu-item[aria-checked="true"] { color: var(--pl-primary); font-weight: 600; }
.pl-menu-check { display: grid; place-items: center; width: 24px; }
.pl-menu-check .pl-icon { width: 20px; height: 20px; }

/* Controls fade away while it plays and nothing moves; the subtitles move up out of their way */
.pl-scrim, .pl-center, .pl-bottom, .player-top { transition: opacity .3s var(--pl-ease), transform .4s var(--pl-ease); }
.player.is-idle :is(.pl-scrim, .pl-center, .pl-bottom, .player-top) { opacity: 0; pointer-events: none; }
.player.is-idle .pl-bottom { transform: translateY(12px); }
.player.is-idle .player-top { transform: translateY(-12px); }
/* While loading or on an error only the top bar and the status show */
.player:is(.is-loading, .has-error) :is(.pl-center, .pl-bottom) { opacity: 0; pointer-events: none; }
.player.is-waiting .pl-center .pl-play { visibility: hidden; }
.player.is-waiting .pl-center::after {
    content: '';
    position: absolute;
    width: 72px;
    height: 72px;
    border: 5px solid rgba(255,255,255,0.2);
    border-top-color: var(--pl-primary);
    border-radius: 50%;
    animation: spin .9s linear infinite;
    pointer-events: none;
}

/* Status: loading and errors, in the middle */
.player-status {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 4;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    width: max-content;
    max-width: min(420px, calc(100% - 32px));
    text-align: center;
    font-size: 0.95rem;
    color: rgba(255,255,255,0.85);
    pointer-events: none;
}
.player-status[hidden] { display: none; }
.pl-spinner { width: 56px; height: 56px; border: 5px solid rgba(255,255,255,0.18); border-top-color: var(--pl-primary); border-radius: 50%; animation: spin .9s linear infinite; }
.player-status.error {
    pointer-events: auto;
    padding: 24px;
    border-radius: 28px;
    background: var(--pl-surface);
    color: #fff;
}
.player-error-text { font-size: 1rem; line-height: 1.5; }
.pl-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.pl-pill-tonal { border: 0; font-family: inherit; color: #fff !important; background: rgba(255,255,255,0.14) !important; }
.pl-pill {
    display: inline-flex;
    align-items: center;
    height: 40px;
    padding: 0 24px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--pl-on-primary);
    background: var(--pl-primary);
    text-decoration: none;
}

@media (max-width: 600px) {
    .player-method { display: none; }
    .pl-play { width: 72px; height: 72px; }
    .pl-play .pl-icon { width: 36px; height: 36px; }
    .player.is-paused .pl-play { border-radius: 22px; }
    .pl-btn-tonal { width: 52px; height: 52px; }
    .pl-btn-tonal .pl-icon { width: 26px; height: 26px; }
    .pl-volume-slider { display: none; }
    .pl-skip-segment { height: 48px; padding: 0 20px; font-size: 0.9rem; }
}
@media (prefers-reduced-motion: reduce) {
    .pl-seek-wave { animation: none; }
    .pl-menu, .pl-skip-segment, .pl-subs-note, .pl-next, .pl-end { animation: none; }
    .pl-osd, .pl-menu-chip, .pl-seek-segments { transition: none; }
    .pl-next-play::before { transition: none; }
    .pl-subs-note-dot { animation-duration: 2.5s; }
}

.jf-mode {
    align-self: flex-start;
    padding: 4px 0;
    border: 0;
    background: none;
    color: var(--user-accent);
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}
.jf-mode:hover { text-decoration: underline; }
.jf-local { margin-top: var(--space-md); max-width: 420px; }
.jf-local-label { display: block; margin-bottom: 6px; font-size: 0.85rem; font-weight: 600; }
.jf-local-row { display: flex; gap: var(--space-sm); }
.jf-local-row .glass-input { flex: 1; min-width: 0; }
.jf-qc { width: 100%; max-width: 420px; padding: var(--space-md); border-radius: var(--radius-md, 12px); background: var(--bg-secondary); }
.jf-qc[hidden] { display: none; }
.jf-qc-code { font-size: 2rem; font-weight: 700; letter-spacing: 0.25em; font-variant-numeric: tabular-nums; }
.jf-qc-how { margin-top: 6px; font-size: 0.85rem; color: var(--text-secondary); line-height: 1.5; }
.jf-qc-wait { display: flex; align-items: center; gap: var(--space-sm); margin-top: var(--space-sm); font-size: 0.85rem; }

/* ===== Episodes (js/player/episodes.js): every episode Jellyfin has, to start any of them ===== */
.ep-dialog { max-width: 640px; width: 94%; display: flex; flex-direction: column; overflow: hidden; padding: var(--space-xl); }
.ep-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-md); }
.ep-heading { margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ep-seasons { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-sm); margin: var(--space-md) 0; }
.ep-seasons:empty { display: none; }
.ep-seasons .is-after { margin-left: auto; }
.ep-list { overflow-y: auto; margin: var(--space-sm) calc(-1 * var(--space-sm)) 0; padding: 0 var(--space-sm); min-height: 120px; }
.ep-row {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm);
    border-radius: var(--radius-lg);
    transition: background-color .2s var(--ease);
}
.ep-row:hover, .ep-row:focus-visible { background: var(--bg-secondary); outline: none; }
.ep-row.is-next { background: color-mix(in srgb, var(--user-accent) 12%, transparent); }
.ep-thumb {
    position: relative;
    flex: none;
    width: 144px;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-secondary);
}
.ep-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ep-row.is-watched .ep-thumb img { opacity: .55; }
.ep-progress { position: absolute; left: 6px; right: 6px; bottom: 6px; margin: 0; }
.ep-progress, .ep-progress .progress-bar-fill { display: block; }
.ep-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ep-title { font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ep-number { color: var(--text-secondary); font-variant-numeric: tabular-nums; margin-right: 8px; }
.ep-meta { font-size: 0.8rem; color: var(--text-secondary); display: flex; align-items: center; gap: 8px; }
.ep-next { font-weight: 700; color: var(--user-accent); }
.ep-empty { display: grid; place-items: center; padding: var(--space-2xl) 0; color: var(--text-secondary); text-align: center; }
@media (max-width: 600px) {
    .ep-dialog { padding: var(--space-lg); max-height: 88vh; }
    .ep-thumb { width: 112px; }
}
:root[data-design="m3"] .ep-row { border-radius: 16px; }
:root[data-design="m3"] .ep-row.is-next { background: var(--md-secondary-container); color: var(--md-on-secondary-container); }
:root[data-design="m3"] .ep-next { color: var(--md-primary); }
:root[data-design="m3"] .ep-thumb { border-radius: 12px; }

/* ===== Waiting page when AniRoll is full (js/seat.js) ===== */
.seat-wait {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    place-items: center;
    padding: 16px;
    background: var(--bg);
}
html.seat-waiting body { overflow: hidden; }
.seat-wait-card { max-width: 440px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: var(--space-md); }
.seat-wait-spinner { width: 48px; height: 48px; border: 4px solid var(--border); border-top-color: var(--user-accent); border-radius: 50%; animation: spin 1.1s linear infinite; }
.seat-wait-title { font-size: 1.6rem; font-weight: 750; letter-spacing: -0.02em; margin: var(--space-sm) 0 0; }
.seat-wait-text { color: var(--text-secondary); line-height: 1.6; margin: 0; }
.seat-wait-line { display: block; margin-top: var(--space-sm); color: var(--text); font-size: 1.05rem; }
.seat-wait-note { font-size: 0.85rem; color: var(--text-secondary); margin: 0 0 var(--space-sm); }
@media (prefers-reduced-motion: reduce) { .seat-wait-spinner { animation-duration: 3s; } }
:root[data-design="m3"] .seat-wait { background: var(--md-surface); }
:root[data-design="m3"] .seat-wait-spinner { border-color: var(--md-secondary-container); border-top-color: var(--md-primary); }

/* ===== Admin (js/pages/admin.js): tiles, charts in the scheme's own colours, tables, controls ===== */
.adm-page { --adm-line: var(--user-accent); --adm-area: color-mix(in srgb, var(--user-accent) 16%, transparent); padding-bottom: var(--space-3xl, 64px); }
.adm-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-md); flex-wrap: wrap; margin-bottom: var(--space-lg); }
.adm-head .page-title { margin: 0; }
.adm-note { color: var(--text-secondary); font-size: 0.9rem; margin: 4px 0 0; }
.adm-ranges { display: flex; gap: 6px; }
.adm-ranges [aria-pressed="true"] { background: var(--user-accent); color: var(--bg); border-color: transparent; }
.adm-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: var(--space-md); margin-bottom: var(--space-lg); }
.adm-tile { padding: var(--space-lg); border-radius: var(--radius-xl); background: var(--bg-secondary); display: flex; flex-direction: column; gap: 4px; }
.adm-tile-value { font-size: 2rem; font-weight: 750; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.adm-tile-value small { font-size: 1rem; font-weight: 600; color: var(--text-secondary); }
.adm-tile-label { font-weight: 600; }
.adm-tile-note { font-size: 0.8rem; color: var(--text-secondary); }
.adm-gauge { height: 6px; border-radius: 3px; background: var(--border-subtle); overflow: hidden; margin-top: 4px; }
.adm-gauge span { display: block; height: 100%; border-radius: 3px; background: var(--user-accent); }
.adm-card { padding: var(--space-lg); border-radius: var(--radius-xl); background: var(--bg-secondary); margin-bottom: var(--space-lg); min-width: 0; }
.adm-card-title { font-size: 1.05rem; font-weight: 700; margin: 0 0 4px; }
.adm-card-sub { font-size: 0.85rem; color: var(--text-secondary); margin: 0 0 var(--space-md); }
.adm-grid2, .adm-grid3 { display: grid; gap: var(--space-lg); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.adm-grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.adm-grid2 > .adm-card, .adm-grid3 > .adm-card { margin-bottom: 0; }
.adm-grid2, .adm-grid3 { margin-bottom: var(--space-lg); }
@media (max-width: 900px) { .adm-grid2, .adm-grid3 { grid-template-columns: minmax(0, 1fr); } }
.adm-chart { position: relative; width: 100%; }
.adm-chart-svg { display: block; width: 100%; height: auto; overflow: visible; }
.adm-grid { stroke: var(--border-subtle); stroke-width: 1; }
.adm-axis { fill: var(--text-secondary); font-size: 11px; font-variant-numeric: tabular-nums; }
.adm-line { fill: none; stroke: var(--adm-line); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.adm-area { fill: var(--adm-area); }
.adm-limit { stroke: var(--text-secondary); stroke-width: 1.5; stroke-dasharray: 6 5; }
.adm-limit-label { fill: var(--text-secondary); font-size: 11px; font-weight: 600; }
.adm-cross-line { stroke: var(--text-secondary); stroke-width: 1; }
.adm-cross-dot { fill: var(--adm-line); stroke: var(--bg-secondary); stroke-width: 2; }
.adm-cross[hidden] { display: none; }
.adm-tip { position: absolute; pointer-events: none; min-width: 90px; padding: 6px 10px; border-radius: 10px; background: var(--text); color: var(--bg); font-size: 0.8rem; display: flex; flex-direction: column; box-shadow: 0 4px 16px rgba(0,0,0,.25); }
.adm-tip[hidden] { display: none; }
.adm-tip span { opacity: .75; }
.adm-table-view { margin-top: var(--space-md); font-size: 0.85rem; }
.adm-table-view summary { color: var(--text-secondary); }
.adm-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.adm-table th { text-align: left; font-weight: 600; color: var(--text-secondary); padding: 6px 8px; }
.adm-table td { padding: 8px; border-top: 1px solid var(--border-subtle); vertical-align: middle; }
.adm-table tr:first-child td { border-top: 0; }
.adm-table a { color: inherit; text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 3px; }
.adm-muted { color: var(--text-secondary); white-space: nowrap; }
.adm-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.adm-act { text-align: right; width: 1%; white-space: nowrap; }
.adm-chip { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 0.7rem; font-weight: 700; background: var(--user-accent-dim, var(--border-subtle)); color: var(--user-accent); vertical-align: 1px; }
.adm-big { font-size: 2rem; font-weight: 750; margin: 0 0 var(--space-sm); font-variant-numeric: tabular-nums; }
.adm-err { font-family: ui-monospace, monospace; font-size: 0.8rem; word-break: break-word; }
.adm-status { font-weight: 600; }
.adm-status::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: currentColor; vertical-align: 1px; }
.adm-status.is-ok { color: var(--success, #2e7d32); }
.adm-status.is-warn { color: var(--warning, #b26a00); }
.adm-form { display: flex; align-items: flex-end; gap: var(--space-sm); flex-wrap: wrap; margin-top: var(--space-sm); }
.adm-field { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; color: var(--text-secondary); }
.adm-field[hidden] { display: none; }
.adm-field-grow { flex: 1; min-width: 180px; }
.adm-field input { width: 100%; min-width: 100px; }
#adm-clear-errors { margin-top: var(--space-md); }
#adm-clear-errors[hidden] { display: none; }
:root[data-design="m3"] .adm-tile, :root[data-design="m3"] .adm-card { border-radius: var(--md-shape-xl, 28px); background: var(--md-surface-container); }
:root[data-design="m3"] .adm-tile:first-child { background: var(--md-primary-container); color: var(--md-on-primary-container); }
:root[data-design="m3"] .adm-tile:first-child :is(.adm-tile-note, .adm-tile-value small) { color: inherit; opacity: .8; }
:root[data-design="m3"] .adm-tile:first-child .adm-gauge { background: color-mix(in srgb, var(--md-on-primary-container) 18%, transparent); }
:root[data-design="m3"] .adm-tile:first-child .adm-gauge span { background: var(--md-on-primary-container); }
:root[data-design="m3"] .adm-page { --adm-line: var(--md-primary); --adm-area: color-mix(in srgb, var(--md-primary) 18%, transparent); }
:root[data-design="m3"] .adm-chip { background: var(--md-secondary-container); color: var(--md-on-secondary-container); }
:root[data-design="m3"] .adm-tip { background: var(--md-inverse-surface); color: var(--md-inverse-on-surface); }
:root[data-design="m3"] .adm-ranges [aria-pressed="true"] { background: var(--md-secondary-container); color: var(--md-on-secondary-container); }

/* Continue / Start over (js/player/controls.js askResume): a card over the paused picture */
.pl-resume { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; padding: 16px; background: rgba(0,0,0,0.45); animation: plResumeIn .3s ease both; }
.pl-resume-card { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 28px 28px 24px; border-radius: 32px; background: var(--pl-surface); box-shadow: 0 12px 40px rgba(0,0,0,0.5); animation: plSkipIn .45s var(--pl-bounce) both; }
.pl-resume-title { font-size: 1.15rem; font-weight: 700; color: #fff; }
.pl-resume-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.pl-resume-btn { display: inline-flex; align-items: center; gap: 8px; height: 56px; padding: 0 24px 0 18px; border: 0; border-radius: 28px; font: inherit; font-size: 1rem; font-weight: 700; cursor: pointer !important;
    color: #fff; background: rgba(255,255,255,0.12); transition: border-radius .35s var(--pl-bounce), transform .35s var(--pl-bounce), background-color .2s; }
.pl-resume-btn .pl-icon { width: 22px; height: 22px; fill: currentColor; }
.pl-resume-btn.is-primary { color: var(--pl-on-primary); background: var(--pl-primary); }
.pl-resume-btn:hover { border-radius: 16px; }
.pl-resume-btn:active { transform: scale(.95); }
.pl-resume-btn:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.player.has-resume :is(.pl-center, .pl-skip-segment) { opacity: 0; pointer-events: none; }
@keyframes plResumeIn { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .pl-resume, .pl-resume-card { animation: none; } }

/* ===== v134: list score button, behind badge, score dialog ===== */
button.list-entry-score {
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    font-weight: 700;
    min-height: 40px;
    padding: 0 10px;
    border-radius: 12px;
    cursor: pointer;
    transition: background .15s, border-radius .25s var(--m3-bouncy, ease);
}
button.list-entry-score:hover, button.list-entry-score:focus-visible { background: color-mix(in srgb, currentColor 10%, transparent); border-radius: 20px; }
.behind-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--md-on-tertiary-container, var(--accent-text));
    background: var(--md-tertiary-container, var(--accent));
}
.score-prompt-text { font-size: 0.9rem; color: var(--text-secondary); margin: -4px 0 var(--space-md); }
.score-prompt-row { display: flex; align-items: center; gap: 16px; margin-bottom: var(--space-md); }
.score-prompt-range { flex: 1; min-height: 40px; accent-color: var(--md-primary, var(--accent)); }
.score-prompt-value { min-width: 3ch; font-size: 1.75rem; font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; color: var(--md-primary, var(--accent)); }
.score-prompt-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--space-lg); }
.score-chip {
    min-width: 44px;
    min-height: 40px;
    padding: 0 10px;
    border: 1px solid var(--md-outline-variant, var(--border));
    border-radius: 12px;
    background: none;
    color: inherit;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: border-radius .25s var(--m3-bouncy, ease), background .15s;
}
.score-chip:hover { background: color-mix(in srgb, currentColor 8%, transparent); }
.score-chip.is-on { border-color: transparent; border-radius: 20px; background: var(--md-primary, var(--accent)); color: var(--md-on-primary, var(--accent-text)); }
@media (prefers-reduced-motion: reduce) { button.list-entry-score, .score-chip { transition: none; } }

/* Home: one line on what aired since the last visit and what the week asks for */
.home-catchup { margin: -4px 0 var(--space-md); font-size: 0.9rem; color: var(--text-secondary); line-height: 1.5; }
.home-catchup strong { color: var(--text); font-weight: 700; }
/* A show untouched for weeks: move it to Paused in one tap */
.cw-pause {
    position: absolute;
    top: var(--space-sm);
    left: var(--space-sm);
    z-index: 3;
    height: 28px;
    padding: 0 10px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
}
.cw-pause:hover { background: var(--user-accent); border-color: transparent; }
/* Small card buttons keep their look but get a finger-sized hit area */
.cw-inc, .cw-pause, .fr-plan { isolation: isolate; }
.cw-inc::after, .cw-pause::after, .fr-plan::after { content: ''; position: absolute; inset: -8px -4px; }

/* Related: where each part stands on your list, a Plan button under a sequel not on it */
.detail-related-cell { flex: 0 0 84px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.detail-related-cell .detail-related-item { flex: none; }
.detail-related-where { font-size: 0.7rem; color: var(--text-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.detail-related-where.is-listed { color: var(--md-primary, var(--user-accent)); font-weight: 600; }
/* As wide as the cover above it, so it reads as that show's button and not as one for the whole row */
.detail-related-plan {
    align-self: stretch;
    min-height: 32px;
    padding: 0 8px;
    border: 1px solid var(--md-outline, var(--border));
    border-radius: 16px;
    background: none;
    color: inherit;
    font: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
}
.detail-related-plan:hover { background: var(--md-secondary-container, var(--bg-secondary)); }
/* Score chart: your own score's bar, and where it stands */
.stat-chart-note { margin: -4px 0 var(--space-sm); font-size: 0.8rem; color: var(--text-secondary); }
.stat-bar-row.is-yours .stat-bar-label { color: var(--md-primary, var(--user-accent)); font-weight: 800; }
.stat-bar-row.is-yours .stat-bar-fill { outline: 2px solid var(--md-primary, var(--user-accent)); outline-offset: 1px; }
.friends-together { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--space-sm); margin-bottom: var(--space-md); padding: 10px 12px 10px 16px; border-radius: var(--radius-lg); background: var(--md-secondary-container, var(--bg-secondary)); color: var(--md-on-secondary-container, inherit); font-size: 0.9rem; }
.empty-state-action { margin-top: var(--space-md); }
.search-group-title { padding: 10px 16px 4px; font-size: 0.75rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-tertiary); }
.search-result-status { margin-left: 8px; padding: 1px 8px; border-radius: 10px; font-size: 0.7rem; font-weight: 700; background: var(--md-secondary-container, var(--bg-secondary)); color: var(--md-on-secondary-container, var(--text)); }
.season-formats { margin: 0 0 var(--space-lg); display: flex; flex-wrap: wrap; gap: 8px; }
.season-more { display: flex; justify-content: center; margin: var(--space-xl) 0; }
.season-more[hidden] { display: none; }
.studio-history { margin: -8px 0 var(--space-lg); color: var(--text-secondary); font-size: 0.95rem; }
.toast { display: flex; align-items: center; gap: 12px; }
.toast-action { flex: none; min-height: 32px; padding: 0 12px; border: 0; border-radius: 16px; background: color-mix(in srgb, currentColor 18%, transparent); color: inherit; font: inherit; font-weight: 700; cursor: pointer; }
.toast-action:hover { background: color-mix(in srgb, currentColor 28%, transparent); }
/* "Not interested" on a recommendation card */
.media-card-dismiss { position: absolute; top: var(--space-sm); right: var(--space-sm); z-index: 3; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: rgba(0,0,0,0.55); color: #fff; opacity: 0; transition: opacity .2s; cursor: pointer; }
.media-card-dismiss svg { width: 16px; height: 16px; }
.media-card:hover .media-card-dismiss, .media-card-dismiss:focus-visible { opacity: 1; }
@media (hover: none) { .media-card-dismiss { opacity: 1; } }
.media-card-dismiss::after { content: ''; position: absolute; inset: -6px; }
.taste-chips { align-items: center; margin-bottom: var(--space-lg); }
.taste-chips-label { margin-right: 4px; font-size: 0.85rem; color: var(--text-secondary); }
/* Social: a post about an episode you have not seen yet */
.activity-ahead { display: inline-flex; align-items: center; gap: 6px; margin: 8px 0 0; padding: 4px 12px; border: 0; border-radius: 12px; background: var(--md-tertiary-container, var(--bg-secondary)); color: var(--md-on-tertiary-container, var(--text)); font: inherit; font-size: 0.75rem; font-weight: 700; cursor: pointer; }
.activity-ahead::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: .7; }
.activity-ahead.is-warning { outline: 2px solid currentColor; }
.activity-collapsed { color: var(--text-tertiary); font-weight: 500; }
.notif-body { min-width: 0; flex: 1; }
.notif-thread { margin-top: var(--space-sm); padding-top: var(--space-sm); border-top: 1px solid var(--md-outline-variant, var(--border)); }
.notif-thread-link { display: inline-block; margin-top: 6px; font-size: 0.8rem; font-weight: 600; color: var(--md-primary, var(--user-accent)); }
/* Profile: hot takes */
.hot-take { display: flex; align-items: center; gap: 12px; padding: 6px; margin: 0 -6px; border-radius: var(--radius-md); cursor: pointer; }
.hot-take:hover { background: color-mix(in srgb, currentColor 6%, transparent); }
.hot-take img { width: 36px; height: 50px; object-fit: cover; border-radius: 8px; flex: none; }
.hot-take-text { min-width: 0; flex: 1; }
.hot-take-title { font-weight: 600; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hot-take-meta { font-size: 0.75rem; color: var(--text-secondary); }
.hot-take-diff { font-weight: 800; font-variant-numeric: tabular-nums; }
.hot-take-diff.pos { color: var(--success); }
.hot-take-diff.neg { color: var(--danger); }
/* Linking a Jellyfin series to AniList by hand */
.jf-link-text { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: var(--space-md); }
.jf-link-search { display: flex; gap: var(--space-sm); margin-bottom: var(--space-sm); }
.jf-link-search input { flex: 1; min-width: 0; }
.jf-link-results { display: flex; flex-direction: column; gap: 4px; max-height: 320px; overflow-y: auto; margin-bottom: var(--space-md); }
.jf-link-item { display: flex; align-items: center; gap: 12px; padding: 6px; border: 2px solid transparent; border-radius: var(--radius-md); background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.jf-link-item:hover { background: color-mix(in srgb, currentColor 6%, transparent); }
.jf-link-item[aria-selected="true"] { border-color: var(--md-primary, var(--user-accent)); background: var(--md-secondary-container, var(--bg-secondary)); }
.jf-link-item img { width: 36px; height: 50px; object-fit: cover; border-radius: 8px; flex: none; }
.jf-link-item span { display: flex; flex-direction: column; min-width: 0; }
.jf-link-item small { color: var(--text-secondary); }
.jf-link-offset { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 0.9rem; }
.jf-now-link { margin-top: 8px; }
.jf-links { margin: var(--space-md) 0; display: flex; flex-direction: column; gap: 6px; }
.jf-link-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); font-size: 0.85rem; }
/* Watch Party: a verdict on the episode just watched */
.wp-vote { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: var(--space-md); }
.wp-vote-label { font-size: 0.85rem; font-weight: 600; }
.wp-vote-chips { display: flex; gap: 6px; }
.wp-vote-chip { min-width: 44px; min-height: 36px; padding: 0 10px; border: 1px solid var(--md-outline-variant, var(--border)); border-radius: 12px; background: none; color: inherit; font: inherit; font-weight: 700; cursor: pointer; transition: border-radius .25s var(--m3-bouncy, ease), background .15s; }
.wp-vote-chip:hover { background: color-mix(in srgb, currentColor 8%, transparent); }
.wp-vote-chip.is-on { border-color: transparent; border-radius: 18px; background: var(--md-primary, var(--user-accent)); color: var(--md-on-primary, #fff); }
.wp-vote-avg { font-size: 0.8rem; color: var(--text-secondary); }
.wp-post-text { width: 100%; min-height: 160px; resize: vertical; font: inherit; line-height: 1.5; }
@media (prefers-reduced-motion: reduce) { .wp-vote-chip { transition: none; } }
/* Landing: a roll to try before logging in */
.landing-try { display: flex; align-items: center; gap: var(--space-2xl, 48px); flex-wrap: wrap; margin-top: var(--space-2xl, 48px); padding: var(--space-xl); border-radius: var(--md-shape-xl, 28px); background: var(--md-surface-container, var(--bg-secondary)); }
.landing-try[hidden] { display: none; }
.landing-try-machine { display: flex; flex-direction: column; align-items: center; gap: var(--space-md); }
.landing-try-window { width: 150px; height: 214px; }
.landing-try-text { flex: 1; min-width: 240px; }
.landing-try-result { margin: var(--space-sm) 0 var(--space-md); color: var(--text-secondary); line-height: 1.6; }
.landing-try-result strong { color: var(--text); }
:root:not([data-design="m3"]) .roll-sticker { display: none; }

/* ===== Accessibility ===== */
/* "Skip to content": the first thing Tab reaches, shown only then */
.skip-link {
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: 10000;
    padding: 10px 16px;
    border-radius: 12px;
    background: var(--md-primary, var(--accent));
    color: var(--md-on-primary, var(--accent-text));
    font-weight: 700;
    transform: translateY(-200%);
    transition: transform .2s;
}
.skip-link:focus { transform: none; }
/* The page heading takes focus after a page change (js/router.js): no ring for that */
h1[tabindex="-1"]:focus { outline: none; }
/* The search box keeps a visible focus ring */
#search-input:focus-visible { outline: 3px solid var(--md-secondary, var(--accent)); outline-offset: 2px; border-radius: 8px; }
/* Windows High Contrast and "more contrast": the system cursor stays, the drawn one goes */
@media (forced-colors: active), (prefers-contrast: more) {
    body, button, .player :is(button, a, input, .pl-seek, .pl-menu-item) { cursor: auto !important; }
    a, button { cursor: pointer !important; }
    .cursor, .m3-cursor { display: none !important; }
}
.glass-menu-option.disabled { opacity: .45; pointer-events: none; }
.media-card-title[role="button"]:focus-visible { outline: 3px solid var(--md-secondary, var(--accent)); outline-offset: 2px; border-radius: 6px; }

/* Home hero: Play from Jellyfin next to "Watched episode N" */
.hero-play-slot:not([hidden]) { display: contents; }
/* Chapters from the file: small dots on the track, the name shows in the hover label */
.pl-seek-chapters { left: 0; right: 0; height: 0; }
.pl-seek-chapter { position: absolute; top: -2.5px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1.5px rgba(0,0,0,0.45); }
.pl-seek:hover .pl-seek-chapter, .player.is-seeking .pl-seek-chapter { transform: scale(1.3); transition: transform .2s var(--pl-bounce); }

/* The public version next to the changelog's title */
.whatsnew-release { margin-left: 8px; font-size: .8rem; font-weight: 600; color: var(--md-on-surface-variant, var(--text-secondary)); vertical-align: 2px; }

/* Detail: the score sits next to the title; the long parts wait behind tabs */
.detail-score { display: flex; align-items: baseline; gap: 8px; margin: 2px 0 var(--space-sm); }
.detail-score-value { font-size: 2rem; font-weight: 800; line-height: 1; letter-spacing: -0.02em; color: var(--user-accent); }
.detail-score-label { font-size: 0.85rem; color: var(--text-secondary); }
.detail-tabs { margin: var(--space-xl) 0 var(--space-lg); display: inline-flex; }
.detail-tabpanel[hidden] { display: none; }
/* The score distribution as a plain histogram: bars without a track behind them */
.detail-dist .stat-bar-track { background: transparent; }
.detail-recs .media-card-score { display: none; }
/* Export is rare: a quiet text action at the end of the toolbar, not a filled button among the filters */
.list-export { background: none; border: 0; padding: 6px 4px; font: inherit; font-size: 0.85rem; font-weight: 500; color: var(--text-secondary); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); }
.list-export:hover { color: var(--text); }
/* Loading shapes (SKELETON in js/store.js) */
.skeleton-heading { height: 44px; width: min(280px, 60%); margin-bottom: var(--space-xl); }
.skeleton-block { height: 320px; border-radius: var(--radius-xl); }
.skeleton-stage { height: 440px; }
.skeleton-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--space-md); }
.skeleton-rows { display: grid; gap: var(--space-sm); }
.skeleton-row { height: 72px; }
