/* VideoKonverter TV - Streaming-Frontend */
/* Optimiert fuer TV (Fernbedienung), Handy, Tablet */

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

/* === Theme: Dark (Standard) === */
:root, [data-theme="dark"] {
    --bg: #0f0f0f;
    --bg-card: #1a1a1a;
    --bg-hover: #252525;
    --bg-input: #1e1e1e;
    --bg-nav: #111;
    --text: #e0e0e0;
    --text-muted: #888;
    --accent: #e5a00d;
    --accent-hover: #f0b830;
    --danger: #ef5350;
    --success: #66bb6a;
    --border: #333;
    --shadow: rgba(0,0,0,0.5);
    --radius: 8px;
    --text-dim: #555;
    --warning: #ffa726;
    --focus-ring: 3px solid var(--accent);
}

/* === Theme: Medium (Grau) === */
[data-theme="medium"] {
    --bg: #2a2d32;
    --bg-card: #363a40;
    --bg-hover: #42474e;
    --bg-input: #31353b;
    --bg-nav: #24272c;
    --text: #e8e8e8;
    --text-muted: #999;
    --text-dim: #666;
    --warning: #ffa726;
    --accent: #d4940c;
    --accent-hover: #e5a825;
    --danger: #e05252;
    --success: #5dba5d;
    --border: #4a4f56;
    --shadow: rgba(0,0,0,0.3);
}

/* === Theme: Light (Hell) === */
[data-theme="light"] {
    --bg: #f0f2f5;
    --bg-card: #ffffff;
    --bg-hover: #e8eaed;
    --bg-input: #ffffff;
    --bg-nav: #ffffff;
    --text: #1a1a1a;
    --text-muted: #666;
    --text-dim: #aaa;
    --warning: #e68900;
    --accent: #b8860b;
    --accent-hover: #9a7209;
    --danger: #d32f2f;
    --success: #388e3c;
    --border: #dadce0;
    --shadow: rgba(0,0,0,0.1);
}

html {
    font-size: clamp(14px, 1.2vw, 20px);
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    scrollbar-width: none;
    -webkit-font-smoothing: antialiased;
}
body::-webkit-scrollbar { display: none; }

a { color: var(--accent); text-decoration: none; }

/* === Focus-Management fuer D-Pad === */
[data-focusable]:focus {
    outline: var(--focus-ring);
    outline-offset: 4px;
    z-index: 10;
}

/* === Navigation === */
.tv-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-nav);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1.5rem;
    border-bottom: 1px solid #222;
}
.tv-nav-links { display: flex; gap: 0.3rem; }
.tv-nav-right { display: flex; align-items: center; gap: 0.8rem; }
.tv-nav-item {
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 0.95rem;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}
.tv-nav-item:hover, .tv-nav-item:focus { background: var(--bg-hover); color: var(--text); }
.tv-nav-item.active { color: var(--text); background: var(--bg-card); font-weight: 600; }
.tv-nav-user { color: var(--text-muted); font-size: 0.85rem; }
.tv-nav-logout { color: var(--danger); font-size: 0.85rem; }

/* === Main Content === */
.tv-main { padding: 1.5rem; max-width: 1600px; margin: 0 auto; }

/* === Sections === */
.tv-section { margin-bottom: 2rem; }
.tv-section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.8rem; }
.tv-section-title { font-size: 1.3rem; font-weight: 600; margin-bottom: 0.5rem; }
.tv-section-more { font-size: 0.85rem; color: var(--accent); padding: 0.3rem 0.6rem; border-radius: var(--radius); }
.tv-section-more:focus { outline: var(--focus-ring); }
.tv-page-title { font-size: 1.6rem; font-weight: 700; margin-bottom: 1rem; }

/* === Horizontale Scroll-Reihen (Netflix-Style) === */
.tv-row {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    overflow-y: clip;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    padding: 10px 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
/* Scrollbar komplett verstecken (Navigation per D-Pad/Touch) */
.tv-row::-webkit-scrollbar { display: none; }
.tv-row .tv-card {
    scroll-snap-align: start;
    flex-shrink: 0;
    width: 176px;
}
/* Weiterspielen-Cards: gleiche Breite wie Standard, horizontales Scrollen */
.tv-row .tv-card-wide { width: 176px; }
.tv-card-wide .tv-card-img { aspect-ratio: 2/3; }
.tv-card-wide .tv-card-placeholder { aspect-ratio: 2/3; }

/* === Poster-Grid === */
.tv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}
/* Versteckte Ansichten vom Rendering ausschliessen */
[style*="display:none"].tv-view-grid,
[style*="display:none"].tv-view-list,
[style*="display:none"].tv-view-detail,
[style*="display:none"].tv-view-folder,
[style*="display: none"].tv-view-grid,
[style*="display: none"].tv-view-list,
[style*="display: none"].tv-view-detail,
[style*="display: none"].tv-view-folder {
    content-visibility: hidden;
}

/* === Poster-Karten === */
.tv-card {
    position: relative;
    display: block;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    transition: filter 0.2s, box-shadow 0.2s;
    cursor: pointer;
}
.tv-card:hover {
    filter: brightness(1.2);
}
.tv-card[data-focusable]:focus {
    outline: none !important;
    outline-offset: 0 !important;
}
.tv-card:focus::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 3px solid var(--accent);
    border-radius: var(--radius);
    pointer-events: none;
    z-index: 10;
}

