/* ==========================================================================
   Color Palette Tokens (hardcoded for Chromium 38 compat — no var())
   ==========================================================================
   --bg-base:        #08080f    Body background
   --bg-surface:     #0f0f18    Sidebar, modal, controls bar
   --bg-elevated:    #161620    Channel items, inputs
   --bg-hover:       #1e1e2c    Hover/focus backgrounds
   --accent:         #2979ff    Primary accent (brighter blue)
   --accent-bright:  #448aff    Text accent, active borders
   --accent-glow:    rgba(41,121,255,0.4)  Focus glow
   --text-primary:   #e8e8f0    Off-white text
   --text-secondary: rgba(232,232,240,0.6)  Muted text
   --text-tertiary:  rgba(232,232,240,0.35) Dimmed text
   --border-subtle:  rgba(255,255,255,0.06) Subtle dividers
   --border-default: rgba(255,255,255,0.10) Standard borders
   --error-bg:       rgba(198,40,40,0.92)   Error states
   --safe-area:      48px       Overscan-safe margin
   ========================================================================== */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #08080f;
    color: #e8e8f0;
    overflow: hidden;
    width: 1920px;
    height: 1080px;
}

/* App Container */
#app {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: #0c0c14;
    padding: 20px 48px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.app-title {
    font-size: 42px;
    font-weight: 700;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.5);
}

.header-info {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 24px;
}

.separator {
    opacity: 0.5;
}

/* Main Content */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 450px;
    background: #0f0f18;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    transition: transform 200ms ease-out;
}

.sidebar.hidden {
    transform: translateX(-100%);
}

.sidebar-header {
    padding: 25px 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.back-indicator {
    font-size: 32px;
    font-weight: 700;
    color: #2979ff;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background-color 150ms ease-out;
}

.back-indicator:hover {
    background: #1e1e2c;
}

.back-indicator.hidden {
    display: none;
}

.sidebar-header h2 {
    font-size: 32px;
    font-weight: 600;
}

.icon-btn {
    background: #161620;
    border: none;
    color: #e8e8f0;
    font-size: 28px;
    padding: 10px 15px;
    cursor: pointer;
    border-radius: 8px;
    transition: background-color 150ms ease-out, transform 150ms ease-out;
}

.icon-btn:hover {
    background: #1e1e2c;
    transform: scale(1.1);
}

/* Search */
.search-container {
    padding: 20px 30px;
}

.search-input {
    width: 100%;
    padding: 15px 20px;
    font-size: 20px;
    background: #161620;
    border: 2px solid rgba(255, 255, 255, 0.10);
    color: #e8e8f0;
    border-radius: 8px;
    transition: border-color 150ms ease-out, background-color 150ms ease-out;
}

.search-input:focus {
    border-color: #2979ff;
    background: #1e1e2c;
}

.search-input::placeholder {
    color: rgba(232, 232, 240, 0.35);
}

/* Content Type Tabs */
.content-type-tabs {
    display: flex;
    gap: 8px;
    padding: 15px 30px 10px 30px;
}

.content-type-tabs.hidden {
    display: none;
}

.content-tab {
    flex: 1;
    padding: 14px 20px;
    font-size: 20px;
    background: #161620;
    border: 2px solid rgba(255, 255, 255, 0.10);
    color: rgba(232, 232, 240, 0.6);
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 150ms ease-out, border-color 150ms ease-out, color 150ms ease-out;
}

.content-tab:hover {
    background: #1e1e2c;
    color: #e8e8f0;
}

.content-tab.active {
    background: #2979ff;
    border-color: #2979ff;
    color: #e8e8f0;
}

/* Category Filter */
.category-filter {
    display: flex;
    gap: 10px;
    padding: 0 30px 20px 30px;
}

.filter-btn {
    flex: 1;
    padding: 12px 20px;
    font-size: 18px;
    background: #161620;
    border: 2px solid rgba(255, 255, 255, 0.10);
    color: #e8e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 150ms ease-out, border-color 150ms ease-out;
}

.filter-btn:hover {
    background: #1e1e2c;
}

.filter-btn.active {
    background: #2979ff;
    border-color: #2979ff;
}

/* Channel List */
.channel-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px 20px;
}

