:root {
    --bg: #050505;
    --bg-soft: #0b0b0d;
    --sidebar: #070809;
    --panel: rgba(12, 13, 16, 0.94);
    --panel-soft: rgba(17, 18, 22, 0.88);
    --line: rgba(255, 255, 255, 0.08);
    --line-strong: rgba(255, 255, 255, 0.14);
    --text: #f4f4f6;
    --muted: #8f9299;
    --accent: #ff1023;
    --accent-strong: #e10817;
    --success: #48d35b;
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 14px;
    --radius-sm: 10px;
}

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

html {
    color-scheme: dark;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Inter', Arial, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 85% 4%, rgba(255, 16, 35, 0.12), transparent 24%),
        linear-gradient(180deg, #060606 0%, #090909 45%, #050505 100%);
}

img {
    display: block;
    max-width: 100%;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

a {
    color: inherit;
    text-decoration: none;
}

svg {
    display: block;
}

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

.is-hidden {
    display: none !important;
}

.app-layout {
    min-height: 100dvh;
}

.sidebar-search,
.icon-action,
.avatar-dot {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.03);
}

.sidebar-search:hover,
.sidebar-search:focus-visible,
.icon-action:hover,
.icon-action:focus-visible {
    color: var(--text);
    outline: none;
    transform: translateY(-1px);
}

.nav-icon {
    width: 21px;
    height: 21px;
    display: grid;
    place-items: center;
}

.nav-icon svg,
.icon-action svg,
.avatar-dot svg {
    width: 100%;
    height: 100%;
}

.page-shell {
    padding: 18px 22px 28px;
}

.topbar,
.section-heading,
.player-header,
.player-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    display: inline-flex;
    align-items: flex-start;
    gap: 4px;
    font-weight: 800;
    letter-spacing: -0.04em;
}

.brand-word {
    font-size: 1.18rem;
}

.topbar-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font-size: 0.94rem;
    font-weight: 600;
    transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.topbar-link:hover,
.topbar-link:focus-visible {
    outline: none;
    transform: translateY(-1px);
    border-color: var(--line-strong);
    background: rgba(255, 255, 255, 0.08);
}

.brand-signal {
    position: relative;
    width: 14px;
    height: 14px;
    margin-top: 2px;
}

.brand-signal::before,
.brand-signal::after {
    content: '';
    position: absolute;
    border: 2px solid transparent;
    border-top-color: var(--accent);
    border-right-color: var(--accent);
    border-radius: 0 100% 0 0;
}

.brand-signal::before {
    inset: 5px 2px 2px 5px;
}

.brand-signal::after {
    inset: 1px -2px -2px 1px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-metrics {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1;
    flex-wrap: wrap;
}

.avatar-dot {
    color: rgba(255, 255, 255, 0.68);
}

.page-main {
    margin-top: 12px;
}

.hero-panel {
    position: relative;
    min-height: 0;
    padding: 22px 26px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    background:
        linear-gradient(90deg, rgba(5, 5, 5, 0.98) 0%, rgba(7, 7, 9, 0.96) 58%, rgba(9, 8, 10, 0.9) 100%),
        radial-gradient(circle at 88% 20%, rgba(255, 24, 43, 0.18), transparent 24%);
    box-shadow: var(--shadow);
}

.hero-panel::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 35%),
        radial-gradient(circle at 34% 4%, rgba(255, 255, 255, 0.05), transparent 18%);
    pointer-events: none;
}

.hero-inline {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.hero-inline h1,
.section-heading h2,
.empty-state h3,
.player-copy h2 {
    margin: 0;
}

.hero-inline h1 {
    flex: 0 1 auto;
    font-size: clamp(2rem, 3vw, 2.9rem);
    line-height: 1;
    letter-spacing: -0.06em;
    white-space: nowrap;
}

.hero-inline h1 span {
    color: var(--accent);
}

.hero-text,
.helper-line,
.section-note,
.player-meta,
.player-tip,
.site-footer p,
.empty-state p {
    color: var(--muted);
    line-height: 1.45;
}

.channel-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 170px;
    gap: 10px;
    flex: 1 1 540px;
    max-width: 720px;
}