.tv-card-img {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    display: block;
    background: #222;
}
.tv-card-placeholder {
    width: 100%;
    aspect-ratio: 2/3;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1e1e1e;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
    padding: 0.5rem;
}
.tv-card-info { padding: 0.3rem 0.4rem; }
.tv-card-title {
    display: block;
    font-size: 0.7rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text);
}
.tv-card-meta {
    display: block;
    font-size: 0.6rem;
    color: var(--text-muted);
}
.tv-card-next {
    color: var(--accent, #1976d2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Schon-gesehen Badge */
.tv-card-watched { opacity: 0.65; }
.tv-card-watched:hover { opacity: 1; }
.tv-card-watched-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--success);
    color: #fff;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}
.tv-title-muted { color: var(--text-muted); }

/* Wiedergabe-Fortschritt auf Karte */
.tv-card-progress {
    height: 3px;
    background: var(--border);
}
.tv-card-progress-bar {
    height: 100%;
    background: var(--accent);
    transition: width 0.3s;
}

/* === Detail-Ansicht === */
.tv-detail-header {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}
.tv-detail-poster {
    width: 200px;
    border-radius: var(--radius);
    flex-shrink: 0;
    object-fit: cover;
}
.tv-detail-info { flex: 1; min-width: 0; }
.tv-detail-genres { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 0.5rem; }
.tv-detail-year { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 0.3rem; }
.tv-detail-overview {
    font-size: 0.9rem;
    line-height: 1.6;
    color: #ccc;
    max-height: 8rem;
    overflow: hidden;
    margin-bottom: 1rem;
}
.tv-detail-actions { margin-top: 1rem; }

/* Play-Button (gross, fuer TV) */
.tv-play-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 2rem;
    background: var(--accent);
    color: #000;
    font-size: 1.1rem;
    font-weight: 700;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.2s;
}
.tv-play-btn:hover, .tv-play-btn:focus {
    background: var(--accent-hover);
    outline: var(--focus-ring);
    outline-offset: 4px;
}

/* === Staffel-Tabs === */
.tv-tabs {
    display: flex;
    gap: 0.3rem;
    margin-bottom: 1rem;
    overflow-x: auto;
    padding-bottom: 4px;
}
.tv-tab {
    padding: 0.5rem 1.2rem;
    background: var(--bg-card);
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s;
}
.tv-tab:hover, .tv-tab:focus { background: var(--bg-hover); color: var(--text); }
.tv-tab.active { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 600; }

/* === Episoden-Liste === */
.tv-episode-list { display: flex; flex-direction: column; gap: 0.5rem; }

/* Episoden-Karte (Netflix-Style) */
.tv-episode-card {
    display: flex;
    gap: 1rem;
    padding: 0.6rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    transition: background 0.2s;
    color: var(--text);
    text-decoration: none;
    align-items: center;
    position: relative;
}
.tv-episode-card:hover { background: var(--bg-hover); }
.tv-ep-link {
    display: flex;
    gap: 1rem;
    color: var(--text);
    text-decoration: none;
    flex: 1;
    min-width: 0;
}
.tv-ep-link:focus { outline: var(--focus-ring); outline-offset: -2px; border-radius: var(--radius); }

/* Gesehen-Button pro Episode */
.tv-ep-mark-btn {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--text-dim);
    background: transparent;
    color: var(--text-dim);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    margin-right: 0.4rem;
}
.tv-ep-mark-btn:hover, .tv-ep-mark-btn:focus {
    border-color: var(--accent);
    color: var(--accent);
    outline: var(--focus-ring);
    outline-offset: 2px;
}
.tv-ep-mark-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.tv-ep-seen { opacity: 0.6; }
.tv-ep-seen:hover { opacity: 1; }

/* Staffel-Aktionen */
.tv-season-actions {
    display: flex;
    justify-content: flex-end;
    padding: 0.3rem 0 0.6rem;
}
.tv-season-mark-btn {
    background: transparent;
    border: 1px solid var(--text-dim);
    color: var(--text-dim);
    padding: 0.3rem 0.8rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}
.tv-season-mark-btn:hover, .tv-season-mark-btn:focus {
    border-color: var(--accent);
    color: var(--accent);
    outline: var(--focus-ring);
    outline-offset: 2px;
}

/* Thumbnail-Bereich */
.tv-ep-thumb {
    position: relative;
    flex-shrink: 0;
    width: 200px;
    aspect-ratio: 16 / 9;
    border-radius: calc(var(--radius) - 2px);
    overflow: hidden;
    background: var(--bg-card);
}
.tv-ep-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.tv-ep-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255,255,255,0.2);
}
.tv-ep-progress-bar {
    height: 100%;
    background: var(--accent);
    border-radius: 0 2px 2px 0;
}
.tv-ep-watched {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0,0,0,0.7);
    color: var(--accent);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
}
.tv-ep-duration {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(0,0,0,0.75);
    color: #fff;
    font-size: 0.8rem;
    padding: 3px 8px;
    border-radius: 3px;
    white-space: nowrap;
}