.channel-item {
    display: flex;
    align-items: center;
    padding: 22px 24px;
    margin-bottom: 10px;
    background: #161620;
    border: 2px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 150ms ease-out, border-color 150ms ease-out, transform 150ms ease-out;
}

.channel-item:hover {
    background: #1e1e2c;
    border-color: #2979ff;
}

.channel-item.active {
    background: linear-gradient(90deg, #1565c0 0%, #1976d2 100%);
    border-color: #448aff;
}

.channel-item.favorite::before {
    content: '\2605';
    margin-right: 10px;
    font-size: 22px;
}

.channel-number {
    font-size: 26px;
    font-weight: 700;
    min-width: 60px;
    color: #448aff;
}

.channel-details {
    flex: 1;
}

.channel-title {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 5px;
}

.channel-group {
    font-size: 18px;
    color: rgba(232, 232, 240, 0.6);
}

/* Category Items */
.category-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 24px;
    margin-bottom: 10px;
    background: #161620;
    border: 2px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 150ms ease-out, border-color 150ms ease-out, transform 150ms ease-out;
}

.category-item:hover {
    background: #1e1e2c;
    border-color: #2979ff;
}

.category-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.category-title {
    font-size: 24px;
    font-weight: 600;
}

.category-count {
    font-size: 18px;
    color: rgba(232, 232, 240, 0.6);
}

.category-arrow {
    font-size: 28px;
    color: rgba(232, 232, 240, 0.35);
}

/* Series list favorite star */
.series-list-item.favorite .category-title::before {
    content: '\2605 ';
    color: #448aff;
}

/* Scrollbar Styling */
.channel-list::-webkit-scrollbar {
    width: 6px;
}

.channel-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 3px;
}

.channel-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

.channel-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Player Area */
.player-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.video-container {
    flex: 1;
    position: relative;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* Video Overlay */
.video-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 40px 48px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, transparent 100%);
    transition: opacity 200ms ease-out;
}

.video-overlay.controls-hidden {
    opacity: 0;
    pointer-events: none;
}

.channel-info {
    margin-bottom: 20px;
}

.channel-name {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.8);
}

.program-info {
    margin-top: 20px;
}

.program-title {
    font-size: 28px;
    margin-bottom: 15px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: #2979ff;
    width: 0%;
    transition: width 300ms ease;
}

.program-time {
    font-size: 20px;
    color: rgba(232, 232, 240, 0.6);
}

/* Loading Indicator */
.loading-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.loading-indicator.hidden {
    display: none;
}

.spinner {
    width: 80px;
    height: 80px;
    border: 6px solid rgba(255, 255, 255, 0.08);
    border-top-color: #2979ff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
}

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

/* Error Message */
.error-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    background: rgba(198, 40, 40, 0.92);
    padding: 40px 60px;
    border-radius: 15px;
    max-width: 600px;
}

.error-message.hidden {
    display: none;
}

.error-message p {
    font-size: 32px;
    margin-bottom: 15px;
}

.error-message small {
    font-size: 20px;
    color: rgba(232, 232, 240, 0.6);
}

/* No Channel Message */
.no-channel-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    max-width: 800px;
}

.welcome-content h2 {
    font-size: 48px;
    margin-bottom: 20px;
    color: #2979ff;
}

.welcome-content p {
    font-size: 28px;
    margin-bottom: 40px;
    color: rgba(232, 232, 240, 0.6);
}

.instructions {
    text-align: left;
    background: #161620;
    padding: 30px;
    border-radius: 15px;
}

.instructions p {
    font-size: 24px;
    margin-bottom: 15px;
}

.instructions ul {
    list-style: none;
}

.instructions li {
    font-size: 22px;
    padding: 10px 0;
    color: rgba(232, 232, 240, 0.6);
}

.instructions strong {
    color: #448aff;
}

/* Player Controls Overlay */
.player-controls-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.92) 0%, transparent 100%);
    z-index: 10;
    opacity: 1;
    transition: opacity 200ms ease-out;
}

