:root {
    --bg: #071320;
    --panel: #0b1b2c;
    --panel-soft: #123a70;
    --text: #f4f7fb;
    --muted: #9fb7d6;
    --accent: #0078ff;
    --accent-strong: #22d9ff;
    --danger: #ff5d66;
    --shadow: rgba(0, 0, 0, 0.42);
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
}

button {
    font: inherit;
}

.app,
.screen {
    width: 100vw;
    height: 100vh;
}

.screen {
    display: none;
}

.screen.is-active {
    display: flex;
}

.splash-screen {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 28px;
    padding: 56px;
    background:
        radial-gradient(circle at 50% 28%, rgba(0, 153, 255, 0.22), transparent 34%),
        linear-gradient(145deg, #071320 0%, #0a2137 52%, #03060d 100%);
    transition: opacity 0.32s ease, visibility 0.32s ease;
}

.splash-screen.is-hidden {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

.splash-logo {
    width: min(360px, 48vw);
    max-height: 54vh;
    border-radius: 28px;
    object-fit: contain;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.44);
}

.splash-status {
    min-height: 34px;
    color: #f4f7fb;
    font-size: 26px;
    font-weight: 700;
    line-height: 1.35;
    text-align: center;
}

.splash-status::after {
    content: "";
    display: block;
    width: min(420px, 70vw);
    height: 4px;
    margin: 18px auto 0;
    border-radius: 999px;
    background: linear-gradient(90deg, transparent, var(--accent-strong), transparent);
    animation: loading-line 1.1s linear infinite;
}

.home-screen {
    background:
        radial-gradient(circle at 50% 4%, rgba(0, 196, 255, 0.20), transparent 30%),
        radial-gradient(circle at 14% 28%, rgba(22, 99, 255, 0.20), transparent 34%),
        radial-gradient(circle at 84% 42%, rgba(28, 214, 255, 0.10), transparent 38%),
        linear-gradient(120deg, #08192a 0%, #0a243d 46%, #07111f 100%);
}

.home-dashboard {
    display: flex;
    width: 100%;
    min-width: 0;
    flex-direction: column;
    padding: 48px 76px 38px;
}

.home-topbar {
    display: flex;
    align-items: center;
    min-height: 86px;
    gap: 34px;
    margin-bottom: 30px;
}

.home-brand,
.home-clock {
    display: flex;
    align-items: center;
    gap: 18px;
}

.home-clock {
    margin-left: auto;
    color: #fff;
    font-size: 34px;
    font-weight: 500;
}

.power-button {
    display: none;
    width: 78px;
    height: 78px;
    margin-left: auto;
    place-items: center;
    border: 3px solid transparent;
    border-radius: 50%;
    background: transparent;
    color: #fff;
    font-size: 46px;
    outline: none;
}

.rail {
    width: 360px;
    padding: 72px 48px;
    background: rgba(4, 7, 12, 0.52);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
    display: flex;
    align-items: center;
    gap: 18px;
}

.brand-mark {
    display: grid;
    width: 76px;
    height: 76px;
    place-items: center;
    border-radius: 8px;
    background: var(--accent);
    color: #f7fbff;
    font-size: 30px;
    font-weight: 800;
}

.brand-logo {
    width: 94px;
    height: 94px;
    border: 0;
    border-radius: 0;
    background: transparent;
    object-fit: contain;
    box-shadow: none;
}

.brand-name {
    font-size: 32px;
    font-weight: 700;
}

.remote-hint {
    display: none;
    min-height: 30px;
    margin: 0 0 24px;
    color: var(--muted);
    font-size: 20px;
    line-height: 1.35;
}

.remote-hint.is-loading::after {
    content: "";
    display: block;
    width: min(420px, 100%);
    height: 4px;
    margin-top: 10px;
    border-radius: 999px;
    background: linear-gradient(90deg, transparent, var(--accent-strong), transparent);
    animation: loading-line 1.1s linear infinite;
}

@keyframes loading-line {
    from {
        transform: translateX(-36%);
    }

    to {
        transform: translateX(36%);
    }
}

.content {
    flex: 1;
    padding: 70px 72px 64px;
}

.home-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.content-header {
    margin-bottom: 40px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--accent);
    font-size: 22px;
    font-weight: 700;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    font-size: 58px;
    line-height: 1.05;
}

.section-grid,
.channel-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(260px, 1fr));
    gap: 36px;
}

