/** Cinematic TV home: fixed top bar, vertical nav, featured live hero and rails. */

#home-page {
    position: relative;
    overflow: hidden;
    background: var(--brand-navy);
    color: var(--text-primary);
}

.home-bg-img {
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: .34;
    z-index: 0;
}

.home-bg-gradient {
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    z-index: 1;
    pointer-events: none;
    background:
        radial-gradient(900px 580px at 66% 25%, var(--brand-accent-soft), transparent 68%),
        linear-gradient(90deg, rgba(7,10,18,.98) 0, rgba(7,10,18,.82) 24%, rgba(7,10,18,.34) 64%, rgba(7,10,18,.76) 100%),
        linear-gradient(180deg, rgba(7,10,18,.50), var(--brand-navy) 88%);
}

/* Fixed top bar */
.home-logo {
    position: absolute;
    top: 26px;
    left: var(--tv-safe-x);
    width: 242px;
    height: 76px;
    display: flex;
    align-items: center;
    z-index: 20;
}
.home-logo img { max-width: 220px; max-height: 70px; object-fit: contain; }

.home-clock {
    position: absolute;
    top: 27px;
    right: var(--tv-safe-x);
    z-index: 20;
    display: flex;
    align-items: baseline;
    gap: 18px;
    text-align: right;
}
.home-date { order: 2; font-size: 19px; color: var(--text-secondary); }
.home-time-row { order: 1; display: flex; align-items: baseline; }
.home-time { font-family: var(--font-brand); font-size: 36px; font-weight: 700; }
.home-seconds { display: none; }

.home-weather {
    position: absolute;
    top: 75px;
    right: var(--tv-safe-x);
    z-index: 20;
    min-width: 240px;
    display: flex;
    justify-content: flex-end;
    gap: 14px;
    color: var(--text-secondary);
}
.home-weather-city-row, .home-weather-bottom { display: flex; align-items: center; gap: 10px; }
.home-weather-city { font-size: 17px; font-weight: 600; }
.home-weather-icon { width: 34px; height: 34px; object-fit: contain; }
.home-weather-temp { font-size: 24px; color: var(--text-primary); }
.home-weather-feels { display: none; }
.home-top-buttons { display: none !important; }

