/* Alien TV web player - same palette and layout language as the Android app (ui/Theme.kt):
 * near-black screen, a darker sidebar rail with icons, grey cards, red accent for focus/selected.
 * Phones: the rail becomes a bottom bar and the player sticks to the top.
 * Wide screens: rail on the left, player on the left of the content like the guide's preview. */
:root {
  --bg: #1a1a1a;        /* Palette.Bg */
  --sidebar: #111111;   /* Palette.Sidebar */
  --panel: #222222;     /* Palette.Panel */
  --card: #2b2b2b;      /* Palette.Card */
  --card-hi: #3a3a3a;   /* Palette.CardHi */
  --line: #3a3a3a;      /* Palette.Border */
  --text: #ffffff;
  --dim: #9e9e9e;       /* Palette.TextDim */
  --faint: #6b6b6b;     /* Palette.TextFaint */
  --error: #ff6b6b;
  --accent: #e53935;    /* Palette.Red; the reseller's brand.accent replaces it */
  --on-accent: #ffffff;
  --accent-soft: rgba(229, 57, 53, .2);
  --radius: 10px;
  --rail: 84px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 15px/1.4 Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%; overscroll-behavior-y: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: var(--card); color: var(--text); border-radius: 8px; padding: 8px 14px; }
button.primary { background: var(--accent); color: var(--on-accent); font-weight: 600; }
button.danger { background: #7a1f1f; color: #fff; }
button:disabled { opacity: .5; cursor: default; }
input, select { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; width: 100%; min-width: 0; }
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--dim) 50%), linear-gradient(135deg, var(--dim) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 28px; }
[hidden] { display: none !important; }
.muted, .dim { color: var(--dim); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.error { color: var(--error); }
a { color: var(--accent); }
h1, h2, h3 { font-weight: 600; }

/* ---- Sign in: wide logo, fields in a narrow column, like the app's LoginScreen ---- */
.screen { min-height: 100%; }
#login { display: flex; align-items: center; justify-content: center; padding: 24px 16px; padding-top: calc(24px + var(--safe-top)); }
.login-card { width: 100%; max-width: 440px; }
.brand { text-align: center; margin-bottom: 26px; }
.brand img { width: 100%; max-width: 360px; max-height: 170px; object-fit: contain; border-radius: 12px; }
.brand h1 { margin: 8px 0 4px; font-size: 32px; letter-spacing: .5px; }
#login-intro { font-size: 16px; }
#login-form label { display: block; margin: 16px 0 6px; font-size: 15px; color: var(--dim); }
#login-form input, #login-form select { font-size: 17px; padding: 13px 14px; border-radius: 10px; margin-top: 2px; }
#login-form label.check { display: flex; gap: 10px; align-items: center; color: var(--text); font-size: 16px; margin: 20px 0; }
label.check input { width: auto; accent-color: var(--accent); }
#login-form label.check input { width: 20px; height: 20px; margin: 0; }
#login-form .primary { width: 100%; padding: 15px; margin-top: 6px; font-size: 18px; border-radius: 10px; }
#login-error { font-size: 15px; }
#login-support { text-align: center; margin: 22px 0 0; white-space: pre-line; font-size: 14px; }
/* Desktop: the card scales up with the screen so it does not look lost on a big monitor. */
@media (min-width: 900px) and (min-height: 700px) {
  .login-card { max-width: 560px; padding: 44px 48px; background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: 18px; box-shadow: 0 24px 60px rgba(0,0,0,.5); }
  .brand img { max-width: 464px; max-height: 240px; }
  .brand h1 { font-size: 40px; }
  #login-intro { font-size: 18px; }
  #login-form label { font-size: 17px; margin-top: 20px; }
  #login-form input, #login-form select { font-size: 20px; padding: 16px 18px; }
  #login-form label.check { font-size: 18px; }
  #login-form label.check input { width: 24px; height: 24px; }
  #login-form .primary { font-size: 21px; padding: 18px; }
  #login-support { font-size: 16px; }
}

/* ---- App frame ---- */
#app { display: flex; flex-direction: column; height: 100%; }
.announce { background: var(--panel); border-bottom: 1px solid var(--line); padding: 10px 44px 10px 14px; position: relative; font-size: 14px; padding-top: calc(10px + var(--safe-top)); }
.announce strong { color: var(--accent); }
.announce button { position: absolute; right: 6px; top: calc(4px + var(--safe-top)); background: transparent; font-size: 20px; }

.player { position: sticky; top: 0; z-index: 5; background: #000; padding-top: var(--safe-top); }
.video-wrap { position: relative; aspect-ratio: 16 / 9; background: #000; }
.video-wrap video { width: 100%; height: 100%; display: block; background: #000; }
.player-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.6); padding: 16px; text-align: center; font-size: 14px; white-space: pre-line; pointer-events: none; }
.now-bar { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--panel); border-bottom: 1px solid var(--line); }
.now-bar img { width: 40px; height: 40px; object-fit: contain; border-radius: 6px; flex: none; }
.now-text { flex: 1; min-width: 0; }
.now-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-sub { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.detail-only { display: none; }
.now-actions { display: flex; gap: 4px; flex: none; }
.now-actions button { padding: 6px 9px; font-size: 14px; }
.now-actions button.on { color: var(--accent); }

.content { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: calc(66px + var(--safe-bottom)); }

/* Rail: bottom bar on phones (icons + tiny labels, like the TV rail turned sideways). */
.rail { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; background: var(--sidebar); border-top: 1px solid var(--line); padding-bottom: var(--safe-bottom); }
.rail-logo { display: none; }
.rail button { flex: 1; background: transparent; border-radius: 0; padding: 8px 2px 6px; color: var(--dim); display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; }
.rail button svg { width: 24px; height: 24px; fill: currentColor; }
.rail button.on { color: var(--accent); }

.tab { padding: 12px 12px 0; }
.toolbar { display: flex; gap: 8px; margin-bottom: 10px; }
.toolbar .drawer-close { display: none; }
.detail .codecs { margin-top: 6px; font-size: 12px; }
.toolbar select { flex: 0 1 42%; }
.toolbar input { flex: 1; }
.toolbar #vod-sort, .toolbar #series-sort { flex: 0 0 auto; width: auto; }

/* ---- Home: welcome + horizontal rails (HomeScreen) ---- */
.welcome { padding: 6px 2px 14px; }
.welcome h1 { margin: 0; font-size: 26px; }
.welcome .dim { font-size: 14px; margin-top: 2px; }
.rail-row { margin-bottom: 18px; }
.rail-title { display: flex; align-items: baseline; gap: 10px; margin: 0 2px 8px; }
.rail-title h3 { margin: 0; font-size: 17px; }
.rail-title span { font-size: 11px; color: var(--faint); }
.rail-wrap { position: relative; }
.rail-items { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-left: 12px; padding-bottom: 6px; margin: 0 -12px; padding-left: 12px; padding-right: 12px; }
/* Row-end arrows for mouse users: plain glyphs, faded in while the pointer is over the row. */
.rail-arrow { position: absolute; top: 0; bottom: 6px; width: 2.4em; border: 0; background: linear-gradient(to right, rgba(11,13,18,.0), rgba(11,13,18,.85)); color: var(--text); font-size: 2.2em; line-height: 1; cursor: pointer; opacity: 0; transition: opacity .18s; padding: 0; }
.rail-arrow.left { left: -12px; background: linear-gradient(to left, rgba(11,13,18,.0), rgba(11,13,18,.85)); }
.rail-arrow.right { right: -12px; }
.rail-arrow[hidden] { display: none; }
@media (hover: hover) { .rail-wrap:hover .rail-arrow { opacity: .55; } .rail-arrow:hover { opacity: .95 !important; font-size: 3em; } }
.rail-arrow { transition: opacity .18s, font-size .12s; }
.rail-arrow:focus-visible { opacity: .95; outline: none; }
.rail-items::-webkit-scrollbar { display: none; }
.rail-items .poster { flex: 0 0 118px; scroll-snap-align: start; }
.rail-items .ch { flex: 0 0 220px; scroll-snap-align: start; }
.home-empty { color: var(--faint); font-size: 14px; padding: 6px 2px 14px; }

/* ---- Channel list: logo flush left, name, now-playing underneath (LiveScreen rows) ---- */
.list { display: flex; flex-direction: column; gap: 4px; }
.ch { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; background: var(--card); border: 1px solid transparent; }
.ch:active { background: var(--card-hi); }
.ch.on { background: var(--accent-soft); border-color: var(--accent); }
.ch img { width: 44px; height: 44px; object-fit: contain; border-radius: 6px; flex: none; }
.ch img:not([src]) { background: var(--card-hi); opacity: .5; }
.ch .ch-text { flex: 1; min-width: 0; }
.ch .ch-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch .ch-now { font-size: 13px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 18px; }
.ch .ch-now b { color: var(--text); font-weight: 500; }
.ch .ch-fav { background: transparent; font-size: 18px; padding: 4px 8px; color: var(--faint); }
.ch .ch-fav.on { color: var(--accent); }
.empty { color: var(--faint); text-align: center; padding: 30px 10px; }
.more { text-align: center; margin: 12px 0; }
.hint { font-size: 12px; color: var(--faint); text-align: center; padding: 8px 0 4px; }

/* ---- Chips (the guide's small buttons) ---- */
.chip { background: var(--card); padding: 5px 10px; font-size: 13px; border-radius: 6px; line-height: 1.2; white-space: nowrap; }
.chip.on { background: var(--accent); color: var(--on-accent); }
.chips { display: flex; gap: 6px; align-items: center; flex: none; }
.accent { color: var(--accent); }

/* ---- Guide (LiveScreen): timeline bar, date line, rows of programme cells ---- */
.guide-bar { display: none; align-items: center; gap: 12px; background: var(--panel); padding: 8px 14px 8px 6px; border-radius: 6px; }
.guide-bar .chips:first-child { min-width: 230px; }
.timeline { flex: 1; position: relative; height: 20px; overflow: hidden; }
.timeline span { position: absolute; top: 0; font-size: 14px; color: var(--dim); white-space: nowrap; }
.guide-date { display: flex; align-items: center; gap: 10px; padding: 0 0 10px; font-size: 12px; min-height: 30px; }
.guide-date input { flex: 1; padding: 8px 10px; font-size: 14px; }
.guide-date #g-date { display: none; }
.grid-rows { position: relative; display: flex; flex-direction: column; gap: 3px; }
.grow { display: flex; height: 52px; gap: 3px; }
.grow .gch { flex: 0 0 230px; display: flex; align-items: center; gap: 8px; background: var(--card); border-radius: 6px; padding: 0 6px 0 4px; border: 1px solid transparent; cursor: pointer; min-width: 0; }
.grow .gch img { width: 40px; height: 40px; object-fit: contain; border-radius: 4px; flex: none; }
.grow .gch img:not([src]) { background: var(--card-hi); opacity: .5; }
.grow .gch span { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grow .gch .ch-fav { font-size: 15px; padding: 2px 4px; color: var(--faint); background: transparent; }
.grow .gch .ch-fav.on { color: var(--accent); }
.grow:hover .gch { background: var(--card-hi); }
.grow.on .gch { background: var(--accent-soft); border-color: var(--accent); }
.grow .gcells { flex: 1; position: relative; min-width: 0; overflow: hidden; }
.gcell { position: absolute; top: 0; height: 100%; box-sizing: border-box; background: var(--card); border-radius: 6px; padding: 5px 8px; margin-right: 3px; overflow: hidden; cursor: pointer; display: flex; flex-direction: column; justify-content: center; border: 1px solid transparent; }
.gcell span { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gcell small { font-size: 12px; color: var(--faint); }
.gcell.now { background: var(--card-hi); border-color: var(--line); }
.gcell.past { opacity: .55; }
.gcell:hover { border-color: var(--accent); }
.gcell.loading, .gcell.empty-cell { position: static; width: 100%; color: var(--faint); cursor: default; font-size: 13px; }
.nowline { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent); z-index: 2; pointer-events: none; }
.hint { display: none; }

/* ---- Categories panel: slides over the left edge (the app's category pane) ---- */
.catpanel { position: fixed; inset: 0; z-index: 15; background: rgba(0,0,0,.55); }
.catpanel-inner { position: absolute; top: 0; bottom: 0; left: 0; width: min(300px, 84vw); background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding-top: var(--safe-top); animation: slidein .15s ease-out; }
@keyframes slidein { from { transform: translateX(-30px); opacity: 0; } to { transform: none; opacity: 1; } }
.catpanel h4, .browse h4 { margin: 0; padding: 14px 16px 8px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); font-weight: 600; }
.catpanel-items, .browse-items { overflow-y: auto; flex: 1; padding: 0 8px calc(12px + var(--safe-bottom)); }
button.cat { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: transparent; border-radius: 6px; padding: 9px 12px 9px 14px; font-size: 14px; color: var(--text); white-space: nowrap; box-shadow: inset 3px 0 0 transparent; }
button.cat svg { width: 20px; height: 20px; flex: none; fill: var(--dim); }
button.cat span { overflow: hidden; text-overflow: ellipsis; }
button.cat.on svg { fill: var(--accent); }
button.cat:hover { background: var(--card); }
button.cat.on { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }

/* ---- Movies / Series: Browse column (NavPanel) on wide screens, chip on phones ---- */
.browse { display: none; }
.browse-main { min-width: 0; flex: 1; }
.cat-chip { max-width: 45%; overflow: hidden; text-overflow: ellipsis; }

/* ---- Poster grids (PosterGrid) ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; }
.poster { background: var(--card); border-radius: 8px; overflow: hidden; border: 2px solid transparent; display: flex; flex-direction: column; cursor: pointer; }
.poster:active, .poster:focus-visible { border-color: var(--accent); outline: 0; }
.poster .img { aspect-ratio: 2 / 3; background: linear-gradient(160deg, #2e2e2e, #1f1f1f); width: 100%; object-fit: cover; display: block; }
.poster .pt { padding: 6px 8px 2px; font-size: 13px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 36px; }
.poster .pm { padding: 0 8px 6px; font-size: 11px; color: var(--dim); display: flex; justify-content: space-between; }
/* #43: ✕ on Continue watching tiles — shows on hover or keyboard focus, always on touch screens; plain glyph, 44px target */
.poster { position: relative; }
.poster .rm { position: absolute; top: .2em; right: .2em; min-width: 2.75em; min-height: 2.75em; padding: 0; border: 0; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; font-size: 1em; line-height: 1; opacity: 0; transition: opacity .15s; }
.poster:hover .rm, .poster:focus-within .rm, .poster .rm:focus-visible { opacity: 1; }
.poster .rm:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; opacity: 1; }
@media (hover: none) { .poster .rm { opacity: .85; } }
.poster .bar { height: 3px; background: var(--card-hi); }
.poster .bar i { display: block; height: 100%; background: var(--accent); }

/* ---- Search (#44) ---- */
.s-bar { align-items: center; flex-wrap: wrap; }
.s-box { position: relative; flex: 1 1 260px; max-width: 520px; display: flex; }
.s-box input { width: 100%; padding-right: 34px; }
.s-box button { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); background: transparent; color: var(--dim); font-size: 14px; padding: 4px 8px; }
.s-hint { margin-left: auto; font-size: 11px; color: var(--faint); text-align: right; }
.s-hint[hidden] { display: none; }
.s-label { margin: 16px 2px 8px; font-size: 11px; letter-spacing: 1.5px; color: var(--dim); font-weight: 600; display: flex; align-items: center; gap: 12px; }
.s-label .s-clearall { background: transparent; color: var(--faint); font-size: 11px; padding: 2px 4px; letter-spacing: 0; font-weight: 400; }
.s-recent { display: flex; flex-wrap: wrap; gap: 8px; }
.s-rchip { display: inline-flex; align-items: center; }
.s-rchip .chip { border-radius: 6px 0 0 6px; }
.s-rm { background: var(--card); color: var(--faint); font-size: 11px; padding: 6px 8px; border-radius: 0 6px 6px 0; border-left: 1px solid var(--bg); }
.s-cols { display: flex; flex-direction: column; gap: 18px; }
.grid.s-pop { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }     /* #47-2: more titles on screen */
.s-pop .pt { font-size: 12px; } .s-pop .pm { font-size: 11px; }
.s-chips { padding: 4px 0; }
.s-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.s-top { align-items: center; padding: 12px; background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.14); border-radius: 12px; cursor: default; }
.s-top .s-art { position: relative; width: 5.5em; height: 5.5em; flex: none; background: var(--card); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 1em; font-weight: 700; color: var(--dim); }
.s-top .s-art span { font-size: 2.2em; }
.s-top .s-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 8px; box-sizing: border-box; background: var(--card); border-radius: 8px; }
.s-top .s-art img:not([src]) { display: none; }
.s-top-body { flex: 1; min-width: 0; }
.s-tags { display: flex; gap: 6px; margin-bottom: 6px; }
.s-tag { background: var(--accent); color: #fff; font-size: 9px; font-weight: 700; letter-spacing: 1px; padding: 2px 6px; border-radius: 4px; }
.s-tag.live { background: #b0304a; }
.s-top-name { font-size: 19px; font-weight: 600; line-height: 1.2; }
.s-prog { height: 3px; background: rgba(255,255,255,.12); border-radius: 2px; margin: 6px 0 10px; overflow: hidden; }
.s-prog i { display: block; height: 100%; background: var(--accent); }
.s-btns { display: flex; gap: 8px; }
.s-btns button { padding: 7px 18px; border-radius: 6px; font-weight: 600; background: var(--card-hi); }
.s-btns .s-watch { background: var(--accent); color: var(--on-accent); }
.s-num { font-size: 11px; color: var(--dim); flex: none; }
.s-more { align-self: flex-start; margin-top: 8px; }
.s-ctl { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 12px 0 8px; }
.s-ctl select, .s-ctl .chip { width: auto; height: 34px; line-height: 22px; border-radius: 17px; padding: 5px 14px; font-size: 13px; }
.s-titles { width: auto; }
mark { background: transparent; color: var(--accent); font-weight: 700; }
.ch.on mark, .chip.on mark { color: inherit; }
@media (min-width: 900px) {
  .s-cols { flex-direction: row; align-items: flex-start; gap: 22px; }
  .s-left { flex: 0 0 52%; min-width: 0; }
  .s-right { flex: 1; min-width: 0; }
  .grid.s-pop { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); }
}

/* ---- Detail sheet (MovieDetail / SeriesDetail) ---- */
.sheet { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.75); display: flex; align-items: flex-end; justify-content: center; }
.sheet-inner { position: relative; width: 100%; max-width: 760px; max-height: 92%; overflow-y: auto; background: var(--bg); border-top: 2px solid var(--accent); border-radius: 14px 14px 0 0; padding: 16px; padding-bottom: calc(16px + var(--safe-bottom)); }
.sheet-close { position: absolute; right: 8px; top: 8px; background: var(--card); font-size: 20px; line-height: 1; padding: 4px 10px; z-index: 1; }
.detail { display: flex; gap: 14px; }
.detail img { width: 120px; aspect-ratio: 2/3; object-fit: cover; border-radius: 8px; background: linear-gradient(160deg, #2e2e2e, #1f1f1f); flex: none; }
.detail h2 { margin: 0 0 6px; font-size: 21px; padding-right: 36px; }
.detail .meta { color: var(--dim); font-size: 13px; margin-bottom: 8px; }
.detail .plot { font-size: 14px; max-height: 7.2em; overflow: hidden; color: #ddd; }
.detail .plot.open { max-height: none; }
.detail .actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
/* #35-1 "You may also like": plain heading, artwork-only tiles, swipe/scroll across. Sized in em so text-size settings scale it. */
.related { margin-top: 1.1em; }
.related .rel-h { font-size: .95em; color: var(--dim); margin: 0 0 .5em; }
.related .rel-row { display: flex; gap: .6em; overflow-x: auto; scroll-snap-type: x proximity; padding: .2em .1em .5em; -webkit-overflow-scrolling: touch; }
.rel-tile { flex: 0 0 clamp(5.5em, 22vw, 7.5em); min-height: 44px; padding: 0; background: transparent; border: 0; border-radius: .4em; overflow: hidden; scroll-snap-align: start; cursor: pointer; display: block; text-align: left; }
.rel-tile img { display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: .4em; }
.rel-tile span { display: none; }
.rel-tile.noart { align-self: start; }
.rel-tile.noart span { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-size: .8em; color: var(--text); padding: .4em .2em; }
.rel-tile:focus-visible, .rel-tile:hover { outline: 2px solid var(--accent); outline-offset: 2px; }

/* #35-2 Series: show block on top, divider, actions that wrap, one Season button with a flat drop-down, episode tiles. */
.detail.series img { width: clamp(5.2em, 22vw, 6.8em); }
.detail.series .meta { color: #c9c9c9; }
.detail.series .plot { color: #ececec; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 1em 0 .8em; }
.series-actions { margin-top: 0; align-items: center; }
.series-actions button, .series-actions a { min-height: 44px; }
.season-wrap { position: relative; display: inline-block; }
.season-menu { position: absolute; left: 0; top: calc(100% + .3em); z-index: 3; min-width: 100%; background: var(--bg); border: 1px solid var(--line); padding: .3em 0; max-height: 50vh; overflow-y: auto; }
.season-menu button { display: block; width: 100%; text-align: left; background: transparent; border-radius: 0; padding: .6em 1.1em; min-height: 44px; color: var(--dim); white-space: nowrap; }
.season-menu button.on { color: var(--text); font-weight: 600; }
.season-menu button:hover, .season-menu button:focus-visible { color: var(--text); background: var(--card); outline: 0; }
.ep-tiles { display: flex; gap: .7em; overflow-x: auto; scroll-snap-type: x proximity; padding: .9em .1em .5em; -webkit-overflow-scrolling: touch; }
.ep-tile { flex: 0 0 clamp(9em, 42vw, 12.5em); min-height: 44px; padding: 0; background: transparent; border: 0; text-align: left; cursor: pointer; scroll-snap-align: start; display: block; color: var(--text); }
.ep-tile img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: .4em; }
.ep-tile .ep-tile-t { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: .85em; line-height: 1.25; padding: .4em .1em 0; }
.ep-tile .ep-tile-t b { color: var(--dim); font-weight: 500; }
.ep-tile .bar { display: block; height: 3px; background: var(--card-hi); border-radius: 2px; margin-top: .3em; }
.ep-tile .bar i { display: block; height: 100%; background: var(--accent); border-radius: 2px; }
.ep-tile:focus-visible img, .ep-tile:hover img { outline: 2px solid var(--accent); outline-offset: 2px; }
.ep-tile.noart:focus-visible, .ep-tile.noart:hover { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: .3em; }
/* No artwork in the whole season: flat text rows instead of empty tiles. */
.ep-tiles.ep-lines { flex-direction: column; gap: 0; overflow: visible; }
.ep-tiles.ep-lines .ep-tile { flex: none; width: 100%; padding: .55em .2em; border-bottom: 1px solid var(--line); }
.ep-tiles.ep-lines .ep-tile .ep-tile-t { padding: 0; font-size: .95em; -webkit-line-clamp: 1; }
.ep-desc { padding: .3em .1em 0; }
.ep-desc .ep-desc-t { font-size: .95em; font-weight: 600; }
.ep-desc .ep-desc-m { color: var(--dim); font-weight: 400; font-size: .85em; margin-left: .4em; }
.ep-desc .ep-desc-p { color: #e0e0e0; font-size: .9em; margin-top: .3em; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.ep { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px; background: var(--card); margin-bottom: 6px; cursor: pointer; border: 1px solid transparent; }
/* #24 hover feedback, same look as keyboard focus (accent outline / lifted card) */
@media (hover: hover) {
  .ep:hover { background: var(--card-hi); border-color: var(--accent); }
  .detail .actions button:hover, .poster:hover { outline: 2px solid var(--accent); outline-offset: 0; }
  .poster:hover { border-color: var(--accent); outline: 0; }
  .ep button:hover { background: var(--accent); color: var(--on-accent); }
  .rail button:hover { color: var(--text); background: var(--card); }
  /* guide chips (☰ ◀ Now ▶ 🔍 ⤒), Browse categories, category panel items, search boxes */
  .chip:hover, button.cat:hover, .catpanel button.cat:hover, #catpanel button:hover { outline: 2px solid var(--accent); outline-offset: 0; }
  input[type="search"]:hover, .toolbar input:hover, #search-q:hover { border-color: var(--accent); }
  .ch:hover, .gcell:hover, .gch:hover { border-color: var(--accent); }
}
.ep:focus-visible { background: var(--card-hi); border-color: var(--accent); outline: 0; }
/* #23 credits: two lines, click to show the whole list */
.detail .credits { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.detail .credits.open { display: block; }
.ep .ep-n { color: var(--dim); font-size: 13px; width: 34px; flex: none; }
.ep .ep-t { flex: 1; min-width: 0; font-size: 14px; }
.ep .ep-d { color: var(--faint); font-size: 12px; }
.ep .bar { height: 3px; background: var(--card-hi); border-radius: 2px; margin-top: 4px; }
.ep .bar i { display: block; height: 100%; background: var(--accent); border-radius: 2px; }

/* ---- Account (Settings / Help) ---- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 10px; }
.card h3 { margin: 0 0 8px; font-size: 16px; }
.card .row { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.card .row:last-child { border-bottom: 0; }
.card .row span:last-child { color: var(--dim); text-align: right; }
.card .row .ok { color: #66bb6a; } .card .row .bad { color: var(--error); }
.card label.check { display: flex; gap: 8px; align-items: center; margin: 8px 0; font-size: 14px; }

.toast { position: fixed; left: 50%; bottom: calc(76px + var(--safe-bottom)); transform: translateX(-50%); background: var(--card-hi); border: 1px solid var(--line); padding: 10px 14px; border-radius: 10px; z-index: 30; font-size: 14px; max-width: 90%; }

/* ---- Wide screens: rail on the left like the TV app, player beside the content ---- */
@media (min-width: 900px) {
  #app { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); height: 100vh; }
  .announce { grid-column: 2; grid-row: 1; padding-top: 10px; }
  .announce button { top: 4px; }
  .rail { position: static; grid-column: 1; grid-row: 1 / -1; flex-direction: column; border-top: 0; border-right: 1px solid var(--line); padding: 12px 0; gap: 2px; }
  .rail-logo { display: block; width: 44px; height: 44px; object-fit: contain; margin: 4px auto 14px; }
  .rail button { flex: 0 0 auto; padding: 10px 4px; font-size: 11px; }
  .rail button.on { color: var(--text); background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
  .rail button:hover { background: var(--card); }
  .player { grid-column: 2; grid-row: 2; position: static; padding-top: 0; display: flex; flex-direction: column; justify-content: center; overflow: hidden; background: #000; }
  .content { grid-column: 2; grid-row: 2; height: auto; min-height: 0; padding-bottom: 24px; }
  /* Player showing: split the content column — video left (58%), lists right. */
  .player:not([hidden]) { grid-column: 2; }
  .player:not([hidden]) + .content { grid-column: 3; }
  body:not([data-tab="live"]) #app:has(.player:not([hidden])) { grid-template-columns: var(--rail) 46fr 54fr; }
  /* Something playing beside the posters: the Browse column collapses to an icon strip (the app's NavPanel
     does the same while the posters have focus) and slides out over the posters on hover / keyboard focus. */
  .tab-browse { position: relative; }
  body:not([data-tab="live"]) #app:has(.player:not([hidden])) .tab-browse { padding-left: 62px; gap: 0; }
  body:not([data-tab="live"]) #app:has(.player:not([hidden])) .browse { position: absolute; left: 0; top: 0; bottom: 0; width: 62px; min-height: 100%; max-height: none; z-index: 8; transition: width .18s ease; overflow: hidden; box-shadow: none; }
  body:not([data-tab="live"]) #app:has(.player:not([hidden])) .browse h4 { visibility: hidden; height: 36px; }
  body:not([data-tab="live"]) #app:has(.player:not([hidden])) .browse button.cat { padding-left: 21px; }
  body:not([data-tab="live"]) #app:has(.player:not([hidden])) .browse button.cat span { opacity: 0; transition: opacity .12s; }
  body:not([data-tab="live"]) #app:has(.player:not([hidden])) .browse:hover, body:not([data-tab="live"]) #app:has(.player:not([hidden])) .browse:focus-within { width: 240px; box-shadow: 8px 0 24px rgba(0,0,0,.5); }
  body:not([data-tab="live"]) #app:has(.player:not([hidden])) .browse:hover h4, body:not([data-tab="live"]) #app:has(.player:not([hidden])) .browse:focus-within h4 { visibility: visible; }
  body:not([data-tab="live"]) #app:has(.player:not([hidden])) .browse:hover button.cat span, body:not([data-tab="live"]) #app:has(.player:not([hidden])) .browse:focus-within button.cat span { opacity: 1; }
  body:not([data-tab="live"]) #app:has(.player:not([hidden])) .announce { grid-column: 2 / -1; }
  .tab { padding: 20px 28px 0; max-width: none; }
  /* Guide: preview + details across the top (the player box), timeline and rows below. */
  body[data-tab="live"] #app { grid-template-columns: var(--rail) minmax(0, 1fr) !important; grid-template-rows: auto auto minmax(0, 1fr); }
  body[data-tab="live"] .announce { grid-column: 2; }
  body[data-tab="live"] .player { grid-column: 2; grid-row: 2; flex-direction: row; align-items: stretch; background: var(--bg); padding: 16px 24px 0 10px; height: auto; justify-content: flex-start; }
  body[data-tab="live"] .video-wrap { width: clamp(356px, 30vw, 640px); aspect-ratio: 16 / 9; height: auto; flex: none; border-radius: 4px; overflow: hidden; }
  body[data-tab="live"] .now-bar { flex: 1; min-width: 0; flex-direction: column; align-items: flex-start; justify-content: flex-start; background: transparent; border: 0; padding: 4px 0 0 24px; gap: 0; }
  body[data-tab="live"] .now-bar > img { display: none; }
  body[data-tab="live"] .now-text { width: 100%; }
  body[data-tab="live"] .now-title { font-size: clamp(28px, 2vw, 36px); font-weight: 600; margin-bottom: 6px; }
  body[data-tab="live"] .now-sub { display: none; }
  body[data-tab="live"] .detail-only { display: block; }
  body[data-tab="live"] .now-prog { font-size: clamp(18px, 1.3vw, 22px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  body[data-tab="live"] .now-time { font-size: 14px; color: var(--accent); }
  body[data-tab="live"] .now-desc { font-size: 14px; margin-top: 6px; max-width: 70ch; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
  body[data-tab="live"] .now-actions { position: absolute; right: 24px; top: 20px; }
  body[data-tab="live"] .player { position: relative; }
  body[data-tab="live"] .player + .content, body[data-tab="live"] .content { grid-column: 2; grid-row: 3; }
  body[data-tab="live"] .player[hidden] + .content { grid-column: 2; max-width: none; }
  #tab-live { max-width: none; padding: 6px 14px 0 6px; }
  .guide-bar { display: flex; }
  .guide-date { gap: 16px; padding: 6px 8px; }
  .guide-date #g-date { display: inline; }
  .guide-date input { flex: 0 0 320px; padding: 6px 10px; }
  .guide-date .cat-chip { display: inline-block; background: transparent; color: var(--dim); padding: 2px 6px; max-width: none; }
  .hint { display: block; }
  .catpanel-inner { left: var(--rail); width: 300px; }
  /* Browse column beside the posters (NavPanel), 220px like the app's expanded panel. */
  .tab-browse { display: flex; gap: 18px; max-width: none; padding-left: 0; }
  .browse { display: flex; flex-direction: column; flex: 0 0 220px; background: var(--panel); border-right: 1px solid var(--line); min-height: calc(100vh - 20px); position: sticky; top: 0; align-self: flex-start; max-height: 100vh; }
  .cat-chip { display: none; }
  .welcome h1 { font-size: 30px; }
  .rail-items .poster { flex-basis: 160px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .sheet { align-items: center; }
  .sheet-inner { border-radius: 14px; border: 1px solid var(--line); border-top: 2px solid var(--accent); max-height: 85%; }
  .ep-tiles:not(.ep-lines) { display: grid; grid-template-columns: repeat(auto-fill, minmax(11em, 1fr)); overflow: visible; align-items: start; }
  .ep-tiles:not(.ep-lines) .ep-tile { flex: none; width: auto; }
  .rel-tile { flex-basis: 7em; }
  .toast { bottom: 24px; }
  /* Theater view: rail | Browse icon strip | video. Posters, rails, search and account are hidden. */
  body[data-theater="1"]:not([data-tab="live"]) #app:has(.player:not([hidden])) { grid-template-columns: var(--rail) auto minmax(0, 1fr); }
  body[data-theater="1"]:not([data-tab="live"]) .content { grid-column: 2; grid-row: 2; overflow: visible; padding: 0; width: 0; position: relative; }
  body[data-theater="1"][data-tab="movies"] .content, body[data-theater="1"][data-tab="series"] .content { width: 62px; }
  body[data-theater="1"]:not([data-tab="live"]) .player { grid-column: 3; grid-row: 2; height: 100%; max-height: 100vh; display: flex; flex-direction: column; justify-content: flex-start; }
  body[data-theater="1"]:not([data-tab="live"]) .video-wrap { flex: 1; min-height: 0; aspect-ratio: auto; }
  body[data-theater="1"]:not([data-tab="live"]) .video-wrap video { object-fit: contain; }
  body[data-theater="1"]:not([data-tab="live"]) .now-bar { flex: none; }
  body[data-theater="1"]:not([data-tab="live"]) .tab { padding: 0; }
  body[data-theater="1"]:not([data-tab="live"]) .tab-browse { padding-left: 62px; width: 62px; min-height: 100%; }
  body[data-theater="1"]:not([data-tab="live"]) .browse-main, body[data-theater="1"]:not([data-tab="live"]) #tab-home > *, body[data-theater="1"]:not([data-tab="live"]) #tab-search > *, body[data-theater="1"]:not([data-tab="live"]) #tab-account > * { display: none; }
  body[data-theater="1"]:not([data-tab="live"]) .browse { position: absolute; left: 0; top: 0; bottom: 0; width: 62px; max-height: none; z-index: 8; transition: width .18s ease; overflow: hidden; }
  body[data-theater="1"]:not([data-tab="live"]) .browse:hover, body[data-theater="1"]:not([data-tab="live"]) .browse:focus-within { width: 240px; box-shadow: 8px 0 24px rgba(0,0,0,.5); }
  /* Drawer: the chosen category's posters slide out over the video; the video stays full size behind. */
  body[data-theater="1"][data-drawer="1"] .content { z-index: 9; }
  body[data-theater="1"][data-drawer="1"] .browse-main { display: block; position: absolute; left: 62px; top: 0; bottom: 0; width: min(900px, calc(100vw - var(--rail) - 62px - 160px)); background: rgba(11,13,18,.94); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-right: 1px solid var(--line); box-shadow: 12px 0 32px rgba(0,0,0,.6); overflow-y: auto; padding: 14px 16px calc(16px + var(--safe-bottom)); animation: drawer-in .18s ease; }
  body[data-theater="1"][data-drawer="1"] .toolbar .drawer-close { display: inline-block; flex: 0 0 auto; }
  @keyframes drawer-in { from { transform: translateX(-24px); opacity: 0; } to { transform: none; opacity: 1; } }
  .now-actions #btn-theater.on { color: var(--accent); }
}

/* #25 leave-site prompt: same sheet styling as the detail panels, centred, sized by text */
.sheet.leave { align-items: center; z-index: 40; }
.leave-inner { max-width: 28em; border-radius: 14px; border: 1px solid var(--line); border-top: 2px solid var(--accent); }
.leave-inner h2 { margin: 0 0 .4em; }
.leave-inner .actions { display: flex; gap: .6em; margin-top: 1em; }
.leave-inner .actions button { flex: 1; padding: .7em 1em; font-size: 1em; }