/* Info-Bereich */
.tv-ep-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
    padding: 0.2rem 0;
}
.tv-ep-header {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}
.tv-ep-num {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    flex-shrink: 0;
}
.tv-ep-title {
    font-size: 0.95rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tv-ep-desc {
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
}
.tv-ep-meta {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: auto;
}
.tv-ep-duplicate {
    border-left: 3px solid var(--warning, #ffa726);
}
.tv-ep-dup-badge {
    display: inline-block;
    background: rgba(255, 167, 38, 0.2);
    color: var(--warning, #ffa726);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Serien-Detail Aktionen */
.tv-detail-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.8rem;
}

/* Legacy-Klassen fuer Rueckwaertskompatibilitaet */
.tv-episode { display: none; }

/* === Ansichts-Umschalter === */
.tv-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}
.tv-list-header .tv-page-title { margin: 0; }
.tv-view-switch {
    display: flex;
    gap: 4px;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 3px;
}
.tv-view-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px 8px;
    border-radius: calc(var(--radius) - 2px);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}
.tv-view-btn svg { fill: currentColor; }
.tv-view-btn:hover { color: var(--text); background: var(--bg-hover); }
.tv-view-btn.active { color: var(--accent); background: var(--bg-hover); }
.tv-view-btn:focus { outline: var(--focus-ring); outline-offset: -1px; }

/* === Kompakte Liste === */
.tv-list-compact {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.tv-list-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.5rem 0.8rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    transition: background 0.2s;
}
.tv-list-item:hover, .tv-list-item:focus {
    background: var(--bg-hover);
}
.tv-list-item:focus { outline: var(--focus-ring); outline-offset: -2px; }
.tv-list-poster {
    width: 40px;
    height: 56px;
    flex-shrink: 0;
    border-radius: 3px;
    overflow: hidden;
    background: var(--bg-card);
}
.tv-list-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.tv-list-title {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tv-list-genre {
    color: var(--text-muted);
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}
.tv-list-count {
    color: var(--text-muted);
    font-size: 0.8rem;
    white-space: nowrap;
    min-width: 50px;
    text-align: right;
}

/* === Detail-Liste === */
.tv-detail-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.tv-detail-item {
    display: flex;
    gap: 1rem;
    padding: 0.6rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    transition: background 0.2s;
}
.tv-detail-item:hover, .tv-detail-item:focus {
    background: var(--bg-hover);
}
.tv-detail-item:focus { outline: var(--focus-ring); outline-offset: -2px; }
.tv-detail-thumb {
    width: 80px;
    height: 112px;
    flex-shrink: 0;
    border-radius: calc(var(--radius) - 2px);
    overflow: hidden;
    background: var(--bg-card);
}
.tv-detail-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.tv-detail-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
    padding: 0.2rem 0;
}
.tv-detail-title {
    font-size: 1rem;
    font-weight: 600;
}
.tv-detail-desc {
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
}
.tv-detail-meta {
    color: var(--text-muted);
    font-size: 0.78rem;
    margin-top: auto;
}

/* === Ordner-Ansicht === */
.tv-folder-view {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}
.tv-folder-source-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    margin: 0 0 0.4rem 0;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--border);
}
.tv-folder-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.tv-folder-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.7rem;
    background: var(--bg-card);
    border-radius: calc(var(--radius) - 2px);
    color: var(--text);
    text-decoration: none;
    transition: background 0.15s;
}
.tv-folder-item:hover, .tv-folder-item:focus {
    background: var(--bg-hover);
}
.tv-folder-item:focus { outline: var(--focus-ring); outline-offset: -2px; }
.tv-folder-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
    width: 1.5rem;
    text-align: center;
}
.tv-folder-name {
    font-size: 0.92rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}
.tv-folder-meta {
    color: var(--text-muted);
    font-size: 0.78rem;
    white-space: nowrap;
    flex-shrink: 0;
}

/* === Filter-Leiste === */
.tv-filter-bar {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.tv-genre-chips {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
    flex: 1;
}
.tv-chip {
    display: inline-block;
    padding: 0.3rem 0.7rem;
    background: var(--bg-card);
    border: 1px solid transparent;
    border-radius: 99px;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}
.tv-chip:hover { color: var(--text); background: var(--bg-hover); }
.tv-chip.active { color: var(--accent); border-color: var(--accent); font-weight: 600; }
.tv-chip:focus { outline: var(--focus-ring); outline-offset: -1px; }
.tv-sort-select {
    padding: 0.4rem 0.8rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.8rem;
    cursor: pointer;
    flex-shrink: 0;
}
.tv-sort-select:focus { border-color: var(--accent); outline: none; }
.tv-source-tabs { margin-bottom: 0.5rem; }

/* === Suche === */
.tv-search-form { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; }
.tv-search-wrapper { flex: 1; position: relative; }
.tv-search-input {
    width: 100%;
    padding: 0.8rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 1rem;
    box-sizing: border-box;
}
.tv-search-input:focus { border-color: var(--accent); outline: none; }

/* Autocomplete-Dropdown */
.tv-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    max-height: 300px;
    overflow-y: auto;
    z-index: 50;
}
.tv-ac-item {
    display: block;
    padding: 0.6rem 1rem;
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.15s;
}
.tv-ac-item:hover { background: var(--bg-hover); }