.section-card,
.channel-card {
    position: relative;
    min-height: 236px;
    padding: 28px;
    overflow: hidden;
    border: 3px solid transparent;
    border-radius: 8px;
    background: linear-gradient(140deg, var(--panel) 0%, var(--panel-soft) 100%);
    box-shadow: 0 18px 40px var(--shadow);
    color: var(--text);
    outline: none;
    transform: scale(1);
    transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.section-card {
    display: flex;
    min-height: 284px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background:
        linear-gradient(155deg, rgba(255, 255, 255, 0.18) 0%, transparent 28%),
        linear-gradient(138deg, #27ddff 0%, #058cff 42%, #0d4be8 100%);
}

.section-card:nth-child(2) {
    background:
        linear-gradient(155deg, rgba(255, 255, 255, 0.15) 0%, transparent 30%),
        linear-gradient(138deg, #17a7ff 0%, #075cff 45%, #2630c9 100%);
}

.section-card:nth-child(3) {
    background:
        linear-gradient(155deg, rgba(255, 255, 255, 0.16) 0%, transparent 30%),
        linear-gradient(138deg, #35e3ff 0%, #1682d8 46%, #07518f 100%);
}

.section-card::before {
    position: absolute;
    inset: 18px;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.015));
    content: "";
}

.section-card > * {
    position: relative;
    z-index: 1;
}

.channel-card::after {
    position: absolute;
    right: -38px;
    bottom: -48px;
    width: 150px;
    height: 150px;
    border: 24px solid rgba(34, 217, 255, 0.14);
    border-radius: 50%;
    content: "";
}

.section-card.is-focused,
.channel-card.is-focused {
    border-color: var(--accent-strong);
    transform: scale(1.035);
}

.section-card.is-focused {
    box-shadow: 0 0 0 4px rgba(225, 248, 255, 0.88), 0 24px 58px rgba(0, 0, 0, 0.48), 0 0 48px rgba(34, 217, 255, 0.26);
}

.channel-card.is-focused {
    background: linear-gradient(140deg, #0c2440 0%, #102a52 100%);
}

.section-icon {
    display: grid;
    width: 108px;
    height: 108px;
    place-items: center;
    border: 0;
    border-radius: 0;
    color: var(--text);
    filter: drop-shadow(0 12px 22px rgba(0, 0, 0, 0.20));
}

.section-icon svg {
    width: 96px;
    height: 96px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 5.5;
}

.section-title {
    margin-top: 10px;
    font-size: 42px;
    font-weight: 800;
    text-transform: uppercase;
}

.section-subtitle {
    color: rgba(255, 255, 255, 0.80);
    font-size: 23px;
    font-weight: 700;
}

.section-count {
    position: absolute;
    right: 26px;
    bottom: 22px;
    color: #fff;
    font-size: 23px;
    font-weight: 800;
}

.home-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    gap: 28px;
    width: min(1420px, 88vw);
    margin: 28px auto 22px;
}

.home-action-button {
    height: 76px;
    border: 3px solid transparent;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(0, 127, 255, 0.78), rgba(0, 83, 190, 0.82));
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.22);
    color: #fff;
    font-size: 25px;
    font-weight: 800;
    outline: none;
}

.home-action-button.is-focused,
.power-button.is-focused {
    border-color: #fff;
    background: linear-gradient(135deg, rgba(36, 217, 255, 0.58), rgba(0, 109, 255, 0.62));
}

.latest-section {
    display: flex;
    min-height: 0;
    flex-direction: column;
    margin-top: 18px;
}

.latest-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.latest-header h2 {
    margin: 0;
    font-size: 30px;
}

.latest-header span {
    color: var(--accent-strong);
    font-size: 22px;
    font-weight: 800;
}

.latest-list {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 168px;
    flex: 0 0 auto;
    gap: 20px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 4px 22px;
    scrollbar-width: none;
}

.latest-list::-webkit-scrollbar {
    display: none;
}

.latest-card {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 8px;
    border: 3px solid transparent;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.18);
    color: var(--text);
    outline: none;
    text-align: left;
}

.latest-card.is-focused {
    border-color: var(--accent-strong);
    background: rgba(0, 120, 255, 0.16);
    box-shadow: inset 0 0 0 1px rgba(34, 217, 255, 0.38), 0 12px 26px rgba(0, 0, 0, 0.22);
}

.latest-poster {
    display: grid;
    width: 100%;
    aspect-ratio: 2 / 2.65;
    place-items: center;
    border-radius: 6px;
    background-position: center;
    background-size: cover;
}

.latest-title,
.latest-meta {
    overflow: hidden;
    padding: 0 4px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.latest-title {
    font-size: 18px;
    font-weight: 800;
}

.latest-meta {
    color: var(--muted);
    font-size: 15px;
    font-weight: 700;
}

.activation-summary {
    display: grid;
    flex: 0 0 auto;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 22px;
    margin-bottom: 34px;
    clear: both;
}

#accountPayButton {
    display: none;
}

.activation-summary span {
    min-width: 0;
    padding: 12px 14px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.78);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.activation-summary strong {
    color: var(--accent-strong);
}

.playlist-screen,
.account-screen,
.settings-screen,
.history-screen {
    align-items: center;
    justify-content: center;
    padding: 48px;
    background:
        radial-gradient(circle at 30% 12%, rgba(34, 217, 255, 0.18), transparent 32%),
        linear-gradient(110deg, rgba(3, 5, 9, 0.99) 0%, rgba(7, 22, 42, 0.96) 60%, rgba(5, 34, 70, 0.94) 100%);
}