.input-shell {
    position: relative;
    min-height: 48px;
    display: flex;
    align-items: center;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(14, 15, 18, 0.92);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.input-icon {
    width: 20px;
    height: 20px;
    margin-left: 14px;
    color: #9ba0a9;
}

.channel-form input {
    width: 100%;
    height: 48px;
    padding: 0 16px 0 10px;
    border: 0;
    outline: none;
    color: var(--text);
    background: transparent;
}

.channel-form input::placeholder {
    color: #80858f;
}

.primary-button,
.ghost-button,
.close-button {
    min-height: 48px;
    padding: 0 18px;
    border-radius: 10px;
    border: 1px solid transparent;
    transition: transform 180ms ease, filter 180ms ease, border-color 180ms ease, background 180ms ease;
}

.primary-button {
    background: linear-gradient(180deg, #ff1b2f 0%, #dd0818 100%);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 12px 28px rgba(255, 16, 35, 0.24);
}

.ghost-button,
.close-button {
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--line);
}

.primary-button:hover,
.ghost-button:hover,
.close-button:hover,
.primary-button:focus-visible,
.ghost-button:focus-visible,
.close-button:focus-visible {
    transform: translateY(-1px);
    filter: brightness(1.05);
    outline: none;
}

.metric-pill {
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: #c4c7ce;
    font-size: 0.78rem;
}

.metric-pill strong {
    color: #fff;
}

.topbar-pill {
    white-space: nowrap;
}

.status-banner {
    display: none;
    margin-top: 10px;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: rgba(12, 13, 16, 0.88);
    font-size: 0.86rem;
}

.status-banner.is-visible {
    display: block;
}

.shelf-section {
    margin-top: 10px;
}

.section-heading {
    margin-bottom: 10px;
}

.section-heading h2 {
    position: relative;
    font-size: 1.18rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.section-heading h2::after {
    content: '›';
    margin-left: 8px;
    color: #9b9ea6;
}

.section-note {
    margin: 0;
    font-size: 0.84rem;
}

.channel-list,
.media-row {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(190px, 1fr);
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 6px;
    scrollbar-width: none;
}

.channel-list::-webkit-scrollbar,
.media-row::-webkit-scrollbar {
    display: none;
}

.channel-chip {
    min-height: 74px;
    display: grid;
    grid-template-columns: 50px minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    background:
        linear-gradient(180deg, rgba(15, 16, 20, 0.94), rgba(10, 11, 14, 0.94)),
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.04), transparent 35%);
}

.channel-chip.is-interactive {
    cursor: pointer;
    transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.channel-chip.is-interactive:hover,
.channel-chip.is-interactive:focus-visible {
    outline: none;
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.16);
}

.channel-chip.is-active {
    border-color: rgba(255, 16, 35, 0.46);
    box-shadow: 0 12px 24px rgba(255, 16, 35, 0.14);
    background:
        linear-gradient(180deg, rgba(35, 12, 16, 0.96), rgba(12, 11, 14, 0.96)),
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.04), transparent 35%);
}

.channel-chip img {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    object-fit: cover;
}

.channel-chip strong {
    display: block;
    margin: 0;
    font-size: 0.94rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.channel-chip span {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.channel-check {
    width: 14px;
    height: 14px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #0a170d;
    background: var(--success);
    font-size: 0.62rem;
    font-weight: 900;
}

.channel-delete {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    color: #f0f1f3;
    font-size: 1rem;
    line-height: 1;
    transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

.channel-delete:hover,
.channel-delete:focus-visible {
    outline: none;
    transform: scale(1.05);
    background: rgba(255, 16, 35, 0.14);
    border-color: rgba(255, 16, 35, 0.34);
}

.channel-chip.is-add {
    grid-template-columns: 24px 1fr;
    color: #c9cbd0;
}

.channel-chip.is-add .channel-plus {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    color: #d2d4d8;
    font-size: 1.4rem;
}

.media-row {
    grid-auto-columns: minmax(210px, 1fr);
}

.episode-card {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #101113;
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.episode-card:hover,
.episode-card:focus-within {
    transform: translateY(-3px);
    box-shadow: 0 18px 34px rgba(0, 0, 0, 0.4);
}

.episode-button {
    all: unset;
    display: block;
    width: 100%;
    cursor: pointer;
}

.episode-button:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.28);
    outline-offset: -2px;
}

.episode-cover {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #141519;
}

.episode-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.episode-cover::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 48%, rgba(0, 0, 0, 0.82) 100%);
}

.play-badge {
    position: absolute;
    inset: auto auto 8px 8px;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 7px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.58);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.play-badge::before {
    content: '';
    width: 0;
    height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 8px solid #fff;
}

.episode-duration {
    position: absolute;
    right: 8px;
    bottom: 8px;
    z-index: 1;
    padding: 3px 6px;
    border-radius: 7px;
    background: rgba(0, 0, 0, 0.76);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
}

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

.episode-card h3 {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.35;
    color: #f1f2f3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.episode-meta {
    margin-top: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    color: #888d96;
    font-size: 0.73rem;
}

.episode-description,
.episode-channel {
    display: none;
}

.empty-state {
    margin-top: 22px;
    padding: 32px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(13, 14, 17, 0.92);
    text-align: center;
}