/* Such-History */
.tv-search-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}
.tv-link-btn {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0.3rem;
}
.tv-link-btn:hover { text-decoration: underline; }
.tv-search-history-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.tv-search-history-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.8rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s;
}
.tv-search-history-item:hover { background: var(--bg-hover); }
.tv-search-history-icon { color: var(--text-muted); font-size: 0.8rem; }

.tv-search-btn {
    padding: 0.8rem 1.5rem;
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
}

/* === Empty State === */
.tv-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 3rem 1rem;
    font-size: 1rem;
}

/* === Login === */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
}
.login-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 100;
}
.login-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.login-container { width: 100%; max-width: 400px; padding: 1rem; }
.login-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 2.5rem;
    text-align: center;
}
.login-title { font-size: 1.8rem; font-weight: 700; margin-bottom: 0.2rem; }
.login-subtitle { color: var(--text-muted); margin-bottom: 1.5rem; font-size: 1rem; }
.login-error {
    background: rgba(239, 83, 80, 0.15);
    color: var(--danger);
    padding: 0.6rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.login-form { text-align: left; }
.login-field { margin-bottom: 1rem; }
.login-field label { display: block; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.3rem; }
.login-field input {
    width: 100%;
    padding: 0.8rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 1rem;
}
.login-field input:focus { border-color: var(--accent); outline: none; }
.login-btn {
    width: 100%;
    padding: 0.9rem;
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: var(--radius);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 0.5rem;
}
.login-btn:hover, .login-btn:focus { background: var(--accent-hover); }

/* === Video-Player === */
.player-body {
    background: #000;
    overflow: hidden;
}
/* VKNative (Tizen AVPlay): Transparenter Hintergrund damit
   das AVPlay-Video (Hardware-Layer unter HTML) durchscheint.
   Controls behalten ihre Gradient-Hintergruende. */
body.vknative-playing {
    background: transparent !important;
}
body.vknative-playing .player-wrapper {
    background: transparent !important;
}
body.vknative-playing #player-video {
    display: none !important;
}
body.vknative-playing .player-loading {
    background: rgba(0, 0, 0, 0.6) !important;
}
body.vknative-playing .player-body {
    background: transparent !important;
}
.player-wrapper {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    background: #000;
}
.player-wrapper video {
    flex: 1;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}
/* Loading-Spinner im Player */
.player-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 50;
    background: #000;
    gap: 1rem;
    opacity: 1;
    transition: opacity 1.5s ease;
}
.player-loading.fade-out {
    opacity: 0;
    pointer-events: none;
}
.player-loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(255,255,255,0.2);
    border-top-color: #2196f3;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.player-loading-text {
    color: rgba(255,255,255,0.7);
    font-size: 0.9rem;
}
.player-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 1rem 1.5rem;
    background: linear-gradient(to bottom, rgba(0,0,0,0.8), transparent);
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 10;
    transition: opacity 0.3s;
}
.player-back {
    color: var(--text);
    font-size: 1rem;
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius);
}
.player-back:focus { outline: var(--focus-ring); }
.player-title {
    color: var(--text);
    font-size: 1rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.5rem 1.5rem 1rem;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    z-index: 10;
    transition: opacity 0.3s;
}
.player-progress {
    height: 6px;
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
    cursor: pointer;
    margin-bottom: 0.5rem;
}
.player-progress-bar {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.2s;
    pointer-events: none;
}
.player-buttons {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}
.player-btn {
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0;
    border-radius: var(--radius);
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.player-btn:focus { outline: var(--focus-ring); }
.player-btn svg { display: block; width: 20px; height: 20px; }
.player-btn-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 1px 4px;
    border: 1px solid currentColor;
    border-radius: 3px;
    line-height: 1.2;
}
.player-btn.active { color: var(--accent); }
.player-btn.active .player-btn-badge {
    border-color: var(--accent);
    background: var(--accent);
    color: #000;
}
.player-time { color: var(--text-muted); font-size: 0.85rem; }
.player-spacer { flex: 1; }

/* Controls ausblenden nach Inaktivitaet */
.player-hide-controls .player-header,
.player-hide-controls .player-controls {
    opacity: 0;
    pointer-events: none;
}

