/* FreeWave Studio / Theme System — intentionally self-hosted, no external font or script requests. */
:root, html[data-theme="midnight"] {
  color-scheme: dark;
  --bg: #080d18;
  --sidebar: #0c1424;
  --sidebar-edge: #233048;
  --surface: #101b2d;
  --surface-raised: #162339;
  --surface-soft: #1b2a41;
  --surface-hover: #253651;
  --surface-strong: #0b1424;
  --stroke: #273852;
  --stroke-soft: #20314a;
  --heading: #f6f8ff;
  --ink: #e7efff;
  --subtext: #91a4c3;
  --subtext-bright: #b6c4dd;
  --accent: #8a8bff;
  --accent-strong: #746bf0;
  --accent-soft: rgba(124, 119, 255, .15);
  --accent-outline: rgba(142, 137, 255, .42);
  --accent-ink: #c7c4ff;
  --mint-accent: #6cdbc2;
  --shadow: rgba(0, 0, 0, .27);
  --hero-1: #312757;
  --hero-2: #0f2740;
  --hero-glow: rgba(140, 110, 255, .35);
  --hero-txt: #f7f5ff;
  --hero-sub: #d1d7e9;
  --hero-btn: #ffffff;
  --hero-btn-text: #191a43;
  --body-orb: rgba(95, 81, 180, .11);
  --ring: rgba(145, 141, 255, .76);
  --danger-bg: #402737;
  --danger-txt: #ffd1db;
  --ok-bg: #193d35;
  --ok-txt: #b4f5d9;
}
html[data-theme="daylight"] {
  color-scheme: light;
  --bg: #f4f6fb;
  --sidebar: #ffffff;
  --sidebar-edge: #e5e9f2;
  --surface: #ffffff;
  --surface-raised: #f8faff;
  --surface-soft: #eef2fa;
  --surface-hover: #e8edf9;
  --surface-strong: #ffffff;
  --stroke: #e1e6f0;
  --stroke-soft: #edf0f6;
  --heading: #152039;
  --ink: #28354f;
  --subtext: #62718a;
  --subtext-bright: #4e5e79;
  --accent: #5858ca;
  --accent-strong: #4e4cb8;
  --accent-soft: rgba(84, 83, 188, .095);
  --accent-outline: rgba(80, 76, 180, .3);
  --accent-ink: #5351b0;
  --mint-accent: #0c8d78;
  --shadow: rgba(26, 36, 74, .065);
  --hero-1: #e2e3ff;
  --hero-2: #dbeefb;
  --hero-glow: rgba(100, 93, 211, .19);
  --hero-txt: #202351;
  --hero-sub: #535a85;
  --hero-btn: #4240a5;
  --hero-btn-text: #ffffff;
  --body-orb: rgba(143, 149, 231, .12);
  --ring: rgba(93, 85, 195, .62);
  --danger-bg: #fff1f2;
  --danger-txt: #ac334b;
  --ok-bg: #e7f7ee;
  --ok-txt: #11734e;
}
html[data-theme="aurora"] {
  color-scheme: dark;
  --bg: #07131c;
  --sidebar: #0a1922;
  --sidebar-edge: #1d3944;
  --surface: #10222d;
  --surface-raised: #152d37;
  --surface-soft: #1b343e;
  --surface-hover: #23414a;
  --surface-strong: #0c1b25;
  --stroke: #294550;
  --stroke-soft: #203b44;
  --heading: #f0fffc;
  --ink: #e0f5f1;
  --subtext: #93b9bb;
  --subtext-bright: #b8d9d8;
  --accent: #58d6c3;
  --accent-strong: #148e8b;
  --accent-soft: rgba(47, 194, 174, .15);
  --accent-outline: rgba(91, 221, 200, .4);
  --accent-ink: #a0eee0;
  --mint-accent: #a1f6cb;
  --shadow: rgba(0, 0, 0, .28);
  --hero-1: #124c4e;
  --hero-2: #1d2f50;
  --hero-glow: rgba(46, 217, 186, .31);
  --hero-txt: #f2fffe;
  --hero-sub: #c0e5e1;
  --hero-btn: #d2fff0;
  --hero-btn-text: #123b3b;
  --body-orb: rgba(66, 213, 190, .085);
  --ring: rgba(93, 226, 205, .7);
  --danger-bg: #432f36;
  --danger-txt: #ffd1db;
  --ok-bg: #164038;
  --ok-txt: #b4f5d9;
}
/* Foundations */
html { background: var(--bg); color: var(--ink); scroll-behavior: smooth; }
body { background: radial-gradient(ellipse 60% 48% at 86% -10%, var(--body-orb), transparent 75%), var(--bg); color: var(--ink); }
body, input, textarea, select, button { font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
:focus-visible { outline: 3px solid var(--ring) !important; outline-offset: 3px; }
::selection { background: var(--accent-soft); color: var(--heading); }
h1,h2,h3,h4,h5,b,strong { color: var(--heading); }
a,button { -webkit-tap-highlight-color: transparent; }
button, .btn, .nav-link, .feature-entry, .theme-choice, .provider, .poster-card { transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, color .18s ease, transform .18s ease; }
/* Primary layout */
.app-shell { min-height: 100dvh; }
.side { width: 268px; background: var(--sidebar); border-right: 1px solid var(--sidebar-edge); padding: 28px 14px 16px; gap: 0; z-index: 50; box-shadow: 5px 0 35px var(--shadow); }
.side-top { display:flex; align-items:center; justify-content:space-between; padding: 0 6px; }
.brand { padding:0 9px; gap:13px; min-width:0; }
.brand-emblem { width:43px; height:43px; flex:none; border-radius:13px; background:linear-gradient(135deg, var(--accent-strong), var(--accent)); color:white; box-shadow:0 7px 23px var(--accent-soft); }
.brand-emblem svg { width:25px; height:25px; }
.brand-wordmark { display:flex; flex-direction:column; gap:5px; }
.brand-name { font-size:23px; font-weight:830; letter-spacing:-1.15px; color:var(--heading); }
.brand-dot { color:var(--accent); }
.brand-tagline { color:var(--subtext); letter-spacing:1.8px; font-size:8.5px; font-weight:800; white-space:nowrap; }
.workspace-label { display:flex; align-items:center; gap:8px; font-size:9px; letter-spacing:1px; font-weight:800; color:var(--subtext-bright); margin:36px 8px 23px; padding:11px 12px; background:var(--surface-raised); border:1px solid var(--stroke-soft); border-radius:10px; }
.online-dot { display:inline-block; width:7px; height:7px; border-radius:100%; background:#4ed9aa; box-shadow:0 0 0 3px rgba(73,220,177,.11); flex:none; }
.workspace-lock { margin-left:auto; font-size:8px; color:var(--mint-accent); }
.nav-block { display:flex; flex-direction:column; gap:5px; }
.nav-label { padding: 8px 15px 8px; margin: 0 0 4px; color:var(--subtext); font-size:10px; letter-spacing:1.4px; }
.nav-label-secondary { margin-top:26px; }
.nav-link { position:relative; min-height:44px; gap:13px; padding:11px 13px; background:transparent; color:var(--subtext-bright); border:1px solid transparent; border-radius:11px; font-size:13px; font-weight:650; }
.nav-link:hover { background:var(--surface-soft); color:var(--heading); }
.nav-link.active { background:var(--accent-soft); color:var(--accent-ink); border-color:var(--accent-outline); box-shadow:inset 3px 0 var(--accent); }
.nav-link.active:hover { background:var(--accent-soft); }
.nav-icon { height:18px; width:18px; stroke:currentColor; fill:none; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; flex:none; }
.nav-trailing { font-size:9px; font-weight:850; letter-spacing:.4px; margin-left:auto; color:var(--mint-accent); display:inline-flex;align-items:center;gap:5px; }
.tiny-live-dot { width:5px; height:5px; background:#52d4ad; border-radius:50%; }
.sidebar-bottom { margin-top:auto; padding:22px 1px 0; border:0; background:transparent; display:grid; gap:12px; }
.appearance-card { background:var(--surface-raised); border:1px solid var(--stroke); border-radius:17px; padding:15px 13px 13px; }
.appearance-heading,.appearance-heading-left { display:flex;align-items:center; gap:9px; }
.appearance-heading { justify-content:space-between; color:var(--heading); font-size:12px; font-weight:800; }
.appearance-heading .nav-icon { width:17px;height:17px;color:var(--accent); }
.appearance-hint { font-size:8px;letter-spacing:.9px; color:var(--subtext); }
.theme-switch-row { display:flex;justify-content:space-between;align-items:center;gap:12px;padding:14px 0 13px;margin-top:7px;border-bottom:1px solid var(--stroke);cursor:pointer; }
.theme-switch-row strong { display:block;font-size:12px;font-weight:700; }
.theme-switch-row small { display:block;font-size:10px;line-height:1.35;color:var(--subtext);margin-top:4px; }
.switch-wrapper { position:relative;flex:none;display:inline-flex;align-items:center; }
.switch-wrapper input { position:absolute;inset:0;margin:0;width:40px;height:23px;cursor:pointer;opacity:0; }
.switch-track { width:40px;height:23px;border-radius:100px;background:var(--stroke);border:1px solid var(--stroke);display:flex;align-items:center;padding:2px;transition:background .2s,border-color .2s;pointer-events:none; }
.switch-thumb { width:17px;height:17px;background:#fff;border-radius:50%;box-shadow:0 1px 5px #0003;transition:transform .2s; }
.switch-wrapper input:checked + .switch-track { background:var(--accent-strong);border-color:var(--accent); }
.switch-wrapper input:checked + .switch-track .switch-thumb { transform:translateX(17px); }
.switch-wrapper input:focus-visible + .switch-track { outline:3px solid var(--ring);outline-offset:3px; }
.palette-label { display:block;color:var(--subtext);letter-spacing:1px;font-size:9px;font-weight:800;margin:15px 0 9px; }
.theme-choices { display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:5px; }
.theme-choice { display:flex;align-items:center;justify-content:center;flex-direction:column;gap:6px;min-width:0;padding:9px 2px 8px;border:1px solid transparent;color:var(--subtext);background:transparent;border-radius:10px;font-size:9px;font-weight:730; }
.theme-choice:hover { color:var(--heading);background:var(--surface-soft); }
.theme-choice.selected { background:var(--accent-soft);border-color:var(--accent-outline);color:var(--heading); }
.theme-swatch { height:23px;width:23px;display:block;border-radius:50%;border:2px solid #ffffff66;box-shadow:0 0 0 1px var(--stroke); }
.midnight-swatch { background:linear-gradient(135deg,#141c33 50%,#8783ef 50%); }
.daylight-swatch { background:linear-gradient(135deg,#f4f5fc 50%,#b8a4ef 50%); }
.aurora-swatch { background:linear-gradient(135deg,#123d46 50%,#5ae0ba 50%); }
.security-card { border:1px solid var(--stroke-soft);border-radius:14px;display:flex;align-items:center;gap:10px;padding:12px 11px;background:var(--surface); }
.security-icon { background:var(--accent-soft);color:var(--accent);border-radius:10px;width:34px;height:34px;display:grid;place-items:center;flex:none; }
.security-icon svg { width:18px;height:18px; }
.security-card strong,.security-card small {display:block;}
.security-card strong {font-size:11px;}
.security-card small {font-size:9px;color:var(--subtext);margin-top:3px;}
.secure-status {font-size:11px;color:var(--mint-accent);margin-left:auto;}
.workarea { background:transparent; }
.topbar { min-height:82px;height:auto;gap:22px;position:relative; background:var(--bg);border-bottom:1px solid var(--stroke-soft);padding:17px clamp(24px,3.4vw,54px); }
.topbar-left { display:flex;align-items:center;gap:15px;min-width:0; }
.page-heading {min-width:0;}
.top-eyebrow { color:var(--subtext);font-size:9px;font-weight:780;letter-spacing:1.7px; }
.topbar h1 { font-size:22px; letter-spacing:-.75px;color:var(--heading);margin:5px 0 0; }
.top-actions { gap:14px;flex-wrap:nowrap; }
.topbar-private { white-space:nowrap;font-size:11px;font-weight:680;color:var(--subtext);display:flex;align-items:center;gap:9px; }
.userpill { background:var(--surface-raised);border:1px solid var(--stroke);padding:4px 11px 4px 5px;display:inline-flex;align-items:center;gap:8px;color:var(--ink);max-width:245px;font-size:11px; }
.avatar {display:grid;place-items:center;background:var(--accent-soft);color:var(--accent-ink);font-size:12px;font-weight:850;border-radius:50%;height:29px;width:29px;flex:none;}
.account-name { overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }
.icon-button { display:inline-flex;align-items:center;justify-content:center;width:39px;height:39px;flex:none;color:var(--ink);background:var(--surface-raised);border:1px solid var(--stroke);border-radius:11px;font-size:25px; }
.icon-button svg { width:21px;height:21px; }
.menu-open,.sidebar-close { display:none; }
.mobile-backdrop {display:none;}
.main-content { max-width:1600px; padding:36px clamp(24px,3.4vw,54px) 90px; }
/* Controls and surfaces */
.btn { border-color:var(--stroke);background:var(--surface-raised);color:var(--ink);border-radius:11px;font-size:12px;font-weight:740;padding:11px 16px; }
.btn:hover { background:var(--surface-hover);border-color:var(--accent-outline);color:var(--heading);transform:translateY(-1px); }
.btn-primary { background:var(--accent-strong);border-color:var(--accent-strong);color:white;box-shadow:0 9px 23px var(--accent-soft); }
.btn-primary:hover {background:var(--accent);border-color:var(--accent);color:white;}
.btn-quiet {background:transparent;}
.btn-danger {background:var(--danger-bg);border-color:var(--danger-txt);color:var(--danger-txt);}
.panel,.stat,.poster-card,.provider,.member-card { border:1px solid var(--stroke);background:var(--surface);border-radius:17px;box-shadow:0 9px 30px var(--shadow);color:var(--ink); }
.panel {background:var(--surface);}
.panel-pad {padding:24px;}
.lead {margin-bottom:27px;}
.lead h2 {color:var(--heading);letter-spacing:-1.25px;font-weight:800;}
.lead p,.sec-head p,.section-meta,.muted,.count,.pageLabel {color:var(--subtext);}
.eyebrow {color:var(--accent-ink);}
.section-title,.sec-head h3 {color:var(--heading);font-weight:790;}
.sec-head a,.poster-info a,.provider footer {color:var(--accent-ink);}
.field,.auth-card input:not([type=hidden]),.auth-card select {background:var(--surface-raised);border:1px solid var(--stroke);color:var(--ink);border-radius:11px;padding:12px 13px;}
.field::placeholder,.auth-card input::placeholder {color:var(--subtext);}
.field:focus {outline:2px solid var(--ring);border-color:var(--accent);}
input[type="checkbox"] {accent-color:var(--accent-strong);}
.form-label,.permission-selects label {color:var(--subtext-bright);}
.form-label {font-weight:750;}
.empty,.note-box,.flash,.tv-status {background:var(--surface-raised);border-color:var(--stroke);color:var(--subtext-bright);}
.flash.success,.tv-status.ok {background:var(--ok-bg);color:var(--ok-txt);}
.flash.error,.tv-status.error {background:var(--danger-bg);color:var(--danger-txt);}
.tag {background:var(--accent-soft);border-color:var(--accent-outline);color:var(--accent-ink);font-weight:780;}
/* Dashboard */
.hero {border:1px solid var(--accent-outline);border-radius:24px;padding:45px;min-height:360px;background:radial-gradient(ellipse 54% 100% at 89% 17%,var(--hero-glow),transparent 71%),linear-gradient(117deg,var(--hero-1) 0%,var(--hero-2) 92%);box-shadow:0 18px 52px var(--shadow);}
.hero:after {content:'◌';font-size:390px;color:var(--accent);opacity:.17;right:1%;top:-84px;line-height:1;pointer-events:none;}
.hero h2 {font-size:clamp(35px,4.3vw,57px);color:var(--hero-txt);font-weight:840;letter-spacing:-2.1px;line-height:1.06;max-width:650px;}
.hero p {color:var(--hero-sub);font-size:14px;line-height:1.75;max-width:530px;}
.hero .tag {background:rgba(255,255,255,.11);border-color:rgba(255,255,255,.22);color:var(--hero-txt);}
.hero .btn-primary {background:var(--hero-btn);color:var(--hero-btn-text);border-color:var(--hero-btn);}
.hero .btn-primary:hover {filter:brightness(.94);}
.hero .btn:not(.btn-primary) {background:rgba(255,255,255,.09);border-color:rgba(255,255,255,.24);color:var(--hero-txt);}
.hero .btn:not(.btn-primary):hover {background:rgba(255,255,255,.18);}
.stats-grid {gap:17px;margin-top:22px;}
.stat {padding:20px 22px;position:relative;overflow:hidden;}
.stat strong {color:var(--heading);font-size:20px;letter-spacing:-.65px;}
.stat strong span {color:var(--accent)!important;}
.stat span {color:var(--subtext);font-size:12px;}
.feature-entry {background:var(--surface);border-color:var(--stroke);padding:25px;border-radius:19px;box-shadow:0 10px 25px var(--shadow);}
.feature-entry:hover {border-color:var(--accent-outline);background:var(--surface-raised);transform:translateY(-3px);}
.feature-entry b {color:var(--heading);}
.feature-entry small {color:var(--subtext);}
.feature-entry strong {color:var(--accent-ink);}
/* Live TV */
.filterbar {gap:12px;}
.tv-layout {gap:20px;}
.tv-player {background:#050811;}
.tv-inner {padding:23px;}
.tv-inner h3 {color:var(--heading);}
.tv-actions a {color:var(--accent-ink);}
.channel {background:var(--surface-raised);border:1px solid var(--stroke);color:var(--ink);}
.channel:hover,.channel.selected {background:var(--accent-soft);border-color:var(--accent-outline);}
.channel .channel-label {color:var(--heading);}
.channel small {color:var(--subtext);}
.channel-list {scrollbar-color:var(--stroke) transparent;}
.tabs button,.paginator button {background:var(--surface-raised);border:1px solid var(--stroke);color:var(--subtext-bright);}
.tabs button.active {background:var(--accent-soft);border-color:var(--accent-outline);color:var(--accent-ink);font-weight:800;}
.tabs button:hover,.paginator button:hover:not(:disabled) {background:var(--surface-hover);}
/* Access studio */
.admin-tabs {padding:6px;background:var(--surface-raised);border:1px solid var(--stroke);border-radius:13px;width:fit-content;max-width:100%;}
.admin-tabs a {background:transparent;border:1px solid transparent;color:var(--subtext-bright);}
.admin-tabs a:hover {background:var(--accent-soft);color:var(--accent-ink);border-color:var(--accent-outline);}
.admin-section h3,.admin-section h4 {color:var(--heading);}
.admin-section .sub,.inline-note {color:var(--subtext);}
.member-card {background:var(--surface-raised);box-shadow:none;}
.member-name {color:var(--heading);}
.perm-option {background:var(--surface-raised);border-color:var(--stroke);}
.perm-option b {color:var(--heading);}
.perm-option small {color:var(--subtext);}
.table td,.table th {border-color:var(--stroke-soft);}
.table th {color:var(--subtext);}
.badge {color:var(--ok-txt);background:var(--ok-bg);border-color:var(--stroke);}
.badge.warn {background:var(--danger-bg);color:var(--danger-txt);border-color:var(--stroke);}
.badge.violet {background:var(--accent-soft);color:var(--accent-ink);border-color:var(--accent-outline);}
/* Extra cards retained for custom media links */
.poster-card,.provider {background:var(--surface);}
.poster-card:hover,.provider:hover {border-color:var(--accent-outline);background:var(--surface-raised);}
.poster-info b,.provider b {color:var(--heading);}
.poster-info small,.poster-info p,.provider p {color:var(--subtext);}
.provider-icon {background:var(--accent-soft);color:var(--accent-ink);}
.provider small {color:var(--mint-accent);}
/* Direct embedded viewer: do not overlay or intercept the external page. */
.direct-embed-page .main-content {max-width:none;padding:13px 16px 16px;}
.direct-embed-page .topbar {min-height:70px;height:auto;}
.direct-external-frame-wrap {border:1px solid var(--stroke);border-radius:14px;background:var(--surface-strong);height:calc(100dvh - 103px);}
.direct-external-frame-wrap iframe {height:100%;width:100%;}
/* Auth screens use shared theme tokens */
body:has(.auth-card) {min-height:100dvh;display:grid;place-items:center;padding:24px;background:radial-gradient(circle at 15% 20%,var(--body-orb),transparent 44%),radial-gradient(circle at 85% 80%,var(--accent-soft),transparent 44%),var(--bg);}
.auth-card {width:min(100%,470px);background:var(--surface);border:1px solid var(--stroke);border-radius:23px;box-shadow:0 24px 80px var(--shadow);padding:34px;}
.auth-card.admin {width:min(100%,980px);}
.auth-brand {display:flex;gap:13px;align-items:center;margin-bottom:27px;}
.auth-brand strong {font-size:25px;}
.auth-card h2 {font-size:27px;letter-spacing:-.8px;margin:10px 0;}
.auth-card p {line-height:1.65;font-size:13px;color:var(--subtext);}
.auth-card label {font-size:13px;color:var(--subtext-bright);display:block;margin-top:15px;}
.auth-card input:not([type=hidden]),.auth-card select {width:100%;margin-top:7px;font-size:14px;}
.auth-card button {background:var(--accent-strong);color:white;border:1px solid var(--accent-outline);border-radius:11px;padding:12px 17px;font-weight:800;margin-top:18px;cursor:pointer;}
.auth-card .message {padding:11px;border:1px solid var(--stroke);border-radius:11px;background:var(--danger-bg);font-size:12px;margin:10px 0;}
.auth-card .message.success {background:var(--ok-bg);}
.auth-card a {color:var(--accent-ink);}
.auth-card .auth-note {color:var(--subtext)!important;}
.auth-card code {overflow-wrap:anywhere;}
.auth-card .linkvalue {font-size:12px;}
.auth-card input:focus,.auth-card button:focus {outline:2px solid var(--ring);}
body:has(.auth-card.admin) .auth-card {max-width:980px;}
/* Mobile menu retains theme switch, unlike previous horizontal navigation. */
@media(max-width:1140px) {
  .side {width:238px;padding:24px 10px 13px;}
  .topbar-private {display:none;}
  .nav-link {font-size:12px;}
}
@media(max-width:800px) {
  .app-shell {display:block;}
  .side {position:fixed;top:0;bottom:0;left:0;display:flex;width:min(298px,86vw);height:100dvh;max-height:100dvh;overflow-y:auto;gap:0;padding:22px 14px 18px;transform:translateX(-110%);transition:transform .23s ease;visibility:hidden;box-shadow:15px 0 50px rgba(0,0,0,.28);z-index:120;}
  body.menu-is-open .side {transform:translateX(0);visibility:visible;}
  body.menu-is-open {overflow:hidden;}
  .mobile-backdrop {display:block;position:fixed;inset:0;background:rgba(5,9,20,.65);opacity:0;visibility:hidden;pointer-events:none;z-index:110;transition:opacity .2s,visibility .2s;}
  body.menu-is-open .mobile-backdrop {opacity:1;visibility:visible;pointer-events:auto;}
  .menu-open,.sidebar-close {display:inline-flex;}
  .sidebar-close {border:0;background:transparent;font-size:27px;}
  .side .nav-block {display:flex;overflow:visible;padding:0;flex-direction:column;gap:5px;}
  .nav-label {display:block;}
  .workspace-label {margin:25px 8px 18px;}
  .nav-link {white-space:normal;padding:11px 13px;}
  .sidebar-bottom {display:grid;}
  .topbar {min-height:73px;padding:13px 17px;}
  .topbar h1 {font-size:19px;}
  .account-name {display:none;}
  .userpill {padding:4px;}
  .logout-button {padding:9px 11px;}
  .main-content {padding:23px 18px 70px;}
  .hero {padding:27px;min-height:310px;}
  .hero:after {font-size:260px;top:0;right:-8%;}
  .hero h2 {font-size:clamp(31px,6vw,44px);}
  .stats-grid {grid-template-columns:1fr;}
  .direct-embed-page .main-content {padding:7px;}
  .direct-embed-page .topbar {min-height:65px;height:auto;padding:11px 15px;}
  .direct-external-frame-wrap {height:calc(100dvh - 90px);min-height:320px;border-radius:9px;}
}
@media(max-width:480px) {
  .top-eyebrow {font-size:8px;letter-spacing:1px;}
  .topbar h1 {font-size:17px;}
  .top-actions {gap:7px;}
  .top-actions .btn {font-size:11px;}
  .hero {min-height:335px;}
  .hero:after {opacity:.085;}
  .hero h2 {letter-spacing:-1.3px;}
  .hero-buttons {flex-wrap:wrap;}
  .tile-grid,.feature-entry-grid {grid-template-columns:1fr;}
  .auth-card {padding:26px 22px;}
}
@media(prefers-reduced-motion:reduce) {
  *,*:before,*:after {transition-duration:.01ms!important;animation-duration:.01ms!important;scroll-behavior:auto!important;}
}
/* Premium dashboard composition */
.welcome-line {display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:18px;}
.welcome-line .eyebrow {display:flex;align-items:center;gap:10px;}
.welcome-date {font-size:11px;color:var(--subtext);font-weight:650;}
.studio-hero {min-height:365px;padding:45px 50px;}
.studio-hero .hero-body {max-width:640px;}
.studio-hero h2 em {font-style:normal;color:var(--hero-txt);}
.studio-hero .hero-visual {position:absolute;inset:0 0 0 55%;pointer-events:none;}
.studio-hero:after {content:none;}
.hero-circle {position:absolute;border:1px solid rgba(255,255,255,.17);border-radius:50%;}
.hero-circle-1 {width:390px;height:390px;right:-95px;top:-80px;}
.hero-circle-2 {width:280px;height:280px;right:4%;top:20%;}
.hero-visual-screen {position:absolute;width:min(340px,86%);height:212px;right:10%;top:23%;border:1px solid rgba(255,255,255,.35);border-radius:18px;padding:20px;transform:rotate(-7deg);display:flex;flex-direction:column;align-items:flex-start;justify-content:space-between;background:radial-gradient(circle at 45% 40%,rgba(169,152,255,.57),transparent 52%),linear-gradient(145deg,rgba(22,31,68,.85),rgba(53,28,101,.8));box-shadow:0 30px 75px rgba(0,0,0,.25);backdrop-filter:blur(6px);color:white;}
.hero-visual-label {font-size:9px;letter-spacing:1.5px;font-weight:760;opacity:.8;}
.hero-visual-play {align-self:center;width:54px;height:54px;border-radius:50%;background:rgba(255,255,255,.23);border:1px solid rgba(255,255,255,.5);display:grid;place-items:center;font-size:23px;padding-left:4px;}
.hero-visual-caption {font-weight:770;font-size:16px;letter-spacing:-.5px;}
.hero-visual-progress {width:100%;height:3px;border-radius:5px;background:rgba(255,255,255,.24);overflow:hidden;}
.hero-visual-progress span {display:block;width:57%;height:100%;background:white;border-radius:5px;}
.hero-visual-float {position:absolute;right:1%;top:66%;transform:rotate(5deg);background:rgba(255,255,255,.92);color:#35346c;border-radius:10px;padding:13px 17px;font-size:11px;font-weight:850;box-shadow:0 13px 35px rgba(0,0,0,.16);}
.studio-highlights {grid-template-columns:repeat(3,minmax(0,1fr));}
.studio-highlights .stat {display:flex;gap:15px;align-items:center;padding:20px;border-radius:15px;}
.studio-highlights .stat strong {font-size:13px;font-weight:800;letter-spacing:-.1px;margin:0 0 6px;}
.studio-highlights .stat span:not(.highlight-icon) {display:block;font-size:11px;line-height:1.4;}
.highlight-icon {width:40px;height:40px;display:grid;place-items:center;flex:none;background:var(--accent-soft);color:var(--accent-ink)!important;border-radius:12px;font-size:22px!important;}
.feature-entry-grid {grid-template-columns:repeat(auto-fit,minmax(220px,1fr));}
.feature-entry {min-height:232px;gap:10px;padding:23px;}
.feature-icon-box {background:var(--accent-soft);color:var(--accent-ink);border:1px solid var(--accent-outline);border-radius:13px;width:46px;height:46px;display:grid;place-items:center;font-size:23px!important;}
.feature-entry .feature-label {font-size:9px;letter-spacing:1.4px;font-weight:840;color:var(--subtext);margin-top:7px;}
.feature-entry b {font-size:21px;letter-spacing:-.7px;}
.feature-entry small {font-size:12px;line-height:1.55;}
.feature-entry strong {margin-top:auto;font-size:12px;display:flex;justify-content:space-between;align-items:center;}
.feature-movies .feature-icon-box {background:rgba(243,152,140,.12);border-color:rgba(243,152,140,.2);color:#d88183;}
.feature-series .feature-icon-box {background:rgba(115,181,248,.12);border-color:rgba(115,181,248,.22);color:#78b9e9;}
.footnote-row {display:flex;align-items:flex-start;gap:12px;margin-top:27px;padding:15px 17px;color:var(--subtext);border-top:1px solid var(--stroke-soft);}
.footnote-row p {font-size:11px;line-height:1.65;margin:0;}
.footnote-mark {font-size:17px;color:var(--accent-ink);}
html[data-theme="daylight"] .hero-visual-screen {background:radial-gradient(circle at 43% 40%,rgba(164,152,255,.55),transparent 52%),linear-gradient(145deg,#6765b2,#44458f);}
@media(max-width:1320px) {.studio-hero .hero-visual {opacity:.5;left:63%;}.studio-hero .hero-body {max-width:580px;}}
@media(max-width:1140px) {.studio-hero .hero-visual {opacity:.22;left:62%;}.studio-hero .hero-body {max-width:590px;}}
@media(max-width:800px) {.studio-hero {padding:28px;min-height:330px;}.studio-hero .hero-visual {opacity:.18;left:55%;}.studio-highlights {grid-template-columns:1fr;}}
@media(max-width:480px) {.welcome-date {display:none;}.studio-hero .hero-visual {display:none;}.studio-hero {min-height:320px;}.studio-hero h2 {font-size:35px;}}

/* Anime launch card; colors flow through the selected site theme. */
.feature-anime .feature-icon-box {background: color-mix(in srgb, var(--accent, #8b7cf6) 17%, transparent); color: var(--accent, #a89bff);}
.feature-anime {transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;}
.feature-anime:hover {transform: translateY(-3px); border-color: var(--accent, #8b7cf6); box-shadow:0 14px 38px rgba(8,10,30,.13);}

/* Collapsible left navigation + compact Appearance. Stored per browser. */
.sidebar-top-controls { display:flex;gap:3px;align-items:center; }
.sidebar-collapse { display:inline-flex; width:32px;height:32px;background:transparent;border-color:transparent;color:var(--subtext); }
.sidebar-collapse:hover { background:var(--surface-soft);color:var(--heading); }
.sidebar-collapse svg { width:19px;height:19px;transition:transform .2s; }
.appearance-toggle { display:flex;width:100%;border:0;background:none;padding:0;color:var(--heading);text-align:left;cursor:pointer; }
.appearance-toggle:hover .appearance-heading-left { color:var(--accent-ink); }
.appearance-heading-right {display:flex;align-items:center;gap:6px;}
.appearance-chevron {width:16px;height:16px;color:var(--subtext);transition:transform .2s;}
.appearance-is-collapsed .appearance-chevron {transform:rotate(-90deg);}
.appearance-contents[hidden] {display:none!important;}
.compact-appearance {display:none;}
@media (min-width:801px) {
  html[data-sidebar="collapsed"] .side { width:76px;padding:22px 10px 15px; }
  html[data-sidebar="collapsed"] .side-top { padding:0;flex-direction:column;gap:11px; }
  html[data-sidebar="collapsed"] .brand {padding:0;}
  html[data-sidebar="collapsed"] .brand-wordmark,
  html[data-sidebar="collapsed"] .workspace-label,
  html[data-sidebar="collapsed"] .nav-label,
  html[data-sidebar="collapsed"] .nav-link > span,
  html[data-sidebar="collapsed"] .appearance-card,
  html[data-sidebar="collapsed"] .security-card {display:none!important;}
  html[data-sidebar="collapsed"] .nav-block {gap:8px;margin-top:23px;}
  html[data-sidebar="collapsed"] .nav-link {justify-content:center;min-height:48px;padding:10px;border-radius:12px;}
  html[data-sidebar="collapsed"] .nav-link .nav-icon {width:22px;height:22px;}
  html[data-sidebar="collapsed"] .sidebar-bottom {display:flex;justify-content:center;padding-top:8px;}
  html[data-sidebar="collapsed"] .compact-appearance {display:inline-flex;}
  html[data-sidebar="collapsed"] .sidebar-collapse svg {transform:rotate(180deg);}
  html[data-sidebar="collapsed"] .side {box-shadow:3px 0 24px var(--shadow);}
}
@media (max-width:800px) {
  .sidebar-collapse {display:none!important;}
  html[data-sidebar="collapsed"] .side {width:min(298px,86vw);}
}

/* Access Studio: safe/explicit invitation-history actions */
.invite-history-tools { margin-top:19px;padding:17px;border:1px solid var(--stroke);border-radius:14px;background:var(--surface-raised);display:flex;align-items:flex-start;justify-content:space-between;gap:20px;flex-wrap:wrap; }
.invite-history-intro {max-width:370px;}
.invite-history-intro strong {font-size:13px;color:var(--heading);}
.invite-history-intro p {font-size:11px;line-height:1.6;color:var(--subtext);margin:7px 0 0;}
.invite-history-actions {display:flex;flex-wrap:wrap;align-items:flex-start;gap:20px;}
.invite-history-actions form {display:grid;gap:9px;}
.invite-history-actions form:first-child {padding-top:23px;}
.clear-confirm-label {font-size:11px;color:var(--subtext);font-weight:600;}
.clear-confirm-controls {display:flex;gap:8px;align-items:center;flex-wrap:wrap;}
.clear-confirm-controls .field {width:110px;min-width:90px;}
.empty-invites {color:var(--subtext);text-align:center!important;}
@media(max-width:800px) {.invite-history-tools,.invite-history-actions {display:grid;}.invite-history-actions form:first-child {padding-top:0;}}

/* Live TV: Korean, family and animation discovery — compatible with all three site themes. */
.catalog-label{display:inline-flex;gap:8px;align-items:center;border-radius:50px;border:1px solid var(--stroke);background:var(--surface-raised);color:var(--subtext);padding:11px 15px;font-size:11px;font-weight:700}
.discovery-cards{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:13px;margin:2px 0 22px}
.discovery-card{display:flex;flex-direction:column;align-items:flex-start;gap:7px;min-height:119px;text-align:left;border:1px solid var(--stroke);background:var(--surface-raised);border-radius:18px;padding:16px 18px;color:var(--heading);transition:transform .17s,border-color .17s,box-shadow .17s}
.discovery-card:hover{transform:translateY(-2px);border-color:var(--accent);box-shadow:0 8px 21px var(--shadow)}
.discovery-card.is-active{border-color:var(--accent);background:var(--surface-soft);box-shadow:inset 3px 0 var(--accent)}
.discovery-card .discovery-emoji{display:grid;place-items:center;width:32px;height:32px;border-radius:10px;background:var(--surface-soft);font-size:19px}
.discovery-card strong{font-size:13px;letter-spacing:-.2px}
.discovery-card small{font-size:11px;color:var(--subtext);line-height:1.4}
.channel-filter-shell{background:var(--surface-raised);border:1px solid var(--stroke);border-radius:17px;padding:16px;margin:0 0 20px}
.channel-filterbar{margin-bottom:8px}
.filter-second-row{display:flex;justify-content:space-between;align-items:center;gap:10px;flex-wrap:wrap}
.filter-second-row label{display:flex;gap:7px;align-items:center}
.health-summary{font-size:11px;color:var(--subtext);margin:9px 0;min-height:14px;line-height:1.45}
.channel-controls{display:flex;align-items:center;gap:6px;flex-shrink:0}
.channel-check{font-size:10px;font-weight:800;color:var(--accent-ink);border:1px solid var(--stroke);border-radius:9px;padding:6px;white-space:nowrap;background:var(--surface-soft)}
.channel-check:hover{border-color:var(--accent);color:var(--heading)}
.channel .star{margin:0;line-height:1}
.manifest-status{display:inline-block;font-size:10px;font-weight:700;margin-top:6px;padding:2px 7px;border:1px solid var(--stroke);border-radius:30px;color:var(--subtext)}
.manifest-status.is-reachable{color:#15916e;border-color:#38ac8d}
.manifest-status.is-restricted{color:#ca9037;border-color:#ca9037}
.manifest-status.is-unavailable{color:#de6f75;border-color:#d97985}
.manifest-status.is-unverified{color:var(--subtext)}
.official-options{margin:24px 0 14px}
.official-option-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}
.official-option{display:flex;flex-direction:column;gap:9px;min-height:120px;padding:17px;border-radius:15px;border:1px solid var(--stroke);background:var(--surface-raised)}
.official-option:hover{border-color:var(--accent);background:var(--surface-soft)}
.official-option b{font-size:13px;color:var(--heading)}
.official-option span{font-size:11px;color:var(--subtext)}
.official-option em{font-style:normal;font-size:11px;font-weight:800;margin-top:auto;color:var(--accent-ink)}
@media(max-width:1150px){.discovery-cards{grid-template-columns:repeat(2,minmax(0,1fr))}.official-option-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:650px){.discovery-cards{grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}.discovery-card{padding:13px;min-height:105px}.discovery-card strong{font-size:12px}.official-option-grid{grid-template-columns:1fr 1fr}.channel-controls{gap:2px}.channel-check{padding:5px 3px;font-size:9px}.catalog-label{display:none}}
@media(max-width:400px){.discovery-cards{grid-template-columns:1fr 1fr}.discovery-card{padding:12px}.official-option-grid{grid-template-columns:1fr}}

/* Captions panel uses theme variables and scales down for narrow viewports. */
.caption-panel { background:var(--surface-2, rgba(120,130,175,.06)); border:1px solid var(--line, rgba(140,150,185,.24)); padding:14px 16px; border-radius:15px; margin:14px 0; }
.caption-header,.caption-header>div { display:flex; flex-wrap:wrap; align-items:center; gap:9px; }
.caption-header { justify-content:space-between; margin-bottom:12px; }
.caption-header strong { font-size:14px; }
.caption-tag { font-size:10px; font-weight:700; border-radius:99px; background:rgba(112,100,240,.13); padding:4px 9px; color:var(--accent, #847cf9); }
.caption-hint { font-size:11px; opacity:.65; }
.caption-controls { display:flex; flex-wrap:wrap; align-items:center; gap:9px; }
.caption-controls .field { flex:1 1 170px; min-width:160px; max-width:300px; }
.caption-controls .btn { min-height:39px; }
.caption-label { font-size:12px; font-weight:700; }
.caption-status { margin:10px 0 0; line-height:1.55; }
.tv-player::cue { color:#fff; background:rgba(0,0,0,.78); font-family:system-ui, sans-serif; font-size:94%; }
@media(max-width:620px) {.caption-controls .field{max-width:none;flex-basis:100%}.caption-hint{display:none}}

.caption-controls [hidden]{display:none !important;}