/* Use controls-hidden for fade (avoids global .hidden display:none !important) */
.player-controls-overlay.controls-hidden {
    opacity: 0;
    pointer-events: none;
}

.controls-bar {
    padding: 20px 48px 20px;
}

/* Seek Bar Row */
.seek-bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.seek-bar-row.hidden {
    display: none;
}

.time-display {
    font-size: 20px;
    color: #e8e8f0;
    min-width: 60px;
    text-align: center;
}

.seek-bar-container {
    flex: 1;
    position: relative;
    height: 8px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    cursor: pointer;
}

.seek-bar-buffered {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    width: 0%;
    pointer-events: none;
}

.seek-bar-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: #2979ff;
    border-radius: 4px;
    width: 0%;
    pointer-events: none;
}

.seek-bar {
    position: absolute;
    top: -8px;
    left: 0;
    width: 100%;
    height: 24px;
    -webkit-appearance: none;
    background: transparent;
    margin: 0;
    cursor: pointer;
    z-index: 2;
}

.seek-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #2979ff;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #e8e8f0;
}

/* Controls Buttons Row */
.controls-buttons-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.controls-group-left,
.controls-group-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.controls-group-right {
    position: relative;
}

.control-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.10);
    color: #e8e8f0;
    font-size: 28px;
    padding: 15px 25px;
    cursor: pointer;
    border-radius: 8px;
    transition: background-color 150ms ease-out, transform 150ms ease-out;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: #2979ff;
}

.control-btn.hidden {
    display: none;
}

.volume-control {
    width: 120px;
}

.volume-control input[type="range"] {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    outline: none;
    -webkit-appearance: none;
}

.volume-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    background: #2979ff;
    border-radius: 50%;
    cursor: pointer;
}

/* Quality Menu */
.quality-menu {
    position: absolute;
    bottom: 100%;
    right: 0;
    background: #161620;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 8px;
    padding: 8px 0;
    min-width: 160px;
    margin-bottom: 10px;
    z-index: 20;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
}

.quality-menu.hidden {
    display: none;
}

.quality-option {
    display: block;
    width: 100%;
    padding: 12px 20px;
    font-size: 20px;
    background: none;
    border: none;
    color: #e8e8f0;
    text-align: left;
    cursor: pointer;
    transition: background-color 150ms ease-out;
}

.quality-option:hover,
.quality-option:focus {
    background: #1e1e2c;
}

.quality-option.active {
    color: #2979ff;
    font-weight: 600;
}

/* Volume OSD */
.volume-osd {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(0, 0, 0, 0.85);
    padding: 20px 32px;
    border-radius: 12px;
    z-index: 15;
    pointer-events: none;
}

.volume-osd.hidden {
    display: none;
}

.volume-osd-icon {
    font-size: 36px;
}

.volume-osd-bar {
    width: 160px;
    height: 8px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    overflow: hidden;
}

.volume-osd-fill {
    height: 100%;
    background: #2979ff;
    border-radius: 4px;
    width: 100%;
    transition: width 100ms ease-out;
}

.volume-osd-value {
    font-size: 24px;
    color: #e8e8f0;
    min-width: 52px;
    text-align: right;
}

/* Seek OSD */
.seek-osd {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.85);
    padding: 20px 36px;
    border-radius: 12px;
    font-size: 36px;
    font-weight: 700;
    color: #e8e8f0;
    z-index: 15;
    pointer-events: none;
}

.seek-osd.hidden {
    display: none;
}

/* Subtitle Display Overlay */
.subtitle-display {
    position: absolute;
    bottom: 80px;
    left: 10%;
    right: 10%;
    text-align: center;
    z-index: 12;
    pointer-events: none;
}

.subtitle-display.hidden {
    display: none;
}

.subtitle-display span {
    display: inline;
    background: rgba(0, 0, 0, 0.75);
    color: #e8e8f0;
    padding: 4px 12px;
    border-radius: 4px;
    line-height: 1.4;
}

.subtitle-display.subtitle-small span {
    font-size: 24px;
}