/* === Player Debug-Info-Overlay === */
.player-debug {
    position: absolute;
    top: 4rem;
    left: 1rem;
    z-index: 20;
    background: rgba(0, 0, 0, 0.82);
    color: #ccc;
    font-family: "SF Mono", "Fira Code", "Consolas", monospace;
    font-size: 0.72rem;
    line-height: 1.45;
    padding: 0.7rem 1rem;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.12);
    max-width: 420px;
    pointer-events: none;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.player-debug b { color: #fff; font-weight: 600; }
.player-debug .dbg-label { color: #888; display: inline-block; min-width: 90px; }
.player-debug .dbg-val { color: #64b5f6; }
.player-debug .dbg-ok { color: #81c784; }
.player-debug .dbg-warn { color: #ffb74d; }
.player-debug .dbg-sep {
    border: none;
    border-top: 1px solid rgba(255,255,255,0.08);
    margin: 0.3rem 0;
}

/* === Player-Popup-Menue (kompakt, ersetzt das grosse Overlay-Panel) === */
.player-popup {
    position: absolute;
    right: 1rem;
    bottom: 5rem;
    width: 280px;
    max-width: 90vw;
    max-height: 60vh;
    overflow-y: auto;
    background: rgba(20, 20, 20, 0.95);
    border-radius: 12px;
    padding: 0.5rem 0;
    z-index: 20;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}
.player-popup.popup-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Hauptmenue-Eintraege */
.popup-menu-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0.7rem 1.2rem;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.15s;
    text-align: left;
}
.popup-menu-item:hover, .popup-menu-item:focus {
    background: var(--bg-hover);
    outline: var(--focus-ring);
    outline-offset: -3px;
}
.popup-item-label { font-weight: 500; }
.popup-item-value {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Zurueck-Button im Submenue */
.popup-back {
    display: block;
    width: 100%;
    padding: 0.7rem 1.2rem;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    text-align: left;
    margin-bottom: 0.3rem;
}
.popup-back:hover, .popup-back:focus {
    background: var(--bg-hover);
    outline: var(--focus-ring);
    outline-offset: -3px;
}

/* Optionen im Submenue */
.popup-option {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.6rem 1.2rem;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.15s;
}
.popup-option:hover, .popup-option:focus {
    background: var(--bg-hover);
    outline: var(--focus-ring);
    outline-offset: -3px;
}
.popup-option.active {
    color: var(--accent);
    font-weight: 600;
}
.popup-option.active::before {
    content: "\2713 ";
}

/* === Naechste Episode Overlay === */
.player-next-overlay, .player-still-watching {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 25;
}
.player-next-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 2.5rem;
    text-align: center;
    max-width: 400px;
    width: 90%;
}
.player-next-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}
.player-next-name {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1rem;
}
.player-next-countdown {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 1.5rem;
}
.player-next-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}
.player-btn-cancel {
    padding: 0.8rem 2rem;
    background: transparent;
    border: 1px solid var(--text-muted);
    color: var(--text);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 1rem;
}
.player-btn-cancel:hover, .player-btn-cancel:focus {
    border-color: var(--text);
    outline: var(--focus-ring);
}

/* Player-Popup responsive: Handy zentriert */
@media (max-width: 480px) {
    .player-popup {
        right: 50%;
        transform: translateX(50%) translateY(8px);
        width: 90vw;
    }
    .player-popup.popup-visible {
        transform: translateX(50%) translateY(0);
    }
}

/* === Toast-Benachrichtigung === */
.tv-toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(1rem);
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
}
.tv-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.tv-toast-error {
    background: var(--danger);
    color: #fff;
}
.tv-toast-success {
    background: var(--success);
    color: #fff;
}

/* === Responsive === */
@media (max-width: 768px) {
    .tv-nav { padding: 0.4rem 0.8rem; }
    .tv-nav-item { padding: 0.4rem 0.6rem; font-size: 0.85rem; }
    .tv-main { padding: 1rem; }
    .tv-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
    .tv-row .tv-card { width: 141px; }
    .tv-row .tv-card-wide { width: 141px; }
    .tv-detail-header { flex-direction: column; }
    .tv-detail-poster { width: 150px; }
    .tv-page-title { font-size: 1.3rem; }
    .tv-nav-user { display: none; }
    /* Episoden-Karten: Thumbnail kleiner */
    .tv-ep-thumb { width: 140px; }
    .tv-ep-desc { -webkit-line-clamp: 1; }
    /* Listen-Ansicht: Genre ausblenden */
    .tv-list-genre { display: none; }
    /* Detail-Liste: Poster kleiner */
    .tv-detail-thumb { width: 60px; height: 84px; }
}

@media (max-width: 480px) {
    .tv-nav-links { gap: 0; }
    .tv-nav-item { padding: 0.3rem 0.5rem; font-size: 0.8rem; }
    .tv-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
    .tv-row .tv-card { width: 118px; }
    .tv-detail-poster { width: 120px; }
    /* Episoden-Karten: kompakt auf Handy */
    .tv-ep-thumb { width: 100px; }
    .tv-ep-title { font-size: 0.85rem; }
    .tv-ep-desc { display: none; }
    .tv-episode-card { gap: 0.6rem; padding: 0.4rem; }
    /* Detail-Liste: Description ausblenden */
    .tv-detail-desc { display: none; }
    .tv-detail-thumb { width: 50px; height: 70px; }
    .tv-detail-item { gap: 0.6rem; }
    /* Listen-Ansicht: kleiner */
    .tv-list-poster { width: 32px; height: 45px; }
    .tv-list-item { padding: 0.4rem 0.6rem; gap: 0.5rem; }
}

/* TV/Desktop (grosse Bildschirme) */
@media (min-width: 1280px) {
    .tv-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
    .tv-row .tv-card { width: 200px; }
    .tv-row .tv-card-wide { width: 200px; }
    .tv-play-btn { padding: 1rem 3rem; font-size: 1.3rem; }
    /* Episoden-Karten: groesser auf TV */
    .tv-ep-thumb { width: 260px; }
    .tv-ep-desc { -webkit-line-clamp: 3; }
    .tv-episode-card { padding: 0.8rem; gap: 1.2rem; }
    /* Detail-Liste: groesser */
    .tv-detail-thumb { width: 100px; height: 140px; }
    .tv-detail-desc { -webkit-line-clamp: 3; }
    .tv-detail-title { font-size: 1.1rem; }
    /* Listen-Ansicht */
    .tv-list-poster { width: 48px; height: 67px; }
    .tv-list-item { padding: 0.6rem 1rem; }
}

/* === Avatar (Profilfarbe) === */
.tv-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: #000;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}
.tv-avatar-lg {
    width: 80px;
    height: 80px;
    font-size: 2rem;
}
.tv-nav-profile { display: flex; align-items: center; }
.tv-nav-profile:focus .tv-avatar { outline: var(--focus-ring); outline-offset: 3px; }

/* === Profilauswahl === */
.profiles-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 3rem 1rem;
    text-align: center;
}
.profiles-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 2rem;
    color: var(--text);
}
.profiles-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
}
.profile-form { display: contents; }
.profile-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    padding: 1.5rem;
    background: transparent;
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    color: var(--text);
    text-decoration: none;
    min-width: 120px;
}
.profile-card:hover, .profile-card:focus {
    background: var(--bg-card);
    border-color: var(--accent);
    outline: none;
}
.profile-active { border-color: var(--accent); }
.profile-add-icon { background: var(--border) !important; color: var(--text-muted) !important; }
.profile-name { font-size: 0.95rem; font-weight: 500; }

