/* Shared LightTV design system. */
        #deleteModal { display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, 0.72); z-index: 9999; align-items: center; justify-content: center; padding: 20px; }
        .modal-content { width: min(100%, 420px); background: var(--panel-strong); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
        .modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }
        .modal-header h3 { margin: 0; font-size: 1.1rem; font-weight: 600; color: var(--text); }
        .close { cursor: pointer; color: var(--text-muted); font-size: 1.8rem; line-height: 1; }
        .close:hover { color: var(--text); }
        .modal-body { padding: 20px; color: var(--text-soft); font-size: 0.96rem; }
        .modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 0 20px 20px; }
        .btn { border: 1px solid var(--border); background: var(--panel); color: var(--text); border-radius: 10px; padding: 10px 16px; cursor: pointer; transition: all 0.2s ease; }
        .btn:hover { border-color: rgba(65, 172, 82, 0.5); color: var(--text); }
        .btn-danger { background: #ef4444; border-color: #ef4444; color: white; }
        .btn-danger:hover { background: #dc2626; border-color: #dc2626; }

:root, body[data-theme="light"] {
    color-scheme: light;
    --bg: #f7f8f6; --panel: #fff; --panel-strong: #fff; --bg-strong: #fff;
    --bg-elevated: #eef1ed; --input: #f8f9f7;
    --text: #202b27; --text-soft: #59665f; --text-muted: #718078;
    --border: #e3e8e2; --brand: #23866d; --brand-strong: #196b56;
    --brand-soft: #e8f3ed; --shadow: 0 8px 32px rgba(25, 49, 36, .035);
}
body[data-theme="dark"] {
    color-scheme: dark;
    --bg: #111715; --panel: #19211d; --panel-strong: #19211d; --bg-strong: #19211d;
    --bg-elevated: #222d26; --input: #141c17;
    --text: #e8eee9; --text-soft: #aab8ae; --text-muted: #8c9e92;
    --border: #2b3830; --brand: #79c7a0; --brand-strong: #99dbb8;
    --brand-soft: #253c30; --shadow: 0 8px 32px rgba(0, 0, 0, .08);
}
* { box-sizing: border-box; }
html { scroll-padding-top: 100px; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; -webkit-font-smoothing: antialiased; line-height: 1.65; }
body:not([data-page="login"]) { display: flex; flex-direction: column; min-height: 100vh; }
body > main { width: 100%; flex: 1; padding-top: 40px; padding-bottom: 72px; }
h1, h2, h3 { letter-spacing: -.035em; text-wrap: balance; }
h1 { line-height: 1.25; }
a, button, input, select { -webkit-tap-highlight-color: transparent; }
button, a { transition: background-color .18s, color .18s, border-color .18s, transform .18s; }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 4px; }
::selection { background: var(--brand-soft); color: var(--brand-strong); }
body .text-white, body .text-slate-100, body .text-slate-200 { color: var(--text); }
body .text-slate-300 { color: var(--text-soft); }
body .text-slate-400, body .text-slate-500 { color: var(--text-muted); }
body .text-brand { color: var(--brand); }
body .bg-slate-900, body .bg-slate-900\/90, body .bg-slate-900\/80, body .bg-slate-800 { background-color: var(--panel); }
body .bg-slate-950, body .bg-slate-950\/60 { background-color: var(--input); }
body .border-slate-700, body .border-slate-700\/80, body .border-slate-800, body .border-slate-600 { border-color: var(--border); }
body .shadow-soft { box-shadow: var(--shadow); }
body .bg-brand, body .action-button { background: #23866d; color: #fff; border: 1px solid transparent; box-shadow: none; }
body .bg-brand:hover, body .action-button:hover { background: #196b56; color: #fff; }
body .hover\:text-brand:hover { color: var(--brand); }
body .hover\:border-brand:hover { border-color: var(--brand); }
body .text-red-200, body .text-red-300, body .text-red-400 { color: #c34c50; }
body[data-theme="dark"] .text-red-200, body[data-theme="dark"] .text-red-300, body[data-theme="dark"] .text-red-400 { color: #f39a9a; }
body .text-green-300 { color: var(--brand); }
body .bg-red-500 { background: #b9474a; color: white; }
.topbar { background: var(--bg); border-bottom: 1px solid var(--border); }
.topbar > div { max-width: 1280px; min-height: 80px; }
.topbar > div > a { color: var(--text); letter-spacing: -.04em; gap: 9px; }
.topbar nav { gap: 8px; }
.topbar nav a { padding: 8px 16px; border-radius: 8px; }
.topbar nav a:hover, .topbar nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand-strong); }
.topbar nav a[href="/logout"] { color: var(--text-muted); margin-left: 20px; font-weight: 400; }
body .theme-toggle { border: 1px solid var(--border); background: var(--panel); color: var(--text-soft); box-shadow: none; min-height: 40px; border-radius: 10px; }
.theme-toggle:hover { background: var(--brand-soft); }
#themeIcon { font-size: 19px; line-height: 1; }
body .hamburger { display: none; gap: 5px; position: relative; z-index: 1001; }
.hamburger span { display: block; width: 21px; height: 2px; background: var(--text); transition: transform .2s; border-radius: 2px; }
.hamburger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.mobile-nav { position: fixed; top: 80px; bottom: 0; right: 0; width: min(320px, 86vw); background: var(--panel); border-left: 1px solid var(--border); z-index: 60; padding: 24px 12px; visibility: hidden; transform: translateX(100%); transition: transform .25s, visibility .25s; }
.mobile-nav.active { visibility: visible; transform: translateX(0); }
.nav-overlay { display: none; position: fixed; inset: 80px 0 0; background: rgba(7, 18, 12, .45); backdrop-filter: blur(3px); z-index: 50; }
.nav-overlay.active { display: block; }
.skip-link { position: fixed; top: -100px; left: 16px; z-index: 10000; padding: 12px 20px; background: var(--panel); border: 1px solid var(--brand); border-radius: 8px; }
.skip-link:focus { top: 12px; }
.eyebrow { font-size: 11px; letter-spacing: .2em; font-weight: 600; color: var(--brand); margin-bottom: 16px; }
.home-intro { text-align: center; padding: 40px 0 28px; }
.home-intro h1 { font-size: clamp(30px, 4vw, 48px); font-weight: 600; letter-spacing: -.055em; }
.home-intro h1 span { color: var(--brand); }
.intro-copy { margin-top: 16px; font-size: 14px; color: var(--text-muted); line-height: 1.8; }
.search-panel { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); }
.home-search { max-width: 720px; margin: 0 auto 64px; padding: 8px !important; }
.search-panel > div { flex-direction: row; gap: 8px; }
body input:not([type="checkbox"]):not([type="hidden"]), body select, body .search-input { min-width: 0; border: 1px solid var(--border); background: var(--input); color: var(--text); border-radius: 10px; min-height: 46px; box-shadow: none; }
body input[class]::placeholder { color: var(--text-muted); }
body input:focus, body select:focus { border-color: var(--brand); outline: 2px solid var(--brand-soft); outline-offset: 2px; box-shadow: none; }
body input[type="checkbox"] { accent-color: #23866d; }
.search-panel #searchInput { background: transparent; border-color: transparent; padding-left: 18px; width: 100%; }
.search-panel button { border-radius: 10px; padding: 12px 28px; flex-shrink: 0; }
#movieGrid, #seriesGrid, #latestGrid, #resultsGrid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 28px 22px; }
#hotMoviesSection, #hotSeriesSection, #latestSection { margin-bottom: 48px; }
#hotMoviesSection h2, #hotSeriesSection h2, #latestSection h2 { font-size: 22px; }
body .video-card { background: transparent; border: 0; border-radius: 0; box-shadow: none; overflow: visible; min-width: 0; transition: transform .2s; }
body .video-card:hover { transform: translateY(-4px); box-shadow: none; }
body .video-card img { width: 100%; height: auto; aspect-ratio: 2 / 3; object-fit: cover; display: block; border-radius: 12px; background: var(--bg-elevated); border: 1px solid var(--border); }
.video-card > div { padding: 14px 1px 0; }
.video-card > div > button:first-child { font-size: 15px; line-height: 1.5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
body .video-card .bg-brand { background: var(--brand-soft); color: var(--brand-strong); border: 0; border-radius: 6px; padding: 6px 10px; margin-top: 10px; }
body .video-card .bg-brand:hover { background: #23866d; color: white; }
.loading-panel, #loadingDiv, .empty-state { border: 1px dashed var(--border); border-radius: 16px; background: transparent; box-shadow: none; text-align: center; color: var(--text-soft); }
.empty-state { padding: 64px 24px; }
.empty-state p { color: var(--text-muted); margin: 12px 0 24px; font-size: 14px; }
.empty-state h2 { font-size: 22px; font-weight: 600; }
.empty-state .action-button { border-radius: 10px; padding: 10px 22px; }
.empty-symbol { display: block; font-size: 48px; color: var(--brand); margin-bottom: 16px; }
.loading-spinner { width: 30px; height: 30px; border: 2px solid var(--border); border-top-color: var(--brand); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }
#resultHeader { border: 0; border-bottom: 1px solid var(--border); border-radius: 0; padding: 0 0 24px; box-shadow: none; background: transparent; }
#pagination { flex-wrap: wrap; }
body > footer { background: transparent !important; border-color: var(--border); color: var(--text-muted); padding: 28px 24px; line-height: 1.9; }
footer p:first-child { max-width: 820px; margin-inline: auto; }
body[data-page="config"] main, body[data-page="test"] main { max-width: 960px; }
body[data-page="config"] main > div:first-child, .page-intro { margin: 8px 0 32px; }
.page-intro h1 { font-size: 32px; font-weight: 600; }
body[data-page="config"] form > section, body[data-page="test"] main > section, #api-test { padding: 28px; box-shadow: none; }
[id^="api-item-"] { background: var(--bg) !important; border-radius: 12px; }
[id^="api-item-"] > .config-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
[id^="api-item-"] > .config-fields > * { margin-top: 0; min-width: 0; }
[id^="api-item-"] > .config-fields > div:nth-child(2) { grid-column: 2; grid-row: 1; }
[id^="api-item-"] > .config-fields > label { align-self: center; }
[id^="api-item-"] > .config-fields > .text-right { grid-column: 1 / -1; padding-top: 16px; border-top: 1px solid var(--border); }
body[data-page="config"] form > div:last-child { box-shadow: none; background: transparent; border: 0; padding: 0; text-align: right; }
#resultBox { color: var(--text-soft); line-height: 1.8; }
.watch-heading { display: flex; justify-content: space-between; margin: 0 0 20px; font-size: 13px; color: var(--text-muted); }
.watch-heading a:hover { color: var(--brand); }
body #playerContainer { padding: 0; overflow: hidden; background: var(--panel); box-shadow: var(--shadow); }
body #videoPlayer { background: #050706; border-radius: 0; }
#loadingOverlay { background: rgba(0, 0, 0, .5); }
#playerContainer > div:nth-child(2) { border: 0; border-radius: 0; margin: 0; padding: 32px; background: var(--panel); }
#playerContainer img { width: 116px; height: 174px; box-shadow: none; }
#playerContainer h1 { font-size: 28px; }
#episodeList { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 10px; max-height: 280px; }
#episodeList button, #playTabs button { border-radius: 8px; min-height: 44px; }
#playTabs { padding-bottom: 24px; border-bottom: 1px solid var(--border); }
body[data-page="login"] main { padding: 24px; gap: clamp(40px, 8vw, 140px); max-width: 1440px; margin: auto; }
.login-story { align-self: stretch; position: relative; width: 51%; min-height: 700px; border-radius: 22px; background: #e9efe5; color: #284837; padding: 44px; overflow: hidden; display: flex; flex-direction: column; }
body[data-theme="dark"] .login-story { background: #20362a; color: #d4e4d5; }
.login-wordmark { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 650; letter-spacing: -.04em; }
.login-story-copy { margin-top: 68px; position: relative; z-index: 1; }
.login-story h1 { font-size: clamp(36px, 3.7vw, 56px); font-weight: 550; line-height: 1.35; }
.login-story-copy > p:last-child { font-size: 14px; line-height: 1.9; opacity: .7; margin-top: 24px; }
.cinema-art { width: 78%; margin: 44px auto 32px; transform: rotate(-6deg); }
.cinema-screen { display: grid; place-items: center; aspect-ratio: 16/9; border-radius: 16px; background: #2c4b3a; border: 8px solid #46654d; box-shadow: 16px 22px 0 #c7d5bd; }
body[data-theme="dark"] .cinema-screen { box-shadow: 16px 22px 0 #304b36; }
.cinema-screen span { color: #d7e6bc; font-size: 62px; font-weight: 200; }
.cinema-caption { font-size: 9px; letter-spacing: .24em; margin-top: 36px; text-align: center; opacity: .6; }
.login-story-footer { margin-top: auto; font-size: 12px; opacity: .55; }
body .login-card { border: 0; background: transparent !important; box-shadow: none !important; padding: 32px 16px; max-width: 380px; }
.login-card > div:first-child { text-align: left; }
.login-card > div:first-child > a { display: none; }
.login-card h2 { font-size: 30px; font-weight: 600; }
body .login-card .theme-toggle { position: absolute; top: 40px; right: 44px; }
.login-subtitle { font-size: 14px; color: var(--text-muted); margin-top: 12px; }
.login-card form { margin-top: 36px; }
.login-card input { min-height: 50px !important; }
.login-card button[type="submit"] { margin-top: 28px; display: flex; justify-content: space-between; padding-inline: 20px; }
@media (max-width: 1023px) {
    #movieGrid, #seriesGrid, #latestGrid, #resultsGrid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px 16px; }
    .login-story { padding: 32px; min-height: 660px; }
    .login-story-copy { margin-top: 50px; }
    body[data-page="login"] main { gap: 32px; }
}
@media (max-width: 767px) {
    .topbar > div { min-height: 68px; }
    body .hamburger { display: flex; flex-direction: column; }
    .mobile-nav { top: 68px; }
    .nav-overlay { top: 68px; }
    body > main { padding-top: 24px; padding-bottom: 44px; }
    .home-intro { padding: 24px 0; }
    .home-search { margin-bottom: 40px; }
    .search-panel { padding: 6px !important; }
    .search-panel button { padding: 12px 20px; }
    #movieGrid, #seriesGrid, #latestGrid, #resultsGrid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px 14px; }
    body[data-page="config"] form > section, body[data-page="test"] main > section, #api-test { padding: 20px; }
    [id^="api-item-"] > .config-fields { display: block; }
    [id^="api-item-"] > .config-fields > * + * { margin-top: 16px; }
    #playerContainer > div:nth-child(2) { padding: 20px; }
    #playerContainer > div:nth-child(2) > div:first-child { flex-direction: row; gap: 16px; }
    #playerContainer img { width: 80px; height: 120px; }
    #playerContainer h1 { font-size: 22px; }
    #playerContainer .flex-1 { min-width: 0; overflow-wrap: anywhere; }
    .login-story { display: none; }
    body[data-page="login"] main { min-height: 100svh; padding: 76px 24px 40px; }
    .login-card > div:first-child > a { display: inline-flex; margin-bottom: 36px; }
    body .login-card .theme-toggle { top: 24px; right: 24px; }
}
@media (max-width: 479px) {
    #movieGrid, #seriesGrid, #latestGrid, #resultsGrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .home-intro h1 { font-size: 30px; }
    .eyebrow { font-size: 10px; }
    #themeLabel { display: none; }
    #playerContainer img { display: none; }
    body input:not([type="checkbox"]), body select { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