.empty-state.is-hidden {
    display: none;
}

.site-footer {
    padding: 20px 4px 0;
}

.site-footer p {
    margin: 0;
    font-size: 0.8rem;
}

.player-dock {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 100;
}

.player-dock.is-open {
    display: block;
}

.player-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.94);
}

.player-panel {
    position: absolute;
    inset: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: #000;
    box-shadow: var(--shadow);
}

.search-picker {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 120;
}

.search-picker.is-open {
    display: block;
}

.search-picker-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.74);
    backdrop-filter: blur(10px);
}

.search-picker-panel {
    position: relative;
    width: min(820px, calc(100% - 32px));
    max-height: calc(100dvh - 48px);
    margin: 24px auto;
    padding: 20px;
    overflow: auto;
    border: 1px solid var(--line-strong);
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(11, 11, 14, 0.98), rgba(8, 9, 12, 0.98));
    box-shadow: var(--shadow);
}

.search-picker-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.search-picker-kicker {
    margin: 0 0 6px;
    color: #b8bac1;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.search-picker-header h2,
.search-picker-text {
    margin: 0;
}

.search-picker-text {
    margin-top: 6px;
    color: var(--muted);
}

.search-picker-list {
    display: grid;
    gap: 10px;
}

.search-picker-option {
    width: 100%;
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
    color: inherit;
    text-align: left;
    transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.search-picker-option:hover,
.search-picker-option:focus-visible {
    outline: none;
    transform: translateY(-2px);
    border-color: rgba(255, 16, 35, 0.28);
    background: rgba(255, 255, 255, 0.05);
}

.search-picker-option img {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    object-fit: cover;
}

.search-picker-option strong,
.search-picker-option span {
    display: block;
}

.search-picker-option strong {
    font-size: 1rem;
}

.search-picker-option span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.84rem;
}

.search-picker-cta {
    padding: 7px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.05);
    font-size: 0.76rem;
    font-weight: 700;
    white-space: nowrap;
}

.player-kicker {
    margin: 0 0 6px;
    color: #b8bac1;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.player-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.player-header,
.player-footer {
    position: absolute;
    left: 24px;
    right: 24px;
    z-index: 2;
    padding: 16px 18px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(10, 11, 14, 0.86), rgba(10, 11, 14, 0.58));
    backdrop-filter: blur(14px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease, transform 180ms ease;
}

.player-header {
    top: 24px;
    transform: translateY(-12px);
}

.player-footer {
    bottom: 24px;
    transform: translateY(12px);
}

.player-dock.is-chrome-visible .player-header,
.player-dock.is-chrome-visible .player-footer,
.player-dock:focus-within .player-header,
.player-dock:focus-within .player-footer {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.player-frame-wrap {
    width: 100%;
    height: 100dvh;
    background: #000;
    overflow: hidden;
}

.player-frame-wrap iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

.text-link {
    color: #fff;
    font-weight: 700;
}

.is-loading {
    opacity: 0.82;
    pointer-events: none;
}

@media (max-width: 1180px) {
    .topbar {
        flex-wrap: wrap;
    }

    .topbar-link {
        order: 2;
    }

    .topbar-metrics {
        order: 3;
        width: 100%;
        justify-content: flex-start;
    }

    .hero-inline {
        flex-direction: column;
        align-items: stretch;
    }

    .hero-inline h1 {
        white-space: normal;
    }
}

@media (max-width: 720px) {
    .topbar,
    .section-heading,
    .player-header,
    .player-footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .channel-form {
        grid-template-columns: 1fr;
    }

    .primary-button,
    .ghost-button,
    .close-button {
        width: 100%;
    }

    .topbar-link {
        width: 100%;
    }

    .channel-list,
    .media-row {
        grid-auto-columns: 78vw;
    }

    .hero-panel {
        padding: 20px;
    }

    .hero-inline h1 {
        font-size: 2.15rem;
    }

    .player-header,
    .player-footer {
        left: 12px;
        right: 12px;
    }

    .search-picker-panel {
        width: calc(100% - 20px);
        margin: 10px auto;
        padding: 16px;
    }

    .search-picker-header {
        flex-direction: column;
    }

    .search-picker-option {
        grid-template-columns: 52px minmax(0, 1fr);
    }

    .search-picker-option img {
        width: 52px;
        height: 52px;
        border-radius: 14px;
    }

    .search-picker-cta {
        grid-column: 1 / -1;
        justify-self: flex-start;
    }
}

@media (max-width: 860px) {
    .page-shell {
        padding: 16px;
    }
}

@media (hover: none) {
    .player-header,
    .player-footer {
        opacity: 1;
        transform: translateY(0);
        pointer-events: auto;
    }
}

@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;
    }
}
