:root {
    color-scheme: dark;
    --bg: #080706;
    --card: #171411;
    --border: #3b2d1a;
    --muted: #aaa39a;
    --accent: #ebaf36;
    --accent-soft: rgba(235, 175, 54, .12);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-width: 320px;
    background: var(--bg);
    color: #fff;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.watching-page { width: min(100% - 2rem, 980px); margin: 0 auto; padding: 2rem 0 5rem; }
.back-link { color: var(--muted); text-decoration: none; }
.back-link:hover, .back-link:focus-visible { color: var(--accent); }
.disclaimer { width: min(calc(100% - 2rem), 30rem); margin: auto; padding: 0; border: 1px solid var(--border); border-radius: 1rem; background: var(--card); color: #fff; box-shadow: 0 1.2rem 3rem rgb(0 0 0 / 45%); }
.disclaimer::backdrop { background: rgb(0 0 0 / 72%); }
.disclaimer-content { padding: clamp(1.25rem, 4vw, 2rem); }
.disclaimer h2 { margin-bottom: .75rem; font-size: clamp(1.5rem, 4vw, 2rem); }
.disclaimer p:not(.eyebrow) { margin: 0 0 1.25rem; color: var(--muted); line-height: 1.5; }
.confirm-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.25rem; }
.grey-button { border-color: var(--border); background: transparent; color: var(--muted); }
.grey-button:hover, .grey-button:focus-visible { border-color: #5a5249; background: rgb(255 255 255 / 6%); color: #d6d0c8; }
.page-header { padding: 3.5rem 0 2rem; }
.eyebrow { margin: 0 0 .7rem; color: var(--accent); font-size: .75rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
h1, h2 { margin: 0; }
h1 { max-width: 760px; color: var(--accent); font-size: clamp(2.7rem, 8vw, 6.2rem); letter-spacing: -.06em; line-height: .94; }
.title-mark { color: #fff; }
.intro { margin: 1.25rem 0 0; color: var(--muted); font-size: clamp(1rem, 2vw, 1.2rem); }

/* Home page hero with brand design */
.home-brand-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.25rem 1.75rem;
    margin: 0.5rem 0 0.5rem;
}

.home-brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.6rem 1.25rem 0.6rem 0.75rem;
    border-radius: 999px;
    background: linear-gradient(
        150deg,
        rgba(26, 21, 16, 0.78) 0%,
        rgba(16, 13, 10, 0.72) 100%
    );
    border: 1px solid rgba(235, 175, 54, 0.5);
    box-shadow:
        0 0 0 1px rgba(235, 175, 54, 0.18),
        0 0 24px rgba(235, 175, 54, 0.12),
        inset 1px 1px 0 rgba(255, 255, 255, 0.18),
        inset 0 1px 2px rgba(235, 175, 54, 0.35);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.home-brand-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f3be4c 0%, #ebaf36 40%, #b88118 100%);
    color: #080706;
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.55),
        inset 0 -1px 2px rgba(0, 0, 0, 0.4),
        0 4px 14px rgba(235, 175, 54, 0.45);
    flex-shrink: 0;
}

.home-brand-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.home-brand-name {
    font-size: 1.2rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.02em;
    text-shadow: 0 0 14px rgba(235, 175, 54, 0.25);
}

.home-heading {
    margin: 0;
    font-size: clamp(2.6rem, 6.5vw, 4.8rem);
    letter-spacing: -0.05em;
    line-height: 0.95;
    color: var(--accent);
}

.card { padding: clamp(1.25rem, 4vw, 2rem); border: 1px solid var(--border); border-radius: 1rem; background: var(--card); box-shadow: 0 1.2rem 3rem rgb(0 0 0 / 28%); }
.section-label { display: flex; align-items: center; gap: .6rem; color: var(--muted); font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.status-dot { width: .65rem; height: .65rem; border-radius: 50%; background: var(--accent); box-shadow: 0 0 .8rem var(--accent); }
.secondary-button, .text-button { border-color: var(--border); color: var(--muted); }
.text-button { padding: .35rem .6rem; font-size: .8rem; }
.search-form { display: flex; gap: .75rem; margin-top: 1.25rem; }
input, select, button { font: inherit; }
input[type="search"], input[type="text"], select { min-width: 0; width: 100%; border: 1px solid var(--border); border-radius: .5rem; padding: .85rem 1rem; background: #0d0b09; color: #fff; outline: none; }
input[type="search"]:focus, input[type="text"]:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
button { border: 1px solid var(--accent); border-radius: .5rem; padding: .75rem 1rem; background: transparent; color: var(--accent); cursor: pointer; font-weight: 700; }
button:hover, button:focus-visible { background: var(--accent); color: #17120b; }
.primary-button { display: flex; align-items: center; gap: .6rem; white-space: nowrap; }
.search-field { position: relative; flex: 1 1 0; min-width: 0; }
.search-field input[type="search"] { padding-right: 5rem; }
.search-actions { position: absolute; top: 0; right: .5rem; bottom: 0; display: flex; align-items: center; gap: .15rem; }
input[type="search"]::-webkit-search-cancel-button { display: none; -webkit-appearance: none; appearance: none; }
.search-clear, .search-genres-toggle { display: grid; flex: none; width: 1.8rem; height: 1.8rem; margin: 0; padding: 0; place-items: center; border-color: transparent; border-radius: 50%; color: var(--muted); font-size: 1.2rem; line-height: 1; transition: transform .3s ease-in-out; }
.search-genres-toggle { place-items: center; border-color: transparent; border-radius: 50%; color: var(--muted); transition: transform .2s ease; }
.search-genres-toggle[aria-expanded="true"] { transform: rotate(180deg); }
.search-genres-toggle:hover, .search-genres-toggle:focus-visible, .search-genres-toggle[aria-expanded="true"] { border-color: transparent; background: var(--accent-soft); color: var(--accent); }
.search-clear:hover, .search-clear:focus-visible { border-color: transparent; background: var(--accent-soft); color: var(--accent); transform: rotate(90deg); }
.search-clear[hidden] { display: none; }
.search-clear.is-spinning { animation: search-clear-click .25s ease-out; }
@keyframes search-clear-click { from { rotate: 0deg; } to { rotate: 360deg; } }
@media (prefers-reduced-motion: reduce) {
    .search-clear { transition: none; }
    .search-clear:hover, .search-clear:focus-visible { transform: none; }
    .search-clear.is-spinning { animation: none; }
}
/* Let the genre dropdown extend past the search card instead of being clipped by it,
   and keep the card stacked above the sections that follow so the panel isn't covered. */
.card:has(.search-field), .card:has(.genre-panel) { position: relative; z-index: 40; overflow: visible; height: auto; max-height: none; }
.genre-panel { position: absolute; top: calc(100% + .5rem); right: 0; left: 0; z-index: 30; padding: 1rem; border: 1px solid var(--border); border-radius: .75rem; background: var(--card); box-shadow: 0 1.2rem 3rem rgb(0 0 0 / 55%); }
.genre-panel[hidden] { display: none; }
.genre-tabs { display: flex; gap: .5rem; margin-bottom: .9rem; }
.genre-tab { border-color: transparent; color: var(--muted); font-size: .85rem; }
.genre-tab.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.genre-tab:hover, .genre-tab:focus-visible { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.genre-list { display: flex; flex-wrap: wrap; gap: .5rem; max-height: 14rem; overflow-y: auto; }
.genre-chip { padding: .45rem .8rem; border-color: var(--border); border-radius: 999px; color: var(--muted); font-size: .8rem; }
.genre-chip:hover, .genre-chip:focus-visible { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .search-genres-toggle { transition: none; } }
.results-grid[hidden] { display: none; }
.genre-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1rem; max-height: 70vh; overflow-y: auto; padding: .4rem .35rem .5rem .1rem; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.genre-grid[hidden] { display: none; }
.genre-grid::-webkit-scrollbar { width: 6px; }
.genre-grid::-webkit-scrollbar-thumb { border-radius: 3px; background: var(--border); }
.genre-grid-status { grid-column: 1 / -1; min-height: 1.25rem; color: var(--muted); font-size: .8rem; text-align: center; }
@media (max-width: 700px) { .genre-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; } }
.settings-button { position: absolute; top: 1.25rem; right: 1.25rem; z-index: 20; display: grid; width: 2.6rem; height: 2.6rem; padding: 0; place-items: center; border-color: var(--border); border-radius: 50%; background: var(--card); color: var(--muted); }
.settings-button:hover, .settings-button:focus-visible { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); transform: rotate(90deg); }
.settings-button { transition: transform .3s ease-in-out; }
.settings-button.is-spinning { animation: search-clear-click .25s ease-out; }
@media (prefers-reduced-motion: reduce) {
    .settings-button { transition: none; }
    .settings-button:hover, .settings-button:focus-visible { transform: none; }
    .settings-button.is-spinning { animation: none; }
}
.settings-label { display: block; margin-bottom: .4rem; color: var(--muted); font-size: .8rem; font-weight: 700; }
.settings-check { display: flex; align-items: center; gap: .6rem; margin-top: 1rem; color: var(--muted); font-size: .9rem; cursor: pointer; }
.settings-check input { width: 1.05rem; height: 1.05rem; accent-color: var(--accent); }
.settings-check.is-disabled { cursor: default; opacity: .5; }
.search-options { display: flex; gap: .5rem; margin-top: 1rem; }
.type-button { border-color: transparent; color: var(--muted); font-size: .85rem; }
.type-button.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.form-message { min-height: 1.3rem; margin: .75rem 0 0; color: var(--accent); font-size: .9rem; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin: 3.5rem 0 1.25rem; }
.section-heading h2 { font-size: clamp(1.6rem, 4vw, 2.4rem); }
.result-count { color: var(--muted); font-size: .85rem; }
.results-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.history-section { margin-top: 3.5rem; }
.history-section .section-heading { margin-top: 0; }
.history-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; }
.history-card { display: flex; min-width: 0; flex-direction: column; overflow: hidden; padding: 0; border-color: var(--border); background: rgba(23, 20, 17, .82); color: #fff; text-align: left; }
.history-card:hover, .history-card:focus-visible { border-color: var(--accent); background: #211a11; color: #fff; transform: translateY(-3px); }
.history-poster { display: block; flex: none; width: 100%; aspect-ratio: 2 / 3; height: auto; object-fit: cover; background: #292019; }
.history-poster-placeholder { display: grid; place-items: center; color: var(--muted); font-size: .75rem; }
.history-copy { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: .3rem; padding: .7rem .8rem; }
.history-copy strong { display: -webkit-box; overflow: hidden; overflow-wrap: anywhere; min-height: 2.4em; line-height: 1.2; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.history-copy small { color: var(--accent); font-size: .7rem; }
.history-empty { margin: 0; color: var(--muted); font-size: .9rem; }
.recommendation-section { margin-top: 3.5rem; }
.recommendation-section .section-heading { margin-top: 0; }
.recommendation-grid { display: flex; gap: 1rem; overflow-x: auto; padding: .15rem .1rem .85rem; scroll-snap-type: x mandatory; scrollbar-width: none; -ms-overflow-style: none; }
.recommendation-grid::-webkit-scrollbar { display: none; }
.recommendation-card { display: flex; min-width: 0; flex-direction: column; overflow: hidden; padding: 0; border-color: var(--border); background: rgba(23, 20, 17, .82); color: #fff; text-align: left; }
.recommendation-card { flex: 0 0 180px; scroll-snap-align: start; }
.recommendation-card:hover, .recommendation-card:focus-visible { border-color: var(--accent); background: #211a11; color: #fff; transform: translateY(-3px); }
.recommendation-poster { position: relative; display: grid; flex: none; width: 100%; aspect-ratio: 2 / 3; overflow: hidden; place-items: center; background: #292019; color: var(--muted); font-size: .75rem; }
.recommendation-poster img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; }
.recommendation-copy { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: .3rem; padding: .7rem .8rem; }
.recommendation-copy small { color: var(--accent); font-size: .7rem; }
.recommendation-copy strong { display: -webkit-box; overflow: hidden; overflow-wrap: anywhere; min-height: 2.4em; line-height: 1.2; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.recommendation-message { margin: 0; color: var(--muted); font-size: .9rem; }
.save-history-prompt { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; margin-top: 3.5rem; }
.save-history-prompt[hidden] { display: none; }
.save-history-prompt .eyebrow { margin-bottom: .4rem; }
.save-history-prompt h2 { font-size: clamp(1.2rem, 3vw, 1.7rem); }
.result-card { display: flex; align-items: stretch; gap: 1rem; width: 100%; padding: .65rem; border-color: var(--border); background: rgba(23, 20, 17, .82); color: #fff; text-align: left; transition: transform .2s ease, border-color .2s ease; }
.result-card:hover, .result-card:focus-visible { border-color: var(--accent); background: #211a11; color: #fff; transform: translateY(-3px); }
.poster { display: grid; flex: 0 0 82px; min-height: 124px; place-items: center; overflow: hidden; border-radius: .3rem; background: #292019; color: var(--muted); font-size: .7rem; text-align: center; }
.poster img { width: 100%; height: 100%; object-fit: cover; }
.result-copy { display: flex; min-width: 0; flex-direction: column; gap: .45rem; padding: .35rem .25rem .35rem 0; }
.result-copy strong { font-size: 1.05rem; line-height: 1.2; }
.result-type { color: var(--accent); font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.result-overview { display: -webkit-box; overflow: hidden; color: var(--muted); font-size: .8rem; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 4; }
.player-section { margin-top: 3.5rem; }
.player-heading { margin: 0 0 1.25rem; align-items: start; }
.player-meta { max-width: 680px; margin: .5rem 0 0; color: var(--muted); font-size: .9rem; line-height: 1.5; }
.icon-button { padding: .2rem .65rem; font-size: 1.5rem; line-height: 1; }
.episode-controls { display: flex; align-items: center; gap: .6rem; margin-bottom: 1rem; color: var(--muted); font-size: .85rem; }
.episode-controls select { width: auto; padding: .6rem .75rem; }
.server-controls { margin-bottom: 1rem; }
.server-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .6rem; color: var(--muted); font-size: .85rem; font-weight: 700; }
.server-status { color: var(--accent); font-size: .75rem; font-weight: 400; }
.server-list { display: flex; flex-wrap: wrap; gap: .5rem; }
.server-button { display: inline-flex; align-items: center; gap: .55rem; border-color: var(--border); padding: .55rem .75rem; color: var(--muted); font-size: .8rem; }
.server-button small { color: var(--accent); font-size: .65rem; letter-spacing: .08em; }
.server-button:hover, .server-button:focus-visible, .server-button.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.audio-controls { margin-bottom: 1rem; }
.audio-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; }
.audio-row select { width: auto; max-width: 100%; padding: .5rem .7rem; font-size: .8rem; }
.audio-status { min-height: 1rem; margin: .6rem 0 0; color: var(--muted); font-size: .75rem; line-height: 1.4; }
.player-frame { overflow: hidden; aspect-ratio: 16 / 9; border: 1px solid var(--border); border-radius: .65rem; background: #000; }
.player-frame iframe { width: 100%; height: 100%; border: 0; }
.download-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem 1rem; margin-top: 1rem; }
.download-actions-content { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem 1rem; }
.download-actions-content[hidden] { display: none; }
.download-dismiss { margin-left: auto; }
.download-restore { margin-top: 1rem; }
.secondary-button { display: inline-flex; align-items: center; gap: .45rem; border: 1px solid var(--border); border-radius: .5rem; padding: .7rem .9rem; color: var(--accent); text-decoration: none; font-weight: 700; }
.secondary-button:hover, .secondary-button:focus-visible { border-color: var(--accent); background: var(--accent-soft); }
.download-note { margin: 0; color: var(--muted); font-size: .8rem; }
.player-note, .attribution { color: var(--muted); font-size: .8rem; line-height: 1.5; }
.player-note { margin-bottom: 0; }
a { color: var(--accent); }
.attribution { margin: 2.5rem 0 0; text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

@media (max-width: 560px) {
    .search-form { flex-direction: column; }
    .search-field { flex: none; }
    .primary-button { justify-content: center; }
    .save-history-prompt { align-items: stretch; flex-direction: column; }
    .section-heading { align-items: start; flex-direction: column; }
    .episode-controls { align-items: stretch; flex-wrap: wrap; }
    .episode-controls select { flex: 1 1 8rem; }
    .server-button { flex: 1 1 7rem; justify-content: center; }
}

/* ---- App Layout & Floating Beveled Left Sidebar ---- */
:root {
    --sidebar-width: 236px;
    --sidebar-floating-gap: 1.25rem;
    --sidebar-bg: #0c0a08;
}

.watch-app-layout {
    display: flex;
    min-height: 100vh;
    background: var(--bg);
    position: relative;
}

.watch-sidebar {
    position: fixed;
    top: var(--sidebar-floating-gap);
    left: var(--sidebar-floating-gap);
    bottom: var(--sidebar-floating-gap);
    width: var(--sidebar-width);
    height: calc(100vh - (var(--sidebar-floating-gap) * 2));
    
    /* Semitransparent frosted-glass matching search bar and card */
    background: linear-gradient(
        150deg,
        rgba(26, 21, 16, 0.76) 0%,
        rgba(16, 13, 10, 0.68) 48%,
        rgba(10, 8, 6, 0.78) 100%
    );
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    
    /* Floating rounded corners */
    border-radius: 1rem;
    
    /* Beveled orange outline */
    border: 1px solid rgba(235, 175, 54, 0.55);
    border-top: 1px solid rgba(235, 175, 54, 0.8);
    border-left: 1px solid rgba(235, 175, 54, 0.65);
    border-right: 1px solid rgba(235, 175, 54, 0.45);
    border-bottom: 1px solid rgba(235, 175, 54, 0.35);
    
    box-shadow:
        /* Outer orange ambient glow & elevation */
        0 0 0 1px rgba(235, 175, 54, 0.18),
        0 0 24px rgba(235, 175, 54, 0.1),
        0 1.2rem 3rem rgba(0, 0, 0, 0.55),
        0 4px 14px rgba(0, 0, 0, 0.4),
        /* Inner beveled edge highlights & shadow */
        inset 1px 1px 0 rgba(255, 255, 255, 0.16),
        inset 0 1px 2px rgba(235, 175, 54, 0.35),
        inset -1px -1px 0 rgba(0, 0, 0, 0.55);
    
    display: flex;
    flex-direction: column;
    z-index: 100;
    padding: 1.25rem 0.85rem 1rem;
    box-sizing: border-box;
    overflow: visible;
    scrollbar-width: none;
    transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.25s ease, box-shadow 0.25s ease;
}

.watch-sidebar::-webkit-scrollbar {
    display: none;
}

.watch-sidebar:hover {
    border-color: var(--accent);
    box-shadow:
        0 0 0 2px rgba(235, 175, 54, 0.25),
        0 0 32px rgba(235, 175, 54, 0.18),
        0 1.3rem 3.5rem rgba(0, 0, 0, 0.6),
        0 6px 16px rgba(0, 0, 0, 0.45),
        inset 1px 1px 0 rgba(255, 255, 255, 0.22),
        inset 0 1px 2px rgba(235, 175, 54, 0.45),
        inset -1px -1px 0 rgba(0, 0, 0, 0.55);
}

/* Sidebar toggle arrow on right edge */
.sidebar-collapse-toggle {
    position: absolute;
    top: 1.55rem;
    right: -13px;
    z-index: 120;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    margin: 0;
    padding: 0;
    border-radius: 50%;
    background: #171411;
    border: 1px solid rgba(235, 175, 54, 0.5);
    color: var(--muted);
    cursor: pointer;
    box-shadow:
        0 4px 10px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    transition: transform 0.25s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.sidebar-collapse-toggle:hover,
.sidebar-collapse-toggle:focus-visible {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
    box-shadow:
        0 0 14px rgba(235, 175, 54, 0.45),
        0 4px 10px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

.sidebar-collapse-toggle svg {
    display: block;
    transition: transform 0.25s ease;
}

/* Collapsed state */
.watch-sidebar.collapsed {
    width: 68px;
    padding: 1.25rem 0.5rem 1rem;
}

.watch-sidebar.collapsed .sidebar-brand .brand-text,
.watch-sidebar.collapsed .sidebar-back-link span,
.watch-sidebar.collapsed .sidebar-section-label,
.watch-sidebar.collapsed .sidebar-nav-item .sidebar-label,
.watch-sidebar.collapsed .sidebar-footer-btn span {
    display: none;
}

.watch-sidebar.collapsed .sidebar-brand {
    align-items: center;
    padding: 0 0 1rem;
}

.watch-sidebar.collapsed .sidebar-back-link {
    justify-content: center;
}

.watch-sidebar.collapsed .sidebar-nav-item {
    justify-content: center;
    padding: 0.75rem 0;
}

.watch-sidebar.collapsed .sidebar-footer-btn {
    justify-content: center;
    padding: 0.65rem 0;
}

.watch-sidebar.collapsed .sidebar-collapse-toggle svg {
    transform: rotate(180deg);
}

.watch-app-layout.sidebar-collapsed .watch-main-content {
    margin-left: calc(68px + (var(--sidebar-floating-gap) * 2));
}

.watch-main-content {
    flex: 1 1 0%;
    min-width: 0;
    margin-left: calc(var(--sidebar-width) + (var(--sidebar-floating-gap) * 2));
    min-height: 100vh;
    transition: margin-left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.watching-page {
    width: min(100% - 3rem, 1100px);
    margin: 0 auto;
    padding: 2rem 0 5rem;
}

.sidebar-brand {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0 0.35rem 1.15rem;
    border-bottom: 1px solid rgba(235, 175, 54, 0.22);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
    margin-bottom: 1.15rem;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: #fff;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.brand-link:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.brand-icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, #f3be4c 0%, #ebaf36 40%, #b88118 100%);
    color: #080706;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.55),
        inset 0 -1px 2px rgba(0, 0, 0, 0.4),
        0 4px 14px rgba(235, 175, 54, 0.45);
    flex-shrink: 0;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.brand-title {
    font-size: 1.08rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #fff;
    text-shadow: 0 0 14px rgba(235, 175, 54, 0.25);
}

.brand-badge {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent);
}

.sidebar-back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    color: var(--muted);
    text-decoration: none;
    padding: 0.2rem 0;
    transition: color 0.2s ease, transform 0.2s ease;
}

.sidebar-back-link:hover {
    color: var(--accent);
    transform: translateX(-2px);
}

.sidebar-section-label {
    display: block;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: #8c7c6a;
    padding: 0 0.65rem 0.45rem;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.68rem 0.85rem;
    border-radius: 0.65rem;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid transparent;
    background: transparent;
}

.sidebar-nav-item:hover {
    background: rgba(235, 175, 54, 0.1);
    color: #fff;
    border-color: rgba(235, 175, 54, 0.3);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 0 12px rgba(235, 175, 54, 0.1);
    transform: translateX(2px);
}

.sidebar-nav-item.active {
    background: linear-gradient(
        135deg,
        rgba(235, 175, 54, 0.25) 0%,
        rgba(235, 175, 54, 0.08) 100%
    );
    color: var(--accent);
    font-weight: 700;
    border: 1px solid var(--accent);
    box-shadow:
        0 0 16px rgba(235, 175, 54, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.18),
        inset 0 -1px 0 rgba(0, 0, 0, 0.3);
}

.sidebar-icon {
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.sidebar-nav-item:hover .sidebar-icon {
    transform: scale(1.08);
}

.sidebar-footer {
    padding-top: 0.9rem;
    border-top: 1px solid rgba(235, 175, 54, 0.22);
    box-shadow: 0 -1px 0 rgba(0, 0, 0, 0.35);
    margin-top: auto;
}

.sidebar-footer-btn {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.65rem 0.8rem;
    border-radius: 0.65rem;
    background: rgba(235, 175, 54, 0.04);
    border: 1px solid rgba(235, 175, 54, 0.18);
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.sidebar-footer-btn:hover {
    background: rgba(235, 175, 54, 0.12);
    color: #fff;
    border-color: var(--accent);
    box-shadow: 0 0 14px rgba(235, 175, 54, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* Subpage quick filter chips */
.filter-tabs-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin: 1.5rem 0 2rem;
}

.filter-tab {
    padding: 0.5rem 0.95rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--card);
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.filter-tab:hover, .filter-tab:focus-visible {
    border-color: var(--accent);
    color: #fff;
    background: var(--accent-soft);
}

.filter-tab.active {
    border-color: var(--accent);
    background: var(--accent);
    color: #17120b;
    font-weight: 700;
}

/* Category cards grid */
.category-pills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.65rem;
    margin: 1.5rem 0 2.5rem;
}

.category-pill {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    background: var(--card);
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.category-pill:hover, .category-pill:focus-visible {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
    transform: translateY(-2px);
}

.category-pill.active {
    border-color: var(--accent);
    background: var(--accent);
    color: #17120b;
    font-weight: 700;
}

/* Ranked cards for trending */
.ranked-card {
    position: relative;
}

.rank-badge {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 5;
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.4rem;
    background: rgba(14, 12, 10, 0.92);
    border: 1px solid var(--accent);
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 800;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.7);
    line-height: 1;
}

.rank-badge.top-three {
    background: linear-gradient(135deg, var(--accent) 0%, #b88118 100%);
    color: #17120b;
    border-color: #ffd875;
}

/* Media Grid for subpages (Movies, TV Shows, Trending, Categories) */
.media-display-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.15rem;
    margin-top: 1.5rem;
}

.load-more-container {
    display: flex;
    justify-content: center;
    margin: 2.5rem 0 1rem;
}

/* Mobile responsive styles */
@media (max-width: 768px) {
    .watch-sidebar {
        top: auto;
        bottom: 0.85rem;
        left: 0.85rem;
        right: 0.85rem;
        width: auto;
        max-width: 500px;
        margin: 0 auto;
        height: 62px;
        flex-direction: row;
        border-radius: 1rem;
        border: 1px solid rgba(235, 175, 54, 0.55);
        border-top-color: rgba(235, 175, 54, 0.8);
        background: linear-gradient(
            160deg,
            rgba(26, 21, 16, 0.82) 0%,
            rgba(14, 12, 10, 0.85) 100%
        );
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
        padding: 0.35rem 0.5rem;
        box-shadow:
            0 0 0 1px rgba(235, 175, 54, 0.18),
            0 0 24px rgba(235, 175, 54, 0.12),
            0 1rem 3rem rgba(0, 0, 0, 0.7),
            inset 0 1px 0 rgba(255, 255, 255, 0.18),
            inset 0 -1px 0 rgba(0, 0, 0, 0.5);
        z-index: 1000;
    }

    .sidebar-brand,
    .sidebar-section-label,
    .sidebar-footer,
    .sidebar-collapse-toggle {
        display: none;
    }

    .sidebar-nav {
        flex-direction: row;
        justify-content: space-around;
        align-items: center;
        width: 100%;
        gap: 0;
    }

    .sidebar-nav-item {
        flex-direction: column;
        gap: 0.15rem;
        padding: 0.35rem 0.3rem;
        border: none;
        border-bottom: 2px solid transparent;
        font-size: 0.66rem;
        text-align: center;
        border-radius: 0.5rem;
        box-shadow: none;
        background: transparent;
    }

    .sidebar-nav-item.active {
        border: none;
        border-bottom: 2px solid var(--accent);
        background: rgba(235, 175, 54, 0.14);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
    }

    .sidebar-nav-item:hover {
        transform: none;
        box-shadow: none;
    }

    .sidebar-icon {
        width: 19px;
        height: 19px;
    }

    .watch-main-content {
        margin-left: 0;
        width: 100%;
        padding-bottom: 5.5rem;
    }

    .watching-page {
        width: min(100% - 1.5rem, 100%);
        padding: 1.25rem 0 4rem;
    }

    .page-header {
        padding: 1.5rem 0 1.25rem;
    }

    .media-display-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 0.75rem;
    }
}

/* ---- Home/Search mobile fix ---- */
html, body { max-width: 100%; overflow-x: hidden !important; }

.watch-app-layout { width: 100%; max-width: 100vw; overflow-x: clip; }

.watch-main-content,
.watching-page,
.watching-page > section,
.page-header,
.card {
    min-width: 0 !important;
    max-width: 100%;
}

.recommendation-grid,
.history-grid { max-width: 100%; overflow-x: auto; }

/* [hidden] loses to display:flex rules, so force it */
[hidden] { display: none !important; }

/* Dialog pinned to the viewport, not the (possibly wider) page */
dialog.disclaimer[open] {
    position: fixed;
    inset: 0;
    margin: auto;
    width: calc(100vw - 2rem);
    max-width: 30rem;
    max-height: calc(100dvh - 2rem);
    overflow-y: auto;
}

@media (max-width: 768px) {
    .watch-sidebar {
        display: flex !important;
        position: fixed !important;
        top: auto !important;
        left: 0.85rem !important;
        right: 0.85rem !important;
        bottom: 0.85rem !important;
        width: auto !important;
        height: 62px !important;
        z-index: 1000;
    }
    .watch-sidebar .sidebar-nav { display: flex; width: 100%; }
    .watch-main-content { margin-left: 0 !important; padding-bottom: 5.5rem; }
    .home-heading { font-size: clamp(2.6rem, 14vw, 4rem); }
}

/* ---- No-script disclaimer ---- */
.noscript-disclaimer {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: .5rem;
    padding: 2rem;
    background: rgb(8 7 6 / 96%);
    color: #fff;
    text-align: center;
}

.noscript-disclaimer .eyebrow { margin: 0; }

.noscript-disclaimer h2 {
    max-width: 28rem;
    font-size: clamp(1.5rem, 5vw, 2.2rem);
    letter-spacing: -.03em;
    line-height: 1.15;
    color: var(--accent);
}