/* === Einstellungen === */
.settings-form { max-width: 600px; }
.settings-group {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.2rem;
    margin-bottom: 1.2rem;
}
.settings-group legend {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0 0.5rem;
}
.settings-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.8rem;
    font-size: 0.9rem;
    color: var(--text);
}
.settings-check {
    justify-content: flex-start;
    gap: 0.5rem;
    cursor: pointer;
}
.settings-check input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--accent);
}
.settings-input, .settings-select {
    padding: 0.5rem 0.8rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.9rem;
    min-width: 180px;
}
.settings-input:focus, .settings-select:focus {
    border-color: var(--accent);
    outline: none;
}
/* SELECT im Editier-Modus: deutlich hervorgehoben */
select.select-editing {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent);
    background: var(--bg-hover);
}
/* Auch Sort-/Filter-Selects im Content-Bereich */
.tv-sort-select.select-editing,
.tv-rating-filter.select-editing {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent);
}
/* INPUT/TEXTAREA im Editier-Modus */
input.input-editing,
textarea.input-editing {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent);
    background: var(--bg-hover);
}
.color-picker-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 0.4rem;
}
.color-swatch {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.15s;
    padding: 0;
}
.color-swatch:hover, .color-swatch:focus {
    transform: scale(1.15);
    outline: none;
}
.color-swatch:focus {
    outline: var(--focus-ring);
    outline-offset: 2px;
}
.color-swatch.active {
    border-color: #fff;
    box-shadow: 0 0 0 2px var(--accent);
}
.settings-save { margin-top: 1rem; }
.settings-danger {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}
.settings-danger-btn {
    padding: 0.6rem 1.2rem;
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}
.settings-danger-btn:hover, .settings-danger-btn:focus {
    background: rgba(239, 83, 80, 0.15);
    outline: var(--focus-ring);
}

/* Erfolgs-Meldung */
.tv-success-msg {
    background: rgba(102, 187, 106, 0.15);
    color: var(--success);
    padding: 0.6rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

/* Login: Angemeldet bleiben */
.login-remember {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}
.login-remember label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
}
.login-remember input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

/* === Watchlist-Button === */
.tv-watchlist-btn {
    background: none;
    border: 1px solid var(--text-muted);
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}
.tv-watchlist-btn:hover, .tv-watchlist-btn:focus {
    border-color: var(--accent);
    color: var(--accent);
    outline: var(--focus-ring);
}
.tv-watchlist-btn.active {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}

