:root {
    --theme: #dc3545;
    --theme-soft: rgba(220, 53, 69, .14);
    --ink: #0f172a;
    --muted: #64748b;
    --surface: #ffffff;
    --line: rgba(15, 23, 42, .08);
    --radius: 22px;
    --shadow: 0 18px 45px rgba(15, 23, 42, .10);
}

* { box-sizing: border-box; }
body {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: #f7f8fb;
}
a { transition: .18s ease; }

/* Admin */
.admin-shell { min-height: 100vh; background: radial-gradient(circle at top left, rgba(99,102,241,.12), transparent 34%), #f7f8fb; }
.admin-navbar { background: rgba(15, 23, 42, .94); backdrop-filter: blur(16px); box-shadow: 0 18px 45px rgba(15, 23, 42, .18); }
.admin-card, .modern-card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); background: var(--surface); }
.metric-card { border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, #fff, #f8fafc); box-shadow: var(--shadow); overflow: hidden; position: relative; }
.metric-card::after { content:""; position:absolute; width:120px; height:120px; right:-45px; top:-45px; background: var(--theme-soft); border-radius:50%; }
.table-modern thead th { color: #64748b; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--line); }
.table-modern tbody td { border-bottom: 1px solid var(--line); }
.form-section-title { font-size: 13px; font-weight: 800; text-transform: uppercase; color: var(--muted); letter-spacing: .08em; margin-bottom: 12px; }
.logo-preview-box { width: 76px; height: 76px; border-radius: 20px; background: #f1f5f9; display:flex; align-items:center; justify-content:center; overflow:hidden; border:1px solid var(--line); }
.logo-preview-box img { width:100%; height:100%; object-fit:contain; padding:8px; }
.logo-preview-fallback { width:100%; height:100%; display:flex; align-items:center; justify-content:center; font-weight:900; color:#fff; background: var(--theme); }
.color-preset { width: 30px; height: 30px; border-radius: 999px; border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(15,23,42,.15); cursor: pointer; }

/* Brand */
.brand-lockup { display:inline-flex; align-items:center; gap:10px; min-width:0; }
.brand-logo { width: 42px; height: 42px; object-fit: contain; border-radius: 13px; background: rgba(255,255,255,.94); padding: 5px; box-shadow: 0 10px 25px rgba(0,0,0,.12); }
.brand-logo-sm { width: 34px; height: 34px; object-fit: contain; border-radius: 10px; background: rgba(255,255,255,.94); padding: 4px; }
.brand-fallback { width: 42px; height: 42px; border-radius: 14px; display:inline-flex; align-items:center; justify-content:center; font-weight:900; color:#fff; background: linear-gradient(135deg, var(--theme), #111827); box-shadow: 0 10px 25px rgba(0,0,0,.16); }
.brand-fallback-sm { width: 34px; height: 34px; border-radius: 10px; display:inline-flex; align-items:center; justify-content:center; font-size:12px; font-weight:900; color:#fff; background: var(--theme); }

/* Portal */
.portal-bg {
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(255,255,255,.32), transparent 30%),
        radial-gradient(circle at 82% 12%, rgba(99,102,241,.28), transparent 26%),
        linear-gradient(135deg, #0f172a 0%, #1e293b 52%, #020617 100%);
    color: #fff;
}
.portal-hero { padding: 72px 0 42px; }
.portal-eyebrow { display:inline-flex; align-items:center; gap:8px; padding: 8px 12px; border: 1px solid rgba(255,255,255,.14); border-radius: 999px; color: rgba(255,255,255,.82); background: rgba(255,255,255,.08); backdrop-filter: blur(12px); }
.portal-title { font-size: clamp(38px, 7vw, 76px); line-height: .95; font-weight: 900; letter-spacing: -.05em; }
.portal-subtitle { color: rgba(255,255,255,.68); max-width: 760px; font-size: 18px; }
.portal-card { position:relative; overflow:hidden; border: 1px solid rgba(255,255,255,.12); border-radius: 28px; background: rgba(255,255,255,.08); backdrop-filter: blur(18px); box-shadow: 0 24px 70px rgba(0,0,0,.22); min-height: 230px; }
.portal-card::before { content:""; position:absolute; inset:-1px; background: radial-gradient(circle at 30% 0%, var(--theme-soft), transparent 46%); pointer-events:none; }
.portal-card:hover { transform: translateY(-5px); border-color: rgba(255,255,255,.28); }
.portal-card .card-body { position:relative; }
.portal-url { color: rgba(255,255,255,.72); background: rgba(255,255,255,.10); border: 1px solid rgba(255,255,255,.12); border-radius: 999px; padding: 6px 10px; display:inline-block; }

/* Front web */
.site-body {
    min-height: 100vh;
    background:
        radial-gradient(circle at 20% 0%, var(--theme-soft), transparent 27%),
        linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
}
.site-navbar {
    background: rgba(15, 23, 42, .88);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.site-navbar .navbar-brand { min-width:0; max-width: 58vw; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.search-pill { border-radius: 999px; background: rgba(255,255,255,.92); border:0; padding-left:16px; }
.site-hero {
    position:relative;
    overflow:hidden;
    background:
        radial-gradient(circle at 20% 16%, rgba(255,255,255,.18), transparent 18%),
        linear-gradient(135deg, var(--theme), #111827 72%);
    color: #fff;
}
.site-hero::after { content:""; position:absolute; width:520px; height:520px; right:-180px; top:-220px; border-radius:50%; background: rgba(255,255,255,.10); }
.site-hero-inner { position:relative; z-index:1; padding: 58px 0 52px; }
.site-hero-title { font-size: clamp(32px, 5vw, 58px); font-weight: 900; letter-spacing: -.04em; }
.site-hero-desc { color: rgba(255,255,255,.74); max-width: 700px; }
.site-stat { padding: 10px 14px; border: 1px solid rgba(255,255,255,.16); border-radius: 18px; background: rgba(255,255,255,.10); color: rgba(255,255,255,.88); }
.chip-row { margin-top: -24px; position:relative; z-index:4; }
.chip-panel { border-radius: 24px; background:#fff; border:1px solid var(--line); box-shadow: var(--shadow); padding:14px; }
.chip-btn { border-radius: 999px; font-weight: 700; }
.chip-btn.active { background: var(--theme); border-color: var(--theme); color:#fff; }
.section-heading { font-weight:900; letter-spacing:-.03em; }
.video-card { border: 1px solid var(--line); border-radius: 22px; overflow: hidden; transition: .2s ease; background:#fff; box-shadow: 0 12px 30px rgba(15,23,42,.08); }
.video-card:hover { transform: translateY(-5px); box-shadow: 0 22px 50px rgba(15,23,42,.15); }
.poster-wrap { position: relative; aspect-ratio: 2 / 3; background: #e9ecef; overflow: hidden; }
.poster-wrap img { width: 100%; height: 100%; object-fit: cover; transition:.28s ease; }
.video-card:hover .poster-wrap img { transform: scale(1.045); }
.poster-overlay { position:absolute; inset:0; background: linear-gradient(180deg, rgba(0,0,0,0) 48%, rgba(0,0,0,.68) 100%); opacity:.88; }
.no-poster { height: 100%; display: flex; align-items: center; justify-content: center; color: #64748b; font-size: 12px; background: linear-gradient(135deg,#e2e8f0,#f8fafc); }
.episode-badge { position: absolute; left: 10px; bottom: 10px; background: var(--theme); color: #fff; font-size: 11px; font-weight:800; padding: 5px 9px; border-radius: 999px; box-shadow: 0 10px 22px rgba(0,0,0,.16); }
.rating-badge { position: absolute; right: 10px; top: 10px; background: rgba(15,23,42,.78); backdrop-filter:blur(10px); color: #fff; font-size: 11px; padding: 5px 9px; border-radius: 999px; }
.type-badge { position:absolute; left:10px; top:10px; background:rgba(255,255,255,.86); color:#111827; font-size:10px; font-weight:900; padding:5px 8px; border-radius:999px; }
.line-clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 41px; }
.meta-badge { display:inline-block; background:#eef2f7; color:#334155; border-radius:999px; padding:6px 12px; font-size:12px; font-weight:700; margin:0 6px 8px 0; }
.cast-avatar { width:44px; height:44px; border-radius:50%; object-fit:cover; background:#e9ecef; }
.pagination-btn { border-radius:999px; padding:10px 18px; font-weight:800; }

/* Detail */
.detail-hero { position:relative; overflow:hidden; color:#fff; background:#0f172a; }
.detail-hero-bg { position:absolute; inset:0; background-size:cover; background-position:center; opacity:.22; filter: blur(1px); transform:scale(1.04); }
.detail-hero::after { content:""; position:absolute; inset:0; background: linear-gradient(90deg, rgba(15,23,42,.95) 0%, rgba(15,23,42,.80) 48%, rgba(15,23,42,.55) 100%); }
.detail-hero-content { position:relative; z-index:1; padding: 54px 0; }
.detail-poster { border-radius: 26px; box-shadow: 0 28px 70px rgba(0,0,0,.34); border:1px solid rgba(255,255,255,.16); }
.episode-card { border-radius: 18px; border:1px solid var(--line); background:#fff; padding:13px; display:block; height:100%; color:var(--ink); text-decoration:none; }
.episode-card:hover { color:var(--ink); border-color: var(--theme); box-shadow: 0 16px 35px rgba(15,23,42,.10); transform: translateY(-2px); }

/* Watch */
.watch-body { min-height:100vh; background: radial-gradient(circle at top, rgba(255,255,255,.08), transparent 30%), #020617; color:#fff; }
.player-shell { border-radius: 26px; overflow:hidden; background:#000; box-shadow:0 30px 80px rgba(0,0,0,.45); border:1px solid rgba(255,255,255,.08); }
.episode-pill { border-radius:999px; }

@media (max-width: 575.98px) {
    .site-hero-inner { padding: 38px 0 44px; }
    .chip-row { margin-top: -18px; }
    .brand-lockup span:last-child { max-width: 200px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
}
.fw-black { font-weight: 900 !important; }

/* Modern Header */
.portal-header {
    z-index: 1030;
    background: rgba(2, 6, 23, .58);
    border-bottom: 1px solid rgba(255,255,255,.10);
    backdrop-filter: blur(18px);
}
.portal-header-inner {
    min-height: 76px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:18px;
}
.portal-brand { display:inline-flex; align-items:center; gap:12px; color:#fff; min-width:0; }
.portal-brand:hover { color:#fff; opacity:.92; }
.portal-brand-mark {
    width:44px; height:44px; border-radius:16px;
    display:inline-flex; align-items:center; justify-content:center;
    font-weight:900; color:#0f172a;
    background: linear-gradient(135deg, #fff, rgba(255,255,255,.72));
    box-shadow: 0 16px 35px rgba(0,0,0,.18);
}
.portal-brand-name { display:block; font-weight:900; line-height:1; letter-spacing:-.03em; }
.portal-brand small { color:rgba(255,255,255,.58); font-weight:700; }
.portal-header-actions { display:flex; align-items:center; gap:10px; }
.portal-live-dot {
    color:rgba(255,255,255,.78);
    border:1px solid rgba(255,255,255,.12);
    background:rgba(255,255,255,.08);
    border-radius:999px;
    padding:8px 12px;
    font-size:13px;
    font-weight:800;
}
.portal-live-dot i { width:8px; height:8px; border-radius:50%; background:#22c55e; display:inline-block; margin-right:7px; box-shadow:0 0 0 5px rgba(34,197,94,.16); }

.modern-header {
    z-index: 1030;
    background: rgba(15, 23, 42, .74);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255,255,255,.10);
    box-shadow: 0 18px 50px rgba(15,23,42,.16);
}
.header-topline { height: 3px; background: linear-gradient(90deg, var(--theme), rgba(255,255,255,.55), var(--theme)); opacity:.95; }
.modern-navbar { min-height: 74px; }
.modern-brand { max-width: 280px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-weight:900; }
.modern-menu { align-items: center; }
.modern-nav-link {
    color: rgba(255,255,255,.72) !important;
    border-radius: 999px;
    padding: 9px 13px !important;
    font-weight: 800;
    font-size: 14px;
}
.modern-nav-link:hover { color: #fff !important; background: rgba(255,255,255,.08); }
.modern-nav-link.active { color:#fff !important; background: linear-gradient(135deg, var(--theme), rgba(255,255,255,.16)); box-shadow: 0 10px 25px rgba(0,0,0,.18); }
.modern-toggler { border:1px solid rgba(255,255,255,.18); border-radius:14px; padding:8px 10px; }
.header-search {
    height: 42px;
    display:flex;
    align-items:center;
    gap:8px;
    border-radius:999px;
    background: rgba(255,255,255,.10);
    border:1px solid rgba(255,255,255,.12);
    padding: 0 6px 0 14px;
    min-width: 270px;
}
.header-search span { color:rgba(255,255,255,.72); font-size:18px; line-height:1; }
.header-search input {
    min-width:0;
    flex:1;
    border:0;
    outline:0;
    color:#fff;
    background:transparent;
    font-size:14px;
}
.header-search input::placeholder { color: rgba(255,255,255,.52); }
.header-search button {
    border:0;
    border-radius:999px;
    padding:7px 13px;
    color:#0f172a;
    background:#fff;
    font-weight:900;
    font-size:13px;
}
.header-provider-badge {
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-height:42px;
    border-radius:999px;
    padding:0 14px;
    color:#fff;
    font-size:13px;
    font-weight:900;
    background: rgba(255,255,255,.10);
    border:1px solid rgba(255,255,255,.12);
}

/* Modern Footer */
.modern-footer {
    position:relative;
    overflow:hidden;
    margin-top: 48px;
    padding: 58px 0 24px;
    background:
        radial-gradient(circle at 12% 0%, var(--theme-soft), transparent 30%),
        linear-gradient(135deg, #0f172a 0%, #020617 100%);
    color:#fff;
}
.modern-footer .container { z-index:1; }
.footer-orb { position:absolute; border-radius:50%; filter: blur(1px); pointer-events:none; }
.footer-orb-a { width:280px; height:280px; right:-110px; top:-110px; background: rgba(255,255,255,.08); }
.footer-orb-b { width:190px; height:190px; left:-70px; bottom:-80px; background: var(--theme-soft); }
.footer-brand { display:inline-flex; align-items:center; gap:13px; color:#fff; }
.footer-brand:hover { color:#fff; opacity:.92; }
.footer-brand img { width:54px; height:54px; object-fit:contain; border-radius:18px; padding:7px; background:rgba(255,255,255,.94); box-shadow:0 16px 36px rgba(0,0,0,.22); }
.footer-brand > span { width:54px; height:54px; border-radius:18px; display:inline-flex; align-items:center; justify-content:center; color:#fff; font-weight:900; background:linear-gradient(135deg, var(--theme), #334155); box-shadow:0 16px 36px rgba(0,0,0,.22); }
.footer-brand strong { display:block; font-size:20px; line-height:1.05; letter-spacing:-.03em; }
.footer-brand small { color:rgba(255,255,255,.58); font-weight:800; }
.footer-desc { max-width:520px; color:rgba(255,255,255,.62); }
.footer-title { color:#fff; font-weight:900; text-transform:uppercase; font-size:12px; letter-spacing:.10em; margin-bottom:14px; }
.footer-links { display:flex; flex-direction:column; gap:9px; }
.footer-links a, .footer-info-list span { color:rgba(255,255,255,.64); text-decoration:none; font-size:14px; }
.footer-links a:hover { color:#fff; transform:translateX(3px); }
.btn-footer-top { color:#fff; background:rgba(255,255,255,.10); border:1px solid rgba(255,255,255,.14); font-weight:900; padding:10px 16px; }
.btn-footer-top:hover { color:#0f172a; background:#fff; }
.footer-bottom {
    margin-top:42px;
    padding-top:18px;
    border-top:1px solid rgba(255,255,255,.10);
    display:flex;
    flex-wrap:wrap;
    justify-content:space-between;
    gap:10px;
    color:rgba(255,255,255,.48);
    font-size:13px;
}
.watch-body .modern-footer { margin-top: 24px; border-top:1px solid rgba(255,255,255,.08); }

.portal-footer { padding: 12px 0 54px; color:#fff; }
.portal-footer-card {
    position:relative;
    overflow:hidden;
    border-radius:30px;
    background:rgba(255,255,255,.08);
    border:1px solid rgba(255,255,255,.12);
    box-shadow:0 28px 80px rgba(0,0,0,.25);
    backdrop-filter:blur(18px);
    padding:30px;
}
.portal-footer-card::after { content:""; position:absolute; width:260px; height:260px; right:-110px; top:-120px; border-radius:50%; background:rgba(255,255,255,.08); }
.portal-footer-chip {
    position:relative;
    z-index:1;
    color:rgba(255,255,255,.78);
    text-decoration:none;
    border-radius:999px;
    border:1px solid rgba(255,255,255,.12);
    background:rgba(255,255,255,.08);
    padding:8px 12px;
    font-size:13px;
    font-weight:800;
}
.portal-footer-chip:hover { color:#0f172a; background:#fff; }
.portal-footer-bottom { margin-top:26px; padding-top:18px; border-top:1px solid rgba(255,255,255,.10); color:rgba(255,255,255,.48); font-size:13px; }

@media (max-width: 991.98px) {
    .modern-navbar { padding: 12px 0; }
    .modern-brand { max-width: 68vw; }
    .modern-menu { align-items: stretch; }
    .header-search { width:100%; min-width:0; }
    .modern-nav-link { padding: 11px 13px !important; }
}
@media (max-width: 575.98px) {
    .portal-header-inner { min-height: 68px; }
    .portal-brand small, .portal-live-dot { display:none !important; }
    .portal-brand-mark { width:40px; height:40px; border-radius:14px; }
    .portal-footer-card { padding:22px; border-radius:24px; }
    .footer-bottom { flex-direction:column; }
}

/* ==========================
   Ads per site
   ========================== */
.ad-zone {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.ad-zone:empty { display:none; }
.ad-item {
    width: 100%;
    overflow: hidden;
    border-radius: 22px;
    text-align: center;
    background: rgba(15, 23, 42, .04);
}
.ad-item img {
    display: block;
    width: 100%;
    max-height: 220px;
    object-fit: cover;
    border-radius: 22px;
}
.ad-item iframe {
    display:block;
    width:100%;
    min-height:90px;
    border-radius:18px;
    background:#fff;
}
.ad-zone-header_top,
.ad-zone-home_after_hero,
.ad-zone-home_before_list,
.ad-zone-home_after_list,
.ad-zone-detail_top,
.ad-zone-detail_before_episodes,
.ad-zone-watch_above_player,
.ad-zone-watch_below_player,
.ad-zone-watch_after_episodes,
.ad-zone-footer_before {
    margin-left:auto;
    margin-right:auto;
}
.watch-body .ad-item {
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.08);
}
.ad-zone-floating_bottom {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 14px;
    width: min(728px, calc(100% - 28px));
    z-index: 1060;
    pointer-events: none;
}
.ad-zone-floating_bottom .ad-item {
    pointer-events: auto;
    box-shadow: 0 18px 50px rgba(0,0,0,.22);
    background: rgba(15,23,42,.92);
    border: 1px solid rgba(255,255,255,.12);
}
.ad-zone-floating_bottom .ad-item img { max-height: 90px; object-fit: contain; background:rgba(255,255,255,.04); }
.ad-preview-help { background: linear-gradient(180deg, rgba(13,110,253,.08), rgba(111,66,193,.08)); border: 1px solid rgba(15,23,42,.08); }
@media (max-width: 575.98px) {
    .ad-item { border-radius: 16px; }
    .ad-item img { border-radius: 16px; max-height: 160px; }
    .ad-zone-floating_bottom { bottom: 8px; width: calc(100% - 16px); }
}

/* Step 6: Modern Homepage Sections */
.home-section-block{
    position:relative;
}
.section-scroll-row{
    display:flex;
    gap:1rem;
    overflow-x:auto;
    padding:.25rem .25rem 1rem;
    scroll-snap-type:x mandatory;
    scrollbar-width:thin;
}
.section-scroll-row::-webkit-scrollbar{height:8px}
.section-scroll-row::-webkit-scrollbar-thumb{background:rgba(15,23,42,.25);border-radius:999px}
.section-scroll-item{
    flex:0 0 155px;
    scroll-snap-align:start;
}
@media (min-width:768px){.section-scroll-item{flex-basis:185px}}
@media (min-width:1200px){.section-scroll-item{flex-basis:200px}}
.content-card-link{
    display:block;
    color:inherit;
    text-decoration:none;
}
.home-section-grid .video-card,
.home-section-slider .video-card{
    box-shadow:0 14px 36px rgba(15,23,42,.08);
}
.home-section-block .section-heading:before{
    content:"";
    display:inline-block;
    width:10px;
    height:10px;
    border-radius:999px;
    background:var(--theme,#dc3545);
    margin-right:.55rem;
    vertical-align:.12rem;
}


/* ==========================
   Taxonomy layout fix
   ========================== */
.taxonomy-panel{
    padding:16px;
    border-radius:28px;
    overflow:hidden;
}
.taxonomy-chip-title{
    font-size:11px;
    text-transform:uppercase;
    letter-spacing:.12em;
    font-weight:900;
    color:#475569;
    margin:0 0 10px;
}
.taxonomy-chip-title.muted{ color:#64748b; }
.taxonomy-chip-list{
    align-items:center;
}
.taxonomy-chip-list .chip-btn{
    white-space:nowrap;
    flex:0 0 auto;
}
.taxonomy-genre-box{
    max-height:190px;
    overflow:auto;
    padding-right:4px;
}
.taxonomy-genre-box::-webkit-scrollbar{width:7px;height:7px}
.taxonomy-genre-box::-webkit-scrollbar-thumb{background:rgba(15,23,42,.18);border-radius:999px}
.video-card .text-muted.small{
    display:-webkit-box;
    -webkit-line-clamp:1;
    -webkit-box-orient:vertical;
    overflow:hidden;
    min-height:18px;
}
@media (max-width: 767.98px){
    .taxonomy-panel{
        padding:12px;
        border-radius:22px;
    }
    .taxonomy-chip-list{
        flex-wrap:nowrap !important;
        overflow-x:auto;
        padding-bottom:6px;
        scrollbar-width:thin;
    }
    .taxonomy-genre-box{
        max-height:none;
        overflow:visible;
    }
    .taxonomy-genre-box .taxonomy-chip-list{
        overflow-x:auto;
    }
    .site-hero-title{font-size:clamp(28px,9vw,42px)}
    .video-card{border-radius:18px}
    .poster-wrap{border-radius:0}
}

/* ==========================
   Step 7: Dark Mode + Theme Customizer
   ========================== */
.theme-toggle-btn{
    width:42px;
    height:42px;
    border-radius:999px;
    border:1px solid rgba(255,255,255,.14);
    background:rgba(255,255,255,.10);
    color:#fff;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    font-weight:900;
    box-shadow:0 10px 24px rgba(0,0,0,.12);
}
.theme-toggle-btn:hover{background:#fff;color:#0f172a;transform:translateY(-1px)}
.theme-icon{font-size:17px;line-height:1}
.theme-preview-card{box-shadow:0 26px 70px rgba(15,23,42,.18)}

body.site-body,
body.watch-body{
    --bg-main:#f8fafc;
    --bg-main-2:#eef2f7;
    --text-main:#0f172a;
    --surface-main:#ffffff;
    --surface-soft:#f8fafc;
    --line-main:rgba(15,23,42,.09);
    --muted-main:#64748b;
    color:var(--text-main);
}
body.site-body.theme-light,
body.site-body.theme-auto{
    background:
        radial-gradient(circle at 18% 0%, var(--theme-soft), transparent 28%),
        linear-gradient(180deg,var(--bg-main) 0%,var(--bg-main-2) 100%);
}
body.site-body.theme-dark,
body.watch-body.theme-dark,
html[data-theme="dark"] body.site-body.theme-auto,
html[data-theme="dark"] body.watch-body.theme-auto{
    --ink:#f8fafc;
    --muted:#94a3b8;
    --surface:#0f172a;
    --text-main:#f8fafc;
    --surface-main:#0f172a;
    --surface-soft:#111827;
    --line-main:rgba(255,255,255,.10);
    --line:rgba(255,255,255,.10);
    --shadow:0 22px 55px rgba(0,0,0,.34);
    background:
        radial-gradient(circle at 15% 0%, rgba(var(--theme-rgb),.24), transparent 30%),
        radial-gradient(circle at 90% 12%, rgba(var(--theme-secondary-rgb),.55), transparent 28%),
        linear-gradient(180deg,#020617 0%,#0f172a 100%);
    color:#f8fafc;
}
@media (prefers-color-scheme: dark){
    body.site-body.theme-auto,
    body.watch-body.theme-auto{
        --ink:#f8fafc;
        --muted:#94a3b8;
        --surface:#0f172a;
        --text-main:#f8fafc;
        --surface-main:#0f172a;
        --surface-soft:#111827;
        --line-main:rgba(255,255,255,.10);
        --line:rgba(255,255,255,.10);
        --shadow:0 22px 55px rgba(0,0,0,.34);
        background:
            radial-gradient(circle at 15% 0%, rgba(var(--theme-rgb),.24), transparent 30%),
            radial-gradient(circle at 90% 12%, rgba(var(--theme-secondary-rgb),.55), transparent 28%),
            linear-gradient(180deg,#020617 0%,#0f172a 100%);
        color:#f8fafc;
    }
}
body.theme-bg-cinema.site-body,
body.theme-bg-cinema.watch-body{
    background:
        radial-gradient(circle at top left, rgba(var(--theme-rgb),.28), transparent 32%),
        radial-gradient(circle at bottom right, rgba(var(--theme-secondary-rgb),.42), transparent 32%),
        linear-gradient(180deg,#020617,#0f172a 70%,#020617);
    color:#f8fafc;
}
body.theme-bg-gradient.site-body{
    background:
        radial-gradient(circle at 20% 0%, rgba(255,255,255,.20), transparent 24%),
        linear-gradient(135deg, rgba(var(--theme-rgb),.18), rgba(var(--theme-secondary-rgb),.18)),
        linear-gradient(180deg,#f8fafc,#eef2f7);
}
body.theme-bg-minimal.site-body{
    background:#f8fafc;
}
body.theme-dark.theme-bg-gradient.site-body,
html[data-theme="dark"] body.theme-auto.theme-bg-gradient.site-body{
    background:
        radial-gradient(circle at 20% 0%, rgba(var(--theme-rgb),.30), transparent 28%),
        radial-gradient(circle at 78% 12%, rgba(var(--theme-secondary-rgb),.44), transparent 26%),
        linear-gradient(180deg,#020617,#0f172a);
}

body.site-body .chip-panel,
body.site-body .video-card,
body.site-body .modern-card,
body.site-body .episode-card,
body.site-body .metric-card,
body.site-body .taxonomy-panel{
    border-color:var(--line-main);
    background:var(--surface-main);
    color:var(--text-main);
    border-radius:var(--card-radius);
}
body.theme-card-glass.site-body .chip-panel,
body.theme-card-glass.site-body .video-card,
body.theme-card-glass.site-body .modern-card,
body.theme-card-glass.site-body .episode-card,
body.theme-card-glass.site-body .taxonomy-panel{
    background:rgba(255,255,255,.70);
    backdrop-filter:blur(18px);
    border-color:rgba(255,255,255,.44);
}
body.theme-dark.theme-card-glass.site-body .chip-panel,
body.theme-dark.theme-card-glass.site-body .video-card,
body.theme-dark.theme-card-glass.site-body .modern-card,
body.theme-dark.theme-card-glass.site-body .episode-card,
body.theme-dark.theme-card-glass.site-body .taxonomy-panel,
html[data-theme="dark"] body.theme-auto.theme-card-glass.site-body .chip-panel,
html[data-theme="dark"] body.theme-auto.theme-card-glass.site-body .video-card,
html[data-theme="dark"] body.theme-auto.theme-card-glass.site-body .modern-card,
html[data-theme="dark"] body.theme-auto.theme-card-glass.site-body .episode-card,
html[data-theme="dark"] body.theme-auto.theme-card-glass.site-body .taxonomy-panel{
    background:rgba(15,23,42,.62);
    border-color:rgba(255,255,255,.12);
}
body.theme-card-bordered.site-body .chip-panel,
body.theme-card-bordered.site-body .video-card,
body.theme-card-bordered.site-body .modern-card,
body.theme-card-bordered.site-body .episode-card,
body.theme-card-bordered.site-body .taxonomy-panel{
    box-shadow:none;
    border-width:2px;
}
body.site-body .video-card{border-radius:var(--card-radius)}
body.site-body .poster-wrap{background:var(--surface-soft)}
body.site-body .meta-badge{background:var(--surface-soft);color:var(--muted-main)}
body.site-body .no-poster{background:linear-gradient(135deg,var(--surface-soft),var(--surface-main));color:var(--muted-main)}
body.site-body .taxonomy-chip-title{color:var(--muted-main)}
body.site-body .text-muted{color:var(--muted-main)!important}
body.site-body .text-dark{color:var(--text-main)!important}
body.site-body .btn-light{background:var(--surface-main);border-color:var(--line-main);color:var(--text-main)}
body.site-body .bg-white{background:var(--surface-main)!important}
body.site-body .bg-light{background:var(--surface-soft)!important}
body.site-body .alert-light{background:var(--surface-soft);color:var(--text-main);border-color:var(--line-main)}
body.theme-dark.site-body .badge.text-bg-light,
html[data-theme="dark"] body.theme-auto.site-body .badge.text-bg-light{background:#1e293b!important;color:#e2e8f0!important}
body.theme-dark.site-body .line-clamp,
html[data-theme="dark"] body.theme-auto.site-body .line-clamp{color:#f8fafc}

.site-hero{
    background:
        radial-gradient(circle at 20% 16%, rgba(255,255,255,.18), transparent 18%),
        linear-gradient(135deg, var(--theme), var(--theme-secondary) 72%);
}
body.theme-bg-minimal.site-body .site-hero{
    background:
        radial-gradient(circle at 16% 18%, rgba(var(--theme-rgb),.22), transparent 24%),
        linear-gradient(135deg,#111827,#334155);
}
body.theme-bg-cinema.site-body .site-hero{
    background:
        radial-gradient(circle at 20% 16%, rgba(var(--theme-rgb),.28), transparent 20%),
        linear-gradient(135deg,#020617,var(--theme-secondary) 80%);
}

body.theme-header-solid .modern-header{background:#020617;border-bottom-color:rgba(255,255,255,.09);box-shadow:0 18px 55px rgba(0,0,0,.25)}
body.theme-header-gradient .modern-header{background:linear-gradient(135deg,rgba(var(--theme-rgb),.95),rgba(var(--theme-secondary-rgb),.95));border-bottom-color:rgba(255,255,255,.14)}
body.theme-header-glass .modern-header{background:rgba(15,23,42,.72);backdrop-filter:blur(22px)}

body.site-body .modern-footer{
    background:
        radial-gradient(circle at 12% 0%, var(--theme-soft-2), transparent 30%),
        linear-gradient(135deg, var(--theme-secondary) 0%, #020617 100%);
}
body.theme-dark.site-body .modern-footer,
html[data-theme="dark"] body.theme-auto.site-body .modern-footer{border-top:1px solid rgba(255,255,255,.08)}

body.watch-body.theme-light{
    background:
        radial-gradient(circle at top, rgba(var(--theme-rgb),.12), transparent 32%),
        #020617;
    color:#fff;
}
body.watch-body .modern-card,
body.watch-body .episode-card{
    background:rgba(255,255,255,.06);
    border-color:rgba(255,255,255,.10);
    color:#fff;
}
body.watch-body .text-muted{color:rgba(255,255,255,.58)!important}
body.watch-body .text-dark{color:#fff!important}

@media (max-width:575.98px){
    .theme-toggle-btn{width:40px;height:40px}
}

/* ==========================
   Step 8: Continue Watching + Favorites
   ========================== */
.user-library-section[hidden],
.library-empty[hidden]{display:none!important}
.library-scroll-row{
    display:flex;
    gap:1rem;
    overflow-x:auto;
    padding:.25rem .25rem 1rem;
    scroll-snap-type:x mandatory;
    scrollbar-width:thin;
}
.library-scroll-row::-webkit-scrollbar{height:8px}
.library-scroll-row::-webkit-scrollbar-thumb{background:rgba(15,23,42,.25);border-radius:999px}
.library-scroll-row .library-card{
    flex:0 0 165px;
    scroll-snap-align:start;
}
@media (min-width:768px){.library-scroll-row .library-card{flex-basis:190px}}
.library-grid{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:1rem;
}
@media (min-width:768px){.library-grid{grid-template-columns:repeat(4,minmax(0,1fr));}}
@media (min-width:1200px){.library-grid{grid-template-columns:repeat(6,minmax(0,1fr));}}
.library-card{
    border:1px solid var(--line-main,rgba(15,23,42,.09));
    border-radius:22px;
    background:var(--surface-main,#fff);
    overflow:hidden;
    box-shadow:0 14px 36px rgba(15,23,42,.08);
    transition:.2s ease;
}
.library-card:hover{transform:translateY(-4px);box-shadow:0 24px 55px rgba(15,23,42,.14)}
.library-card-main{display:block;text-decoration:none;color:inherit}
.library-poster{position:relative;aspect-ratio:2/3;background:#e9ecef;overflow:hidden}
.library-poster img{width:100%;height:100%;object-fit:cover;display:block;transition:.25s ease}
.library-card:hover .library-poster img{transform:scale(1.045)}
.library-poster:after{content:"";position:absolute;inset:0;background:linear-gradient(180deg,rgba(0,0,0,0) 50%,rgba(0,0,0,.62) 100%)}
.library-no-poster{height:100%;display:flex;align-items:center;justify-content:center;color:#64748b;background:linear-gradient(135deg,#e2e8f0,#f8fafc);font-size:12px}
.library-badge{position:absolute;left:10px;bottom:10px;z-index:2;background:var(--theme,#dc3545);color:#fff;border-radius:999px;padding:5px 9px;font-size:10px;font-weight:900;box-shadow:0 10px 22px rgba(0,0,0,.18)}
.library-body{padding:12px 12px 8px}
.library-title{font-weight:900;font-size:13px;line-height:1.28;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;min-height:34px;color:var(--text-main,#0f172a)}
.library-meta{margin-top:5px;font-size:12px;color:var(--muted-main,#64748b);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.library-actions{display:flex;gap:6px;padding:0 12px 12px;flex-wrap:wrap}
.library-actions .btn{font-size:11px;font-weight:900;padding:5px 9px}
.favorite-toggle-btn.is-favorite{
    background:var(--theme,#dc3545)!important;
    border-color:var(--theme,#dc3545)!important;
    color:#fff!important;
    box-shadow:0 14px 30px rgba(0,0,0,.18);
}
.library-page-hero .site-hero-inner{padding-top:48px;padding-bottom:48px}
body.theme-dark .library-card,
html[data-theme="dark"] body.theme-auto .library-card{
    background:rgba(15,23,42,.72);
    border-color:rgba(255,255,255,.10);
}
body.theme-dark .library-title,
html[data-theme="dark"] body.theme-auto .library-title{color:#f8fafc}
body.theme-dark .library-meta,
html[data-theme="dark"] body.theme-auto .library-meta{color:#94a3b8}
body.theme-dark .library-actions .btn-outline-dark,
html[data-theme="dark"] body.theme-auto .library-actions .btn-outline-dark{color:#f8fafc;border-color:rgba(255,255,255,.25)}
body.theme-dark .library-actions .btn-dark,
html[data-theme="dark"] body.theme-auto .library-actions .btn-dark{background:#f8fafc;color:#0f172a;border-color:#f8fafc}
@media (max-width:575.98px){
    .library-scroll-row .library-card{flex-basis:150px}
    .library-grid{gap:.85rem}
    .library-card{border-radius:18px}
}

/* Admin Analytics */
.analytics-kpi-row .analytics-kpi {
    border: 1px solid rgba(15, 23, 42, .08);
    background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.98));
}
.analytics-kpi-value {
    font-size: clamp(1.4rem, 2.3vw, 2rem);
    font-weight: 900;
    letter-spacing: -.04em;
    color: #111827;
    line-height: 1.05;
    margin: .35rem 0;
}
.text-break {
    word-break: break-word;
}

/* Step SEO 5 - Taxonomy Content */
.seo-taxonomy-box,
.seo-faq-box{
    border:1px solid var(--line-main,rgba(15,23,42,.09));
    border-radius:var(--radius-main,26px);
    background:linear-gradient(135deg,rgba(255,255,255,.94),rgba(248,250,252,.82));
    box-shadow:0 18px 55px rgba(15,23,42,.08);
    overflow:hidden;
}
.seo-taxonomy-inner{padding:clamp(1.1rem,2vw,1.8rem)}
.seo-taxonomy-kicker{
    display:inline-flex;align-items:center;gap:.45rem;
    padding:.35rem .7rem;border-radius:999px;
    background:color-mix(in srgb,var(--theme,#dc3545) 12%, transparent);
    color:var(--theme,#dc3545);font-size:.72rem;font-weight:900;text-transform:uppercase;letter-spacing:.08em;margin-bottom:.85rem;
}
.seo-taxonomy-title,.seo-faq-title{
    font-size:clamp(1.1rem,2.4vw,1.65rem);
    font-weight:950;letter-spacing:-.035em;color:var(--text-main,#0f172a);margin-bottom:.7rem;
}
.seo-taxonomy-desc{max-width:920px;color:var(--muted-main,#64748b);line-height:1.75;font-size:.96rem}
.seo-related-title{font-size:.82rem;font-weight:900;text-transform:uppercase;letter-spacing:.06em;color:var(--muted-main,#64748b)}
.seo-related-chip{
    display:inline-flex;align-items:center;justify-content:center;text-decoration:none;
    border:1px solid var(--line-main,rgba(15,23,42,.10));
    background:var(--surface-main,#fff);color:var(--text-main,#0f172a);
    border-radius:999px;padding:.45rem .78rem;font-size:.82rem;font-weight:850;
    transition:.18s ease;
}
.seo-related-chip:hover{transform:translateY(-1px);border-color:var(--theme,#dc3545);color:var(--theme,#dc3545);box-shadow:0 12px 26px rgba(15,23,42,.10)}
.seo-faq-box{padding:clamp(1.1rem,2vw,1.8rem)}
.seo-faq-list{display:grid;gap:.65rem}
.seo-faq-item{
    border:1px solid var(--line-main,rgba(15,23,42,.08));
    border-radius:18px;background:var(--surface-main,#fff);padding:.9rem 1rem;
}
.seo-faq-item summary{cursor:pointer;font-weight:900;color:var(--text-main,#0f172a);list-style:none}
.seo-faq-item summary::-webkit-details-marker{display:none}
.seo-faq-item summary:after{content:'+';float:right;color:var(--theme,#dc3545);font-weight:950}
.seo-faq-item[open] summary:after{content:'–'}
.seo-faq-item p{margin:.7rem 0 0;color:var(--muted-main,#64748b);line-height:1.65}
body.theme-dark .seo-taxonomy-box,
body.theme-dark .seo-faq-box,
html[data-theme="dark"] body.theme-auto .seo-taxonomy-box,
html[data-theme="dark"] body.theme-auto .seo-faq-box{
    background:linear-gradient(135deg,rgba(15,23,42,.76),rgba(2,6,23,.62));
    border-color:rgba(255,255,255,.10);
}
body.theme-dark .seo-related-chip,
body.theme-dark .seo-faq-item,
html[data-theme="dark"] body.theme-auto .seo-related-chip,
html[data-theme="dark"] body.theme-auto .seo-faq-item{
    background:rgba(15,23,42,.72);border-color:rgba(255,255,255,.10);
}

/* Step SEO 6 — Internal Linking Engine */
.internal-link-box {
    border: 1px solid rgba(15, 23, 42, .08);
    background: rgba(255, 255, 255, .74);
    backdrop-filter: blur(14px);
    border-radius: var(--card-radius, 24px);
    padding: 1rem;
    box-shadow: 0 18px 45px rgba(15, 23, 42, .06);
}
.internal-chip {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    border-radius: 999px;
    padding: .48rem .78rem;
    text-decoration: none;
    color: #111827;
    background: rgba(15, 23, 42, .055);
    border: 1px solid rgba(15, 23, 42, .07);
    font-weight: 700;
    font-size: .875rem;
    transition: transform .18s ease, background .18s ease, border-color .18s ease;
}
.internal-chip span {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--theme-color, #dc3545);
}
.internal-chip:hover {
    transform: translateY(-1px);
    background: color-mix(in srgb, var(--theme-color, #dc3545) 12%, white);
    border-color: color-mix(in srgb, var(--theme-color, #dc3545) 26%, transparent);
    color: #111827;
}
.related-content-section {
    border-radius: var(--card-radius, 24px);
}
.episode-nav-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}
.episode-nav-card {
    display: block;
    padding: 1rem 1.1rem;
    border-radius: 20px;
    text-decoration: none;
    color: #fff;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.12);
    transition: transform .18s ease, background .18s ease, border-color .18s ease;
}
.episode-nav-card span {
    display: block;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: rgba(255,255,255,.62);
    margin-bottom: .25rem;
}
.episode-nav-card strong {
    color: #fff;
}
.episode-nav-card:hover {
    transform: translateY(-1px);
    color: #fff;
    background: rgba(255,255,255,.14);
    border-color: rgba(255,255,255,.24);
}
[data-theme-mode="dark"] .internal-link-box,
.theme-dark .internal-link-box,
.watch-body .internal-link-box {
    background: rgba(255,255,255,.06);
    border-color: rgba(255,255,255,.10);
    color: #fff;
}
[data-theme-mode="dark"] .internal-chip,
.theme-dark .internal-chip,
.watch-body .internal-chip {
    color: #fff;
    background: rgba(255,255,255,.08);
    border-color: rgba(255,255,255,.11);
}
[data-theme-mode="dark"] .internal-chip:hover,
.theme-dark .internal-chip:hover,
.watch-body .internal-chip:hover {
    color: #fff;
    background: rgba(255,255,255,.14);
}
@media (max-width: 767.98px) {
    .episode-nav-grid { grid-template-columns: 1fr; }
    .internal-link-box { border-radius: 18px; }
    .internal-chip { font-size: .82rem; }
}


/* Step SEO 7 - Static Trust Pages */
.static-page-wrap{max-width:1040px}.static-hero{position:relative;overflow:hidden;border-radius:34px;padding:48px;background:linear-gradient(135deg,var(--theme-soft,rgba(220,53,69,.16)),rgba(255,255,255,.82));box-shadow:0 22px 70px rgba(15,23,42,.10);border:1px solid rgba(255,255,255,.55);margin-bottom:24px}.theme-dark .static-hero,.site-body.theme-dark .static-hero{background:linear-gradient(135deg,rgba(255,255,255,.08),rgba(15,23,42,.94));border-color:rgba(255,255,255,.10);box-shadow:0 24px 90px rgba(0,0,0,.36)}.static-eyebrow{display:inline-flex;align-items:center;gap:8px;border-radius:999px;padding:8px 14px;background:var(--theme-soft,rgba(220,53,69,.14));color:var(--theme,#dc3545);font-weight:800;text-transform:uppercase;letter-spacing:.08em;font-size:.76rem;margin-bottom:18px}.static-hero h1{font-size:clamp(2rem,4vw,4.2rem);line-height:1;font-weight:950;letter-spacing:-.05em;margin:0 0 18px;color:var(--text-strong,#0f172a)}.theme-dark .static-hero h1,.site-body.theme-dark .static-hero h1{color:#fff}.static-hero p{max-width:820px;font-size:1.08rem;color:var(--text-muted,#64748b);margin:0}.theme-dark .static-hero p,.site-body.theme-dark .static-hero p{color:rgba(255,255,255,.72)}.static-meta-row{display:flex;flex-wrap:wrap;gap:10px;margin-top:24px}.static-meta-row span{border-radius:999px;background:rgba(255,255,255,.74);border:1px solid rgba(15,23,42,.08);padding:8px 13px;font-size:.85rem;font-weight:800;color:#334155}.theme-dark .static-meta-row span,.site-body.theme-dark .static-meta-row span{background:rgba(255,255,255,.08);border-color:rgba(255,255,255,.10);color:rgba(255,255,255,.82)}.static-content-card,.static-related-card{border-radius:30px;background:var(--card-bg,#fff);border:1px solid rgba(15,23,42,.08);box-shadow:0 18px 55px rgba(15,23,42,.08);padding:34px;margin-bottom:24px}.theme-dark .static-content-card,.theme-dark .static-related-card,.site-body.theme-dark .static-content-card,.site-body.theme-dark .static-related-card{background:rgba(15,23,42,.72);border-color:rgba(255,255,255,.10);box-shadow:0 24px 80px rgba(0,0,0,.34)}.static-section-block+ .static-section-block{border-top:1px solid rgba(15,23,42,.08);padding-top:24px;margin-top:24px}.theme-dark .static-section-block+ .static-section-block,.site-body.theme-dark .static-section-block+ .static-section-block{border-top-color:rgba(255,255,255,.10)}.static-section-block h2,.static-related-card h2{font-size:1.22rem;font-weight:900;letter-spacing:-.02em;margin-bottom:10px;color:var(--text-strong,#0f172a)}.theme-dark .static-section-block h2,.theme-dark .static-related-card h2,.site-body.theme-dark .static-section-block h2,.site-body.theme-dark .static-related-card h2{color:#fff}.static-section-block p{line-height:1.75;color:var(--text-muted,#64748b);margin:0}.theme-dark .static-section-block p,.site-body.theme-dark .static-section-block p{color:rgba(255,255,255,.72)}.static-link-grid{display:flex;flex-wrap:wrap;gap:10px}.static-link-grid a{display:inline-flex;text-decoration:none;border-radius:999px;padding:10px 14px;background:var(--theme-soft,rgba(220,53,69,.12));color:var(--theme,#dc3545);font-weight:850;border:1px solid rgba(220,53,69,.14)}.static-link-grid a:hover{transform:translateY(-1px);filter:brightness(.96)}@media (max-width:768px){.static-hero{padding:32px 24px;border-radius:26px}.static-content-card,.static-related-card{padding:24px;border-radius:24px}}

/* Step SEO 9 - Performance & Core Web Vitals */
.poster-wrap,
.video-card,
.content-card-link,
.detail-poster,
.cast-avatar {
    content-visibility: auto;
}
.poster-wrap {
    aspect-ratio: 2 / 3;
    background: linear-gradient(135deg, rgba(148,163,184,.16), rgba(15,23,42,.18));
    contain: layout paint;
}
.poster-wrap img,
.detail-poster,
.brand-logo,
.brand-logo-sm {
    transform: translateZ(0);
    backface-visibility: hidden;
}
.img-fallback-used {
    object-fit: cover;
    opacity: .85;
}
.skeleton-card {
    min-height: 280px;
    border-radius: var(--site-radius, 22px);
    background: linear-gradient(90deg, rgba(148,163,184,.10), rgba(148,163,184,.22), rgba(148,163,184,.10));
    background-size: 200% 100%;
    animation: skeletonMove 1.2s ease-in-out infinite;
}
@keyframes skeletonMove {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.perf-ready .skeleton-card { animation-play-state: paused; }
iframe[loading="lazy"] {
    background: #020617;
}
@media (prefers-reduced-motion: reduce) {
    .skeleton-card { animation: none; }
    *, *::before, *::after { scroll-behavior: auto !important; }
}

/* Step SEO 10 - Error Page SEO & Broken Link Handler */
.seo-error-card{max-width:860px;border-radius:34px;position:relative;overflow:hidden}
.seo-error-card:before{content:"";position:absolute;inset:-40% -20% auto auto;width:320px;height:320px;border-radius:999px;background:var(--theme-soft,rgba(220,53,69,.16));filter:blur(20px);pointer-events:none}
.seo-error-code{font-size:clamp(4rem,12vw,8rem);font-weight:900;line-height:.9;letter-spacing:-.08em;color:var(--theme,#dc3545);text-shadow:0 24px 70px var(--theme-soft,rgba(220,53,69,.22));margin-bottom:1rem}
.seo-error-search{display:flex;gap:.5rem;max-width:560px;background:rgba(255,255,255,.82);border:1px solid rgba(15,23,42,.08);border-radius:999px;padding:.45rem;box-shadow:0 20px 60px rgba(15,23,42,.08)}
.seo-error-search input{flex:1;border:0;background:transparent;padding:.75rem 1rem;outline:0;min-width:0}
.seo-error-search button{border:0;border-radius:999px;background:var(--theme,#dc3545);color:#fff;font-weight:800;padding:.75rem 1.35rem}
[data-theme="dark"] .seo-error-search{background:rgba(15,23,42,.72);border-color:rgba(255,255,255,.10)}
[data-theme="dark"] .seo-error-search input{color:#fff}
[data-theme="dark"] .seo-error-search input::placeholder{color:rgba(255,255,255,.55)}
@media(max-width:575.98px){.seo-error-search{border-radius:24px;flex-direction:column}.seo-error-search button{width:100%}}

/* Ads Analytics / Monetization Pro */
.ad-item { position: relative; }
.ad-close {
  position: absolute;
  top: .35rem;
  right: .35rem;
  z-index: 4;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: rgba(15, 23, 42, .72);
  color: #fff;
  line-height: 1;
  font-size: 18px;
  box-shadow: 0 10px 25px rgba(0,0,0,.18);
}
.ad-close:hover { background: rgba(220, 53, 69, .92); }
.admin-kpi-muted { color: rgba(100,116,139,.95); }


/* UX Upgrade Styles */
.ux-toast-wrap{position:fixed;right:18px;bottom:22px;z-index:99999;display:flex;flex-direction:column;gap:10px;max-width:min(380px,calc(100vw - 32px))}
.ux-toast{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:13px 14px;border-radius:18px;background:rgba(15,17,23,.92);color:#fff;box-shadow:0 20px 70px rgba(0,0,0,.25);backdrop-filter:blur(16px);animation:uxToastIn .25s ease-out;border:1px solid rgba(255,255,255,.12)}
.ux-toast button{border:0;background:rgba(255,255,255,.12);color:#fff;width:26px;height:26px;border-radius:50%;line-height:1}
.ux-toast-success{background:rgba(20,120,80,.94)}.ux-toast-danger{background:rgba(190,45,65,.94)}.ux-toast-info{background:rgba(35,65,145,.94)}
.ux-toast.is-hide{opacity:0;transform:translateY(10px)}
@keyframes uxToastIn{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:translateY(0)}}
.ux-install-btn,.ux-backtop{position:fixed;z-index:9990;border:0;border-radius:999px;box-shadow:0 18px 55px rgba(0,0,0,.25);font-weight:800}
.ux-install-btn{left:18px;bottom:22px;background:var(--site-primary,#6f42c1);color:#fff;padding:11px 16px}
.ux-backtop{right:18px;bottom:88px;width:46px;height:46px;background:rgba(15,17,23,.86);color:#fff;opacity:0;pointer-events:none;transition:.2s ease;backdrop-filter:blur(16px)}
.ux-backtop.show{opacity:1;pointer-events:auto}
.ux-modal-overlay{position:fixed;inset:0;z-index:99998;background:rgba(0,0,0,.68);display:flex;align-items:center;justify-content:center;padding:18px;opacity:0;transition:.2s ease;backdrop-filter:blur(10px)}
.ux-modal-overlay.show{opacity:1}.ux-modal-card{width:min(620px,100%);max-height:90vh;overflow:auto;background:var(--bs-body-bg,#fff);color:var(--bs-body-color,#111);border-radius:28px;box-shadow:0 28px 100px rgba(0,0,0,.38);border:1px solid rgba(255,255,255,.14)}
.ux-modal-head{display:flex;justify-content:space-between;align-items:center;padding:18px 20px;border-bottom:1px solid rgba(128,128,128,.18);font-size:1.05rem}.ux-modal-head button{border:0;background:rgba(127,127,127,.14);border-radius:50%;width:34px;height:34px;font-size:22px;line-height:1}
.ux-server-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:10px;padding:18px}.ux-server-choice{padding:13px 15px;border-radius:18px;text-decoration:none;background:rgba(127,127,127,.10);font-weight:800;color:inherit;border:1px solid rgba(127,127,127,.16)}.ux-server-choice.active{background:var(--site-primary,#6f42c1);color:#fff;border-color:transparent}
.ux-report-card form{display:flex;flex-direction:column;gap:10px;padding:18px}.ux-report-card label{font-weight:800}.ux-report-card select,.ux-report-card textarea{width:100%;border-radius:16px;border:1px solid rgba(127,127,127,.22);padding:12px 14px;background:var(--bs-body-bg,#fff);color:var(--bs-body-color,#111)}.ux-submit-btn{border:0;border-radius:999px;background:var(--site-primary,#6f42c1);color:#fff;font-weight:900;padding:12px 18px;margin-top:6px}
.ux-watch-tools{position:relative;overflow:hidden}.ux-watch-tools:before{content:"";position:absolute;inset:auto -80px -110px auto;width:190px;height:190px;border-radius:50%;background:radial-gradient(circle,rgba(255,255,255,.16),transparent 65%)}
.ux-admin-option{display:flex;gap:12px;padding:16px;border:1px solid rgba(127,127,127,.18);border-radius:22px;background:rgba(255,255,255,.7);box-shadow:0 18px 60px rgba(0,0,0,.04);cursor:pointer}.admin-shell .ux-admin-option{background:#fff}.ux-admin-option input{width:20px;height:20px;margin-top:2px}.ux-admin-option strong{display:block}.ux-admin-option small{display:block;color:#6c757d;margin-top:4px;line-height:1.35}
@media(max-width:576px){.ux-toast-wrap{left:12px;right:12px;bottom:14px}.ux-install-btn{left:12px;bottom:14px}.ux-backtop{right:12px;bottom:76px}.ux-modal-card{border-radius:22px}.ux-server-grid{grid-template-columns:1fr}}

/* PWA Streaming App Mode */
.pwa-install-inline {
  border-color: rgba(255,255,255,.26) !important;
  color: rgba(255,255,255,.92) !important;
  backdrop-filter: blur(12px);
}
.pwa-install-inline:not(.d-none) { display: inline-flex !important; align-items: center; gap: .4rem; }
.pwa-install-inline::before { content: '⬇'; font-size: .92em; }
.pwa-install-float,
.ux-install-btn {
  position: fixed;
  right: 18px;
  bottom: 92px;
  z-index: 1060;
  border: 0;
  border-radius: 999px;
  padding: .78rem 1.05rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--theme-color, #7c3aed), #06b6d4);
  box-shadow: 0 18px 45px rgba(0,0,0,.28);
}
.pwa-install-float:hover,
.ux-install-btn:hover { transform: translateY(-1px); box-shadow: 0 24px 60px rgba(0,0,0,.34); }
.offline-card {
  max-width: 680px;
  border: 1px solid rgba(148,163,184,.18);
}
.offline-icon {
  width: 88px;
  height: 88px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 28px;
  font-size: 2.8rem;
  background: rgba(124,58,237,.12);
  box-shadow: inset 0 0 0 1px rgba(124,58,237,.18);
}
.pwa-preview-icon {
  width: 74px;
  height: 74px;
  border-radius: 22px;
  object-fit: cover;
  background: #0f172a;
  box-shadow: 0 18px 50px rgba(0,0,0,.18);
}
@media (max-width: 575.98px) {
  .pwa-install-float,
  .ux-install-btn {
    right: 14px;
    bottom: 82px;
    padding: .68rem .9rem;
  }
}

/* =========================================================
   Admin Sidebar Modern + Grouped Menu
   ========================================================= */
.admin-modern-shell {
    --admin-sidebar-width: 292px;
    --admin-sidebar-mini-width: 92px;
    --admin-topbar-height: 72px;
    --admin-sidebar-bg: #0f172a;
    --admin-sidebar-bg-2: #111c33;
    --admin-sidebar-border: rgba(255,255,255,.08);
    --admin-sidebar-text: rgba(255,255,255,.88);
    --admin-sidebar-muted: rgba(255,255,255,.54);
    --admin-sidebar-active: #2563eb;
    --admin-sidebar-active-2: #7c3aed;
    --admin-content-bg: #f4f6fb;
    background: var(--admin-content-bg);
}
.admin-modern-layout {
    min-height: 100vh;
    display: flex;
    background:
        radial-gradient(circle at top right, rgba(37,99,235,.10), transparent 32rem),
        linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
}
.admin-sidebar {
    width: var(--admin-sidebar-width);
    min-width: var(--admin-sidebar-width);
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    color: var(--admin-sidebar-text);
    background:
        radial-gradient(circle at top left, rgba(124,58,237,.25), transparent 18rem),
        linear-gradient(180deg, var(--admin-sidebar-bg) 0%, var(--admin-sidebar-bg-2) 100%);
    border-right: 1px solid var(--admin-sidebar-border);
    box-shadow: 24px 0 60px rgba(15,23,42,.20);
    transition: width .22s ease, min-width .22s ease, transform .22s ease;
}
.admin-sidebar-head {
    min-height: var(--admin-topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--admin-sidebar-border);
}
.admin-sidebar-brand {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    gap: 12px;
    color: #fff;
    text-decoration: none;
}
.admin-sidebar-brand:hover { color: #fff; }
.admin-sidebar-logo {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 14px 30px rgba(37,99,235,.28);
}
.admin-sidebar-brand-text {
    display: grid;
    line-height: 1.15;
    min-width: 0;
}
.admin-sidebar-brand-text strong {
    font-size: 15px;
    letter-spacing: -.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.admin-sidebar-brand-text small {
    margin-top: 3px;
    font-size: 11px;
    color: var(--admin-sidebar-muted);
    text-transform: uppercase;
    letter-spacing: .08em;
}
.admin-mobile-close {
    display: none;
    width: 34px;
    height: 34px;
    border-radius: 12px;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: rgba(255,255,255,.10);
    cursor: pointer;
}
.admin-menu-search-wrap {
    padding: 14px 16px 10px;
}
.admin-menu-search {
    width: 100%;
    height: 42px;
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 14px;
    color: #fff;
    background: rgba(255,255,255,.075);
    padding: 0 14px;
    outline: none;
    transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
}
.admin-menu-search::placeholder { color: rgba(255,255,255,.42); }
.admin-menu-search:focus {
    border-color: rgba(96,165,250,.55);
    background: rgba(255,255,255,.11);
    box-shadow: 0 0 0 4px rgba(37,99,235,.18);
}
.admin-menu-groups {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px 14px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.24) transparent;
}
.admin-menu-groups::-webkit-scrollbar { width: 8px; }
.admin-menu-groups::-webkit-scrollbar-thumb { background: rgba(255,255,255,.20); border-radius: 999px; }
.admin-menu-group {
    margin-bottom: 7px;
    border-radius: 16px;
    overflow: hidden;
}
.admin-menu-group summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    color: rgba(255,255,255,.68);
    border-radius: 16px;
    transition: background .18s ease, color .18s ease;
}
.admin-menu-group summary::-webkit-details-marker { display: none; }
.admin-menu-group summary:hover,
.admin-menu-group[open] > summary {
    color: #fff;
    background: rgba(255,255,255,.08);
}
.admin-menu-group-icon,
.admin-menu-icon {
    width: 28px;
    height: 28px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 28px;
    font-size: 14px;
    background: rgba(255,255,255,.08);
}
.admin-menu-group-label {
    flex: 1;
    min-width: 0;
    font-weight: 800;
    font-size: 11px;
    line-height: 1.15;
    text-transform: uppercase;
    letter-spacing: .08em;
}
.admin-menu-group-chevron {
    opacity: .6;
    transition: transform .18s ease;
}
.admin-menu-group[open] .admin-menu-group-chevron { transform: rotate(180deg); }
.admin-menu-items {
    display: grid;
    gap: 4px;
    padding: 5px 0 8px 12px;
}
.admin-menu-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 11px;
    border-radius: 14px;
    color: rgba(255,255,255,.70);
    text-decoration: none;
    transition: color .18s ease, background .18s ease, transform .18s ease;
}
.admin-menu-link:hover {
    color: #fff;
    background: rgba(255,255,255,.08);
    transform: translateX(2px);
}
.admin-menu-link.active {
    color: #fff;
    background: linear-gradient(135deg, var(--admin-sidebar-active), var(--admin-sidebar-active-2));
    box-shadow: 0 14px 28px rgba(37,99,235,.24);
}
.admin-menu-link.active .admin-menu-icon {
    background: rgba(255,255,255,.18);
}
.admin-menu-label {
    font-size: 13px;
    font-weight: 750;
    line-height: 1.2;
}
.admin-sidebar-footer {
    padding: 14px 16px 16px;
    border-top: 1px solid var(--admin-sidebar-border);
    display: grid;
    gap: 10px;
}
.admin-sidebar-portal {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border-radius: 16px;
    color: #fff;
    text-decoration: none;
    background: rgba(255,255,255,.08);
}
.admin-sidebar-portal:hover {
    color: #fff;
    background: rgba(255,255,255,.12);
}
.admin-sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    min-width: 0;
}
.admin-sidebar-user strong,
.admin-sidebar-user small {
    display: block;
    line-height: 1.15;
}
.admin-sidebar-user strong {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.admin-sidebar-user small {
    margin-top: 2px;
    font-size: 11px;
    color: var(--admin-sidebar-muted);
}
.admin-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    background: linear-gradient(135deg, #22c55e, #2563eb);
    box-shadow: 0 12px 24px rgba(37,99,235,.20);
}
.admin-sidebar-mobile-toggle { display: none; }
.admin-sidebar-backdrop { display: none; }
.admin-main-panel {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.admin-topbar {
    min-height: var(--admin-topbar-height);
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 12px 24px;
    background: rgba(15,23,42,.90);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(255,255,255,.08);
    box-shadow: 0 18px 45px rgba(15,23,42,.16);
}
.admin-topbar-left,
.admin-topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}
.admin-sidebar-collapse-btn,
.admin-mobile-menu-btn {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 14px;
    color: #fff;
    background: rgba(255,255,255,.08);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.admin-sidebar-collapse-btn:hover,
.admin-mobile-menu-btn:hover {
    background: rgba(255,255,255,.14);
}
.admin-mobile-menu-btn { display: none; }
.admin-topbar-title {
    display: grid;
    line-height: 1.15;
    color: #fff;
}
.admin-topbar-title strong {
    font-size: 16px;
    font-weight: 900;
    letter-spacing: -.02em;
}
.admin-topbar-title small {
    margin-top: 3px;
    color: rgba(255,255,255,.56);
    font-size: 12px;
}
.admin-topbar-user {
    color: rgba(255,255,255,.66);
    font-size: 13px;
}
.admin-content {
    flex: 1;
    min-width: 0;
}
.admin-modern-shell .admin-navbar {
    display: none !important;
}
body.admin-sidebar-collapsed .admin-sidebar {
    width: var(--admin-sidebar-mini-width);
    min-width: var(--admin-sidebar-mini-width);
}
body.admin-sidebar-collapsed .admin-sidebar-brand-text,
body.admin-sidebar-collapsed .admin-menu-search-wrap,
body.admin-sidebar-collapsed .admin-menu-group-label,
body.admin-sidebar-collapsed .admin-menu-group-chevron,
body.admin-sidebar-collapsed .admin-menu-label,
body.admin-sidebar-collapsed .admin-sidebar-portal span:last-child,
body.admin-sidebar-collapsed .admin-sidebar-user span:not(.admin-user-avatar) {
    display: none !important;
}
body.admin-sidebar-collapsed .admin-sidebar-head {
    justify-content: center;
    padding-left: 12px;
    padding-right: 12px;
}
body.admin-sidebar-collapsed .admin-menu-groups {
    padding-left: 10px;
    padding-right: 10px;
}
body.admin-sidebar-collapsed .admin-menu-group summary,
body.admin-sidebar-collapsed .admin-menu-link,
body.admin-sidebar-collapsed .admin-sidebar-portal {
    justify-content: center;
    padding-left: 8px;
    padding-right: 8px;
}
body.admin-sidebar-collapsed .admin-menu-items {
    padding-left: 0;
}
body.admin-sidebar-collapsed .admin-menu-group {
    overflow: visible;
}
body.admin-sidebar-collapsed .admin-sidebar-footer {
    padding-left: 10px;
    padding-right: 10px;
}
@media (max-width: 991.98px) {
    .admin-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-105%);
        width: min(88vw, 320px);
        min-width: min(88vw, 320px);
    }
    .admin-sidebar-mobile-toggle:checked ~ .admin-modern-layout .admin-sidebar {
        transform: translateX(0);
    }
    .admin-sidebar-mobile-toggle:checked ~ .admin-modern-layout .admin-sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1030;
        background: rgba(15,23,42,.55);
        backdrop-filter: blur(4px);
    }
    .admin-mobile-close,
    .admin-mobile-menu-btn {
        display: inline-flex;
    }
    .admin-sidebar-collapse-btn {
        display: none;
    }
    .admin-topbar {
        padding: 12px 14px;
    }
    .admin-topbar-title small {
        display: none;
    }
    .admin-topbar-actions .btn-light {
        display: none !important;
    }
    body.admin-sidebar-collapsed .admin-sidebar {
        width: min(88vw, 320px);
        min-width: min(88vw, 320px);
    }
    body.admin-sidebar-collapsed .admin-sidebar-brand-text,
    body.admin-sidebar-collapsed .admin-menu-search-wrap,
    body.admin-sidebar-collapsed .admin-menu-group-label,
    body.admin-sidebar-collapsed .admin-menu-group-chevron,
    body.admin-sidebar-collapsed .admin-menu-label,
    body.admin-sidebar-collapsed .admin-sidebar-portal span:last-child,
    body.admin-sidebar-collapsed .admin-sidebar-user span:not(.admin-user-avatar) {
        display: initial !important;
    }
    body.admin-sidebar-collapsed .admin-menu-group summary,
    body.admin-sidebar-collapsed .admin-menu-link,
    body.admin-sidebar-collapsed .admin-sidebar-portal {
        justify-content: flex-start;
    }
}

/* Portal Settings */
.portal-bg {
    background:
        radial-gradient(circle at 12% 5%, color-mix(in srgb, var(--portal-primary, #dc3545) 35%, transparent), transparent 32%),
        radial-gradient(circle at 88% 0%, color-mix(in srgb, var(--portal-secondary, #6f42c1) 36%, transparent), transparent 34%),
        linear-gradient(135deg, #0b1020 0%, #12172a 50%, #0f172a 100%);
}
.portal-brand-logo {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    object-fit: cover;
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.16);
    box-shadow: 0 16px 34px rgba(0,0,0,.22);
}
.portal-footer-logo {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    object-fit: cover;
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.16);
}

/* Admin Activity Log */
.admin-code {
    background: rgba(15, 23, 42, .06);
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: 14px;
    padding: 12px;
    max-height: 280px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}
body.dark-mode .admin-code,
[data-bs-theme="dark"] .admin-code {
    background: rgba(255,255,255,.06);
    border-color: rgba(255,255,255,.12);
}

/* ==========================
   Step - Template Builder Frontend
   ========================== */
body.site-body[class*="template-"] .home-section-block{margin-bottom:var(--template-section-gap,1.65rem)}
body.site-body.template-density-compact main.container{padding-top:1.15rem!important;padding-bottom:1.15rem!important}
body.site-body.template-density-comfortable main.container{padding-top:2.25rem!important;padding-bottom:2.25rem!important}
body.site-body .row.g-3 > [class*="col-6"] .video-card{height:100%}
@media (min-width:1200px){
    body.site-body .home-section-grid{--bs-gutter-x:1rem;--bs-gutter-y:1rem;}
    body.site-body.template-card-wide-poster .home-section-grid > [class*="col-"]{width:calc(100% / min(var(--template-grid-cols,5), 5));}
}
body.template-hero-cinematic .site-hero{background:radial-gradient(circle at 18% 0%,rgba(var(--theme-rgb,220,53,69),.32),transparent 36%),linear-gradient(135deg,#020617,#111827 45%,#020617);min-height:380px;display:flex;align-items:center}
body.template-hero-cinematic .site-hero::after{background:radial-gradient(circle,rgba(255,255,255,.14),transparent 62%);filter:blur(2px)}
body.template-hero-cinematic .site-hero-title{font-size:clamp(40px,7vw,82px);letter-spacing:-.07em;text-transform:uppercase}
body.template-hero-gradient .site-hero{background:radial-gradient(circle at 15% 0%,rgba(255,255,255,.32),transparent 28%),linear-gradient(135deg,var(--theme,#dc3545),var(--theme-secondary,#6f42c1));}
body.template-hero-gradient .site-hero::after{background:rgba(255,255,255,.16)}
body.template-hero-immersive .site-hero{min-height:430px;background:linear-gradient(115deg,rgba(var(--theme-rgb,220,53,69),.24),rgba(2,6,23,.94)),radial-gradient(circle at 80% 20%,rgba(255,255,255,.16),transparent 34%)}
body.template-hero-immersive .site-hero-inner{padding-top:86px;padding-bottom:76px}
body.template-hero-simple .site-hero{background:#fff;color:#0f172a;border-bottom:1px solid rgba(15,23,42,.08);box-shadow:none}
body.template-hero-simple .site-hero-title{color:#0f172a;font-size:clamp(30px,4.2vw,54px)}
body.template-hero-simple .site-hero-desc{color:#475569}
body.template-hero-simple .site-stat{background:#f8fafc;color:#334155;border-color:#e2e8f0}
body.template-card-poster-glow .video-card{background:linear-gradient(180deg,rgba(15,23,42,.96),rgba(15,23,42,.78));color:#fff;border-color:rgba(255,255,255,.10);box-shadow:0 20px 70px rgba(0,0,0,.26)}
body.template-card-poster-glow .video-card:hover{box-shadow:0 26px 90px rgba(var(--theme-rgb,220,53,69),.32)}
body.template-card-poster-glow .video-card .text-muted{color:rgba(255,255,255,.66)!important}
body.template-card-soft-pop .video-card{border:0;background:linear-gradient(180deg,#fff,rgba(var(--theme-rgb,220,53,69),.055));box-shadow:0 18px 45px rgba(var(--theme-rgb,220,53,69),.16)}
body.template-card-soft-pop .episode-badge{background:linear-gradient(135deg,var(--theme,#dc3545),var(--theme-secondary,#6f42c1))}
body.template-card-wide-poster .video-card{border-radius:28px}
body.template-card-wide-poster .poster-wrap{aspect-ratio:16/20}
body.template-card-wide-poster .line-clamp{font-size:1.02rem;min-height:48px}
body.template-card-clean .video-card{box-shadow:none;border:1px solid rgba(15,23,42,.10);border-radius:16px;background:#fff}
body.template-card-clean .video-card:hover{transform:none;box-shadow:0 12px 28px rgba(15,23,42,.08)}
body.template-card-clean .poster-overlay{opacity:.52}
body.template-card-clean .rating-badge,body.template-card-clean .type-badge{display:none}
body.template-card-clean .episode-badge{position:static;display:inline-flex;margin-top:8px}
body.template-density-compact .video-card .p-3{padding:.75rem!important}
body.template-density-compact .line-clamp{-webkit-line-clamp:2;min-height:38px;font-size:.92rem}
body.template-density-comfortable .video-card .p-3{padding:1.15rem!important}
body.template-density-comfortable .line-clamp{font-size:1.02rem;line-height:1.32;min-height:54px}
body.template-minimal_seo .chip-panel,body.template-minimal_seo .taxonomy-seo-box,body.template-minimal_seo .seo-faq-box{box-shadow:none!important}
html[data-theme="dark"] body.template-hero-simple.theme-auto .site-hero,body.theme-dark.template-hero-simple .site-hero{background:#020617;color:#fff;border-bottom-color:rgba(255,255,255,.10)}
html[data-theme="dark"] body.template-hero-simple.theme-auto .site-hero-title,body.theme-dark.template-hero-simple .site-hero-title{color:#fff}
html[data-theme="dark"] body.template-hero-simple.theme-auto .site-hero-desc,body.theme-dark.template-hero-simple .site-hero-desc{color:rgba(255,255,255,.72)}
html[data-theme="dark"] body.template-card-clean.theme-auto .video-card,body.theme-dark.template-card-clean .video-card{background:rgba(15,23,42,.74);border-color:rgba(255,255,255,.10)}

.template-admin-preview{background:linear-gradient(135deg,#0f172a,#111827);color:#fff;min-height:100%}
.template-admin-preview.template-anime_pop{background:radial-gradient(circle at 0 0,rgba(255,255,255,.22),transparent 28%),linear-gradient(135deg,var(--theme,#dc3545),#7c3aed)}
.template-admin-preview.template-cinema{background:radial-gradient(circle at 18% 0%,rgba(255,255,255,.15),transparent 28%),linear-gradient(135deg,#020617,#111827)}
.template-admin-preview.template-donghua_immersive{background:linear-gradient(135deg,#052e2b,#111827)}
.template-admin-preview.template-minimal_seo{background:#f8fafc;color:#0f172a}
.template-preview-hero{border:1px solid rgba(255,255,255,.14);border-radius:28px;padding:24px;background:rgba(255,255,255,.10);backdrop-filter:blur(16px)}
.template-minimal_seo .template-preview-hero{background:#fff;border-color:#e2e8f0}
.template-preview-pill{display:inline-flex;border-radius:999px;padding:7px 11px;background:rgba(255,255,255,.16);font-size:11px;font-weight:900;text-transform:uppercase;letter-spacing:.09em;margin-bottom:16px}
.template-minimal_seo .template-preview-pill{background:#eef2ff;color:#3730a3}
.template-preview-hero h4{font-weight:950;letter-spacing:-.04em;margin:0 0 8px}.template-preview-hero p{margin:0;opacity:.75}
.template-preview-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.template-preview-card{border-radius:20px;background:rgba(255,255,255,.12);padding:12px}.template-minimal_seo .template-preview-card{background:#fff;border:1px solid #e2e8f0}.template-preview-card span{display:block;aspect-ratio:2/3;border-radius:14px;background:linear-gradient(135deg,var(--theme,#dc3545),rgba(255,255,255,.28));margin-bottom:10px}.template-preview-card b{display:block;font-size:13px}.template-preview-card small{opacity:.7}

/* Step — Notification Center Admin */
.admin-notification-wrap{position:relative;display:inline-flex;align-items:center}
.admin-notification-btn{
    position:relative;width:40px;height:40px;border-radius:999px;border:1px solid rgba(255,255,255,.22);
    background:rgba(255,255,255,.08);color:#fff;display:inline-flex;align-items:center;justify-content:center;
    transition:.18s ease;box-shadow:0 8px 22px rgba(0,0,0,.12);
}
.admin-notification-btn:hover{background:rgba(255,255,255,.15);transform:translateY(-1px)}
.admin-notification-bell{font-size:17px;line-height:1}
.admin-notification-count{
    position:absolute;right:-4px;top:-5px;min-width:20px;height:20px;border-radius:999px;background:#ef4444;color:#fff;
    font-size:11px;font-weight:950;display:inline-flex;align-items:center;justify-content:center;padding:0 5px;border:2px solid #0f172a;
}
.admin-notification-menu{width:min(390px,calc(100vw - 24px));border:0;border-radius:22px;overflow:hidden;box-shadow:0 24px 70px rgba(15,23,42,.24)}
.admin-notification-head{display:flex;justify-content:space-between;align-items:center;gap:1rem;padding:1rem 1.1rem;border-bottom:1px solid rgba(15,23,42,.08);background:linear-gradient(135deg,#f8fafc,#ffffff)}
.admin-notification-head strong{display:block;font-weight:950;color:#0f172a}
.admin-notification-head small{display:block;color:#64748b;font-size:.78rem;margin-top:2px}
.admin-notification-list{max-height:390px;overflow:auto;background:#fff}
.admin-notification-item{display:flex;gap:.8rem;padding:.9rem 1rem;text-decoration:none;color:#0f172a;border-bottom:1px solid rgba(15,23,42,.06);transition:.16s ease}
.admin-notification-item:hover{background:#f8fafc;color:#0f172a}
.admin-notification-item.is-unread{background:linear-gradient(90deg,rgba(37,99,235,.08),rgba(255,255,255,1))}
.admin-notification-level{width:30px;height:30px;border-radius:999px;display:inline-flex;align-items:center;justify-content:center;flex:0 0 30px;color:#fff;font-weight:950;font-size:.82rem}
.notification-level-info{background:#2563eb}.notification-level-success{background:#059669}.notification-level-warning{background:#f59e0b}.notification-level-danger{background:#ef4444}
.admin-notification-copy{min-width:0;display:block}
.admin-notification-copy strong{display:block;font-size:.88rem;font-weight:950;line-height:1.25;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.admin-notification-copy small{display:block;color:#64748b;line-height:1.35;margin-top:3px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.admin-notification-empty{padding:2rem 1rem;text-align:center;color:#64748b;font-weight:700}
.admin-notification-foot{padding:.8rem 1rem;text-align:center;background:#f8fafc;border-top:1px solid rgba(15,23,42,.08)}
.admin-notification-foot a{font-weight:900;text-decoration:none}
.notification-row-unread{background:rgba(37,99,235,.045)}
@media(max-width:575.98px){.admin-notification-menu{width:calc(100vw - 18px)}.admin-notification-head{align-items:flex-start}.admin-notification-list{max-height:320px}}

/* Frontend Template Marketplace Lokal */
.template-market-card{border:1px solid rgba(15,23,42,.08);transition:transform .2s ease,box-shadow .2s ease,border-color .2s ease;}
.template-market-card:hover{transform:translateY(-4px);box-shadow:0 24px 70px rgba(15,23,42,.12);border-color:rgba(99,102,241,.22);}
.template-market-preview{position:relative;min-height:230px;background:radial-gradient(circle at 20% 20%,color-mix(in srgb,var(--tm-primary) 38%,transparent),transparent 34%),linear-gradient(135deg,var(--tm-secondary),#020617);overflow:hidden;padding:18px;}
.template-market-preview:after{content:"";position:absolute;inset:auto -20% -45% -20%;height:65%;background:radial-gradient(circle,color-mix(in srgb,var(--tm-primary) 28%,transparent),transparent 62%);}
.template-market-preview-top{display:flex;gap:7px;position:relative;z-index:2;margin-bottom:18px;}
.template-market-preview-top span{width:10px;height:10px;border-radius:999px;background:rgba(255,255,255,.72);}
.template-market-hero{position:relative;z-index:2;border:1px solid rgba(255,255,255,.16);background:rgba(255,255,255,.08);backdrop-filter:blur(12px);border-radius:24px;padding:18px;display:flex;justify-content:space-between;gap:16px;align-items:center;box-shadow:0 20px 55px rgba(0,0,0,.22);}
.template-market-hero small{display:block;color:rgba(255,255,255,.76);font-weight:800;text-transform:uppercase;letter-spacing:.09em;font-size:.7rem;margin-bottom:6px;}
.template-market-hero strong{display:block;color:#fff;font-size:1.35rem;line-height:1.05;font-weight:950;letter-spacing:-.04em;}
.template-market-hero em{display:block;color:rgba(255,255,255,.74);font-style:normal;font-size:.86rem;margin-top:8px;}
.template-market-hero i{display:block;width:78px;height:104px;border-radius:18px;background:linear-gradient(160deg,color-mix(in srgb,var(--tm-primary) 75%,#fff),rgba(255,255,255,.18));box-shadow:0 18px 38px rgba(0,0,0,.24);transform:rotate(5deg);flex:0 0 auto;}
.template-market-grid{position:relative;z-index:2;display:grid;grid-template-columns:repeat(5,1fr);gap:10px;margin-top:16px;}
.template-market-grid span{display:block;aspect-ratio:2/3;border-radius:14px;background:linear-gradient(180deg,rgba(255,255,255,.28),rgba(255,255,255,.08));border:1px solid rgba(255,255,255,.12);}
.template-market-specs{display:flex;flex-wrap:wrap;gap:8px;}
.template-market-specs span{display:inline-flex;align-items:center;border-radius:999px;background:rgba(15,23,42,.06);color:#475569;font-weight:800;font-size:.78rem;padding:.45rem .72rem;}
.template-market-check{display:flex;gap:.55rem;align-items:center;border:1px solid rgba(15,23,42,.08);border-radius:16px;padding:.7rem .8rem;min-height:100%;font-size:.86rem;font-weight:700;color:#475569;background:rgba(248,250,252,.8);}
.template-market-check input{accent-color:var(--theme,#dc3545);}
.template-market-current{border-left:5px solid var(--theme,#dc3545);}
body.theme-dark .template-market-card,html[data-theme="dark"] .template-market-card{border-color:rgba(255,255,255,.1);}
body.theme-dark .template-market-specs span,html[data-theme="dark"] .template-market-specs span{background:rgba(255,255,255,.08);color:#cbd5e1;}
body.theme-dark .template-market-check,html[data-theme="dark"] .template-market-check{background:rgba(255,255,255,.05);border-color:rgba(255,255,255,.1);color:#cbd5e1;}
@media(max-width:768px){.template-market-preview{min-height:200px}.template-market-hero strong{font-size:1.1rem}.template-market-grid{gap:7px}.template-market-hero i{width:58px;height:82px}}


/* Step Fix 1 — Mobile Responsive + Portal Link New Tab */
html, body { max-width: 100%; overflow-x: hidden; }
img, svg, iframe, video { max-width: 100%; }
.ratio > iframe, .player-shell iframe { width: 100% !important; height: 100% !important; display:block; border:0; }
.table-responsive, .admin-card, .modern-card { max-width: 100%; }
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-modern { min-width: 760px; }

.portal-header-inner,
.portal-footer-card .row,
.modern-navbar .container,
.footer-bottom,
.admin-topbar,
.admin-topbar-left,
.admin-topbar-actions { min-width: 0; }
.portal-brand,
.modern-brand,
.footer-brand { min-width: 0; }
.portal-brand span,
.modern-brand span,
.footer-brand div { min-width: 0; }
.portal-brand-name,
.footer-brand strong,
.admin-topbar-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.header-search { max-width: 100%; }
.header-search input { width: 100%; }
.modern-menu { flex-wrap: wrap; }
.modern-nav-link { white-space: nowrap; }

.chip-panel { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.chip-panel .d-flex,
.chip-panel .d-inline-flex,
.chip-panel form,
.chip-row .d-flex { min-width: 0; }
.chip-panel .chip-btn { flex: 0 0 auto; }

.poster-wrap { width:100%; }
.video-card, .content-card-link, .episode-card { min-width:0; }
.line-clamp { word-break: break-word; }
.meta-badge { max-width: 100%; word-break: break-word; }

.detail-hero-content .lead,
.site-hero-desc,
.portal-subtitle,
.footer-desc { word-break: break-word; }
.detail-poster { max-height: 420px; object-fit: cover; }

.watch-body .container,
.site-body .container,
.portal-bg .container { min-width: 0; }
.player-shell { width: 100%; max-width: 100%; border-radius: 22px; }
.watch-body .episode-pill { white-space: nowrap; }
.watch-body .modern-card .d-flex.flex-wrap { min-width:0; }

.admin-content { overflow-x: hidden; }
.admin-content .container-fluid,
.admin-content .container { max-width: 100%; }
.admin-content .row { min-width: 0; }
.admin-content .col,
.admin-content [class*="col-"] { min-width: 0; }
.admin-content .btn-toolbar,
.admin-content .btn-group,
.admin-content form .d-flex { flex-wrap: wrap; }
.admin-content textarea,
.admin-content input,
.admin-content select { max-width: 100%; }

@media (max-width: 1199.98px) {
    .modern-menu { gap: .25rem !important; }
    .modern-nav-link { padding: 9px 12px !important; }
    .header-search { min-width: 230px; }
}

@media (max-width: 991.98px) {
    .modern-navbar .container { align-items: center; }
    .modern-brand { max-width: calc(100vw - 96px); overflow:hidden; }
    .modern-brand .brand-lockup > span:last-child,
    .modern-brand strong,
    .modern-brand small { max-width: 58vw; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
    .navbar-collapse { padding-top: 12px; }
    .modern-menu { display: flex; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 4px 0 10px; margin-left: -2px; margin-right: -2px; }
    .modern-menu .nav-item { flex: 0 0 auto; }
    .modern-nav-link { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.10); border-radius: 999px; }
    .header-search { width: 100%; min-width: 0; }
    .header-provider-badge { width: 100%; }
    .portal-header-inner { gap: 12px; }
    .portal-header-actions { gap: 8px; }
    .portal-header-actions .btn { padding-left: 14px !important; padding-right: 14px !important; }
    .detail-hero-content { padding: 34px 0; }
    .detail-hero::after { background: linear-gradient(180deg, rgba(15,23,42,.96) 0%, rgba(15,23,42,.84) 100%); }
    .detail-hero .display-5 { font-size: clamp(1.75rem, 6vw, 2.35rem); }
    .detail-hero .btn-lg { width: 100%; justify-content:center; }
    .modern-footer { padding-top: 42px; }
    .footer-bottom { gap: 8px; }
    .admin-topbar-user { display:none; }
    .admin-notification-wrap { position: static; }
    .admin-notification-menu { right: 8px !important; left: auto !important; }
}

@media (max-width: 767.98px) {
    .container { padding-left: 14px; padding-right: 14px; }
    .portal-hero { padding: 46px 0 28px; }
    .portal-title { font-size: clamp(2.1rem, 12vw, 3.4rem); letter-spacing: -.055em; }
    .portal-subtitle { font-size: .98rem; }
    .portal-card { border-radius: 22px; min-height: auto; }
    .portal-card .card-body { padding: 20px !important; }
    .portal-card .d-flex.align-items-center.justify-content-between { align-items:flex-start !important; }
    .portal-url { max-width: 100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
    .portal-footer-card { border-radius: 24px; padding: 22px; }
    .portal-footer-card .text-lg-end { text-align:left !important; }
    .site-hero-inner { padding: 34px 0 36px; }
    .site-hero-title { font-size: clamp(2rem, 11vw, 3rem); }
    .site-stat { padding: 8px 11px; font-size: .82rem; }
    .chip-row { margin-top: -14px; }
    .chip-panel { border-radius: 18px; padding: 10px; }
    .home-section-grid { row-gap: 14px !important; }
    .video-card { border-radius: 18px; }
    .video-card .p-3 { padding: .75rem !important; }
    .line-clamp { min-height: auto; font-size: .92rem; }
    .episode-badge, .rating-badge, .type-badge { font-size: 10px; padding: 4px 7px; }
    .detail-poster { width: min(220px, 70vw) !important; display:block; margin:0 auto 10px; }
    .detail-hero .d-flex.flex-wrap.gap-2 .btn { width:100%; }
    .modern-card { border-radius: 20px; }
    .modern-card.p-4 { padding: 18px !important; }
    .episode-card { border-radius: 15px; padding: 11px; }
    .watch-body .d-flex.flex-column.flex-lg-row.justify-content-between { align-items: stretch !important; }
    .watch-body .btn { white-space: normal; }
    .watch-body .server-grid,
    .ux-server-grid { grid-template-columns: 1fr !important; }
    .player-shell { border-radius: 18px; box-shadow: 0 18px 44px rgba(0,0,0,.36); }
    .watch-body .modern-card .d-flex.flex-wrap.gap-2 { flex-wrap: nowrap !important; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
    .watch-body .episode-pill { flex: 0 0 auto; }
    .footer-brand strong { font-size: 17px; }
    .footer-links { gap: 7px; }
    .admin-content .p-4 { padding: 1rem !important; }
    .admin-card, .metric-card { border-radius: 18px; }
    .admin-card.p-4, .metric-card.p-4 { padding: 1rem !important; }
    .admin-topbar { min-height: 62px; }
    .admin-topbar-title strong { max-width: 48vw; }
    .admin-topbar-actions { gap: 8px; }
    .admin-notification-btn,
    .admin-mobile-menu-btn { width: 38px; height: 38px; border-radius: 13px; }
}

@media (max-width: 575.98px) {
    .portal-header { position: sticky; }
    .portal-header-inner { min-height: 64px; }
    .portal-brand-logo,
    .portal-brand-mark { width: 38px !important; height: 38px !important; flex: 0 0 38px; }
    .portal-brand-name { max-width: 48vw; font-size: .94rem; }
    .portal-brand small { display:none; }
    .portal-header-actions .portal-live-dot { display:none !important; }
    .portal-header-actions .btn { font-size: .86rem; padding: 8px 12px !important; }
    .brand-logo { width: 38px; height: 38px; border-radius: 12px; }
    .brand-logo-sm, .brand-fallback-sm { width: 32px; height: 32px; }
    .header-search { height: 44px; border-radius: 18px; }
    .header-search button { padding: 7px 11px; }
    .site-hero::after { width: 300px; height: 300px; right: -150px; top: -150px; }
    .site-hero-desc { font-size: .96rem; }
    .meta-badge { display:inline-flex; max-width:100%; font-size: 11px; padding: 5px 9px; }
    .detail-hero-content { padding: 26px 0; }
    .detail-hero .lead { font-size: 1rem; }
    .detail-poster { width: min(190px, 72vw) !important; }
    .watch-body main.container { padding-top: 20px !important; padding-bottom: 28px !important; }
    .watch-body h1, .watch-body .h3 { font-size: 1.35rem; }
    .player-shell { border-radius: 16px; }
    .footer-bottom { flex-direction: column; align-items:flex-start; font-size: .82rem; }
    .admin-topbar-title small { display:none; }
    .admin-topbar-title strong { font-size: 14px; max-width: 42vw; }
    .admin-content .table-modern { font-size: .86rem; }
    .admin-notification-menu { width: calc(100vw - 16px) !important; }
}

/* Step Fix 2: Movie player fallback */
.player-fallback-hint {
    background: rgba(245, 158, 11, .10);
    color: var(--text-color, #f8fafc);
}
.movie-player-frame-wrap,
.movie-player-frame-wrap iframe,
.player-shell > iframe {
    width: 100%;
    height: 100%;
    display: block;
    border: 0;
}
.watch-body .server-kind-badge {
    font-size: 10px;
    letter-spacing: .03em;
    text-transform: uppercase;
    opacity: .75;
}
@media (max-width: 767.98px) {
    .player-fallback-hint .btn { width: 100%; }
}

/* Movie iframe blocked fallback */
.external-player-panel {
  max-width: 680px;
  padding: 28px;
  border-radius: 28px;
  border: 1px solid rgba(255,255,255,.14);
  background: linear-gradient(135deg, rgba(255,255,255,.08), rgba(255,255,255,.03));
  box-shadow: 0 24px 80px rgba(0,0,0,.28);
  backdrop-filter: blur(16px);
}
.external-player-panel code {
  color: #fbbf24;
  background: rgba(0,0,0,.28);
  border-radius: 8px;
  padding: 2px 6px;
}
@media (max-width: 575.98px) {
  .external-player-panel {
    padding: 18px;
    border-radius: 20px;
  }
  .external-player-panel .h4 {
    font-size: 1.05rem;
  }
}


/* =========================================================
   Mobile Responsive Global Fix + Default Light Frontend
   ========================================================= */
html,
body {
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
}
body { -webkit-text-size-adjust: 100%; }
.container,
.container-fluid {
    min-width: 0;
}
.row,
[class*="col-"] {
    min-width: 0;
}
img,
svg,
video,
iframe,
embed,
object {
    max-width: 100%;
}
iframe { border: 0; }
.btn,
.badge,
.meta-badge,
.chip-btn,
.modern-nav-link,
.portal-url,
.episode-pill {
    max-width: 100%;
}
.btn,
.chip-btn,
.episode-pill {
    overflow-wrap: anywhere;
}

/* Mode terang sebagai default visual frontend. */
html[data-theme="light"],
body.theme-light,
.site-body.theme-light {
    color-scheme: light;
}
.site-body.theme-light {
    color: #0f172a;
    background:
        radial-gradient(circle at 18% 0%, rgba(var(--theme-rgb,220,53,69),.10), transparent 28rem),
        linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
}
.site-body.theme-light .modern-card,
.site-body.theme-light .video-card,
.site-body.theme-light .episode-card,
.site-body.theme-light .chip-panel,
.site-body.theme-light .internal-link-box,
.site-body.theme-light .taxonomy-seo-box,
.site-body.theme-light .static-content-card,
.site-body.theme-light .static-related-card {
    background: #fff;
    color: #0f172a;
    border-color: rgba(15,23,42,.08);
}
.site-body.theme-light .text-dark,
.site-body.theme-light strong.text-dark {
    color: #0f172a !important;
}
.site-body.theme-light .text-muted {
    color: #64748b !important;
}

/* Watch page juga dibuat terang jika theme light. */
.watch-body.theme-light {
    color: #0f172a;
    background:
        radial-gradient(circle at 20% 0%, rgba(var(--theme-rgb,220,53,69),.12), transparent 24rem),
        linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
}
.watch-body.theme-light .text-white,
.watch-body.theme-light .text-white-50 {
    color: #0f172a !important;
}
.watch-body.theme-light .text-white-50 {
    opacity: 1;
    color: #64748b !important;
}
.watch-body.theme-light .bg-dark,
.watch-body.theme-light .modern-card.bg-dark,
.watch-body.theme-light .ux-watch-tools,
.watch-body.theme-light .internal-link-box {
    background: #fff !important;
    color: #0f172a !important;
    border-color: rgba(15,23,42,.10) !important;
}
.watch-body.theme-light .border-light,
.watch-body.theme-light .border-opacity-10 {
    border-color: rgba(15,23,42,.10) !important;
}
.watch-body.theme-light .btn-outline-light {
    color: #0f172a;
    border-color: #cbd5e1;
    background: rgba(255,255,255,.72);
}
.watch-body.theme-light .btn-outline-light:hover {
    color: #fff;
    background: #0f172a;
    border-color: #0f172a;
}
.watch-body.theme-light .btn-light {
    background: #0f172a;
    color: #fff;
    border-color: #0f172a;
}
.watch-body.theme-light .player-shell {
    background: #111827;
    color: #fff;
}
.watch-body.theme-light .external-player-panel {
    background: rgba(255,255,255,.92);
    color: #0f172a;
    border-color: rgba(15,23,42,.10);
}
.watch-body.theme-light .external-player-panel .text-white-50,
.watch-body.theme-light .external-player-panel code {
    color: #475569 !important;
}

/* Portal utama terang dan nyaman mobile. */
.portal-bg {
    background:
        radial-gradient(circle at 12% 0%, color-mix(in srgb, var(--portal-primary, #dc3545) 14%, transparent), transparent 28rem),
        radial-gradient(circle at 88% 0%, color-mix(in srgb, var(--portal-secondary, #6f42c1) 16%, transparent), transparent 30rem),
        linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%) !important;
    color: #0f172a;
}
.portal-header {
    background: rgba(255,255,255,.82);
    border-bottom: 1px solid rgba(15,23,42,.08);
    backdrop-filter: blur(18px);
}
.portal-brand,
.portal-brand:hover { color: #0f172a; }
.portal-brand small { color: #64748b; }
.portal-live-dot {
    color: #334155;
    background: rgba(15,23,42,.04);
    border-color: rgba(15,23,42,.08);
}
.portal-title { color: #0f172a; }
.portal-subtitle { color: #64748b; }
.portal-eyebrow {
    color: #334155;
    border-color: rgba(15,23,42,.08);
    background: rgba(255,255,255,.66);
}
.portal-card {
    background: rgba(255,255,255,.90);
    border-color: rgba(15,23,42,.08);
    color: #0f172a;
    box-shadow: 0 18px 50px rgba(15,23,42,.10);
}
.portal-card .text-white,
.portal-card .text-white-50 {
    color: #0f172a !important;
}
.portal-card .text-white-50 {
    color: #64748b !important;
}
.portal-url {
    color: #334155;
    background: #f8fafc;
    border-color: rgba(15,23,42,.08);
}
.portal-footer { color: #0f172a; }
.portal-footer-card {
    background: #fff;
    border: 1px solid rgba(15,23,42,.08);
    color: #0f172a;
    box-shadow: 0 18px 50px rgba(15,23,42,.10);
}
.portal-footer-card .text-white-50 { color: #64748b !important; }
.portal-footer-chip {
    background: #f8fafc;
    border-color: rgba(15,23,42,.08);
    color: #0f172a;
}
.portal-footer-bottom { color: #64748b; border-top-color: rgba(15,23,42,.08); }

/* Hardening mobile: mencegah elemen saling menimpa/terpotong. */
@media (max-width: 991.98px) {
    .modern-header { position: sticky; top: 0; }
    .modern-navbar > .container {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }
    .modern-navbar .navbar-collapse {
        width: 100%;
        flex-basis: 100%;
        max-width: 100%;
        overflow: hidden;
    }
    .modern-menu {
        width: 100%;
        max-width: 100%;
        flex-wrap: nowrap !important;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scrollbar-width: none;
    }
    .modern-menu::-webkit-scrollbar { display: none; }
    .modern-menu .nav-item { flex: 0 0 auto; }
    .header-search,
    .header-provider-badge,
    .theme-toggle-btn,
    .pwa-install-inline {
        flex: 0 0 auto;
    }
    .navbar-collapse > .d-flex {
        width: 100%;
        min-width: 0;
    }
    .detail-hero .row { align-items: flex-start !important; }
}

@media (max-width: 767.98px) {
    body { font-size: 15px; }
    .container { padding-left: 12px !important; padding-right: 12px !important; }
    .portal-header-inner,
    .portal-brand,
    .portal-header-actions,
    .footer-brand,
    .modern-brand,
    .admin-topbar-left,
    .admin-topbar-actions {
        min-width: 0;
    }
    .portal-header-inner { gap: 10px; }
    .portal-brand { flex: 1 1 auto; max-width: calc(100% - 92px); }
    .portal-header-actions { flex: 0 0 auto; }
    .portal-header-actions .btn { white-space: nowrap; }
    .portal-hero { padding: 34px 0 22px; }
    .portal-title { font-size: clamp(2rem, 11vw, 3.1rem); line-height: 1; }
    .portal-subtitle { max-width: 100%; }
    .portal-card { border-radius: 20px; }
    .portal-card .d-flex.align-items-center.justify-content-between,
    .portal-card .d-flex.align-items-center.gap-3 {
        min-width: 0;
    }
    .portal-card .h5 {
        font-size: 1rem;
        overflow-wrap: anywhere;
    }

    .site-hero-inner { padding: 28px 0 30px; }
    .site-hero-title { font-size: clamp(1.85rem, 10vw, 2.7rem); line-height: 1.04; }
    .site-hero .d-flex.align-items-center.gap-3 { align-items: flex-start !important; }
    .site-stat { max-width: 100%; overflow-wrap: anywhere; }
    .chip-panel,
    .taxonomy-panel {
        max-height: none !important;
        overflow-x: auto;
        overflow-y: visible;
    }
    .taxonomy-chip-list,
    .genre-list {
        flex-wrap: nowrap !important;
        overflow-x: auto;
        padding-bottom: 4px;
        scrollbar-width: none;
    }
    .taxonomy-chip-list::-webkit-scrollbar,
    .genre-list::-webkit-scrollbar { display: none; }
    .taxonomy-chip-list .chip-btn,
    .genre-list .chip-btn {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .home-section-grid > [class*="col-"],
    main .row > .col-6.col-md-3.col-lg-2 {
        width: 50%;
        flex: 0 0 50%;
    }
    .video-card { height: 100%; }
    .video-card .p-3 { padding: .7rem !important; }
    .video-card .small.fw-bold,
    .line-clamp {
        font-size: .86rem;
        line-height: 1.25;
        min-height: 2.2em;
        overflow-wrap: anywhere;
    }
    .poster-wrap { contain: layout paint; }
    .poster-overlay { pointer-events: none; }
    .rating-badge,
    .type-badge,
    .episode-badge {
        max-width: calc(100% - 18px);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .detail-hero-content { padding: 24px 0 28px; }
    .detail-hero .display-5,
    .detail-hero h1 {
        font-size: clamp(1.55rem, 8vw, 2.25rem) !important;
        line-height: 1.06;
        overflow-wrap: anywhere;
    }
    .detail-hero .lead {
        font-size: .96rem;
        line-height: 1.55;
    }
    .detail-poster {
        width: min(170px, 55vw) !important;
        max-height: 260px;
        object-fit: cover;
        margin-left: auto;
        margin-right: auto;
    }
    .meta-badge {
        white-space: normal;
        overflow-wrap: anywhere;
        line-height: 1.2;
    }
    .detail-hero .btn-lg,
    .watch-body .btn {
        min-height: 40px;
    }
    .detail-hero .d-flex.flex-wrap.gap-2 .btn,
    .watch-body > main > .d-flex:first-child .btn {
        flex: 1 1 100%;
    }
    .modern-card.p-4,
    .static-content-card,
    .static-related-card {
        padding: 16px !important;
    }
    .modern-card .d-flex.justify-content-between.align-items-center,
    .modern-card .d-flex.justify-content-between.align-items-center.mb-3 {
        align-items: flex-start !important;
        gap: 10px;
    }

    .watch-body main.container { padding-top: 18px !important; }
    .watch-body h1,
    .watch-body .h2,
    .watch-body .h3 {
        font-size: clamp(1.25rem, 7vw, 1.75rem) !important;
        line-height: 1.12;
        overflow-wrap: anywhere;
    }
    .player-shell.ratio,
    .ratio.player-shell {
        aspect-ratio: 16 / 9;
        min-height: 190px;
        max-height: 62vh;
        border-radius: 16px;
    }
    .player-shell > .d-flex {
        min-height: 190px;
    }
    .external-player-panel {
        width: 100%;
        max-width: 100%;
    }
    .external-player-panel .d-flex,
    .player-fallback-hint .d-flex,
    .watch-body .modern-card .d-flex.flex-wrap.gap-2,
    .watch-body .modern-card .d-flex.flex-wrap.align-items-center.justify-content-between {
        min-width: 0;
    }
    .watch-body .modern-card .d-flex.flex-wrap.gap-2 .btn,
    .watch-body .modern-card .d-flex.flex-wrap.align-items-center.justify-content-between .btn {
        flex: 0 0 auto;
        white-space: nowrap;
    }
    .watch-body .modern-card .d-flex.flex-wrap.gap-2,
    .watch-body .modern-card .d-flex.flex-wrap.align-items-center.justify-content-between > .d-flex {
        overflow-x: auto;
        scrollbar-width: none;
        padding-bottom: 4px;
    }
    .watch-body .modern-card .d-flex.flex-wrap.gap-2::-webkit-scrollbar,
    .watch-body .modern-card .d-flex.flex-wrap.align-items-center.justify-content-between > .d-flex::-webkit-scrollbar { display: none; }

    .footer-links,
    .portal-footer-legal,
    .portal-footer-card .d-flex.flex-wrap {
        max-width: 100%;
        overflow-x: auto;
        scrollbar-width: none;
        flex-wrap: nowrap !important;
        padding-bottom: 4px;
    }
    .footer-links::-webkit-scrollbar,
    .portal-footer-legal::-webkit-scrollbar,
    .portal-footer-card .d-flex.flex-wrap::-webkit-scrollbar { display: none; }
    .footer-links a,
    .portal-footer-chip { flex: 0 0 auto; white-space: nowrap; }

    .admin-content .row > [class*="col-"] { margin-bottom: 10px; }
    .admin-topbar { gap: 8px; }
    .admin-topbar-actions { flex: 0 0 auto; }
}

@media (max-width: 380px) {
    .container { padding-left: 10px !important; padding-right: 10px !important; }
    .portal-brand-name,
    .modern-brand strong,
    .admin-topbar-title strong { max-width: 38vw; }
    .site-hero-title,
    .portal-title { letter-spacing: -.035em; }
    .home-section-grid > [class*="col-"],
    main .row > .col-6.col-md-3.col-lg-2 {
        width: 100%;
        flex: 0 0 100%;
    }
    .poster-wrap { aspect-ratio: 16 / 22; }
    .player-shell.ratio,
    .ratio.player-shell {
        min-height: 170px;
    }
}