/* Sidebar */
.home-nav-area {
    position: absolute;
    top: 122px;
    bottom: 50px;
    left: var(--tv-safe-x);
    width: 250px;
    z-index: 18;
    overflow: hidden;
}
.home-nav-buttons {
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px 10px 4px;
    border-right: 1px solid rgba(255,255,255,.10);
}
.home-nav-btn {
    min-height: 70px;
    flex: 0 0 70px;
    display: flex;
    align-items: center;
    gap: 17px;
    padding: 0 18px;
    border: 2px solid transparent;
    border-radius: 14px;
    color: var(--text-secondary);
    background: rgba(18,24,38,.62);
    cursor: pointer;
    transform-origin: left center;
    transition: background .18s ease, border-color .18s ease, transform .18s ease;
}
.home-nav-btn-icon {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.home-nav-img { max-width: 34px; max-height: 34px; object-fit: contain; filter: brightness(0) invert(1); opacity: .76; }
.home-nav-glyph { font-size: 34px; line-height: 1; font-weight: 700; }
.home-nav-btn-label { font-size: 21px; font-weight: 650; white-space: nowrap; }
.home-nav-btn.focused {
    color: var(--brand-navy);
    background: var(--brand-color);
    border-color: var(--brand-color);
}
.home-nav-btn.focused .home-nav-img { filter: brightness(0); opacity: .9; }
.home-nav-btn.disabled { opacity: .35; filter: grayscale(1); }

/* Scrollable content column */
.home-cinema-content {
    position: absolute;
    z-index: 8;
    top: 116px;
    right: var(--tv-safe-x);
    bottom: 52px;
    left: 382px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 12px 80px 10px;
    scroll-behavior: smooth;
}
.home-cinema-content::-webkit-scrollbar { width: 0; }
.home-content-state {
    min-height: 430px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 28px;
}
.home-content-blocked { color: var(--error); }
.home-content-spinner {
    width: 46px;
    height: 46px;
    border: 4px solid rgba(255,255,255,.15);
    border-top-color: var(--brand-color);
    border-radius: 50%;
    animation: home-spin .8s linear infinite;
}
@keyframes home-spin { to { transform: rotate(360deg); } }

/* Featured channel */
.home-hero {
    position: relative;
    min-height: 330px;
    display: grid;
    grid-template-columns: 350px minmax(0, 1fr);
    align-items: center;
    gap: 42px;
    padding: 28px 42px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 24px;
    overflow: hidden;
    background: linear-gradient(115deg, rgba(27,34,51,.94), rgba(11,15,26,.74));
    box-shadow: 0 24px 70px rgba(0,0,0,.34);
}
.home-hero-glow {
    position: absolute;
    width: 620px;
    height: 620px;
    left: -130px;
    top: -160px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--brand-accent-soft), transparent 68%);
    pointer-events: none;
}
.home-hero-logo {
    position: relative;
    height: 210px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    background: rgba(255,255,255,.94);
    box-shadow: 0 22px 60px rgba(0,0,0,.38);
    overflow: hidden;
}
.home-hero-logo-img { max-width: 78%; max-height: 72%; object-fit: contain; }
.home-hero-logo-fallback { color: var(--brand-navy); font-family: var(--font-brand); font-size: 68px; font-weight: 800; }
.home-hero-copy { position: relative; min-width: 0; }
.home-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 11px;
    border: 1px solid var(--success);
    border-radius: 999px;
    color: var(--success);
    background: rgba(0,230,168,.12);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 1px;
}
.home-live-badge span { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 10px var(--success); }
.home-hero h1 { margin: 12px 0 10px; font-family: var(--font-brand); font-size: 41px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-hero-now, .home-hero-next { font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-primary); }
.home-hero-now b, .home-hero-next b { margin-right: 12px; color: var(--success); font-size: 13px; letter-spacing: .8px; }
.home-hero-next { margin-top: 8px; color: var(--text-secondary); }
.home-hero-next b { color: var(--brand-accent); }
.home-hero-progress { width: 100%; max-width: 650px; height: 5px; margin-top: 10px; overflow: hidden; border-radius: 9px; background: rgba(255,255,255,.14); }
.home-hero-progress i, .home-card-progress i { display: block; height: 100%; background: var(--success); }
.home-hero-actions { display: flex; gap: 13px; margin-top: 22px; }
.home-hero-btn {
    min-height: 56px;
    padding: 0 22px;
    border: 2px solid rgba(255,255,255,.18);
    border-radius: 12px;
    background: rgba(35,44,64,.86);
    color: var(--text-primary);
    font: 700 18px var(--font);
    cursor: pointer;
}
.home-hero-btn.primary { background: var(--brand-color); border-color: var(--brand-color); color: var(--brand-navy); }
.home-hero-btn.focused { border-color: var(--tv-focus-color); }
.home-hero-dots { position: absolute; right: 30px; bottom: 22px; display: flex; gap: 8px; }
.home-hero-dots span { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.28); cursor: pointer; }
.home-hero-dots span.active { width: 25px; border-radius: 8px; background: var(--brand-color); }