.playlist-panel {
    width: min(980px, 100%);
    max-height: calc(100vh - 96px);
    overflow-y: auto;
    padding: 28px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.30);
    border: 1px solid rgba(255, 255, 255, 0.10);
}

.playlist-header h1 {
    font-size: 48px;
}

.playlist-device-info,
.playlist-current-info {
    color: var(--muted);
    font-size: 20px;
    line-height: 1.45;
}

.playlist-current-info {
    margin: 18px 0;
    padding: 18px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
}

.playlist-editor {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.playlist-editor label {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 8px;
    color: #fff;
    font-size: 18px;
    font-weight: 800;
}

.playlist-editor input,
.playlist-editor select {
    width: 100%;
    min-height: 58px;
    padding: 0 16px;
    border: 2px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.10);
    color: #fff;
    font: inherit;
    outline: none;
}

.playlist-editor input:focus,
.playlist-editor select:focus,
.playlist-editor input.is-focused,
.playlist-editor select.is-focused {
    border-color: var(--accent-strong);
    background: rgba(0, 120, 255, 0.18);
}

.settings-editor {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 24px;
}

.settings-screen .playlist-header .eyebrow {
    display: none;
}

.settings-editor > label {
    display: none;
}

.settings-nav {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.settings-nav-button,
.settings-choice-grid button {
    min-height: 52px;
    border: 2px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    font: inherit;
    font-weight: 900;
    outline: none;
}

.settings-nav-button.is-active,
.settings-choice-grid button.is-selected {
    border-color: var(--accent-strong);
    background: rgba(0, 120, 255, 0.24);
}

.settings-nav-button:focus,
.settings-choice-grid button:focus,
.settings-nav-button.is-focused,
.settings-choice-grid button.is-focused {
    border-color: var(--accent-strong);
    box-shadow: 0 0 0 3px rgba(34, 217, 255, 0.22);
}

.settings-nav-button.is-focused:not(.is-active),
.settings-choice-grid button.is-focused:not(.is-selected) {
    background: rgba(255, 255, 255, 0.12);
}

.settings-panels {
    min-width: 0;
}

.settings-panel {
    display: none;
}

.settings-panel.is-active {
    display: block;
}

.settings-panel h2 {
    display: none;
}

.settings-choice-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.settings-choice-grid.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-choice-grid button {
    min-height: 50px;
    padding: 8px 12px;
    font-size: 18px;
}

.settings-note {
    padding: 18px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--muted);
    font-size: 20px;
    font-weight: 800;
}

.settings-save-button {
    grid-column: 2;
    margin-top: 24px;
}

#playlistSaveButton {
    grid-column: auto;
    width: 260px;
}

#playlistDeleteButton,
.detail-action-button.danger {
    width: 260px;
    background: rgba(255, 93, 102, 0.28);
}

.account-info {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin: 18px 0;
}

.account-info span {
    padding: 16px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.82);
    font-size: 20px;
    font-weight: 800;
}

.account-info strong {
    display: block;
    color: var(--accent-strong);
    font-size: 15px;
}

.settings-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.playlist-screen .library-back.is-focused,
.account-screen .library-back.is-focused,
.history-screen .library-back.is-focused,
.settings-screen .library-back.is-focused,
.playlist-screen .detail-action-button.is-focused,
.account-screen .detail-action-button.is-focused,
.settings-screen .detail-action-button.is-focused {
    border-color: var(--accent-strong);
    background: rgba(0, 120, 255, 0.26);
}

.history-panel {
    width: min(1240px, 100%);
}

.history-section {
    margin-top: 24px;
}

.history-section h2 {
    margin: 0 0 14px;
    font-size: 28px;
}

.history-list {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.history-empty {
    grid-column: 1 / -1;
    padding: 20px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--muted);
    font-size: 20px;
    font-weight: 800;
}

.channel-type {
    display: inline-flex;
    padding: 8px 12px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent-strong);
    font-size: 18px;
    font-weight: 700;
}

.channel-title {
    margin: 38px 0 12px;
    font-size: 32px;
    font-weight: 800;
    line-height: 1.12;
}

.channel-description {
    margin: 0;
    color: var(--muted);
    font-size: 22px;
    line-height: 1.35;
}

.library-screen {
    background:
        radial-gradient(circle at 72% 12%, rgba(157, 54, 255, 0.22), transparent 28%),
        linear-gradient(110deg, rgba(5, 6, 10, 0.99) 0%, rgba(12, 15, 22, 0.97) 58%, rgba(5, 8, 14, 0.96) 100%);
}

.library-sidebar {
    display: flex;
    width: 430px;
    height: 100%;
    min-height: 0;
    flex-direction: column;
    padding: 40px 24px;
    overflow: hidden;
    border-right: 2px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.28);
}