.subtitle-display.subtitle-medium span {
    font-size: 32px;
}

.subtitle-display.subtitle-large span {
    font-size: 42px;
}

video::cue {
    background: rgba(0, 0, 0, 0.75);
    color: #e8e8f0;
    font-size: 32px;
}

/* Resume Prompt */
.resume-prompt {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(15, 15, 24, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.10);
    padding: 30px 40px;
    border-radius: 15px;
    text-align: center;
    z-index: 20;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7);
}

.resume-prompt.hidden {
    display: none;
}

.resume-prompt p {
    font-size: 28px;
    margin-bottom: 24px;
    color: #e8e8f0;
}

.resume-prompt-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #0f0f18;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 15px;
    max-width: 900px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.7);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px 40px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.modal-header h2 {
    font-size: 36px;
}

.close-btn {
    background: #161620;
    border: none;
    color: #e8e8f0;
    font-size: 32px;
    padding: 10px 20px;
    cursor: pointer;
    border-radius: 8px;
    transition: background-color 150ms ease-out;
}

.close-btn:hover {
    background: rgba(198, 40, 40, 0.8);
}

.modal-body {
    padding: 30px 40px;
}

.setting-group {
    margin-bottom: 30px;
}

.setting-group label {
    display: block;
    font-size: 22px;
    margin-bottom: 10px;
    color: rgba(232, 232, 240, 0.6);
}

.input-field {
    width: 100%;
    padding: 15px 20px;
    font-size: 20px;
    background: #161620;
    border: 2px solid rgba(255, 255, 255, 0.10);
    color: #e8e8f0;
    border-radius: 8px;
    margin-bottom: 15px;
}

.input-field:focus {
    border-color: #2979ff;
    background: #1e1e2c;
}

.select-field {
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    background-image: none;
}

.btn-primary,
.btn-secondary {
    padding: 15px 30px;
    font-size: 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 150ms ease-out, transform 150ms ease-out;
    margin-right: 10px;
}

.btn-primary {
    background: #2979ff;
    color: #e8e8f0;
}

.btn-primary:hover {
    background: #1565c0;
    transform: scale(1.05);
}

.btn-secondary {
    background: #161620;
    color: #e8e8f0;
    border: 2px solid rgba(255, 255, 255, 0.10);
}

.btn-secondary:hover {
    background: #1e1e2c;
}