/* Horizontal content rails */
.home-rails { padding-top: 8px; }
.home-rail-section { padding-top: 25px; }
.home-rail-section header { display: flex; align-items: flex-end; justify-content: space-between; margin: 0 2px 12px; }
.home-rail-section header small { color: var(--brand-accent); font-size: 12px; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase; }
.home-rail-section h2 { margin-top: 3px; font-size: 28px; }
.home-rail {
    display: flex;
    gap: 17px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 7px 7px 18px;
    scroll-behavior: smooth;
}
.home-rail::-webkit-scrollbar { height: 0; }
.home-rail-item { flex: 0 0 auto; cursor: pointer; transform-origin: center; }
.home-channel-card {
    position: relative;
    width: 272px;
    min-height: var(--tv-target-lg);
    overflow: hidden;
    border: 2px solid rgba(255,255,255,.10);
    border-radius: 16px;
    background: rgba(27,34,51,.92);
}
.home-card-visual { position: relative; height: 108px; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,.94); }
.home-card-logo { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.home-card-logo-img { max-width: 68%; max-height: 62%; object-fit: contain; }
.home-card-logo-fallback { color: var(--brand-navy); font-family: var(--font-brand); font-size: 35px; font-weight: 800; }
.home-card-live { position: absolute; top: 9px; right: 9px; padding: 4px 7px; border-radius: 999px; background: var(--success); color: #06130f; font-size: 10px; font-weight: 900; }
.home-card-copy { padding: 12px 14px 15px; }
.home-card-copy strong { display: block; margin-bottom: 5px; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-card-copy span { display: block; color: var(--text-secondary); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-card-progress { position: absolute; bottom: 0; left: 0; right: 0; height: 4px; background: rgba(255,255,255,.12); }

.home-category-card {
    width: 220px;
    min-height: 132px;
    padding: 19px;
    border: 2px solid rgba(255,255,255,.10);
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(123,44,255,.28), rgba(27,34,51,.94));
}
.home-category-icon { width: 44px; height: 44px; margin-bottom: 13px; display: flex; align-items: center; justify-content: center; border-radius: 12px; background: var(--brand-gradient); font-size: 26px; }
.home-category-icon img { max-width: 34px; max-height: 34px; object-fit: contain; }
.home-category-card strong { display: block; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-category-card > span { display: block; margin-top: 5px; color: var(--text-secondary); font-size: 13px; }
.home-channel-card.focused, .home-category-card.focused { border-color: var(--tv-focus-color); }

/* Compact status line preserves plan/security visibility without competing with content. */
.home-status-bar {
    position: absolute;
    z-index: 20;
    left: var(--tv-safe-x);
    right: var(--tv-safe-x);
    bottom: 12px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: 286px;
    color: rgba(255,255,255,.58);
    font-size: 14px;
    pointer-events: none;
}
.status-item { display: flex; align-items: center; gap: 7px; }
.status-icon { display: flex; opacity: .72; }
.status-icon svg { width: 17px; height: 17px; }

#home-page.home-autostart-cloak { visibility: hidden; }

/* Exit-confirm modal */
.exit-overlay { position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: 3000; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.68); }
.exit-card { width: 580px; padding: 44px 48px; text-align: center; border: 2px solid rgba(255,255,255,.16); border-radius: 18px; background: var(--bg-medium); box-shadow: 0 24px 70px rgba(0,0,0,.85); }
.exit-title { margin-bottom: 16px; color: #fff; font-size: 34px; font-weight: 700; }
.exit-msg { margin-bottom: 38px; color: rgba(255,255,255,.80); font-size: 24px; }
.exit-btns { display: flex; justify-content: center; gap: 24px; }
.exit-btn { min-width: 190px; min-height: var(--tv-target-min); padding: 16px 28px; border: 2px solid var(--bg-hover); border-radius: 10px; background: var(--bg-light); color: rgba(255,255,255,.80); font-size: var(--tv-font-caption); font-weight: 600; cursor: pointer; }
.exit-btn.cancel.focused { background: var(--brand-color); border-color: var(--brand-color); color: var(--brand-navy); }
.exit-btn.danger.focused { background: var(--error); border-color: var(--error); color: #fff; }

/* Chrome 79 flex-gap fallback. */
html.no-flex-gap .home-clock > * + * { margin-left: 18px; }
html.no-flex-gap .home-weather > * + * { margin-left: 14px; }
html.no-flex-gap .home-weather-city-row > * + *,
html.no-flex-gap .home-weather-bottom > * + * { margin-left: 10px; }
html.no-flex-gap .home-nav-buttons > * + * { margin-top: 8px; }
html.no-flex-gap .home-nav-btn > * + * { margin-left: 17px; }
html.no-flex-gap .home-live-badge > * + * { margin-left: 8px; }
html.no-flex-gap .home-hero-actions > * + * { margin-left: 13px; }
html.no-flex-gap .home-hero-dots > * + * { margin-left: 8px; }
html.no-flex-gap .home-rail > * + * { margin-left: 17px; }
html.no-flex-gap .status-item > * + * { margin-left: 7px; }
html.no-flex-gap .exit-btns > * + * { margin-left: 24px; }