/* === Watch-Status Badge === */
.tv-status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}
.tv-status-watched { background: var(--success); color: #000; }
.tv-status-watching { background: var(--accent); color: #000; }
.tv-status-unwatched { background: #444; color: var(--text-muted); }

/* === Bewertungssystem (Rating) === */
.tv-rating-section {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem 1.5rem;
    align-items: center;
    margin: 0.8rem 0;
}
.tv-rating-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.tv-rating-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.tv-stars-input {
    display: flex;
    align-items: center;
    gap: 2px;
}
.tv-stars-input .tv-star {
    font-size: 1.6rem;
    color: #555;
    cursor: pointer;
    transition: color 0.15s, transform 0.15s;
    user-select: none;
    line-height: 1;
}
.tv-stars-input .tv-star:hover,
.tv-stars-input .tv-star:focus {
    transform: scale(1.2);
}
.tv-stars-input .tv-star.active {
    color: #f5c518;
}
.tv-stars-input .tv-star:hover ~ .tv-star {
    color: #555 !important;
}
/* Hover-Effekt: alle Sterne bis zum gehovertem golden */
.tv-stars-input:hover .tv-star {
    color: #f5c518;
}
.tv-stars-input:hover .tv-star:hover ~ .tv-star {
    color: #555;
}
.tv-rating-remove {
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
    margin-left: 4px;
    padding: 2px 6px;
    border-radius: 3px;
    transition: color 0.15s, background 0.15s;
}
.tv-rating-remove:hover,
.tv-rating-remove:focus {
    color: #f44;
    background: rgba(255, 68, 68, 0.1);
}

/* Durchschnittsbewertung (nur Anzeige) */
.tv-rating-avg {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.tv-stars-display {
    display: flex;
    gap: 1px;
}
.tv-stars-display .tv-star {
    font-size: 1rem;
    color: #555;
    line-height: 1;
}
.tv-stars-display .tv-star.active {
    color: #f5c518;
}
.tv-rating-text {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Externe Bewertung (TVDB Badge) */
.tv-rating-external {
    display: flex;
    align-items: center;
}
.tv-rating-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.tv-rating-badge.tvdb {
    background: #3b7;
    color: #000;
}

/* Mini-Sterne fuer Listen/Karten */
.tv-star-sm {
    font-size: 0.75rem;
    color: #555;
    line-height: 1;
}
.tv-star-sm.active {
    color: #f5c518;
}
.tv-card-stars {
    white-space: nowrap;
}
.tv-list-rating {
    min-width: 70px;
    white-space: nowrap;
}

/* Rating-Filter Dropdown */
.tv-rating-filter {
    min-width: 100px;
}

/* Responsive: Rating kleiner auf Handy */
@media (max-width: 480px) {
    .tv-rating-section {
        gap: 0.5rem;
    }
    .tv-stars-input .tv-star {
        font-size: 1.3rem;
    }
    .tv-rating-label {
        font-size: 0.75rem;
    }
    .tv-list-rating {
        display: none;
    }
}

/* === Alphabet-Seitenleiste === */
.tv-alpha-sidebar {
    position: fixed;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 50;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 6px 4px;
}
.tv-alpha-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 36px;
    font-size: 1.1rem;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
    font-weight: 700;
    user-select: none;
}
.tv-alpha-letter:hover { color: var(--text); background: var(--bg-hover); }
.tv-alpha-letter:focus { outline: var(--focus-ring); outline-offset: 2px; }
.tv-alpha-letter.active { color: #000; background: var(--accent); }
.tv-alpha-letter.dimmed { color: var(--border); opacity: 0.4; }

@media (max-width: 768px) {
    .tv-alpha-sidebar { right: 4px; padding: 4px 2px; }
    .tv-alpha-letter { width: 32px; height: 26px; font-size: 0.85rem; }
}
@media (max-width: 480px) {
    .tv-alpha-sidebar { right: 2px; padding: 3px 1px; }
    .tv-alpha-letter { width: 24px; height: 20px; font-size: 0.7rem; }
}

/* ============================================================
   Phase 3-6: Post-Play, Gelbe Tabs, Episode Grid, Animationen
   ============================================================ */

/* --- Gelbe Staffel-Tabs bei komplett gesehen (Phase 4) --- */
.tv-tab-complete {
    background: #b8860b !important;
    color: #fff !important;
    border-color: #9a7209 !important;
}
.tv-tab-complete:hover, .tv-tab-complete:focus {
    background: #d4a017 !important;
}
.tv-tab-complete.active {
    background: #d4a017 !important;
    border-color: #d4a017 !important;
}
.tv-tab-check {
    margin-left: 0.3rem;
    font-size: 0.75rem;
}

/* Serie als gesehen markieren - Button */
.tv-mark-series-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s, border-color 0.2s;
}
.tv-mark-series-btn:hover,
.tv-mark-series-btn:focus {
    background: var(--bg-hover);
    border-color: var(--accent);
}
.tv-mark-series-btn.active {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}

/* --- Episode Card-Grid (Phase 5, Plex-Style) --- */
.tv-episode-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
    padding: 6px; /* Platz fuer Focus-Ring + Scale-Transform */
}
.tv-episode-tile {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.tv-episode-tile:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.tv-ep-tile-link {
    display: block;
    color: var(--text);
    text-decoration: none;
}
.tv-ep-tile-link:focus {
    outline: none;
}
.tv-ep-tile-link:focus .tv-ep-thumb {
    outline: none;
}
.tv-episode-tile:focus-within {
    transform: scale(1.05);
    box-shadow: 0 0 0 3px var(--accent), 0 6px 20px rgba(0,0,0,0.5);
}
.tv-ep-tile-label {
    padding: 0.4rem 0.5rem;
    font-size: 0.82rem;
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    overflow: hidden;
}
.tv-ep-tile-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-muted);
    font-size: 0.78rem;
}
.tv-ep-tile-mark {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.5);
    background: rgba(0,0,0,0.5);
    color: rgba(255,255,255,0.6);
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
    z-index: 2;
}
/* TV-Geraete (kein Hover): Mark-Button immer leicht sichtbar */
@media (hover: none) {
    .tv-ep-tile-mark {
        opacity: 0.5;
    }
}
.tv-episode-tile:hover .tv-ep-tile-mark,
.tv-episode-tile:focus-within .tv-ep-tile-mark,
.tv-ep-tile-mark:focus {
    opacity: 1;
}
.tv-ep-tile-mark.active {
    opacity: 1;
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.tv-ep-tile-mark:hover, .tv-ep-tile-mark:focus {
    border-color: var(--accent);
    color: var(--accent);
    opacity: 1;
}
.tv-ep-tile-mark:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Detail-Panel oben (zeigt Beschreibung der fokussierten Episode) */
.tv-ep-detail-panel {
    background: var(--bg-card);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    min-height: 60px;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
    padding: 0 1rem;
}
.tv-ep-detail-panel.visible {
    max-height: 200px;
    opacity: 1;
    padding: 0.8rem 1rem;
}
.tv-ep-detail-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}
.tv-ep-detail-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.tv-ep-detail-meta {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 0.3rem;
}

/* --- Post-Play: Naechste Episode Countdown auf Karte (Phase 3) --- */
.tv-ep-next-loading {
    border: 2px solid var(--accent);
    animation: pulse-border 1.5s ease-in-out infinite;
    transform: scale(1.05);
    z-index: 5;
}
.tv-ep-countdown-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.75);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 3;
    animation: fadeIn 0.3s ease;
}
.tv-ep-countdown-num {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1;
}
.tv-ep-countdown-label {
    font-size: 0.8rem;
    color: #ccc;
    margin-top: 0.3rem;
}
@keyframes pulse-border {
    0%, 100% { border-color: var(--accent); box-shadow: 0 0 8px rgba(229,160,13,0.3); }
    50% { border-color: rgba(229,160,13,0.3); box-shadow: none; }
}

