/*
 * TV-first layout. 1rem = 1/96 of the screen width (20px on a 1920px TV), so the UI scales to any TV
 * resolution. Phones get a minimum size and a stacked layout. Only flexbox, no CSS grid or flex `gap`
 * (not supported on webOS 4 / Chromium 53).
 */
:root {
  /* Streamary TV brand */
  --brand: #802dfb;
  --brand-2: #5b1fd8;
  --brand-light: #a970ff;
  --bg: #0c0a14;
  --panel: #17141f;
  --panel-2: #221d2e;
  --line: #2f2940;
  --text: #f1eff7;
  --muted: #958fa8;
  --accent: #802dfb;
  --focus: #a970ff;
  --green: #2fbf71;
  --amber: #f0a92e;
  --red: #ef5350;
}

html { font-size: calc(100vw / 96); font-size: max(calc(100vw / 96), 11px); }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); }
body { font-family: 'LG Smart UI', 'SamsungOne', Roboto, 'Segoe UI', Arial, sans-serif; font-size: 1rem; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
* { box-sizing: border-box; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; text-align: left; cursor: pointer; outline: none; }
h1 { font-size: 2.2rem; margin: 0 0 1rem; }
h2 { font-size: 1.3rem; margin: 0 0 .6rem; }
p { margin: 0 0 .8rem; }
.muted { color: var(--muted); }
.mono { font-family: 'Consolas', 'Courier New', monospace; letter-spacing: .05em; }

#app { position: absolute; top: 0; right: 0; bottom: 0; left: 0; }
.screen {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0; display: flex; flex-direction: column;
  background: radial-gradient(ellipse at 12% -20%, rgba(128, 45, 251, .28), transparent 55%),
              radial-gradient(ellipse at 105% 115%, rgba(91, 31, 216, .22), transparent 50%), var(--bg);
}
.scroll-y { overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }
.scroll-x { overflow-x: auto; overflow-y: hidden; white-space: nowrap; -webkit-overflow-scrolling: touch; }
.tv .scroll-y, .tv .scroll-x { overflow: hidden; } /* remote-driven: we scroll programmatically, no scrollbars */
.empty { color: var(--muted); padding: 2rem; font-size: 1.1rem; white-space: normal; }

/* ---------- Focus ---------- */
.focusable { transition: transform .12s, background-color .12s, box-shadow .12s; }
.focusable.focused { box-shadow: 0 0 0 .2rem var(--focus); background-color: var(--panel-2); }
.touch .focusable.focused { box-shadow: none; transform: none; } /* focus zoom is for remotes only */
.touch .focusable:active { background-color: var(--panel-2); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; padding: .7rem 1.6rem; border-radius: .5rem; background: var(--panel-2); font-size: 1.1rem; margin: 0 .8rem .8rem 0; }
.btn .icon { width: 1.2rem; height: 1.2rem; margin-right: .5rem; }
.btn-primary { background: var(--accent); color: #fff; }
.btn.focused { transform: scale(1.06); background: var(--brand); color: #fff; box-shadow: 0 0 0 .2rem #fff; }
.button-row { display: flex; flex-wrap: wrap; margin-top: 1rem; }
.icon { display: inline-block; width: 1.4rem; height: 1.4rem; vertical-align: middle; }
.icon svg, .tile-icon svg, .fav-star svg { width: 100%; height: 100%; display: block; }
/* Icon boxes: centre the SVG (as inline content it would sit on the text baseline, off-centre) */
.title-icon, .group-icon, .shortcut-icon, .search-box-icon, .tile-icon, .empty-icon, .edit-overlay, .copy-btn .icon {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; box-sizing: border-box;
}
.title-icon svg, .group-icon svg, .shortcut-icon svg, .search-box-icon svg, .empty-icon svg, .edit-overlay svg { width: 100%; height: 100%; display: block; }

/* ---------- Top bar ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 1.2rem 2.5rem; flex-shrink: 0; }
.brand { font-size: 1.6rem; font-weight: 700; }
.topbar-right { display: flex; align-items: center; color: var(--muted); }
.topbar-right > * { margin-left: 1.2rem; }
.clock { font-size: 1.4rem; color: var(--text); }
.sub-badge { padding: .25rem .8rem; border-radius: 1rem; background: var(--panel-2); font-size: .9rem; }
.sub-badge.trial { color: var(--amber); }
.sub-badge.active { color: var(--green); }
.heading-cat { color: var(--text); font-size: 1.2rem; }
.heading-count { background: var(--panel-2); padding: .1rem .6rem; border-radius: 1rem; font-size: .9rem; }
.hint { font-size: .85rem; }
.touch .hint { display: none; }

/* ---------- Loading / activation ---------- */
.loading { align-items: center; justify-content: center; }
.spinner { width: 4rem; height: 4rem; border: .4rem solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { margin-top: 1.5rem; color: var(--muted); font-size: 1.2rem; }

.activation { align-items: center; justify-content: center; padding: 2rem; }
.activation-card { display: flex; align-items: center; background: var(--panel); border-radius: 1.2rem; padding: 3rem; max-width: 70rem; width: 100%; }
.activation-main { flex: 1; }
.lead { font-size: 1.3rem; line-height: 1.5; color: #c9cfdb; max-width: 44rem; }
.device-box { display: flex; flex-wrap: wrap; background: var(--bg); border-radius: .8rem; padding: 1.2rem 1.6rem; margin: 1.5rem 0; }
.device-box > div { margin-right: 3rem; }
.device-box .label { display: block; color: var(--muted); font-size: .95rem; }
.device-box .value { font-size: 2rem; font-weight: 700; }
.support { font-size: 1.1rem; }
.qr { width: 18rem; height: 18rem; background: #fff; border-radius: .8rem; padding: .6rem; margin-left: 3rem; flex-shrink: 0; }
.qr svg { width: 100%; height: 100%; display: block; }
.version { margin-top: 1rem; font-size: .8rem; }

/* ---------- Logo ---------- */
.logo { display: flex; align-items: center; }
.logo-mark { height: 3.4rem; margin-right: 1rem; }
.logo-word { height: 1.5rem; }
.logo-large { margin-bottom: 2rem; }
.logo-large .logo-mark { height: 4rem; }
.logo-large .logo-word { height: 1.7rem; }
.logo-splash { flex-direction: column; margin-bottom: 3rem; }
.logo-splash .logo-mark { height: 9rem; margin: 0 0 2rem; }
.logo-splash .logo-word { height: 2.2rem; }

/* ---------- Home ---------- */
.home-header { display: flex; align-items: center; justify-content: space-between; padding: 2rem 3.5rem 1rem; flex-shrink: 0; }
.header-right { display: flex; align-items: center; }
.header-right > * { margin-left: 1.6rem; }
.sub-pill { padding: .45rem 1.1rem; border-radius: 2rem; font-size: .95rem; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .08); }
.sub-pill.trial { color: var(--amber); }
.sub-pill.active { color: var(--green); }
.sub-pill.expiring { color: var(--red); }
.clock { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.clock-time { font-size: 1.8rem; font-weight: 700; }
.clock-date { font-size: .9rem; color: var(--muted); }
.icon-btn { width: 3.4rem; height: 3.4rem; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, .07); }
.icon-btn .icon { width: 1.6rem; height: 1.6rem; }
.icon-btn.focused { background: var(--brand); box-shadow: 0 0 0 .2rem #fff; transform: scale(1.08); }

.home-main { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 0 3.5rem; min-height: 0; }
.section-row { display: flex; margin-bottom: 1.6rem; }
.section-tile {
  position: relative; overflow: hidden; flex: 1; height: 24rem; margin-right: 1.6rem; padding: 2.4rem;
  border-radius: 1.4rem; display: flex; flex-direction: column; justify-content: space-between;
  box-shadow: 0 1rem 2.5rem rgba(0, 0, 0, .35);
}
.section-tile:last-child { margin-right: 0; }
.section-tile.live { background: linear-gradient(145deg, #9a4dff 0%, #6a24ea 45%, #3b119e 100%); }
.section-tile.movies { background: linear-gradient(145deg, #e0529c 0%, #9b2bd6 50%, #4a1596 100%); }
.section-tile.series { background: linear-gradient(145deg, #4f7dff 0%, #5a35e6 50%, #2a1488 100%); }
.section-tile.disabled { opacity: .35; }
.tile-glow { position: absolute; width: 22rem; height: 22rem; right: -7rem; top: -7rem; border-radius: 50%; background: rgba(255, 255, 255, .12); }
.section-tile .tile-icon { position: relative; width: 5.5rem; height: 5.5rem; padding: 1.2rem; border-radius: 1.2rem; background: rgba(255, 255, 255, .16); }
.section-tile .tile-text { position: relative; display: flex; flex-direction: column; }
.section-tile .tile-label { font-size: 2.6rem; font-weight: 800; letter-spacing: .02em; }
.tile-sub { font-size: 1.1rem; color: rgba(255, 255, 255, .78); margin-top: .3rem; }
.tile-arrow { position: absolute; right: 2.2rem; bottom: 2rem; font-size: 3.2rem; line-height: 1; opacity: .6; }
.section-tile.focused { transform: scale(1.045); box-shadow: 0 0 0 .3rem #fff, 0 1.6rem 3.5rem rgba(128, 45, 251, .55); }
.section-tile.focused .tile-arrow { opacity: 1; }

.shortcut-row { display: flex; }
.shortcut-tile {
  flex: 1; display: flex; align-items: center; height: 8.5rem; margin-right: 1.6rem; padding: 0 2.2rem;
  border-radius: 1.2rem; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .07);
}
.shortcut-tile:last-child { margin-right: 0; }
.shortcut-icon { width: 4.2rem; height: 4.2rem; padding: 1rem; margin-right: 1.6rem; border-radius: 50%; background: rgba(128, 45, 251, .22); color: var(--brand-light); flex-shrink: 0; }
.shortcut-tile.favorites .shortcut-icon { color: var(--amber); background: rgba(240, 169, 46, .15); }
.shortcut-tile .tile-text { display: flex; flex-direction: column; }
.shortcut-tile .tile-label { font-size: 1.6rem; font-weight: 700; }
.shortcut-tile .tile-sub { color: var(--muted); }
.shortcut-tile.focused { background: var(--brand); border-color: var(--brand); transform: scale(1.03); box-shadow: 0 0 0 .25rem #fff, 0 1rem 2.5rem rgba(128, 45, 251, .45); }
.shortcut-tile.focused .shortcut-icon { background: rgba(255, 255, 255, .2); color: #fff; }
.shortcut-tile.focused .tile-sub { color: rgba(255, 255, 255, .85); }

.announcements { margin-top: 1.6rem; }
.announcement { background: rgba(240, 169, 46, .08); border-left: .3rem solid var(--amber); border-radius: .6rem; padding: .9rem 1.4rem; margin-bottom: .6rem; }
.announcement strong { margin-right: .8rem; }
.announcement span { color: #d6d1e3; }

.home-footer { display: flex; padding: 1.2rem 3.5rem 1.8rem; color: var(--muted); font-size: .95rem; flex-shrink: 0; }
.home-footer > span { margin-right: 2.5rem; }
.home-footer strong { color: var(--text); font-weight: 600; }

/* ---------- Page headers & search boxes ---------- */
.page-title { display: flex; align-items: center; font-size: 1.7rem; font-weight: 700; flex-shrink: 0; }
.title-icon { width: 2.4rem; height: 2.4rem; padding: .5rem; margin-right: .9rem; border-radius: .6rem; background: var(--brand); color: #fff; }
.search-box { flex: 1; display: flex; align-items: center; position: relative; margin: 0 2rem; max-width: 42rem; }
.search-box-icon { position: absolute; left: 1rem; width: 1.3rem; height: 1.3rem; color: var(--muted); pointer-events: none; z-index: 1; }
.search-box .search-input { flex: 1; margin: 0; padding-left: 3rem; }
.empty-state { text-align: center; padding: 5rem 2rem; white-space: normal; }
.empty-icon { width: 4rem; height: 4rem; color: var(--amber); margin-bottom: 1rem; }
.media-row h2 { display: flex; align-items: center; }
.row-count { margin-left: .7rem; font-size: .85rem; background: var(--panel-2); color: var(--muted); padding: .1rem .6rem; border-radius: 1rem; }

/* ---------- Browse ---------- */
.browse-body { flex: 1; display: flex; min-height: 0; padding: 0 2.5rem 1.5rem; }
.cat-list { width: 20rem; flex-shrink: 0; margin-right: 1.2rem; padding: .3rem; }
.cat-item { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: .75rem 1rem; border-radius: .5rem; font-size: 1.1rem; }
.cat-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-count { color: var(--muted); font-size: .9rem; margin-left: .6rem; }
.cat-item.focused { background: var(--brand); box-shadow: none; }
.cat-item.focused .cat-count { color: #fff; }

.channel-list { flex: 1; padding: .3rem; }
.channel-row { display: flex; align-items: center; width: 100%; padding: .55rem 1rem; border-radius: .5rem; font-size: 1.15rem; }
.ch-num { width: 3.5rem; color: var(--muted); flex-shrink: 0; }
.ch-logo { width: 4.5rem; height: 2.8rem; flex-shrink: 0; margin-right: 1.2rem; display: flex; align-items: center; justify-content: center; background: var(--panel); border-radius: .3rem; overflow: hidden; }
.ch-logo img { max-width: 100%; max-height: 100%; }
.ch-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-row.focused { background: rgba(128, 45, 251, .28); box-shadow: inset .3rem 0 0 var(--brand); }
.fav-star { width: 1.2rem; height: 1.2rem; color: var(--amber); flex-shrink: 0; margin-left: .5rem; }
.thumb-letter { font-weight: 700; color: var(--muted); font-size: 1.2rem; }

.info-panel { width: 30rem; flex-shrink: 0; margin-left: 1.2rem; background: var(--panel); border-radius: .8rem; padding: 1.6rem; overflow: hidden; }
.info-logo { height: 6rem; display: flex; align-items: center; margin-bottom: 1rem; }
.info-logo img { max-height: 100%; max-width: 12rem; }
.info-logo .thumb-letter { font-size: 3rem; }
.epg-item { padding: .7rem 0; border-top: 1px solid var(--line); }
.epg-item.now .epg-title { font-size: 1.2rem; font-weight: 700; }
.epg-time { color: var(--muted); font-size: .9rem; }
.epg-desc { color: #c9cfdb; font-size: .95rem; margin-top: .5rem; max-height: 9rem; overflow: hidden; }
.progress { height: .3rem; background: var(--line); border-radius: .2rem; margin-top: .4rem; overflow: hidden; }
.progress-bar { height: 100%; background: var(--accent); }

.poster-grid { flex: 1; display: flex; flex-wrap: wrap; align-content: flex-start; padding: .5rem; }
.poster { width: 11rem; margin: 0 1.1rem 1.4rem 0; border-radius: .6rem; padding: .3rem; position: relative; vertical-align: top; }
.poster-img { width: 100%; height: 15.5rem; border-radius: .5rem; overflow: hidden; background: var(--panel); display: flex; align-items: center; justify-content: center; }
.poster-img img { width: 100%; height: 100%; object-fit: cover; }
.poster-img .thumb-letter { font-size: 3rem; }
.poster-title { display: block; margin-top: .5rem; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.poster .channel-row.focused { background: rgba(128, 45, 251, .28); box-shadow: inset .3rem 0 0 var(--brand); }
.fav-star { position: absolute; top: .8rem; right: .8rem; }
.poster.focused { transform: scale(1.07); background: var(--panel-2); box-shadow: 0 0 0 .2rem var(--brand-light); }

/* ---------- Details ---------- */
.details-body { display: flex; padding: 3rem; flex: 1; min-height: 0; }
.detail-poster { width: 20rem; height: 29rem; flex-shrink: 0; margin-right: 3rem; border-radius: .8rem; overflow: hidden; background: var(--panel); display: flex; align-items: center; justify-content: center; }
.detail-poster img { width: 100%; height: 100%; object-fit: cover; }
.detail-poster .thumb-letter { font-size: 5rem; }
.details-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.meta { display: flex; flex-wrap: wrap; }
.chip { background: var(--panel-2); padding: .3rem .8rem; border-radius: 1rem; margin: 0 .6rem .6rem 0; font-size: .95rem; }
.plot { font-size: 1.15rem; line-height: 1.5; color: #c9cfdb; max-width: 60rem; margin-top: 1rem; }
.season-tabs { flex-shrink: 0; padding: .3rem; margin: .5rem 0; }
.season-tab { display: inline-block; padding: .6rem 1.2rem; border-radius: .5rem; margin-right: .6rem; background: var(--panel); }
.season-tab.active { color: var(--accent); }
.season-tab.focused { background: var(--accent); color: #fff; }
.episode-list { flex: 1; min-height: 0; padding: .3rem; }
.episode { display: flex; flex-wrap: wrap; align-items: center; width: 100%; padding: .8rem 1rem; border-radius: .5rem; margin-bottom: .3rem; background: var(--panel); }
.ep-num { width: 4rem; color: var(--muted); }
.ep-title { flex: 1; }
.episode .progress { width: 100%; }

/* ---------- Settings & search ---------- */
.settings-body { flex: 1; padding: 0 2.5rem 2rem; max-width: 70rem; }
.settings-body h2 { margin-top: 1.5rem; color: var(--muted); font-size: 1rem; text-transform: uppercase; letter-spacing: .08em; }
.settings-row { display: flex; justify-content: space-between; width: 100%; padding: 1rem 1.2rem; border-radius: .5rem; background: var(--panel); margin-bottom: .4rem; font-size: 1.1rem; }
.settings-value { color: var(--muted); text-align: right; margin-left: 2rem; }
.settings-row.focused .settings-value { color: var(--text); }
.disclaimer { font-size: .95rem; margin: .8rem 0; }

.search-input { flex: 1; padding: .8rem 1.2rem; font-size: 1.2rem; background: rgba(255, 255, 255, .06); color: var(--text); border: .15rem solid var(--line); border-radius: 2rem; outline: none; }
.search-input.focused { border-color: var(--focus); box-shadow: none; }
.search-results { flex: 1; padding: 0 2.5rem 2rem; }
.search-results section { margin-bottom: 1.5rem; }
.result-strip { padding: .4rem; }
.result-card { display: inline-block; vertical-align: top; width: 11rem; margin-right: 1rem; border-radius: .6rem; padding: .3rem; white-space: normal; }
.result-card .ch-logo { width: 100%; height: 6rem; margin: 0; }
.result-card.focused { transform: scale(1.06); }

/* ---------- Dialog & toast ---------- */
.overlay { position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: rgba(0, 0, 0, .7); display: flex; align-items: center; justify-content: center; z-index: 20; }
.dialog { background: var(--panel); border-radius: 1rem; padding: 2.4rem; min-width: 32rem; max-width: 50rem; }
.dialog-buttons { display: flex; flex-wrap: wrap; margin-top: 1.5rem; }
.toast { position: fixed; left: 50%; bottom: 3rem; transform: translate(-50%, 2rem); background: rgba(20, 25, 35, .95); padding: .9rem 1.8rem; border-radius: 2rem; font-size: 1.1rem; opacity: 0; transition: opacity .2s, transform .2s; z-index: 100; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Player ---------- */
.player { background: #000; z-index: 10; }
.video { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: #000; }
.player-spinner { position: absolute; top: 50%; left: 50%; margin: -2rem 0 0 -2rem; }
.player-error { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: rgba(0, 0, 0, .8); padding: 2rem 3rem; border-radius: 1rem; text-align: center; font-size: 1.3rem; max-width: 50rem; }
.number-entry { position: absolute; top: 2rem; right: 3rem; font-size: 4rem; font-weight: 700; text-shadow: 0 0 1rem #000; }
.osd { position: absolute; top: 0; right: 0; bottom: 0; left: 0; opacity: 0; transition: opacity .25s; pointer-events: none; }
.osd.show { opacity: 1; pointer-events: auto; }
.osd-top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; padding: 1.5rem 2.5rem 4rem; background: linear-gradient(rgba(0, 0, 0, .85), transparent); }
.osd-title { flex: 1; font-size: 1.6rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.osd-num { font-size: 1.6rem; color: var(--accent); margin-right: 1rem; font-weight: 700; }
.osd-logo { width: 5rem; height: 3rem; margin-right: 1rem; display: flex; align-items: center; justify-content: center; }
.osd-logo img { max-width: 100%; max-height: 100%; }
.osd-clock { font-size: 1.4rem; margin-left: 1rem; }
.osd-bottom { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: flex-end; padding: 4rem 2.5rem 2rem; background: linear-gradient(transparent, rgba(0, 0, 0, .9)); }
.osd-epg { flex: 1; font-size: 1.2rem; }
.epg-now .epg-time { margin-right: .6rem; }
.epg-next { margin-top: .5rem; font-size: 1rem; }
.vod-bar { flex: 1; display: flex; align-items: center; }
.vod-bar .progress { flex: 1; height: .5rem; margin: 0 1.2rem; }
.vod-bar .time { font-size: 1.1rem; min-width: 5rem; text-align: center; }
.osd-controls { display: flex; margin-left: 1.5rem; }
.osd-btn { width: 3.2rem; height: 3.2rem; border-radius: 50%; background: rgba(255, 255, 255, .15); display: flex; align-items: center; justify-content: center; margin-left: .6rem; }
.osd-btn .icon { width: 1.5rem; height: 1.5rem; }
.tv .osd-btn { display: none; }               /* remotes use keys; buttons are for touch */
.tv .osd-controls .osd-play { display: flex; } /* but keep the play/pause state visible */

/* ---------- Phones & small windows ---------- */
@media (max-width: 900px) {
  html { font-size: 12px; }
  .topbar { padding: 1rem; }
  .home-header { padding: 1rem; }
  .logo-mark { height: 2.6rem; margin-right: .6rem; }
  .logo-word { height: 1.1rem; }
  .clock, .sub-pill { display: none; }
  .home-main { padding: 0 1rem; justify-content: flex-start; overflow-y: auto; }
  .section-row { flex-direction: column; margin-bottom: 0; }
  .section-tile { flex: none; height: 9.5rem; margin: 0 0 1rem; padding: 1.4rem; flex-direction: row; align-items: center; justify-content: flex-start; }
  .section-tile .tile-icon { width: 4rem; height: 4rem; padding: .9rem; margin-right: 1.2rem; }
  .section-tile .tile-label { font-size: 1.8rem; }
  .shortcut-row { flex-direction: column; }
  .shortcut-tile { flex: none; height: 6.5rem; margin: 0 0 1rem; }
  .home-footer { flex-wrap: wrap; padding: .8rem 1rem; }
  .topbar { flex-wrap: wrap; }
  .search-box { order: 3; flex-basis: 100%; margin: .8rem 0 0; max-width: none; }
  .browse-body { flex-direction: column; padding: 0 1rem 1rem; }
  .cat-list { width: auto; margin: 0 0 .8rem; overflow-x: auto; overflow-y: hidden; white-space: nowrap; flex-shrink: 0; }
  .cat-item { display: inline-flex; width: auto; background: var(--panel); margin-right: .5rem; }
  .info-panel { display: none; }
  .poster { width: 30%; margin-right: 3%; }
  .poster-img { height: 14rem; }
  .activation-card { flex-direction: column; padding: 1.5rem; }
  .qr { margin: 1.5rem 0 0; width: 14rem; height: 14rem; }
  .details-body { flex-direction: column; padding: 1rem; overflow-y: auto; }
  .detail-poster { width: 12rem; height: 17rem; margin: 0 0 1rem; }
  .dialog { min-width: 0; width: 90%; }
  .topbar-right .playlist-name { display: none; }
}

/* =====================================================================
   Design pass 2: back buttons, profiles, panels, settings, details
   ===================================================================== */

/* ---------- Header / back ---------- */
.topbar { padding: 1.6rem 2.5rem 1.2rem; }
.topbar .back-btn { margin-right: 1.2rem; flex-shrink: 0; }
.corner-back { position: absolute; top: 1.6rem; left: 2rem; z-index: 5; }
.back-btn .icon { width: 1.5rem; height: 1.5rem; }
.touch .icon-btn:active, .touch .profile-btn:active { background: var(--brand); }

/* ---------- Avatars & profiles ---------- */
.avatar { position: relative; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; font-weight: 800; flex-shrink: 0; }
.avatar-small { width: 2.6rem; height: 2.6rem; font-size: 1.2rem; }
.avatar-large { width: 10rem; height: 10rem; font-size: 4.2rem; border-radius: 2rem; box-shadow: 0 1rem 2.5rem rgba(0, 0, 0, .35); }
.avatar-add { background: rgba(255, 255, 255, .08); border: .2rem dashed rgba(255, 255, 255, .25); color: var(--muted); font-weight: 300; }
.kids-badge { position: absolute; bottom: -.4rem; left: 50%; transform: translateX(-50%); background: var(--amber); color: #1b1400; font-size: .7rem; font-weight: 800; padding: .1rem .5rem; border-radius: 1rem; letter-spacing: .05em; }
.avatar-large .kids-badge { font-size: 1rem; padding: .2rem .8rem; bottom: -.8rem; }

.profile-btn { display: flex; align-items: center; padding: .3rem 1.1rem .3rem .3rem; border-radius: 2rem; background: rgba(255, 255, 255, .07); }
.profile-btn-name { margin-left: .7rem; font-weight: 600; }
.profile-btn.focused { background: var(--brand); box-shadow: 0 0 0 .2rem #fff; transform: scale(1.05); }

.profiles { align-items: center; justify-content: center; }
.profile-logo { margin-bottom: 2.5rem; }
.profile-title { font-size: 2.8rem; margin-bottom: 2.5rem; }
.profile-grid { display: flex; flex-wrap: wrap; justify-content: center; max-width: 80rem; }
.profile-card { display: flex; flex-direction: column; align-items: center; margin: 0 1.6rem 2rem; padding: 1rem; border-radius: 1.6rem; position: relative; }
.profile-name { margin-top: 1.3rem; font-size: 1.3rem; color: var(--muted); }
.profile-card.current .profile-name { color: var(--text); font-weight: 700; }
.profile-card.focused { background: transparent; box-shadow: none; transform: scale(1.08); }
.profile-card.focused .avatar-large { box-shadow: 0 0 0 .35rem #fff, 0 1.2rem 3rem rgba(128, 45, 251, .5); }
.profile-card.focused .profile-name { color: #fff; }
.edit-overlay { position: absolute; top: 1rem; right: 1rem; width: 2.6rem; height: 2.6rem; padding: .6rem; border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff; }
.center-row { justify-content: center; }

.profile-edit { align-items: center; justify-content: center; }
.edit-card { width: 44rem; max-width: 92%; background: rgba(23, 20, 31, .85); border: 1px solid var(--line); border-radius: 1.4rem; padding: 2.4rem; display: flex; flex-direction: column; align-items: stretch; }
.edit-card h1 { text-align: center; }
.edit-preview { display: flex; justify-content: center; margin-bottom: 1.6rem; }
.profile-input { flex: none; font-size: 1.4rem; text-align: center; margin-bottom: 1.2rem; }
.field-label { color: var(--muted); margin: .4rem 0 .6rem; }
.swatches { display: flex; margin-bottom: 1.4rem; }
.swatch { width: 3.2rem; height: 3.2rem; border-radius: 50%; margin-right: 1rem; border: .2rem solid transparent; }
.swatch.selected { border-color: #fff; }
.swatch.focused { transform: scale(1.18); box-shadow: 0 0 0 .2rem var(--brand-light); }
.btn-danger { color: #ff8a87; }
.btn-danger.focused { background: var(--red); color: #fff; }

/* ---------- Toggles ---------- */
.toggle { position: relative; width: 3.6rem; height: 2rem; border-radius: 1rem; background: rgba(255, 255, 255, .15); flex-shrink: 0; transition: background-color .15s; }
.toggle-knob { position: absolute; top: .2rem; left: .2rem; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: #fff; transition: left .15s; }
.toggle.on { background: var(--brand); }
.toggle.on .toggle-knob { left: 1.8rem; }

/* ---------- Settings ---------- */
.settings-body { max-width: 76rem; width: 100%; margin: 0 auto; padding: 0 2.5rem 3rem; }
.settings-group { margin-bottom: 1.8rem; }
.settings-group h2 { display: flex; align-items: center; margin: 0 0 .7rem; color: var(--muted); font-size: .95rem; text-transform: uppercase; letter-spacing: .1em; }
.group-icon { width: 1.3rem; height: 1.3rem; margin-right: .6rem; color: var(--brand-light); }
.settings-card { background: rgba(255, 255, 255, .045); border: 1px solid rgba(255, 255, 255, .06); border-radius: 1.1rem; overflow: hidden; }
.settings-card .settings-row { margin: 0; border-radius: 0; background: transparent; border-bottom: 1px solid rgba(255, 255, 255, .05); align-items: center; padding: 1.1rem 1.5rem; }
.settings-card .settings-row:last-child { border-bottom: 0; }
.settings-card .settings-row.focused { background: rgba(128, 45, 251, .3); box-shadow: inset .3rem 0 0 var(--brand); }
.settings-label { display: flex; flex-direction: column; flex: 1; }
.settings-label small { font-size: .85rem; margin-top: .2rem; }
.settings-value { display: flex; align-items: center; }
.profile-value .avatar { margin-right: .7rem; }
.chevron { margin-left: 1rem; font-size: 1.6rem; line-height: 1; color: var(--muted); }
.in-use { color: var(--green); font-weight: 600; }
.status-dot::before { content: ""; display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; margin-right: .5rem; background: var(--muted); }
.status-dot.active::before { background: var(--green); }
.status-dot.trial::before { background: var(--amber); }
.status-dot.expired::before, .status-dot.blocked::before { background: var(--red); }

/* ---------- Browse panels ---------- */
.cat-list, .channel-list, .info-panel { background: rgba(255, 255, 255, .035); border: 1px solid rgba(255, 255, 255, .055); border-radius: 1.1rem; }
.cat-list { padding: .6rem; }
.channel-list { padding: .6rem; }
.cat-item { margin-bottom: .15rem; }
.cat-item.active { color: #fff; background: rgba(128, 45, 251, .22); box-shadow: inset .25rem 0 0 var(--brand); }
.cat-item.active .cat-count { color: var(--brand-light); }
.channel-row { padding: .7rem 1rem; margin-bottom: .15rem; font-size: 1.2rem; }
.ch-num { width: 3.2rem; margin-right: .8rem; text-align: center; font-size: .9rem; padding: .2rem 0; border-radius: .4rem; background: rgba(255, 255, 255, .06); }
.channel-row.focused .ch-num { background: var(--brand); color: #fff; }
.ch-logo { background: rgba(255, 255, 255, .92); }
.ch-logo .thumb-letter { color: var(--brand-2); }
.info-panel { padding: 0; display: flex; flex-direction: column; }
.info-hero { height: 13rem; display: flex; align-items: center; justify-content: center; background: linear-gradient(145deg, rgba(128, 45, 251, .5), rgba(59, 17, 158, .35)); border-radius: 1.1rem 1.1rem 0 0; }
.info-hero .info-logo { height: 7rem; margin: 0; padding: 1rem 1.6rem; background: rgba(255, 255, 255, .92); border-radius: .8rem; }
.info-hero .info-logo .thumb-letter { color: var(--brand-2); font-size: 3.4rem; }
.info-num { color: var(--brand-light); font-size: .9rem; margin: 1.4rem 1.6rem .2rem; text-transform: uppercase; letter-spacing: .08em; }
.info-panel h2 { margin: 0 1.6rem .4rem; font-size: 1.6rem; }
.info-actions { margin: .6rem 1.6rem 0; }
.info-actions .btn { padding: .55rem 1.2rem; font-size: 1rem; }
.info-panel .epg { padding: 0 1.6rem 1.4rem; overflow: hidden; }

.poster { width: 12rem; margin: 0 1.3rem 1.6rem 0; }
.poster-img { height: 17rem; border-radius: .8rem; box-shadow: 0 .6rem 1.4rem rgba(0, 0, 0, .4); }
.poster-img .thumb-letter { color: var(--brand-light); }
.rating-badge { position: absolute; top: .9rem; left: .9rem; background: rgba(0, 0, 0, .7); color: var(--amber); font-size: .8rem; font-weight: 700; padding: .15rem .5rem; border-radius: .4rem; }
.poster.focused .poster-title { color: #fff; font-weight: 700; }

/* ---------- Details ---------- */
.details { overflow: hidden; }
.backdrop { position: absolute; top: -5%; left: -5%; width: 110%; height: 110%; background-size: cover; background-position: center; filter: blur(2.2rem) brightness(.35) saturate(1.2); opacity: .9; }
.details-body { position: relative; padding: 5rem 4rem 3rem 6rem; }
.detail-poster { box-shadow: 0 1.5rem 3.5rem rgba(0, 0, 0, .55); }
.details-text h1 { font-size: 2.8rem; }
.episode { background: rgba(255, 255, 255, .06); }
.episode.focused { background: rgba(128, 45, 251, .35); box-shadow: inset .3rem 0 0 var(--brand); }
.season-tab.focused { background: var(--brand); }

/* ---------- Phones ---------- */
@media (max-width: 900px) {
  .topbar { padding: 1rem; }
  .profile-title { font-size: 2rem; }
  .avatar-large { width: 7rem; height: 7rem; font-size: 3rem; }
  .profile-card { margin: 0 .6rem 1.2rem; }
  .profile-btn-name { display: none; }
  .profile-btn { padding: .3rem; }
  .settings-body { padding: 0 1rem 2rem; }
  .corner-back { top: 1rem; left: 1rem; }
  .details-body { padding: 4.5rem 1rem 1rem; }
  .cat-list { border-radius: .8rem; }
}
/* Header: back + title on the left, extras pushed right */
.topbar { justify-content: flex-start; }
.topbar .topbar-right, .topbar > .hint { margin-left: auto; }

/* ---------- Copy buttons (Device ID / Key) ---------- */
.copyable, .value-line { display: inline-flex; align-items: center; }
.copy-btn { width: 2.4rem; height: 2.4rem; margin-left: .8rem; border-radius: .6rem; display: inline-flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, .08); color: var(--muted); flex-shrink: 0; }
.copy-btn .icon { width: 1.2rem; height: 1.2rem; }
.copy-btn:hover, .copy-btn.focused { background: var(--brand); color: #fff; box-shadow: none; }
.value-line .copy-btn { width: 2.8rem; height: 2.8rem; }
.tv .copy-btn { display: none; } /* nothing to paste into on a TV */

/* ---------- Scrollbars (phones, browsers, LG Magic Remote pointer) ----------
   Slim brand-purple thumb on a transparent track. Remote-only TVs hide them (see .tv rule above). */
/* Standard properties only where ::-webkit-scrollbar is unsupported (Firefox); Chrome 121+ would otherwise ignore the styles below */
@supports not selector(::-webkit-scrollbar) { * { scrollbar-width: thin; scrollbar-color: rgba(128, 45, 251, .55) transparent; } }
::-webkit-scrollbar { width: .55rem; height: .55rem; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(169, 112, 255, .75), rgba(91, 31, 216, .75));
  border-radius: 1rem;
  border: .12rem solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, #b584ff, #6a24ea); background-clip: padding-box; }
::-webkit-scrollbar-thumb:horizontal { background: linear-gradient(90deg, rgba(169, 112, 255, .75), rgba(91, 31, 216, .75)); background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }
/* Keep list content clear of the scrollbar */
.cat-list.scroll-y, .channel-list.scroll-y, .settings-body.scroll-y, .episode-list.scroll-y { scrollbar-gutter: stable; }
/* Phones: overlay-style, even thinner */
@media (max-width: 900px) {
  ::-webkit-scrollbar { width: 4px; height: 4px; }
  ::-webkit-scrollbar-thumb { border: 0; }
}

/* =====================================================================
   EPG, TV guide, subtitles, languages (Arabic RTL)
   ===================================================================== */

/* ---------- Now playing under channel names ---------- */
.ch-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ch-text .ch-name { flex: none; }
.ch-now { display: flex; align-items: center; font-size: .85rem; color: var(--muted); margin-top: .15rem; }
.ch-now:empty { display: none; }
.ch-now-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.ch-now-bar { width: 4rem; height: .25rem; border-radius: .2rem; background: rgba(255, 255, 255, .12); margin-left: .8rem; overflow: hidden; flex-shrink: 0; }
.ch-now-bar span { display: block; height: 100%; background: var(--brand-light); }
.channel-row.focused .ch-now { color: #e7dcff; }
.guide-btn .icon { width: 1.1rem; height: 1.1rem; margin-right: .4rem; }
.btn-small { padding: .45rem 1rem; font-size: .95rem; margin: 0 0 0 1rem; }
.shortcut-tile.guide .shortcut-icon { color: #7fb0ff; background: rgba(79, 125, 255, .18); }

/* ---------- TV guide ---------- */
.guide { overflow: hidden; }
.guide-date { margin-left: auto; }
.guide-body { flex: 1; min-height: 0; display: flex; margin: 0 2.5rem; border-radius: 1.1rem; overflow: hidden; background: rgba(255, 255, 255, .035); border: 1px solid rgba(255, 255, 255, .055); }
.guide-side { width: 19rem; flex-shrink: 0; display: flex; flex-direction: column; border-right: 1px solid rgba(255, 255, 255, .07); background: rgba(12, 10, 20, .55); }
.guide-corner { height: 3rem; flex-shrink: 0; border-bottom: 1px solid rgba(255, 255, 255, .07); }
.guide-channels-clip { flex: 1; overflow: hidden; }
.guide-channel { height: 5.2rem; display: flex; align-items: center; padding: 0 1rem; border-bottom: 1px solid rgba(255, 255, 255, .05); }
.guide-channel .ch-num { width: 2.8rem; margin-right: .7rem; }
.guide-channel .ch-logo { width: 3.8rem; height: 2.4rem; margin-right: .8rem; }
.guide-ch-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1rem; }
.guide-channel.active { background: rgba(128, 45, 251, .2); box-shadow: inset .25rem 0 0 var(--brand); }
.guide-main { flex: 1; min-width: 0; display: flex; }
.guide-timeline { position: relative; flex: 1; display: flex; flex-direction: column; min-width: 0; }
.guide-ruler { height: 3rem; flex-shrink: 0; display: flex; border-bottom: 1px solid rgba(255, 255, 255, .07); }
.guide-slot { flex-shrink: 0; padding: .9rem 0 0 .6rem; font-size: .9rem; color: var(--muted); border-left: 1px solid rgba(255, 255, 255, .07); box-sizing: border-box; }
.guide-rows { flex: 1; min-height: 0; position: relative; }
.guide-row { position: relative; height: 5.2rem; border-bottom: 1px solid rgba(255, 255, 255, .05); }
.guide-prog {
  position: absolute; top: .35rem; bottom: .35rem; padding: .5rem .8rem; border-radius: .6rem; overflow: hidden;
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .06); display: flex; flex-direction: column; justify-content: center;
}
.guide-prog + .guide-prog { margin-left: .25rem; }
.guide-prog.live { background: rgba(128, 45, 251, .2); border-color: rgba(169, 112, 255, .35); }
.guide-prog.empty { color: var(--muted); font-style: italic; }
.guide-prog-title { font-size: .98rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guide-prog-time { font-size: .8rem; color: var(--muted); margin-top: .15rem; white-space: nowrap; }
.guide-prog.focused { background: var(--brand); border-color: #fff; box-shadow: 0 0 0 .15rem #fff; z-index: 2; }
.guide-prog.focused .guide-prog-time { color: rgba(255, 255, 255, .85); }
.guide-now { position: absolute; top: 0; bottom: 0; width: .18rem; background: #ff4d8d; z-index: 3; pointer-events: none; box-shadow: 0 0 .6rem rgba(255, 77, 141, .7); }
.guide-now-label { position: absolute; top: .5rem; left: .35rem; background: #ff4d8d; color: #fff; font-size: .75rem; font-weight: 700; padding: .05rem .45rem; border-radius: .3rem; }
.guide-status { margin: .6rem 2.5rem 0; color: var(--amber); }
.guide-status:empty { display: none; }
.guide-detail { display: flex; align-items: center; min-height: 6.5rem; margin: 1rem 2.5rem 1.6rem; padding: 1rem 1.4rem; border-radius: 1rem; background: rgba(255, 255, 255, .05); }
.guide-detail .ch-logo { width: 6rem; height: 3.8rem; margin-right: 1.4rem; }
.guide-detail-text { min-width: 0; flex: 1; }
.guide-detail-title { font-size: 1.35rem; font-weight: 700; }
.guide-detail-desc { margin: .3rem 0 0; color: #cfc8e0; max-height: 2.9em; overflow: hidden; }
.guide-dialog { max-width: 56rem; }

/* ---------- Subtitles & audio ---------- */
.osd-cc { margin-left: 1rem; }
.tv .osd-top .osd-cc { display: none; }
.osd-hint { position: absolute; right: 2.5rem; bottom: 9rem; font-size: .9rem; color: rgba(255, 255, 255, .7); background: rgba(0, 0, 0, .45); padding: .3rem .8rem; border-radius: 1rem; }
.touch .osd-hint { display: none; }
.tracks-dialog { min-width: 46rem; }
.tracks-dialog h2 { display: flex; align-items: center; }
.tracks-dialog h2 .icon { margin-right: .7rem; color: var(--brand-light); }
.tracks-columns { display: flex; }
.tracks-col { flex: 1; min-width: 0; margin-right: 1.6rem; }
.tracks-col:last-child { margin-right: 0; }
.tracks-col h3 { font-size: .95rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin: .4rem 0 .7rem; }
.tracks-list { max-height: 24rem; }
.track-option { display: flex; align-items: center; width: 100%; padding: .75rem 1rem; border-radius: .6rem; margin-bottom: .2rem; font-size: 1.1rem; }
.track-check { width: 1.6rem; color: var(--brand-light); font-weight: 800; }
.track-option.selected { color: #fff; }
.track-option.focused { background: var(--brand); box-shadow: none; }
.track-option.focused .track-check { color: #fff; }
/* Subtitle text rendered by the browser/TV */
.video::cue { font-size: 1.5rem; line-height: 1.35; background: rgba(0, 0, 0, .65); color: #fff; }

/* ---------- Language button ---------- */
.activation-top { display: flex; align-items: flex-start; justify-content: space-between; }
.lang-btn { margin: 0; padding: .45rem 1rem; font-size: .95rem; }
.lang-btn .icon { width: 1.2rem; height: 1.2rem; margin-right: .5rem; }
.ltr, .mono, .clock-time, .guide-slot, .guide-prog-time, .epg-time, .time { direction: ltr; unicode-bidi: embed; }

/* ---------- Arabic / right-to-left ---------- */
html[lang="ar"] body { font-family: 'Noto Sans Arabic', 'Segoe UI', Tahoma, 'LG Smart UI', 'SamsungOne', Arial, sans-serif; }
[dir="rtl"] .back-btn svg, [dir="rtl"] .osd-top .osd-btn:first-child svg { transform: scaleX(-1); }
[dir="rtl"] .tile-arrow, [dir="rtl"] .chevron { transform: scaleX(-1); }
[dir="rtl"] .tile-arrow { right: auto; left: 2.2rem; }
[dir="rtl"] .tile-glow { right: auto; left: -7rem; }
/* Flip the one-sided spacing rules used across the UI */
[dir="rtl"] .btn { margin: 0 0 .8rem .8rem; }
[dir="rtl"] .btn .icon { margin-right: 0; margin-left: .5rem; }
[dir="rtl"] .topbar .back-btn { margin-right: 0; margin-left: 1.2rem; }
[dir="rtl"] .title-icon { margin-right: 0; margin-left: .9rem; }
[dir="rtl"] .topbar .topbar-right, [dir="rtl"] .topbar > .hint, [dir="rtl"] .guide-date { margin-left: 0; margin-right: auto; }
[dir="rtl"] .topbar-right > * { margin-left: 0; margin-right: 1.2rem; }
[dir="rtl"] .header-right > * { margin-left: 0; margin-right: 1.6rem; }
[dir="rtl"] .logo-mark { margin-right: 0; margin-left: 1rem; }
[dir="rtl"] .logo-splash .logo-mark, [dir="rtl"] .logo-large .logo-mark { margin-left: 1rem; }
[dir="rtl"] .section-tile { margin-right: 0; margin-left: 1.6rem; }
[dir="rtl"] .section-tile:last-child, [dir="rtl"] .shortcut-tile:last-child { margin-left: 0; }
[dir="rtl"] .shortcut-tile { margin-right: 0; margin-left: 1.6rem; }
[dir="rtl"] .shortcut-icon { margin-right: 0; margin-left: 1.6rem; }
[dir="rtl"] .home-footer > span { margin-right: 0; margin-left: 2.5rem; }
[dir="rtl"] .cat-list { margin-right: 0; margin-left: 1.2rem; }
[dir="rtl"] .cat-count { margin-left: 0; margin-right: .6rem; }
[dir="rtl"] .cat-item.active, [dir="rtl"] .channel-row.focused, [dir="rtl"] .settings-card .settings-row.focused, [dir="rtl"] .episode.focused, [dir="rtl"] .guide-channel.active { box-shadow: inset -.3rem 0 0 var(--brand); }
[dir="rtl"] .ch-num { margin-right: 0; margin-left: .8rem; }
[dir="rtl"] .ch-logo { margin-right: 0; margin-left: 1.2rem; }
[dir="rtl"] .fav-star { margin-left: 0; margin-right: .5rem; }
[dir="rtl"] .ch-now-bar { margin-left: 0; margin-right: .8rem; }
[dir="rtl"] .info-panel { margin-left: 0; margin-right: 1.2rem; }
[dir="rtl"] .poster { margin: 0 0 1.6rem 1.3rem; }
[dir="rtl"] .poster .fav-star { right: auto; left: .8rem; }
[dir="rtl"] .rating-badge { left: auto; right: .9rem; }
[dir="rtl"] .detail-poster { margin-right: 0; margin-left: 3rem; }
[dir="rtl"] .details-body { padding: 5rem 6rem 3rem 4rem; }
[dir="rtl"] .corner-back { left: auto; right: 2rem; }
[dir="rtl"] .chip { margin: 0 0 .6rem .6rem; }
[dir="rtl"] .season-tab { margin-right: 0; margin-left: .6rem; }
[dir="rtl"] .settings-value { margin-left: 0; margin-right: 2rem; text-align: left; }
[dir="rtl"] .chevron { margin-left: 0; margin-right: 1rem; }
[dir="rtl"] .profile-value .avatar { margin-right: 0; margin-left: .7rem; }
[dir="rtl"] .group-icon { margin-right: 0; margin-left: .6rem; }
[dir="rtl"] .copy-btn { margin-left: 0; margin-right: .8rem; }
[dir="rtl"] .search-box-icon { left: auto; right: 1rem; }
[dir="rtl"] .search-box .search-input { padding-left: 1.2rem; padding-right: 3rem; }
[dir="rtl"] .device-box > div { margin-right: 0; margin-left: 3rem; }
[dir="rtl"] .qr { margin-left: 0; margin-right: 3rem; }
[dir="rtl"] .announcement { border-left: 0; border-right: .3rem solid var(--amber); }
[dir="rtl"] .announcement strong { margin-right: 0; margin-left: .8rem; }
[dir="rtl"] .profile-btn { padding: .3rem .3rem .3rem 1.1rem; }
[dir="rtl"] .profile-btn-name { margin-left: 0; margin-right: .7rem; }
[dir="rtl"] .swatch { margin-right: 0; margin-left: 1rem; }
[dir="rtl"] .edit-overlay { right: auto; left: 1rem; }
[dir="rtl"] .tracks-col { margin-right: 0; margin-left: 1.6rem; }
[dir="rtl"] .tracks-col:last-child { margin-left: 0; }
[dir="rtl"] .tracks-dialog h2 .icon { margin-right: 0; margin-left: .7rem; }
[dir="rtl"] .lang-btn .icon { margin-right: 0; margin-left: .5rem; }
[dir="rtl"] .osd-num { margin-right: 0; margin-left: 1rem; }
[dir="rtl"] .osd-logo { margin-right: 0; margin-left: 1rem; }
[dir="rtl"] .osd-clock { margin-left: 0; margin-right: 1rem; }
[dir="rtl"] .osd-hint { right: auto; left: 2.5rem; }
[dir="rtl"] .guide-side { border-right: 0; border-left: 1px solid rgba(255, 255, 255, .07); }
[dir="rtl"] .guide-detail .ch-logo { margin-right: 0; margin-left: 1.4rem; }
[dir="rtl"] .guide-channel .ch-num { margin-right: 0; margin-left: .7rem; }
[dir="rtl"] .guide-channel .ch-logo { margin-right: 0; margin-left: .8rem; }
[dir="rtl"] .guide-prog + .guide-prog { margin-left: 0; }
/* The timeline itself reads left-to-right (clock time), like most TV guides */
[dir="rtl"] .guide-main, [dir="rtl"] .vod-bar, [dir="rtl"] .progress { direction: ltr; }
[dir="rtl"] .guide-prog { direction: rtl; text-align: right; }
@media (max-width: 900px) {
  [dir="rtl"] .section-tile, [dir="rtl"] .shortcut-tile { margin-left: 0; }
  [dir="rtl"] .section-tile .tile-icon { margin-right: 0; margin-left: 1.2rem; }
  .guide-side { width: 11rem; }
  .guide-body { margin: 0 .6rem; }
  .guide-detail, .guide-status { margin-left: .6rem; margin-right: .6rem; }
  .tracks-dialog { min-width: 0; }
  .tracks-columns { flex-direction: column; }
  .tracks-col { margin: 0 0 1rem; }
}

/* The brand logo keeps its shape in every language */
.logo { direction: ltr; }
[dir="rtl"] .logo .logo-mark { margin-left: 0; margin-right: 1rem; }
[dir="rtl"] .logo-splash .logo-mark { margin-right: 0; }

/* =====================================================================
   Continue watching, parental PIN, sort & hide, catch-up
   ===================================================================== */

/* ---------- Home rows ---------- */
.home-main.scroll-y { justify-content: flex-start; padding-top: 1rem; padding-bottom: 1rem; }
.home.has-rows .section-tile { height: 19rem; }
.home.has-rows .shortcut-tile { height: 7rem; }
.home-rows { margin-top: 1.8rem; }
.home-rows .media-row { margin-bottom: 1.4rem; }
.home-rows .media-row h2 { font-size: 1.3rem; }
.continue-card { width: 17rem; }
.poster-img.wide { width: 100%; height: 9.6rem; }
.continue-card .progress { margin-top: .5rem; height: .3rem; }
.result-card.live .ch-logo { background: rgba(255, 255, 255, .92); }

/* ---------- PIN pad ---------- */
.pin-dialog { min-width: 0; width: 30rem; text-align: center; display: flex; flex-direction: column; align-items: center; }
.pin-lock { width: 3.4rem; height: 3.4rem; padding: .8rem; border-radius: 50%; background: rgba(128, 45, 251, .22); color: var(--brand-light); margin-bottom: 1rem; }
.pin-lock svg { width: 100%; height: 100%; display: block; }
.pin-msg { color: var(--muted); min-height: 1.4em; }
.pin-dots { display: flex; justify-content: center; margin: .8rem 0 1.6rem; direction: ltr; }
.pin-dot { width: 1.3rem; height: 1.3rem; border-radius: 50%; margin: 0 .6rem; border: .15rem solid var(--brand-light); }
.pin-dot.filled { background: var(--brand-light); }
.pin-pad { display: flex; flex-wrap: wrap; width: 21rem; direction: ltr; }
.pin-key { width: 6rem; height: 4.2rem; margin: .5rem; border-radius: 1rem; background: rgba(255, 255, 255, .07); font-size: 1.7rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.pin-key-text { font-size: .95rem; font-weight: 600; }
.pin-key-icon .icon { width: 1.8rem; height: 1.8rem; }
.pin-key.focused { background: var(--brand); box-shadow: 0 0 0 .2rem #fff; transform: scale(1.06); }

/* ---------- Locks, sort, catch-up ---------- */
.cat-item.locked .cat-name { color: var(--muted); }
.cat-lock { width: 1rem; height: 1rem; margin-right: .5rem; color: var(--amber); flex-shrink: 0; }
.avatar-lock { position: absolute; top: -.4rem; right: -.4rem; width: 1.8rem; height: 1.8rem; padding: .35rem; border-radius: 50%; background: var(--amber); color: #1b1400; }
.avatar-small .avatar-lock { width: 1.1rem; height: 1.1rem; padding: .2rem; top: -.25rem; right: -.25rem; }
.sort-btn .icon { width: 1.1rem; height: 1.1rem; margin-right: .4rem; }
.guide-prog.past { opacity: .6; }
.guide-prog.catchup { opacity: 1; border-color: rgba(47, 191, 113, .35); }
.guide-prog.focused { opacity: 1; }
.catchup-icon { width: .95rem; height: .95rem; margin-right: .35rem; color: var(--green); vertical-align: -.1rem; }
.guide-prog.focused .catchup-icon { color: #fff; }
.catchup-hint { display: flex; align-items: center; color: var(--green); font-size: .95rem; margin-top: .3rem; }
.catchup-hint .icon { width: 1rem; height: 1rem; margin-right: .4rem; }

[dir="rtl"] .cat-lock { margin-right: 0; margin-left: .5rem; }
[dir="rtl"] .avatar-lock { right: auto; left: -.4rem; }
[dir="rtl"] .sort-btn .icon { margin-right: 0; margin-left: .4rem; }
[dir="rtl"] .catchup-icon { margin-right: 0; margin-left: .35rem; }
[dir="rtl"] .catchup-hint .icon { margin-right: 0; margin-left: .4rem; }

@media (max-width: 900px) {
  .home.has-rows .section-tile { height: 8rem; }
  .continue-card { width: 13rem; }
  .pin-dialog { width: 92%; }
  .pin-pad { width: 19rem; }
  .pin-key { width: 5.3rem; }
}

/* =====================================================================
   My account: subscription & playlist dates / cost
   ===================================================================== */
.sub-pill { font: inherit; }
.sub-pill.focused { background: var(--brand); color: #fff; box-shadow: 0 0 0 .2rem #fff; transform: scale(1.05); }
.touch .sub-pill:active { background: var(--brand); color: #fff; }

.account-body { flex: 1; max-width: 90rem; width: 100%; margin: 0 auto; padding: 0 2.5rem 3rem; }
.account-card {
  display: block; width: 100%; text-align: start; position: relative; overflow: hidden;
  background: rgba(255, 255, 255, .045); border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 1.3rem; padding: 1.8rem 2rem; margin-bottom: 1.4rem;
}
.account-card.focused { box-shadow: 0 0 0 .2rem var(--brand-light); background-color: rgba(128, 45, 251, .08); }
.sub-card { background: linear-gradient(135deg, rgba(128, 45, 251, .35), rgba(59, 17, 158, .25) 60%, rgba(255, 255, 255, .03)); border-color: rgba(169, 112, 255, .3); }
.account-card-head { display: flex; align-items: center; margin-bottom: 1.4rem; }
.account-card-head > div { flex: 1; min-width: 0; }
.account-card-head h2 { margin: 0; font-size: 1.7rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-kicker { color: var(--brand-light); font-size: .85rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; }
.account-icon { width: 3.4rem; height: 3.4rem; padding: .8rem; border-radius: 1rem; background: rgba(255, 255, 255, .1); color: #fff; margin-right: 1.2rem; flex-shrink: 0; }
.account-icon svg { width: 100%; height: 100%; display: block; }
.status-chip { padding: .35rem 1rem; border-radius: 2rem; font-size: .9rem; font-weight: 700; background: rgba(255, 255, 255, .1); flex-shrink: 0; }
.status-chip.active { color: var(--green); background: rgba(47, 191, 113, .14); }
.status-chip.trial { color: var(--amber); background: rgba(240, 169, 46, .14); }
.status-chip.expired, .status-chip.blocked { color: #ff8a87; background: rgba(239, 83, 80, .14); }
.facts { display: flex; flex-wrap: wrap; }
.fact { min-width: 14rem; margin: 0 2.5rem .8rem 0; }
.fact-label { display: block; color: var(--muted); font-size: .9rem; margin-bottom: .2rem; }
.fact-value { font-size: 1.35rem; font-weight: 700; direction: ltr; unicode-bidi: embed; }
.fact.soon .fact-value { color: var(--amber); }
.fact.ended .fact-value { color: #ff8a87; }
.fact.ok .fact-value { color: var(--green); }
.period { margin-top: .6rem; }
.period-bar { height: .5rem; border-radius: .3rem; background: rgba(255, 255, 255, .12); overflow: hidden; direction: ltr; }
.period-fill { height: 100%; border-radius: .3rem; background: linear-gradient(90deg, var(--brand-light), var(--brand)); }
.period-ends { display: flex; justify-content: space-between; color: var(--muted); font-size: .85rem; margin-top: .4rem; direction: ltr; }
.account-section { display: flex; align-items: center; margin: 2rem 0 1rem; color: var(--muted); font-size: 1rem; text-transform: uppercase; letter-spacing: .1em; }
.account-grid { display: flex; flex-wrap: wrap; margin-right: -1.4rem; }
.account-grid .playlist-card { width: calc(50% - 1.4rem); margin-right: 1.4rem; }
.playlist-card.is-ended { border-color: rgba(239, 83, 80, .35); }
.small-note { font-size: .85rem; margin: .6rem 0 0; }
.account .topbar-right .avatar { margin-right: .6rem; }

[dir="rtl"] .account-icon { margin-right: 0; margin-left: 1.2rem; }
[dir="rtl"] .fact { margin: 0 0 .8rem 2.5rem; }
[dir="rtl"] .account-grid { margin-right: 0; margin-left: -1.4rem; }
[dir="rtl"] .account-grid .playlist-card { margin-right: 0; margin-left: 1.4rem; }
[dir="rtl"] .account .topbar-right .avatar { margin-right: 0; margin-left: .6rem; }

@media (max-width: 900px) {
  .account-body { padding: 0 1rem 2rem; }
  .account-grid .playlist-card { width: 100%; }
  .fact { min-width: 45%; margin-right: 1rem; }
}

/* Scrolling home: keep its own side margins and never squash cards/announcements */
.home-main.scroll-y { padding-left: 3.5rem; padding-right: 3.5rem; }
.home-main > * { flex-shrink: 0; }
@media (max-width: 900px) { .home-main.scroll-y { padding-left: 1rem; padding-right: 1rem; } }

.fact-note { display: block; color: var(--muted); font-size: .8rem; margin-top: .2rem; }

/* Announcements with images (home banners) */
.announcement.with-image { display: flex; align-items: center; gap: 1.6rem; padding: .9rem; }
.announcement-image { width: 22rem; height: 12.4rem; object-fit: cover; border-radius: .5rem; flex-shrink: 0; background: rgba(255, 255, 255, .05); }
.announcement-text { display: flex; flex-direction: column; gap: .4rem; min-width: 0; }
.announcement.with-image .announcement-text strong { font-size: 2rem; margin: 0; }
.announcement .announcement-text span { white-space: pre-line; }

/* Pop-up ads at app start */
.ad-overlay { background: rgba(6, 4, 16, .86); z-index: 40; }
.ad-popup { position: relative; background: var(--panel); border-radius: 1.4rem; overflow: hidden; width: 72rem; max-width: 86vw; max-height: 88vh; display: flex; flex-direction: column; box-shadow: 0 2rem 6rem rgba(0, 0, 0, .6); }
.ad-image { display: block; width: 100%; max-height: 58vh; object-fit: contain; background: #000; flex-shrink: 1; min-height: 0; }
.ad-text { padding: 1.8rem 2.4rem .4rem; }
.ad-text h2 { margin: 0 0 .6rem; font-size: 2.6rem; }
.ad-text p { margin: 0; color: #d6d1e3; font-size: 1.8rem; line-height: 1.45; white-space: pre-line; max-height: 18vh; overflow: hidden; }
.ad-popup.no-image .ad-text { padding-top: 3.2rem; }
.ad-actions { display: flex; align-items: center; justify-content: flex-end; gap: 1.6rem; padding: 1.6rem 2.4rem 2rem; }
.ad-countdown { color: #a69fbd; font-size: 1.5rem; margin-right: auto; }
.ad-label { position: absolute; top: 1rem; left: 1rem; background: rgba(0, 0, 0, .65); color: #fff; font-size: 1.3rem; font-weight: 700; padding: .3rem 1rem; border-radius: 99rem; letter-spacing: .05em; }
[dir="rtl"] .ad-countdown { margin-right: 0; margin-left: auto; }
[dir="rtl"] .ad-label { left: auto; right: 1rem; }

/* Video ads */
video.announcement-image { background: #000; }
.ad-video { width: 100%; aspect-ratio: 16 / 9; height: auto; max-height: 62vh; object-fit: contain; }

/* Buying a plan in the app (Stripe Checkout via QR code) */
.buy-plan-iptv { color: #c9b8ff; font-size: 1.6rem; font-weight: 600; }
.buy-body { padding: 2.4rem 4rem 4rem; }
.buy-note { margin: 0 0 2rem; font-size: 1.8rem; }
.buy-plans { display: flex; flex-wrap: wrap; gap: 1.6rem; }
.buy-plan { display: flex; flex-direction: column; align-items: flex-start; gap: .6rem; width: 26rem; padding: 2.2rem 2.4rem; border-radius: 1.2rem; background: var(--panel); border: .2rem solid transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.buy-plan.focused, .buy-plan:focus { border-color: var(--accent, #8b5cf6); background: #2a2248; outline: none; }
.buy-plan-name { font-size: 2.2rem; font-weight: 700; }
.buy-plan-length { color: #a69fbd; font-size: 1.6rem; }
.buy-plan-price { margin-top: .8rem; font-size: 3rem; font-weight: 800; }
.pay-body { display: flex; align-items: center; justify-content: center; gap: 5rem; padding: 3rem 4rem; flex: 1; }
.pay-qr { width: 30rem; height: 30rem; background: #fff; border-radius: 1.4rem; padding: .8rem; flex-shrink: 0; }
.pay-qr svg { width: 100%; height: 100%; display: block; }
.pay-info { display: flex; flex-direction: column; gap: .8rem; max-width: 56rem; }
.pay-plan { font-size: 2.2rem; font-weight: 700; }
.pay-price { font-size: 4.6rem; font-weight: 800; line-height: 1.1; }
.pay-info p { font-size: 1.7rem; margin: .6rem 0; }
.pay-status { display: flex; align-items: center; gap: 1rem; font-size: 1.9rem; color: #ffd48a; }
.pay .pulse-dot { width: 1.2rem; height: 1.2rem; border-radius: 50%; background: #f0a92e; animation: pay-pulse 1.6s infinite; flex-shrink: 0; }
@keyframes pay-pulse { 0% { opacity: 1; } 50% { opacity: .3; } 100% { opacity: 1; } }
.pay.is-paid .pay-status { color: #4ade80; }
.pay-ok-icon { display: inline-flex; width: 2.6rem; height: 2.6rem; }
.pay-ok-icon svg { width: 100%; height: 100%; }
.pay.is-paid .pay-qr { opacity: .25; }
.btn-icon { display: inline-flex; width: 2rem; height: 2rem; margin-right: .8rem; vertical-align: middle; }
.btn-icon svg { width: 100%; height: 100%; }
.account-buy { margin-top: 1.6rem; }
.error-text { color: #ff8a8a; }
[dir="rtl"] .buy-plan { text-align: right; align-items: flex-start; }
[dir="rtl"] .btn-icon { margin-right: 0; margin-left: .8rem; }
.pay-info > .muted { font-size: 1.7rem; }

/* Install app (web/PWA) */
.install-btn { display: inline-flex; align-items: center; gap: .8rem; height: 4.4rem; padding: 0 1.6rem; border-radius: 99rem; border: .15rem solid rgba(139, 92, 246, .6);
  background: rgba(139, 92, 246, .16); color: #e9e2ff; font: inherit; font-size: 1.5rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.install-btn .icon { display: inline-flex; width: 2rem; height: 2rem; }
.install-btn .icon svg { width: 100%; height: 100%; }
.install-btn.focused, .install-btn:hover { background: #8b5cf6; color: #fff; border-color: #8b5cf6; }