/* Source Mode Toggle */
.source-toggle {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.mode-btn {
    flex: 1;
    padding: 15px 30px;
    font-size: 20px;
    background: #161620;
    border: 2px solid rgba(255, 255, 255, 0.10);
    color: #e8e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 150ms ease-out, border-color 150ms ease-out;
}

.mode-btn:hover {
    background: #1e1e2c;
}

.mode-btn.active {
    background: #2979ff;
    border-color: #2979ff;
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: #161620;
    color: #e8e8f0;
    padding: 20px 40px;
    border-radius: 10px;
    border-left: 4px solid #2979ff;
    font-size: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    z-index: 2000;
    animation: slideUp 300ms ease-out;
}

.toast.hidden {
    display: none;
}

@keyframes slideUp {
    from {
        transform: translate(-50%, 100px);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

/* Loading State */
.loading {
    text-align: center;
    padding: 40px;
    font-size: 24px;
    color: rgba(232, 232, 240, 0.6);
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* ==========================================================================
   Unified Focus System for TV Remote
   ========================================================================== */
button:focus,
input:focus,
.channel-item:focus,
.category-item:focus,
.content-tab:focus {
    outline: 4px solid #2979ff;
    outline-offset: 3px;
    box-shadow: 0 0 0 6px rgba(41, 121, 255, 0.4);
}

.channel-item:focus,
.category-item:focus,
.episode-item:focus {
    background: #1e1e2c;
    border-color: #2979ff;
    transform: translateX(8px);
}

/* ==========================================================================
   Sidebar Toggle Button (hidden by default — shown on responsive breakpoints)
   ========================================================================== */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: #e8e8f0;
    font-size: 32px;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 8px;
    line-height: 1;
}

.sidebar-toggle:hover {
    background: #1e1e2c;
}

/* ==========================================================================
   Sidebar Overlay Backdrop (hidden by default)
   ========================================================================== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 149;
}

.sidebar-overlay.active {
    display: block;
}

/* ==========================================================================
   Responsive Layout (scoped under body.responsive)
   ========================================================================== */
body.responsive {
    width: 100%;
    height: 100vh;
    height: 100dvh;
}

/* --- Desktop: up to 1919px --- */
@media screen and (max-width: 1919px) {
    body.responsive .sidebar {
        width: 380px;
    }

    body.responsive .app-title {
        font-size: 34px;
    }

    body.responsive .header {
        padding: 16px 32px;
    }

    body.responsive .header-info {
        font-size: 20px;
    }

    body.responsive .sidebar-header h2 {
        font-size: 26px;
    }

    body.responsive .channel-name {
        font-size: 38px;
    }

    body.responsive .channel-title {
        font-size: 20px;
    }

    body.responsive .channel-number {
        font-size: 22px;
        min-width: 48px;
    }

    body.responsive .category-title {
        font-size: 20px;
    }

    body.responsive .channel-item {
        padding: 16px 20px;
        margin-bottom: 8px;
    }

    body.responsive .category-item {
        padding: 16px 20px;
        margin-bottom: 8px;
    }

    body.responsive .video-overlay {
        padding: 30px 32px;
    }

    body.responsive .controls-bar {
        padding: 16px 32px;
    }

    body.responsive .time-display {
        font-size: 18px;
        font-variant-numeric: tabular-nums;
    }

    body.responsive .volume-control {
        width: 100px;
    }
}

/* --- Tablet: up to 1023px --- */
@media screen and (max-width: 1023px) {
    body.responsive .sidebar-toggle {
        display: block;
    }

    body.responsive .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 380px;
        max-width: 85vw;
        z-index: 150;
        transform: translateX(-100%);
    }

    body.responsive .sidebar.open {
        transform: translateX(0);
    }

    body.responsive .app-title {
        font-size: 28px;
    }

    body.responsive .header {
        padding: 12px 20px;
    }

    body.responsive .header-info {
        font-size: 18px;
        gap: 12px;
    }

    body.responsive .sidebar-header {
        padding: 20px 24px;
    }

    body.responsive .sidebar-header h2 {
        font-size: 24px;
    }

    body.responsive .search-container {
        padding: 16px 24px;
    }

    body.responsive .search-input {
        font-size: 18px;
        padding: 12px 16px;
    }

    body.responsive .content-type-tabs {
        padding: 12px 24px 8px 24px;
    }

    body.responsive .content-tab {
        padding: 12px 16px;
        font-size: 18px;
    }

    body.responsive .category-filter {
        padding: 0 24px 16px 24px;
    }

    body.responsive .channel-list {
        padding: 8px 16px;
    }

    body.responsive .channel-name {
        font-size: 32px;
    }

    body.responsive .program-title {
        font-size: 22px;
    }

    body.responsive .video-overlay {
        padding: 24px 20px;
    }

    body.responsive .welcome-content h2 {
        font-size: 36px;
    }

    body.responsive .welcome-content p {
        font-size: 22px;
    }

    body.responsive .instructions {
        padding: 20px;
    }

    body.responsive .instructions p {
        font-size: 20px;
    }

    body.responsive .instructions li {
        font-size: 18px;
    }

    body.responsive .error-message {
        padding: 30px 40px;
        max-width: 90%;
    }

    body.responsive .error-message p {
        font-size: 26px;
    }

    body.responsive .controls-bar {
        padding: 12px 20px;
    }

    body.responsive .controls-group-left,
    body.responsive .controls-group-right {
        gap: 8px;
    }

    body.responsive .control-btn {
        font-size: 24px;
        padding: 12px 20px;
    }

    body.responsive .seek-bar-row {
        gap: 8px;
        margin-bottom: 8px;
    }

    body.responsive .time-display {
        font-size: 16px;
        min-width: 48px;
    }

    body.responsive .volume-control {
        width: 80px;
    }

    body.responsive .subtitle-display {
        bottom: 60px;
    }

    body.responsive .subtitle-display.subtitle-small span {
        font-size: 20px;
    }

    body.responsive .subtitle-display.subtitle-medium span {
        font-size: 26px;
    }

    body.responsive .subtitle-display.subtitle-large span {
        font-size: 34px;
    }

    body.responsive .seek-osd {
        font-size: 28px;
        padding: 16px 28px;
    }

    body.responsive .volume-osd {
        padding: 16px 24px;
        gap: 12px;
    }

    body.responsive .volume-osd-icon {
        font-size: 28px;
    }

    body.responsive .volume-osd-bar {
        width: 120px;
    }

    body.responsive .volume-osd-value {
        font-size: 20px;
    }

    body.responsive .resume-prompt {
        padding: 24px 28px;
        max-width: 90%;
    }

    body.responsive .resume-prompt p {
        font-size: 22px;
    }

    body.responsive .toast {
        font-size: 20px;
        padding: 16px 28px;
        bottom: 80px;
    }

    /* Touch-friendly targets */
    body.responsive .channel-item,
    body.responsive .category-item,
    body.responsive .filter-btn,
    body.responsive .content-tab,
    body.responsive .control-btn,
    body.responsive .icon-btn,
    body.responsive .mode-btn,
    body.responsive .btn-primary,
    body.responsive .btn-secondary {
        min-height: 44px;
    }

    /* Softer focus styles for touch devices */
    body.responsive .channel-item:focus,
    body.responsive .category-item:focus,
    body.responsive .episode-item:focus {
        outline-width: 3px;
        outline-offset: 2px;
        transform: none;
    }

    /* Modal adjustments */
    body.responsive .modal-content {
        width: 95%;
        max-height: 85vh;
    }

    body.responsive .modal-header {
        padding: 20px 24px;
    }

    body.responsive .modal-header h2 {
        font-size: 28px;
    }

    body.responsive .modal-body {
        padding: 20px 24px;
    }
}

/* --- Mobile: up to 767px --- */
@media screen and (max-width: 767px) {
    body.responsive .sidebar {
        width: 100%;
        max-width: 100%;
    }

    body.responsive .app-title {
        font-size: 22px;
    }

    body.responsive .header {
        padding: 10px 16px;
    }

    body.responsive .header-info {
        font-size: 16px;
        gap: 8px;
    }

    body.responsive .sidebar-header {
        padding: 16px 20px;
    }

    body.responsive .sidebar-header h2 {
        font-size: 22px;
    }

    body.responsive .search-container {
        padding: 12px 20px;
    }

    body.responsive .search-input {
        font-size: 16px;
        padding: 12px 14px;
    }

    body.responsive .content-type-tabs {
        padding: 10px 20px 8px 20px;
    }

    body.responsive .content-tab {
        padding: 10px 12px;
        font-size: 16px;
    }

    body.responsive .category-filter {
        padding: 0 20px 12px 20px;
    }

    body.responsive .filter-btn {
        font-size: 16px;
        padding: 10px 14px;
    }

    body.responsive .channel-list {
        padding: 6px 12px;
    }

    body.responsive .channel-item {
        padding: 14px 16px;
        margin-bottom: 6px;
    }

    body.responsive .category-item {
        padding: 14px 16px;
        margin-bottom: 6px;
    }

    body.responsive .channel-number {
        font-size: 18px;
        min-width: 40px;
    }

    body.responsive .channel-title {
        font-size: 18px;
    }

    body.responsive .channel-group {
        font-size: 15px;
    }

    body.responsive .category-title {
        font-size: 18px;
    }

    body.responsive .category-count {
        font-size: 15px;
    }

    body.responsive .channel-name {
        font-size: 26px;
    }

    body.responsive .program-title {
        font-size: 18px;
    }

    body.responsive .video-overlay {
        padding: 20px 16px;
    }

    body.responsive .welcome-content h2 {
        font-size: 28px;
    }

    body.responsive .welcome-content p {
        font-size: 18px;
        margin-bottom: 24px;
    }

    body.responsive .no-channel-message {
        max-width: 90%;
    }

    body.responsive .instructions {
        padding: 16px;
    }

    body.responsive .instructions p {
        font-size: 18px;
    }

    body.responsive .instructions li {
        font-size: 16px;
        padding: 8px 0;
    }

    body.responsive .error-message {
        padding: 24px 28px;
    }

    body.responsive .error-message p {
        font-size: 22px;
    }

    body.responsive .error-message small {
        font-size: 16px;
    }

    body.responsive .controls-bar {
        padding: 10px 16px;
    }

    body.responsive .controls-group-left,
    body.responsive .controls-group-right {
        gap: 6px;
    }

    body.responsive .control-btn {
        font-size: 22px;
        padding: 10px 16px;
    }

    body.responsive .seek-bar-row {
        gap: 6px;
        margin-bottom: 6px;
    }

    body.responsive .time-display {
        font-size: 14px;
        min-width: 42px;
    }

    body.responsive .volume-control {
        width: 60px;
    }

    body.responsive .subtitle-display {
        bottom: 50px;
        left: 5%;
        right: 5%;
    }

    body.responsive .subtitle-display.subtitle-small span {
        font-size: 16px;
    }

    body.responsive .subtitle-display.subtitle-medium span {
        font-size: 22px;
    }

    body.responsive .subtitle-display.subtitle-large span {
        font-size: 28px;
    }

    body.responsive .seek-osd {
        font-size: 24px;
        padding: 14px 22px;
    }

    body.responsive .volume-osd {
        padding: 12px 20px;
        gap: 10px;
    }

    body.responsive .volume-osd-icon {
        font-size: 24px;
    }

    body.responsive .volume-osd-bar {
        width: 100px;
    }

    body.responsive .volume-osd-value {
        font-size: 18px;
    }

    body.responsive .resume-prompt p {
        font-size: 18px;
        margin-bottom: 16px;
    }

    body.responsive .resume-prompt-buttons {
        gap: 10px;
    }

    body.responsive .quality-option {
        font-size: 18px;
        padding: 10px 16px;
    }

    body.responsive .toast {
        font-size: 18px;
        padding: 14px 24px;
        bottom: 60px;
        max-width: 90%;
    }

    body.responsive .modal-content {
        width: 98%;
        max-height: 90vh;
        border-radius: 10px;
    }

    body.responsive .modal-header {
        padding: 16px 20px;
    }

    body.responsive .modal-header h2 {
        font-size: 24px;
    }

    body.responsive .modal-body {
        padding: 16px 20px;
    }

    body.responsive .setting-group label {
        font-size: 18px;
    }

    body.responsive .input-field {
        font-size: 16px;
        padding: 12px 16px;
    }

    body.responsive .btn-primary,
    body.responsive .btn-secondary {
        font-size: 16px;
        padding: 12px 24px;
    }

    body.responsive .mode-btn {
        font-size: 16px;
        padding: 12px 20px;
    }
}

/* --- Small Mobile: up to 479px --- */
@media screen and (max-width: 479px) {
    body.responsive .app-title {
        font-size: 18px;
    }

    body.responsive .header {
        padding: 8px 12px;
    }

    body.responsive .header-info {
        font-size: 14px;
        gap: 6px;
    }

    body.responsive .sidebar-header h2 {
        font-size: 20px;
    }

    body.responsive .channel-name {
        font-size: 22px;
    }

    body.responsive .welcome-content h2 {
        font-size: 24px;
    }

    body.responsive .welcome-content p {
        font-size: 16px;
    }
}

/* Responsive adjustments for different TV resolutions */
@media screen and (max-width: 1280px) {
    body {
        width: 1280px;
        height: 720px;
    }

    .app-title {
        font-size: 32px;
    }

    .sidebar {
        width: 350px;
    }

    .channel-name {
        font-size: 36px;
    }

    .category-title {
        font-size: 20px;
    }

    .category-count {
        font-size: 16px;
    }

    .category-item {
        padding: 18px 20px;
    }
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
    .channel-item:focus,
    .category-item:focus,
    .episode-item:focus { transform: none; }
}