/* --- Weiche Uebergangseffekte (Phase 6) --- */

/* Seiten-Fade-In */
.tv-section {
    animation: fadeSlideIn 0.3s ease;
}
@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Player Fade-In */
.player-wrapper {
    animation: fadeIn 0.5s ease;
}

/* Serien/Film-Karten Hover-Scale */
.tv-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.tv-card:hover, .tv-card:focus-within {
    transform: scale(1.04);
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

/* Staffel-Tab-Wechsel: Sections sanft einblenden */
.tv-season {
    animation: fadeIn 0.2s ease;
}

/* Episode-Tile Duplikat-Markierung */
.tv-episode-tile.tv-ep-duplicate {
    border-left: 3px solid var(--warn, #ff9800);
}
.tv-episode-tile .tv-ep-dup-badge {
    font-size: 0.6rem;
    background: var(--warn, #ff9800);
    color: #000;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 600;
}
.tv-episode-tile.tv-ep-seen { opacity: 0.6; }
.tv-episode-tile.tv-ep-seen:hover,
.tv-episode-tile.tv-ep-seen:focus-within { opacity: 1; }

/* Responsive: Episode-Grid */
@media (min-width: 1200px) {
    .tv-episode-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
}
@media (max-width: 768px) {
    .tv-episode-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.5rem; }
    .tv-ep-tile-label { font-size: 0.75rem; padding: 0.3rem; }
    .tv-ep-detail-panel.visible { max-height: 150px; }
    .tv-ep-detail-desc { -webkit-line-clamp: 2; }
}
@media (max-width: 480px) {
    .tv-episode-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 0.4rem; }
    .tv-ep-tile-label { font-size: 0.7rem; }
    .tv-ep-tile-mark { width: 24px; height: 24px; font-size: 0.7rem; }
}

/* === Untertitel-Stil (CSS-Variablen aus User-Settings) === */
video::cue {
    font-size: var(--sub-size, 1.1em);
    color: var(--sub-color, #ffffff);
    background: rgba(0, 0, 0, var(--sub-bg, 0.5));
    line-height: 1.4;
}

/* === Intro-Skip Button === */
.intro-skip-btn {
    position: fixed;
    bottom: 100px;
    right: 40px;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.6);
    color: #fff;
    padding: 0.6rem 1.5rem;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    z-index: 9000;
    backdrop-filter: blur(8px);
    transition: all 0.2s ease;
    animation: intro-fade-in 0.3s ease;
}
.intro-skip-btn:hover, .intro-skip-btn:focus {
    background: rgba(255, 255, 255, 0.3);
    border-color: #fff;
    outline: none;
    transform: scale(1.05);
}
@keyframes intro-fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === Kontextmenue (Rot-Taste) === */
.tv-context-menu {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(10, 10, 10, 0.96);
    border-top: 2px solid var(--accent, #1976d2);
    z-index: 9999;
    padding: 1rem 2rem 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
    animation: ctx-slide-up 0.2s ease;
}
@keyframes ctx-slide-up {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.tv-ctx-title {
    color: #aaa;
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #333;
}
.tv-ctx-items {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.tv-ctx-item {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    border: 2px solid transparent;
    border-radius: 6px;
    color: #e0e0e0;
    padding: 0.6rem 1rem;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.15s ease;
}
.tv-ctx-item:hover, .tv-ctx-item:focus {
    background: rgba(25, 118, 210, 0.2);
    border-color: var(--accent, #1976d2);
    color: #fff;
    outline: none;
}
.tv-ctx-confirm-msg {
    color: #ffa726;
    font-size: 1rem;
    padding: 0.5rem 1rem;
    margin-bottom: 0.5rem;
}
.tv-ctx-confirm-yes:hover, .tv-ctx-confirm-yes:focus {
    background: rgba(239, 83, 80, 0.3);
    border-color: #ef5350;
}