.library-screen.is-live-library {
    background:
        radial-gradient(circle at 64% 20%, rgba(168, 61, 255, 0.22), transparent 18%),
        radial-gradient(circle at 62% 74%, rgba(168, 61, 255, 0.16), transparent 18%),
        linear-gradient(100deg, #07090e 0%, #090b11 54%, #050609 100%);
}

.library-screen.is-live-library .library-sidebar {
    width: 320px;
    padding: 26px 18px;
    border-right: 0;
    background: rgba(6, 8, 14, 0.82);
}

.library-screen.is-live-library .library-back {
    height: 58px;
    margin-bottom: 18px;
    background: rgba(255, 255, 255, 0.08);
}

.library-screen.is-live-library .library-title {
    margin-bottom: 14px;
    padding: 0;
}

.library-screen.is-live-library .library-title h1 {
    overflow: hidden;
    font-size: 32px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.library-screen.is-live-library .library-search {
    margin-bottom: 12px;
}

.library-back {
    width: 100%;
    height: 64px;
    margin-bottom: 34px;
    border: 3px solid transparent;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
    color: var(--text);
    font-size: 24px;
    font-weight: 800;
    outline: none;
}

.library-title {
    margin-bottom: 24px;
    padding: 0 12px;
}

.library-title .eyebrow {
    display: none;
}

.library-title h1 {
    font-size: 44px;
}

.library-search {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0 2px 18px;
    color: var(--muted);
    font-size: 18px;
    font-weight: 800;
}

.library-search input {
    width: 100%;
    height: 56px;
    border: 3px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    font-size: 22px;
    font-weight: 800;
    outline: none;
    padding: 0 16px;
}

.library-search input.is-focused,
.library-search input:focus {
    border-color: var(--accent-strong);
    background: rgba(0, 120, 255, 0.18);
}

.virtual-keyboard {
    flex: 0 0 auto;
    margin: 0 2px 16px;
    padding: 10px;
    border: 2px solid rgba(34, 217, 255, 0.24);
    border-radius: 8px;
    background: rgba(5, 12, 22, 0.98);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.38);
}

.virtual-keyboard-grid {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.virtual-keyboard-row {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 7px;
}

.virtual-key {
    min-width: 0;
    height: 44px;
    padding: 0 3px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(27, 39, 54, 0.96), rgba(13, 24, 37, 0.98));
    color: #fff;
    font: inherit;
    font-size: 22px;
    font-weight: 900;
    outline: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 8px 18px rgba(0, 0, 0, 0.24);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.virtual-key.is-action,
.virtual-key.is-space,
.virtual-key.is-search {
    font-size: 18px;
}

.virtual-key.is-icon {
    font-size: 24px;
}

.virtual-key.is-focused,
.virtual-key:focus {
    border-color: var(--accent-strong);
    background: linear-gradient(180deg, rgba(15, 59, 95, 0.98), rgba(8, 34, 58, 0.98));
    box-shadow: 0 0 0 2px rgba(34, 217, 255, 0.30), 0 10px 24px rgba(0, 0, 0, 0.32);
}

.category-list {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    flex-direction: column;
    gap: 8px;
    overflow-x: hidden;
    overflow-y: auto;
    padding-right: 4px;
}

.category-row,
.item-row {
    border: 3px solid transparent;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    outline: none;
    text-align: left;
}

.category-row {
    display: flex;
    min-height: 64px;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    font-size: 23px;
    font-weight: 700;
}

.category-row.is-selected {
    color: var(--accent-strong);
    background: rgba(34, 217, 255, 0.11);
}

.category-row.is-focused,
.item-row.is-focused,
.library-back:focus {
    border-color: var(--accent-strong);
    background: rgba(0, 120, 255, 0.22);
}

.row-count {
    min-width: 48px;
    color: var(--muted);
    font-size: 20px;
    text-align: right;
}

.library-content {
    display: flex;
    flex: 1;
    min-width: 0;
    flex-direction: column;
    padding: 42px 52px;
}

.library-screen.is-live-library .library-content {
    padding: 26px 28px 24px 22px;
}

.library-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
}

.library-screen.is-live-library .library-header {
    height: 62px;
    margin-bottom: 14px;
    padding: 0 18px;
    border: 1px solid rgba(210, 220, 242, 0.32);
    border-radius: 6px;
    background: rgba(20, 25, 35, 0.72);
}

.library-screen.is-live-library .library-header h2 {
    max-width: 62%;
    font-size: 30px;
}

.library-screen.is-live-library .item-count {
    color: #fff;
    font-size: 24px;
}

.live-top-menu {
    display: flex;
    height: 58px;
    align-items: center;
    justify-content: flex-end;
    gap: 42px;
    margin: -76px 0 18px 460px;
    padding: 0 22px;
    border: 1px solid rgba(210, 220, 242, 0.28);
    border-radius: 6px;
    background: rgba(15, 18, 26, 0.82);
    color: #fff;
    font-size: 22px;
    font-weight: 900;
    pointer-events: none;
}

.menu-dot {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 10px;
    border-radius: 4px;
    vertical-align: middle;
}

.menu-dot.red { background: #ff5361; }
.menu-dot.green { background: #64e679; }
.menu-dot.yellow { background: #f7f079; }
.menu-dot.blue { background: #5070ff; }

.library-main {
    display: flex;
    flex: 1;
    min-height: 0;
    gap: 18px;
}

.library-header h2 {
    max-width: 900px;
    margin: 0;
    overflow: hidden;
    font-size: 42px;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.item-count {
    color: var(--accent-strong);
    font-size: 24px;
    font-weight: 800;
}

.item-list {
    display: grid;
    flex: 1;
    min-height: 0;
    grid-template-columns: repeat(2, minmax(360px, 1fr));
    gap: 14px;
    overflow-x: hidden;
    overflow-y: auto;
    padding-right: 4px;
}

.library-screen.is-live-library .item-list {
    flex: 0 0 430px;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 0 2px 0 0;
}

.item-list.poster-grid {
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    grid-auto-rows: minmax(350px, auto);
    gap: 28px;
    align-content: start;
}

.category-list::-webkit-scrollbar,
.item-list::-webkit-scrollbar {
    width: 8px;
}

.category-list::-webkit-scrollbar-thumb,
.item-list::-webkit-scrollbar-thumb {
    border-radius: 8px;
    background: rgba(34, 217, 255, 0.30);
}

.item-row {
    display: flex;
    min-height: 92px;
    align-items: center;
    gap: 18px;
    padding: 14px 18px;
}

.live-channel-row {
    min-height: 62px;
    gap: 14px;
    padding: 8px 14px;
    border-width: 1px;
    border-color: rgba(210, 220, 242, 0.30);
    background: rgba(21, 25, 36, 0.88);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.live-channel-row.is-focused,
.live-channel-row:focus {
    border-color: #fff;
    background: #f5f7fb;
    color: #10141e;
}

.live-channel-row.is-focused .item-number,
.live-channel-row.is-focused .item-meta,
.live-channel-row.is-focused .item-type,
.live-channel-row:focus .item-number,
.live-channel-row:focus .item-meta,
.live-channel-row:focus .item-type {
    color: #10141e;
}

.item-number {
    display: grid;
    width: 48px;
    height: 48px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent-strong);
    font-size: 20px;
    font-weight: 800;
}

.live-channel-row .item-number {
    width: 52px;
    height: 42px;
    background: transparent;
    color: #f7f9ff;
    font-size: 20px;
}

.live-channel-logo,
.live-now-logo {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.24);
    background-color: rgba(255, 255, 255, 0.9);
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
    color: #111827;
    font-weight: 900;
}

.live-channel-logo {
    width: 48px;
    height: 42px;
}

.live-channel-logo span,
.live-now-logo span {
    font-size: 15px;
}

.item-main {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    gap: 6px;
}

.item-title {
    overflow: hidden;
    font-size: 25px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.live-channel-row .item-title {
    font-size: 21px;
}

.live-channel-row .item-meta,
.live-channel-row .item-type {
    display: none;
}

.live-info-panel {
    display: flex;
    flex: 1;
    min-width: 0;
    flex-direction: column;
    gap: 14px;
    padding: 0 0 18px;
}

.live-preview-card {
    position: relative;
    flex: 1 1 auto;
    min-height: 360px;
    overflow: hidden;
    border: 1px solid rgba(210, 220, 242, 0.32);
    border-radius: 6px;
    background: #000;
}

.live-preview-video {
    display: block;
    width: 100%;
    height: 100%;
    background: #000;
    object-fit: contain;
}

.live-preview-loading,
.live-preview-error {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 3;
    display: flex;
    min-width: 230px;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 18px 22px;
    border-radius: 6px;
    background: rgba(8, 11, 16, 0.88);
    color: #fff;
    font-size: 20px;
    font-weight: 900;
    transform: translate(-50%, -50%);
}

.live-preview-error {
    max-width: 72%;
    border: 1px solid rgba(255, 93, 102, 0.72);
    color: #ffe8ea;
    line-height: 1.35;
    text-align: center;
}

.live-now-card {
    display: flex;
    min-height: 78px;
    align-items: center;
    gap: 22px;
    padding: 12px 22px;
    color: #fff;
    font-size: 26px;
    font-weight: 900;
}

.live-now-number {
    min-width: 58px;
    text-align: center;
}

.live-now-logo {
    width: 58px;
    height: 50px;
}

.program-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #dce2ee;
}

.live-empty {
    margin: auto;
    color: var(--muted);
    font-size: 24px;
    font-weight: 900;
}

.item-meta {
    overflow: hidden;
    color: var(--muted);
    font-size: 19px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.item-type {
    flex: 0 0 auto;
    color: var(--accent-strong);
    font-size: 18px;
    font-weight: 800;
}

.poster-card {
    display: flex;
    min-width: 0;
    height: 350px;
    flex-direction: column;
    gap: 10px;
    border: 3px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    outline: none;
    text-align: left;
}

.poster-card.is-focused,
.poster-card:focus {
    border-color: var(--accent-strong);
    background: rgba(0, 120, 255, 0.14);
    transform: scale(1.035);
}

.poster-art,
.detail-poster {
    position: relative;
    display: grid;
    overflow: hidden;
    place-items: center;
    border-radius: 8px;
    background-position: center;
    background-size: cover;
    box-shadow: 0 18px 38px rgba(0, 0, 0, 0.44);
}

.poster-art {
    width: 100%;
    aspect-ratio: 2 / 3;
}

.poster-fallback {
    display: grid;
    width: 86px;
    height: 86px;
    place-items: center;
    border: 2px solid rgba(255, 255, 255, 0.72);
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.26);
    color: #fff;
    font-size: 30px;
    font-weight: 900;
}

.poster-title,
.poster-meta {
    overflow: hidden;
    padding: 0 4px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.poster-title {
    font-size: 22px;
    font-weight: 800;
}

.poster-meta {
    color: var(--muted);
    font-size: 17px;
    font-weight: 700;
}

.download-message {
    margin-top: 12px;
    color: var(--accent-strong);
    font-size: 20px;
    font-weight: 700;
}

.resume-dialog {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, 0.64);
}

.resume-dialog[hidden] {
    display: none;
}

.resume-dialog-panel {
    width: min(620px, calc(100vw - 80px));
    padding: 32px;
    border: 1px solid rgba(34, 217, 255, 0.35);
    border-radius: 8px;
    background: rgba(7, 22, 42, 0.96);
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.45);
    color: var(--text);
    text-align: center;
}

.resume-dialog-panel h2 {
    margin: 0 0 12px;
    font-size: 34px;
}

.resume-dialog-panel p {
    margin: 0 0 24px;
    color: var(--muted);
    font-size: 22px;
    font-weight: 800;
}

.resume-dialog-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.resume-dialog-actions button {
    min-height: 64px;
    border: 2px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    background: rgba(0, 120, 255, 0.28);
    color: #fff;
    font: inherit;
    font-size: 22px;
    font-weight: 900;
    outline: none;
}

.resume-dialog-actions button:focus {
    border-color: var(--accent-strong);
    background: rgba(0, 120, 255, 0.48);
}

.detail-screen {
    position: relative;
    align-items: flex-start;
    overflow-x: hidden;
    overflow-y: auto;
    background: #030509;
}

.detail-backdrop,
.detail-shade {
    position: absolute;
    inset: 0;
}

.detail-backdrop {
    background-position: center;
    background-size: cover;
    filter: saturate(1.08);
    transform: scale(1.02);
}

.detail-shade {
    background:
        linear-gradient(180deg, rgba(3, 5, 9, 0.12) 0%, rgba(5, 14, 28, 0.76) 78%, rgba(3, 5, 9, 0.96) 100%),
        radial-gradient(circle at 82% 18%, rgba(34, 217, 255, 0.18), transparent 34%);
}

.detail-content {
    position: relative;
    z-index: 1;
    display: grid;
    width: 100%;
    min-height: 100%;
    grid-template-columns: minmax(0, 1fr) 360px;
    grid-template-rows: minmax(560px, auto) auto;
    gap: 28px 48px;
    padding: 54px 70px 42px;
}

.detail-back-button {
    position: absolute;
    top: 46px;
    left: 54px;
    z-index: 2;
}

.detail-copy {
    align-self: center;
    max-width: 1120px;
    padding-top: 74px;
}

.detail-copy h1 {
    max-width: 1080px;
    margin-bottom: 22px;
    overflow: hidden;
    font-size: 58px;
    line-height: 1.08;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
}

.detail-meta span {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    padding: 0 16px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 20px;
    font-weight: 800;
}

.detail-meta .rating {
    color: var(--accent-strong);
}

.detail-story h2 {
    margin: 0 0 8px;
    color: #fff;
    font-size: 26px;
}

.detail-description {
    max-width: 940px;
    margin: 0 0 24px;
    color: #f7fbff;
    font-size: 25px;
    font-weight: 700;
    line-height: 1.42;
}

.detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.detail-action-button {
    min-width: 150px;
    height: 64px;
    max-width: 360px;
    border: 3px solid transparent;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.15);
    color: var(--text);
    font-size: 24px;
    font-weight: 900;
    outline: none;
    white-space: nowrap;
}

.detail-action-button.primary {
    min-width: 220px;
    background: #fff;
    color: #06152a;
}

.detail-action-button.square {
    min-width: 74px;
    padding: 0;
}

.detail-action-message {
    margin-top: 14px;
    color: var(--accent-strong);
    font-size: 20px;
    font-weight: 800;
}

.detail-action-button.is-focused,
.detail-back-button.is-focused {
    border-color: var(--accent-strong);
    background: rgba(0, 120, 255, 0.26);
}

.detail-poster-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
}

.detail-poster {
    width: 320px;
    aspect-ratio: 2 / 3;
    border: 3px solid rgba(255, 255, 255, 0.16);
}

.season-section,
.cast-section,
.actor-works-section {
    grid-column: 1 / -1;
    min-width: 0;
}

.season-section h2,
.cast-section h2,
.actor-works-section h2 {
    margin: 0 0 18px;
    font-size: 30px;
}

.season-list {
    display: flex;
    gap: 14px;
    margin-bottom: 18px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.season-button {
    min-width: 170px;
    height: 58px;
    border: 3px solid rgba(255, 255, 255, 0.28);
    border-radius: 8px;
    background: rgba(7, 22, 42, 0.76);
    color: var(--text);
    font-size: 22px;
    font-weight: 900;
    outline: none;
}

.episode-list,
.actor-works-list {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 300px;
    gap: 18px;
    overflow-x: auto;
    padding-bottom: 6px;
}

.episode-list {
    scrollbar-width: none;
    padding-bottom: 18px;
}

.episode-list::-webkit-scrollbar {
    display: none;
}

.actor-works-list {
    scrollbar-width: none;
    padding-bottom: 18px;
}

.actor-works-list::-webkit-scrollbar {
    display: none;
}

.actor-work-empty {
    width: 560px;
    padding: 24px;
    border-radius: 8px;
    background: rgba(7, 22, 42, 0.72);
    color: var(--muted);
    font-size: 24px;
    font-weight: 800;
}

.episode-card,
.actor-work-card {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 10px;
    border: 3px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: rgba(7, 22, 42, 0.68);
    color: var(--text);
    outline: none;
}

.episode-thumb,
.actor-work-poster {
    display: grid;
    width: 100%;
    aspect-ratio: 16 / 9;
    place-items: center;
    border-radius: 6px 6px 0 0;
    background-position: center;
    background-size: cover;
}

.episode-title,
.actor-work-card span:last-child {
    overflow: hidden;
    padding: 0 12px 12px;
    font-size: 22px;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cast-list {
    display: grid;
    grid-template-columns: repeat(6, minmax(150px, 1fr));
    gap: 18px;
}

.cast-card {
    min-width: 0;
    border: 3px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    outline: none;
    text-align: left;
}

.cast-photo {
    display: grid;
    width: 100%;
    aspect-ratio: 1 / 1;
    place-items: center;
    border: 3px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    background-position: center;
    background-size: cover;
    color: #fff;
    font-size: 38px;
    font-weight: 900;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.75);
}

.actor-work-poster {
    aspect-ratio: 1 / 1;
}

.cast-card span {
    display: block;
    overflow: hidden;
    margin-top: 10px;
    color: #fff;
    font-size: 18px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cast-color-0 { background: linear-gradient(145deg, #0a8dff, #102a52); }
.cast-color-1 { background: linear-gradient(145deg, #1fdcff, #07345f); }
.cast-color-2 { background: linear-gradient(145deg, #005dff, #061b3c); }
.cast-color-3 { background: linear-gradient(145deg, #00b7ff, #0c2440); }
.cast-color-4 { background: linear-gradient(145deg, #236bff, #101f4a); }
.cast-color-5 { background: linear-gradient(145deg, #008dff, #071a36); }

.season-button.is-focused,
.episode-card.is-focused,
.cast-card.is-focused,
.cast-card.is-selected,
.actor-work-card.is-focused {
    border-color: var(--accent-strong);
    background: rgba(0, 120, 255, 0.20);
}

.cast-card.is-selected .cast-photo {
    border-color: var(--accent-strong);
    box-shadow: 0 0 0 4px rgba(34, 217, 255, 0.22);
}

.player-screen {
    position: relative;
    align-items: stretch;
    justify-content: stretch;
    background: #000;
}

.video-player {
    width: 100%;
    height: 100%;
    background: #000;
    object-fit: contain;
}

.subtitle-overlay {
    position: absolute;
    right: 8%;
    bottom: 132px;
    left: 8%;
    z-index: 6;
    pointer-events: none;
    color: #fff;
    font-size: 40px;
    font-weight: 800;
    line-height: 1.32;
    text-align: center;
    text-shadow: 0 2px 4px #000, 0 0 12px rgba(0, 0, 0, 0.95);
    white-space: pre-line;
    unicode-bidi: plaintext;
}

.video-player.subtitle-large + .subtitle-overlay {
    font-size: 52px;
}

.video-player.subtitle-boxed + .subtitle-overlay {
    display: block;
    width: fit-content;
    max-width: 84%;
    margin: 0 auto;
    padding: 8px 16px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.78);
}

.loading-indicator,
.error-message {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 18px;
    min-width: 300px;
    justify-content: center;
    padding: 28px 34px;
    border-radius: 8px;
    background: rgba(8, 11, 16, 0.88);
    color: var(--text);
    font-size: 28px;
    transform: translate(-50%, -50%);
}

.error-message {
    max-width: 900px;
    border: 2px solid rgba(255, 93, 102, 0.7);
    color: #ffe8ea;
    line-height: 1.35;
    text-align: center;
}

.spinner {
    width: 42px;
    height: 42px;
    border: 5px solid rgba(255, 255, 255, 0.24);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 850ms linear infinite;
}

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

.controls-overlay {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 48px 60px 54px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.72) 0%, transparent 34%, rgba(0, 0, 0, 0.82) 100%);
    opacity: 1;
    transition: opacity 220ms ease;
}

.player-option-row {
    display: none;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.player-tool-buttons {
    position: absolute;
    top: 50%;
    left: 42px;
    display: flex;
    z-index: 6;
    flex-direction: column;
    justify-content: center;
    gap: 18px;
    margin-top: 0;
    transform: translateY(-50%);
}

.player-tool-button {
    display: grid;
    width: 72px;
    height: 72px;
    place-items: center;
    border: 3px solid rgba(255, 255, 255, 0.22);
    border-radius: 8px;
    background: rgba(34, 48, 64, 0.84);
    color: #fff;
    font-size: 28px;
    font-weight: 900;
    outline: none;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.player-tool-button.is-focused,
.player-tool-button.is-open {
    border-color: #e7f7ff;
    background: rgba(0, 120, 255, 0.42);
}

.player-tool-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 7;
    width: min(1180px, 88vw);
    max-height: min(78vh, 760px);
    overflow-y: auto;
    margin: 0;
    padding: 28px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.64);
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.44);
    transform: translate(-50%, -50%);
    backdrop-filter: blur(8px);
}

.player-tool-panel h3 {
    margin: 0 0 22px;
    color: #fff;
    font-size: 34px;
}

.player-tool-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 28px;
}

.player-tool-options.subtitle-settings {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.player-tool-option {
    min-height: 66px;
    padding: 0 22px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-radius: 8px;
    background: rgba(22, 34, 46, 0.82);
    color: #fff;
    font-size: 25px;
    font-weight: 900;
    text-align: start;
    outline: none;
}

.player-tool-option.is-muted {
    opacity: 0.72;
}

.player-tool-option.is-selected,
.player-tool-option.is-focused,
.player-tool-option:focus {
    border-color: #fff;
    background: rgba(255, 255, 255, 0.94);
    color: #243040;
}

.subtitle-preview {
    grid-column: 1 / -1;
    padding: 4px 8px 10px;
    color: #fff;
    font-size: 28px;
    font-weight: 800;
    text-align: center;
}

.player-option-row label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: rgba(255, 255, 255, 0.78);
    font-size: 14px;
    font-weight: 800;
}

.player-select {
    min-height: 42px;
    padding: 0 10px;
    border: 2px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    background: rgba(8, 11, 16, 0.88);
    color: #fff;
    font: inherit;
    outline: none;
}

.video-player.subtitle-large::cue {
    font-size: 170%;
}

.video-player.subtitle-boxed::cue {
    background: rgba(0, 0, 0, 0.78);
    color: #fff;
}

.video-player.screen-contain {
    object-fit: contain;
}

.video-player.screen-cover {
    object-fit: cover;
}

.video-player.screen-fill,
.video-player.screen-wide {
    object-fit: fill;
}

.controls-overlay.is-hidden {
    opacity: 0;
}

.control-top,
.transport-row {
    display: flex;
    align-items: center;
    gap: 24px;
}

.control-top h2 {
    max-width: 1450px;
    margin: 0;
    overflow: hidden;
    font-size: 38px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.icon-button,
.play-button {
    min-width: 84px;
    height: 72px;
    border: 3px solid transparent;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.14);
    color: var(--text);
    outline: none;
}

.icon-button {
    font-size: 54px;
    line-height: 0.7;
}

.play-button {
    padding: 0 28px;
    font-size: 26px;
    font-weight: 700;
}

.focusable-control.is-focused {
    border-color: var(--accent-strong);
    background: rgba(0, 120, 255, 0.24);
}

.time-labels {
    display: flex;
    gap: 10px;
    color: var(--text);
    font-size: 26px;
    font-variant-numeric: tabular-nums;
}

.progress-track {
    width: 100%;
    height: 16px;
    margin-top: 24px;
    overflow: hidden;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.22);
}

.progress-bar {
    width: 0%;
    height: 100%;
    border-radius: 8px;
    background: var(--accent);
    transition: width 120ms linear;
}

[hidden] {
    display: none !important;
}

@media (max-width: 1280px) {
    .rail {
        width: 300px;
        padding: 48px 34px;
    }

    .content {
        padding: 48px;
    }

    .channel-grid {
        grid-template-columns: repeat(2, minmax(240px, 1fr));
    }

    h1 {
        font-size: 48px;
    }
}
