/* App-only additions on top of site.css */
html, body { overscroll-behavior-y: contain; }
body { -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
input, textarea, select { user-select: text; -webkit-user-select: text; }
.header { padding-top: env(safe-area-inset-top, 0px); }
main { padding-block: 18px 40px; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; background: var(--header-bg); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px; font-size: 11px; font-weight: 700; color: var(--muted); position: relative; }
.tabbar a svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.on { color: var(--teal); }
.tabbar a .dot, .icon-btn .dot { position: absolute; top: 6px; left: calc(50% + 6px); width: 9px; height: 9px; border-radius: 50%; background: #FF3B4E; border: 2px solid var(--bg); }
.icon-btn { position: relative; display: grid; place-items: center; width: 40px; height: 40px; color: var(--fg); }
.icon-btn .dot { top: 6px; right: 6px; left: auto; }
.theme-toggle { background: none; border: 0; color: var(--fg); width: 40px; height: 40px; display: grid; place-items: center; cursor: pointer; }
.theme-toggle svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
#hdr-user { display: flex; align-items: center; gap: 4px; }
.gbtn { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 18px; border-radius: 999px; background: #fff; color: #1f1f1f; border: 1px solid #dadce0; font: inherit; font-weight: 700; cursor: pointer; }
.gbtn svg { width: 20px; height: 20px; }
.signup-hero { display: flex; justify-content: center; }
.signup-cta { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; margin-top: 36px; padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.signup-cta h2 { font-size: 22px; }
.signup-cta p { margin: 6px 0 0; color: var(--muted); }
.signup-cta.inline { margin-top: 18px; }
.srch-box { position: relative; margin-bottom: 18px; }
.srch-box input { height: 52px; padding-left: 48px; border-radius: 999px; font-size: 17px; }
.srch-box svg { position: absolute; left: 17px; top: 15px; width: 22px; height: 22px; color: var(--muted); fill: none; stroke: currentColor; stroke-width: 2; }
.hscroll { display: grid; grid-auto-flow: column; grid-auto-columns: 132px; gap: 12px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x proximity; }
.hscroll .card { scroll-snap-align: start; }
.spin { text-align: center; padding: 48px 0; color: var(--muted); }
.overlay-term { position: fixed; inset: 0; z-index: 90; background: rgba(10,13,20,.55); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); display: grid; place-items: center; padding: 24px; text-align: center; }
.methods { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 14px 0; }
.admin-nav a { cursor: pointer; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }
.chip.btnchip { cursor: pointer; background: var(--surface); }
.chip.btnchip.on { background: var(--tag-bg); border-color: var(--tag-line); color: var(--fg); font-weight: 700; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { color: var(--muted); font-weight: 600; white-space: nowrap; }
.tbl td .btn { margin: 2px 4px 2px 0; }
.tbl .nowrap { white-space: nowrap; }
.sect { margin-top: 28px; }
.sect > h2 { font-size: 22px; margin-bottom: 12px; }
.listrow { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); }
.listrow:last-child { border-bottom: 0; }
.listrow .t { min-width: 0; overflow-wrap: anywhere; }
/* Admin title rows: on a narrow phone the status and Edit move under the title instead of squeezing it into a thin column. */
.mrow { flex-wrap: wrap; }
.mrow .t { flex: 1 1 150px; }
.mrow .mact { flex: none; margin-left: auto; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--surface-2); border: 1px solid var(--line); }
.badge.warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-fg); }
.badge.ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-fg); }
.badge.bad { background: var(--err-bg); border-color: var(--err-line); color: var(--err-fg); }
.shot-preview { max-width: 100%; max-height: 260px; border-radius: 12px; border: 1px solid var(--line); margin-top: 10px; }
.poster-prev { width: 120px; aspect-ratio: 2/3; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); }
.pickrow { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 12px; align-items: center; padding: 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; }
.pickrow .in { grid-column: 1 / -1; display: flex; gap: 6px; }
.pickrow .in input { min-height: 38px; padding: 6px 10px; }
.pickrow input[type=checkbox] { width: 22px; height: 22px; min-height: 0; }
.seg { display: flex; gap: 8px; margin-bottom: 14px; }
.seg label { flex: 1; margin: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; text-align: center; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-weight: 700; color: var(--fg); }
.seg input:checked + span { background: var(--tag-bg); border-color: var(--teal); }
.method { display: block; margin: 0; }
.method input { position: absolute; opacity: 0; pointer-events: none; }
.method > span { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; color: var(--fg); }
.method input:checked + span { border-color: var(--teal); box-shadow: 0 0 0 2px var(--teal) inset; }
.method em { font-style: normal; font-weight: 700; }
.plogo img { height: 30px; width: auto; max-width: 56px; object-fit: contain; }
.paybox { display: none; margin: 8px 0 14px; padding: 14px; border: 1px dashed var(--line); border-radius: 12px; background: var(--surface-2); }
.paybox.show { display: block; }
.paybox .num { font-family: var(--font-display); font-size: 22px; font-weight: 700; white-space: pre-line; overflow-wrap: anywhere; }
.price { font-family: var(--font-display); font-size: 40px; font-weight: 700; color: var(--teal); }
.price small { display: block; font-size: 14px; color: var(--muted); font-weight: 500; }
.steps { padding-left: 20px; color: var(--fg-soft); }
.steps li { margin: 6px 0; }
.invoice { margin-top: 8px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 14px; }
.status { display: inline-block; padding: 4px 12px; border-radius: 999px; font-weight: 700; font-size: 13px; }
.status.ok { background: var(--ok-bg); color: var(--ok-fg); }
.status.pending { background: var(--warn-bg); color: var(--warn-fg); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; overflow-wrap: anywhere; }
.msg { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--surface); margin-bottom: 10px; }
.msg.new { background: var(--newmsg-bg); }
.msg-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 14px; }
.msg-head time { margin-left: auto; color: var(--muted); font-size: 12px; }
.msg p { margin: 8px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.note { padding: 12px 14px; border-radius: 12px; margin: 10px 0; border: 1px solid var(--line); background: var(--surface-2); font-size: 14px; }
.note.ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-fg); }
.note.error { background: var(--err-bg); border-color: var(--err-line); color: var(--err-fg); }
.note.warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-fg); }
.btn.dlbtn { width: 100%; justify-content: flex-start; }
.btns { display: flex; flex-wrap: wrap; gap: 10px; }
@media (min-width: 560px) { .btn.dlbtn { width: auto; } }
/* admin form: show/hide by type */
.se { display: none; gap: 6px; flex: 1; } .se input { flex: 1; min-width: 0; }
.is-series .se { display: flex; }
.only-series { display: none; } .is-series .only-series { display: block; }
.is-series .only-movie { display: none; }
.tabs.admin-nav { margin-bottom: 16px; overflow-x: auto; flex-wrap: nowrap; white-space: nowrap; padding-bottom: 4px; scrollbar-width: none; }
.tabs.admin-nav::-webkit-scrollbar { display: none; }
.tabs.admin-nav .chip { flex: none; }

/* ---- brand: logo with a light ring so it shows on the dark header, BSUBFLIX in a brighter green ---- */
.brand { background: none !important; -webkit-background-clip: border-box !important; background-clip: border-box !important; -webkit-text-fill-color: #FFFFFF !important; color: #FFFFFF !important; text-transform: uppercase; letter-spacing: .6px; font-weight: 800; }
.brand img { filter: none !important; border-radius: 9px; box-shadow: 0 0 0 1.5px #3A4352; }

/* ---- messages: dark card, green border ---- */
.msg, .msg.new { background: var(--surface) !important; border: 2px solid #008000 !important; color: var(--fg) !important; }
.msg.new { background: #0E1A12 !important; }
.msg p, .msg b { color: var(--fg) !important; }
.msg-head, .msg-head time, .msg-head svg { color: var(--muted) !important; }

/* ---- bottom tab: longer label ---- */
.tabbar a { font-size: 10.5px; text-align: center; line-height: 1.15; white-space: nowrap; }

/* ---- forced update ---- */
.overlay-update { position: fixed; top: 0; left: 0; width: 100%; height: 100%; height: 100dvh; box-sizing: border-box; z-index: 99999; display: flex; align-items: center; justify-content: center; padding: 24px; background: #0B0E11; overflow: hidden; touch-action: none; overscroll-behavior: none; }
.update-card { max-width: 360px; width: 100%; text-align: center; color: #fff; }
.update-card img { border-radius: 16px; margin-bottom: 14px; }
.update-card h2 { color: #F0B90B; margin: 0 0 10px; font-size: 26px; }
.update-card p { color: #D7DBE0; margin: 0 0 18px; }
.update-card .hint { color: #98A1AB; font-size: 13px; margin: 14px 0 0; }
.update-card .btn { width: 100%; justify-content: center; }

/* ---- message icon ring: green ---- */
.icon-btn { border: 2px solid #008000 !important; }

/* ---- dark theme: search and form focus ring is black, not orange ---- */
.search input:focus, input:focus, select:focus, textarea:focus,
.srch-box:focus-within, .search:focus-within input { outline: none !important; border-color: #000 !important; box-shadow: 0 0 0 3px #000 !important; }
:focus-visible { outline-color: #000; }
input[type=search], input[type=text], input[type=url], input[type=number], input:not([type]), select, textarea { background: var(--surface); color: var(--fg); border-color: #3A4352; }
.header { background: #0A0D14; }
.tabbar { background: #0A0D14; border-top: 1px solid var(--line); }

/* ---- subscribe page: premium card, one plan, coloured payment methods ---- */
.label { color: var(--muted); font-size: 15px; margin: 22px 0 10px; letter-spacing: .3px; }
.pcard { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px 18px 16px; margin-top: 4px; }
.pcard .pt { font-family: var(--font-display); font-size: 28px; font-weight: 700; margin-bottom: 4px; }
.pcard.ok .pt { color: #2ED47A; } .pcard.bad .pt { color: #FF6B6B; }
.pleft { margin-top: 4px; color: var(--muted); } .pleft.soon, b.soon { color: #F0B90B; }
.plans { display: grid; grid-template-columns: 1fr; }
.plan { text-align: center; padding: 16px 12px; border-radius: 14px; border: 2px solid #1F8A4C; background: #0F2A19; }
.plan b { display: block; font-size: 20px; color: #2ED47A; } .plan span { color: #2ED47A; font-size: 17px; }
.methods.pm { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0 0 14px; }
.methods.pm .method > span { flex-direction: column; justify-content: center; gap: 6px; padding: 8px 4px; min-height: 84px; border: 2px solid var(--line); border-radius: 14px; background: var(--surface); text-align: center; }
.methods.pm .method .plogo { width: 100%; height: 40px; padding: 5px 6px; background: #fff; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.methods.pm .method .plogo.gold { background: transparent; }
.methods.pm .method .plogo img { max-height: 100%; max-width: 100%; width: auto; height: auto; object-fit: contain; }
.methods.pm .method em { font-size: 13px; }
.methods.pm .method input:checked + span { border-color: var(--pc); background: color-mix(in srgb, var(--pc) 16%, var(--surface)); box-shadow: none; }
.methods.pm .method input:checked + span em { color: var(--pc); }
.paybox { display: none; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px; margin: 0 0 14px; }
.paybox.show { display: block; }
.paybox h3 { font-family: var(--font-body); font-size: 18px; font-weight: 700; margin: 0 0 14px; color: var(--fg); }
.paybox .prow { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.paybox .plabel { color: var(--muted); }
.paybox .pnum { color: var(--pc); font-family: var(--font-display); font-size: 28px; font-weight: 700; letter-spacing: .5px; }
.paybox .amt { margin-top: 14px; font-size: 18px; font-weight: 600; color: var(--fg); }
.paybox .small { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.paybox .bankdet { color: var(--fg); font-size: 18px; font-weight: 600; overflow-wrap: anywhere; margin-bottom: 12px; line-height: 1.6; }
.paybox .bankdet .acno { color: #F0B90B; font-family: var(--font-display); font-size: 26px; font-weight: 700; letter-spacing: .5px; }
.paybox .bankdet .bk.bk-new { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.paybox .bankdet .acrow { display: flex; flex-wrap: wrap; align-items: center; column-gap: 10px; }
.paybox .bankdet .acval { display: inline-flex; align-items: center; gap: 10px; }
/* little copy icon sitting right beside a gold account number */
.cpico { flex: none; display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; border-radius: 10px; border: 1.5px solid rgba(240, 185, 11, .55); background: rgba(240, 185, 11, .08); color: #F0B90B; cursor: pointer; transition: background .15s, transform .1s; }
.cpico svg { width: 18px; height: 18px; }
.cpico:active { background: rgba(240, 185, 11, .24); transform: scale(.93); }
.copybtn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1.5px solid currentColor; background: transparent; color: var(--pc, var(--fg)); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.copybtn svg { flex: none; }
.invoice .copybtn { color: var(--fg); }
.afterpay { margin-top: 16px; }
.afterpay h2 { font-size: 20px; margin-bottom: 12px; }
.status.bad { color: #FF6B6B; }
.exitbtn { border-color: #3A4352; }
main.wrap { padding-bottom: 110px; }

/* ---- payments waiting, report, header subscribe ---- */
.payitem { margin: 10px 0 14px; }
.pi-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.pi-id { font-family: var(--font-display); font-weight: 700; overflow-wrap: anywhere; }
.note.pend { background: var(--surface-2); border-color: #F0B90B; color: var(--fg); }
.tick { font-variant-numeric: tabular-nums; color: #F0B90B; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; font-weight: 700; color: inherit; text-decoration: underline; cursor: pointer; }
.btn:disabled, .btn[disabled] { opacity: .45; cursor: not-allowed; }
.subbtn { padding: 7px 12px; font-size: 13px; min-height: 34px; white-space: nowrap; }
#hdr-user { gap: 8px; }

/* =====================================================================
   v7 refresh: profile ring, search, categories, download colours
   ===================================================================== */

/* ---- header profile: round photo inside a gradient ring ---- */
.avatar-ring { position: relative; flex: none; display: grid; place-items: center; width: 42px; height: 42px; padding: 2px; border-radius: 50%;
  background: conic-gradient(from 200deg, #FF6B2C, #F5C451, #22C55E, #FF6B2C); box-shadow: 0 4px 14px -4px rgba(255, 107, 44, .55); }
.avatar-ring .avatar { width: 100%; height: 100%; max-width: none; aspect-ratio: 1 / 1; border-radius: 50%; object-fit: cover; border: 2px solid #0A0D14; background: var(--surface-2); }
.avatar-ring .dot { position: absolute; top: -1px; right: -1px; width: 12px; height: 12px; border-radius: 50%; background: #FF3B4E; border: 2px solid #0A0D14; }
@media (max-width: 420px) { .avatar-ring { width: 40px; height: 40px; } }
@media (max-width: 350px) { .avatar-ring { width: 36px; height: 36px; } }

/* ---- focus: the black ring is gone, a soft emerald glow replaces it ---- */
:focus-visible { outline-color: #34D399; }
.search input:focus, input:focus, select:focus, textarea:focus { border-color: #34D399 !important; box-shadow: 0 0 0 3px rgba(52, 211, 153, .2) !important; }
.srch-box:focus-within, .search:focus-within input { box-shadow: none !important; border-color: transparent !important; }

/* ---- search box: glass pill with a light edge, glows when you type ---- */
.srch-box { position: relative; margin-bottom: 20px; }
.srch-box > svg { left: 20px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; color: #7C879C; transition: color .2s; z-index: 1; }
.srch-box:focus-within > svg { color: #34D399; }
.srch-box input, .srch-box input[type=search] {
  -webkit-appearance: none; appearance: none; height: 56px; padding: 0 54px 0 56px; border-radius: 999px; font-size: 17px; font-weight: 500; color: var(--fg);
  border: 1.5px solid transparent;
  background: linear-gradient(#151B29, #0F1420) padding-box, linear-gradient(135deg, rgba(255, 255, 255, .20), rgba(255, 255, 255, .05) 45%, rgba(255, 255, 255, .14)) border-box;
  box-shadow: 0 14px 30px -16px rgba(0, 0, 0, .9), inset 0 1px 0 rgba(255, 255, 255, .05);
  transition: box-shadow .25s, background .25s;
}
.srch-box input::placeholder { color: #6F7A90; font-weight: 400; }
.srch-box input:focus, .srch-box input[type=search]:focus {
  outline: none; border-color: transparent !important;
  background: linear-gradient(#151B29, #0F1420) padding-box, linear-gradient(120deg, #19D27A, #38BDF8 55%, #34D399) border-box;
  box-shadow: 0 0 0 4px rgba(52, 211, 153, .14), 0 16px 38px -14px rgba(25, 210, 122, .55) !important;
}
.srch-box input::-webkit-search-cancel-button, .srch-box input::-webkit-search-decoration { -webkit-appearance: none; display: none; }
.srch-clear { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; background: rgba(255, 255, 255, .09); color: var(--fg-soft); }
.srch-clear:active { background: rgba(255, 255, 255, .18); }
.srch-box .srch-clear svg { position: static; transform: none; width: 16px; height: 16px; color: inherit; pointer-events: none; }
.srch-box input:placeholder-shown ~ .srch-clear { display: none; }
.s-empty { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 60px 16px; text-align: center; color: var(--muted); }
.s-empty p { margin: 0; font-size: 16px; }
.s-ico { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; border: 1px solid var(--line);
  background: radial-gradient(circle at 30% 25%, rgba(52, 211, 153, .2), rgba(56, 189, 248, .06) 70%); }
.s-ico svg { width: 30px; height: 30px; fill: none; stroke: #6EE7B7; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---- categories tab ---- */
.cats .section:first-child { margin-top: 4px; }

/* ---- download buttons: one colour per quality (dark-mode friendly gradients) ---- */
.btn.dlbtn { --dl-1: #4F46E5; --dl-2: #3B82F6; --dl-fg: #fff; --dl-glow: rgba(79, 70, 229, .6); --dl-ico-bg: rgba(255, 255, 255, .2); --dl-sep: rgba(255, 255, 255, .4); }
.btn.dlbtn.q-480  { --dl-1: #0E7490; --dl-2: #06B6D4; --dl-glow: rgba(6, 182, 212, .55); }
.btn.dlbtn.q-720  { --dl-1: #1D4ED8; --dl-2: #3B82F6; --dl-glow: rgba(59, 130, 246, .6); }
.btn.dlbtn.q-1080 { --dl-1: #6D28D9; --dl-2: #C026D3; --dl-glow: rgba(168, 85, 247, .6); }
.btn.dlbtn.q-4k   { --dl-1: #E11D48; --dl-2: #F97316; --dl-glow: rgba(244, 63, 94, .6); }
.btn.dlbtn.q-sub  { --dl-1: #F59E0B; --dl-2: #FBBF24; --dl-fg: #1F1300; --dl-glow: rgba(245, 158, 11, .5); --dl-ico-bg: rgba(0, 0, 0, .16); --dl-sep: rgba(0, 0, 0, .28); }
.btn.dlbtn:focus-visible { outline-color: #fff; }
/* already downloaded: dark button with a coloured edge and a check badge */
.btn.dlbtn.done:not(.locked), .btn.dlbtn.done:not(.locked):hover {
  color: var(--fg); border: 1.5px solid transparent; box-shadow: none;
  background: linear-gradient(#161C2A, #161C2A) padding-box, linear-gradient(135deg, var(--dl-1), var(--dl-2)) border-box;
}
.btn.dlbtn.done:not(.locked):hover { filter: brightness(1.12); }
.btn.dlbtn.done .dl-ico { background: linear-gradient(135deg, var(--dl-1), var(--dl-2)); color: var(--dl-fg); }
.btn.dlbtn.done .dl-q + .dl-size { border-left-color: rgba(255, 255, 255, .2); }

/* =====================================================================
   v8: fixed app shell. Header and tab bar never move; only #main scrolls.
   ===================================================================== */
html { height: 100%; overflow: hidden; }
body { height: 100%; height: 100dvh; min-height: 0; overflow: hidden; padding-bottom: 0; display: flex; flex-direction: column; }
#banner, #pricebar, .header, .tabbar { flex: none; }
.header { position: relative; top: auto; }
.tabbar { position: relative; left: auto; right: auto; bottom: auto; }
main#main, main.wrap { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding-block: 18px 28px; }
main.wrap { padding-bottom: 28px; }

/* header that fits every width: sizes follow the screen, nothing is cut off */
.header .wrap { gap: clamp(4px, 1.6vw, 8px); min-width: 0; padding-inline: max(clamp(10px, 3.4vw, 16px), env(safe-area-inset-left, 0px)) max(clamp(10px, 3.4vw, 16px), env(safe-area-inset-right, 0px)); }
.header .nav-space { flex: 1 1 0; min-width: 0; }
.brand { font-size: clamp(14px, 4.7vw, 22px); gap: clamp(5px, 1.6vw, 8px); min-width: 0; letter-spacing: .3px; }
.brand img { width: clamp(26px, 8vw, 34px); height: clamp(26px, 8vw, 34px); flex: none; }
#hdr-user { flex: none; gap: clamp(4px, 1.6vw, 8px); }
#hdr-user .icon-btn, #hdr-user .avatar-ring { width: clamp(33px, 10vw, 40px); height: clamp(33px, 10vw, 40px); flex: none; }
#hdr-user .subbtn { padding: 6px clamp(8px, 2.8vw, 12px); font-size: clamp(11.5px, 3.5vw, 13px); min-height: 32px; }
#hdr-user .btn.small { white-space: nowrap; }

/* tab bar: four equal slots, labels never cut */
.tabbar a { min-width: 0; padding: 8px 2px calc(6px + 0px); font-size: clamp(9.5px, 2.9vw, 11px); }
.tabbar a svg { flex: none; }

.mailbtn { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; touch-action: manipulation; }

.ta { position: relative; }
.ta-list { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; margin-top: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 28px rgba(0,0,0,.35); overflow: hidden; }
.ta-list[hidden] { display: none; }
.ta-item { display: block; width: 100%; min-height: 44px; padding: 10px 14px; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); color: var(--fg); font: inherit; cursor: pointer; }
.ta-item:last-child { border-bottom: 0; }
.ta-item:active { background: var(--tag-bg); }
.rt-row { gap: 8px; flex-wrap: nowrap; }
.rt { display: flex; flex: 1; flex-direction: column; gap: 4px; margin: 0; font-size: 13px; color: var(--muted); }
.rt input { text-align: center; }

/* The page never moves sideways. Lists that scroll sideways (rows of posters, tab bars) are their own scroll boxes and still work. */
html, body { max-width: 100%; overflow-x: hidden; touch-action: pan-y; }
html.locked, html.locked body { touch-action: none; }

/* ---- genre tiles: break between words, never inside one; the text shrinks a little on narrow phones ---- */
.tile .n { overflow-wrap: break-word; word-break: normal; hyphens: manual; font-size: clamp(15px, 4.4vw, 20px); line-height: 1.25; }

/* ---- movie poster: centered ---- */
.movie > div:first-child { display: flex; justify-content: center; }
.movie .poster-lg { margin-inline: auto; }

/* ---- download buttons: dark card, coloured icon square (quality colour), everything centred ---- */
.btn.dlbtn { --ico: #4F46E5; --ico-fg: #fff; display: flex; align-items: center; justify-content: flex-start; gap: 12px; padding: 6px; min-height: 64px; width: 100%; max-width: 360px; border-radius: 14px; background: #151A26; border: 1px solid #252B3B; color: #fff; box-shadow: none; text-align: left; }
.btn.dlbtn:hover { background: #1A2030; filter: none; transform: none; box-shadow: none; }
.btn.dlbtn.q-480  { --ico: #06B6D4; --ico-fg: #04222B; }
.btn.dlbtn.q-720  { --ico: #3B82F6; --ico-fg: #fff; }
.btn.dlbtn.q-1080 { --ico: #A855F7; --ico-fg: #fff; }
.btn.dlbtn.q-4k   { --ico: #F43F5E; --ico-fg: #fff; }
.btn.dlbtn.q-sub  { --ico: #F59E0B; --ico-fg: #1F1300; }
.btn.dlbtn .dl-ico { width: 52px; height: 52px; border-radius: 11px; background: var(--ico); color: var(--ico-fg); }
.btn.dlbtn .dl-txt { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; }
.btn.dlbtn .dl-title { font-family: var(--font-display); font-size: 16px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; line-height: 1.2; color: #fff; }
.btn.dlbtn .dl-sub { font-size: 13px; font-weight: 500; color: #98A1B3; line-height: 1.3; }
.btn.dlbtn.locked { opacity: .85; }
.btn.dlbtn.done:not(.locked) .dl-ico { background: #008000; color: #fff; }
.dl, .dl h2, .dl h3, .dl .hint { text-align: center; }
.dl .btns { justify-content: center; }
.dl .btn.dlbtn { margin-inline: auto; }
.rowbtns { display: flex; gap: 6px; flex-shrink: 0; }

.updbar { height: 12px; border-radius: 999px; background: #232A36; overflow: hidden; margin: 0 0 10px; }
.updfill { height: 100%; width: 0; background: #F0B90B; border-radius: 999px; transition: width .2s; }
.updbar.indet .updfill { width: 40% !important; animation: updslide 1.1s ease-in-out infinite alternate; }
@keyframes updslide { from { margin-left: 0; } to { margin-left: 60%; } }
.updtext { color: #D7DBE0; font-size: 15px; margin: 0 0 14px; min-height: 20px; }

/* =====================================================================
   v44: loading screen and pull to refresh
   ===================================================================== */
.ld { padding-top: 22px; }
.ld-hero { display: flex; flex-direction: column; align-items: center; }
.ld-logo { position: relative; width: 104px; height: 104px; display: flex; align-items: center; justify-content: center; }
.ld-logo img { position: relative; width: 66px; height: 66px; border-radius: 19px; animation: ld-breathe 2.4s ease-in-out infinite; }
.ld-logo > i { position: absolute; inset: 0; margin: auto; width: 66px; height: 66px; border-radius: 19px; border: 2px solid #E4102E; animation: ld-ring 2.4s ease-out infinite; }
.ld-logo > i + i { animation-delay: 1.2s; }
.ld-orbit { position: absolute; left: 0; top: 0; width: 104px; height: 104px; animation: ld-spin 1.6s linear infinite; }
.ld-orbit circle { fill: none; stroke: #E4102E; stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 60 242; }
.ld-bar { margin-top: 14px; width: 110px; height: 3px; border-radius: 2px; background: var(--line); overflow: hidden; }
.ld-bar b { display: block; width: 35%; height: 100%; border-radius: 2px; background: #E4102E; animation: ld-bar 1.4s ease-in-out infinite; }
.ld-hero > span { margin-top: 10px; font-size: 12px; color: var(--muted); letter-spacing: .4px; }
.ld-sk { margin-top: 30px; }
.ld-sk em { display: block; height: 10px; width: 90px; border-radius: 5px; background: var(--surface-2); margin: 0 0 10px; }
.ld-sk > div { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 20px; }
.ld-sk p { position: relative; overflow: hidden; margin: 0; aspect-ratio: 2 / 3; border-radius: 8px; background: var(--surface-2); }
.ld-sk p u { position: absolute; left: 0; top: 0; bottom: 0; width: 30%; background: rgba(255, 255, 255, .07); animation: ld-sh 1.6s ease-in-out infinite; }
.ld-sk > div p:nth-child(2) u { animation-delay: .15s; }
.ld-sk > div p:nth-child(3) u { animation-delay: .3s; }
@keyframes ld-ring { 0% { transform: scale(1); opacity: .55; } 100% { transform: scale(2.1); opacity: 0; } }
@keyframes ld-spin { to { transform: rotate(360deg); } }
@keyframes ld-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes ld-sh { 0% { transform: translateX(-120%) skewX(-18deg); } 100% { transform: translateX(420%) skewX(-18deg); } }
@keyframes ld-bar { 0% { transform: translateX(-110%); } 100% { transform: translateX(330%); } }
@media (prefers-reduced-motion: reduce) { .ld-logo > i, .ld-sk p u { animation: none; opacity: 0; } .ld-logo img { animation: none; } }

#ptr { position: fixed; left: 50%; margin-left: -20px; top: 0; width: 40px; height: 40px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; z-index: 20; opacity: 0; pointer-events: none; transform: translateY(-44px); }
#ptr svg { width: 28px; height: 28px; }
#ptr circle { fill: none; stroke-width: 2.5; }
#ptr .t { stroke: var(--line); }
#ptr .a { stroke: #E4102E; stroke-linecap: round; stroke-dasharray: 69.1; stroke-dashoffset: 69.1; transform: rotate(-90deg); transform-origin: 14px 14px; }
#ptr.go svg { animation: ld-spin .8s linear infinite; }
#ptr.go .a { stroke-dasharray: 22 47.1; stroke-dashoffset: 0; }

/* v46: trending slots and the picker sheet */
.tslots { display: flex; flex-direction: column; gap: 8px; }
.tslot { display: flex; align-items: center; gap: 10px; width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); color: var(--fg); font: inherit; text-align: left; cursor: pointer; }
.tslot.free { border-style: dashed; background: transparent; }
.tslot .tn { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.tslot .tp { flex: none; width: 36px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 6px; background: var(--surface); }
.tslot .tt { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
.tslot .tacts { flex: none; display: flex; gap: 6px; }
.tslot .tacts .btn { min-height: 34px; min-width: 34px; padding: 0 8px; }
.tslot .tplus { flex: none; font-size: 24px; line-height: 1; color: #E4102E; padding: 0 6px; }
dialog.sheet { position: fixed; left: 0; right: 0; bottom: 0; top: auto; margin: 0; width: 100%; max-width: none; height: 82vh; height: 82dvh; box-sizing: border-box; padding: 14px 14px max(14px, env(safe-area-inset-bottom, 0px)); border: 0; border-radius: 18px 18px 0 0; background: var(--surface); color: var(--fg); flex-direction: column; gap: 10px; overflow: hidden; }
dialog.sheet[open] { display: flex; }
dialog.sheet::backdrop { background: var(--overlay, rgba(0, 0, 0, .6)); }
.sh-h { display: flex; align-items: center; justify-content: space-between; font-size: 18px; }
.sh-x { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: transparent; color: var(--fg); font-size: 16px; cursor: pointer; }
.sh-q { width: 100%; box-sizing: border-box; min-height: 46px; }
.sh-l { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 0 -4px; padding: 0 4px; }
.sh-r { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 4px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--fg); font: inherit; text-align: left; cursor: pointer; }
.sh-r[hidden], .sh-none[hidden] { display: none; }
.sh-r .tt { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
.sh-r .badge { flex: none; white-space: nowrap; }
.sh-none { padding: 24px 0; text-align: center; color: var(--muted); }

/* v46: update screen */
.overlay-update { background: #110F0F; }
.upd-logo { position: relative; width: 104px; height: 104px; margin: 0 auto 14px; display: flex; align-items: center; justify-content: center; }
.upd-logo img { position: relative; width: 60px; height: 60px; border-radius: 17px; margin: 0; animation: ld-breathe 2.4s ease-in-out infinite; }
.upd-rings i { position: absolute; inset: 0; margin: auto; width: 60px; height: 60px; border-radius: 18px; border: 2px solid #E4102E; display: none; animation: ld-ring 2.4s ease-out infinite; }
.upd-logo.idle .upd-rings i { display: block; }
.upd-logo.idle .upd-rings i + i { animation-delay: 1.2s; }
.upd-ring { position: absolute; left: 0; top: 0; width: 104px; height: 104px; }
.upd-ring circle { fill: none; stroke-width: 3; }
.upd-ring .trk { stroke: #2a2626; opacity: 1; }
.upd-logo.idle .trk { opacity: 0; }
.upd-ring .arc { stroke: #E4102E; stroke-linecap: round; stroke-dasharray: 301.6; transform: rotate(-90deg); transform-origin: 52px 52px; transition: stroke-dashoffset .3s linear, stroke .3s; }
.upd-logo.failed .arc { stroke: #6b6464; }
.upd-logo.indet .upd-ring { animation: ld-spin 1.6s linear infinite; }
.upd-logo.indet .arc { stroke-dasharray: 60 242; stroke-dashoffset: 0 !important; }
.upd-chk { position: absolute; right: 6px; bottom: 6px; width: 26px; height: 26px; border-radius: 50%; background: #fff; color: #E4102E; border: 3px solid #110F0F; box-sizing: content-box; display: none; align-items: center; justify-content: center; }
.upd-logo.ready .upd-chk { display: flex; }
.update-card h2 { font-size: 22px; margin: 0 0 8px; }
.updpct { font-size: 32px; font-weight: 700; margin: 0 0 18px; color: #fff; }
.updpct small { display: block; font-size: 13px; font-weight: 400; color: #8a8f96; margin-top: 2px; }
@media (prefers-reduced-motion: reduce) { .upd-logo img, .upd-rings i { animation: none; } }

/* Title with the admin's Edit icon beside it (no word, not under the name). */
.titlerow { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.titlerow h1 { flex: 1 1 auto; min-width: 0; margin: 0; overflow-wrap: anywhere; }
.iconbtn { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--line); background: transparent; color: var(--fg); }
.iconbtn svg { width: 20px; height: 20px; }
.iconbtn:active { background: #1b1919; }

/* BSUB (has a subtitle) bottom-left and DUAL AUDIO bottom-right: corner tabs in the same red and shape as the MOVIE tag.
   They sit in one row with a guaranteed gap between them; on a narrow poster they shrink a little instead of touching. */
.card .poster { container-type: inline-size; }
.ptags { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; pointer-events: none; }
.ptag { font-size: 11px; font-weight: 800; letter-spacing: .03em; padding: 3px 8px; line-height: 1.35; white-space: nowrap; background: var(--red, #DA0B2A); color: #fff; }
.ptag-sub { border-top-right-radius: 9px; margin-right: auto; }
.ptag-dual { border-top-left-radius: 9px; margin-left: auto; }
@container (max-width: 150px) { .ptag { font-size: 10px; letter-spacing: 0; padding: 3px 6px; } .ptags { gap: 8px; } }

/* Audio languages of a Dual Audio title: a split block between the video download and the subtitle download. */
.audiocard { display: flex; align-items: stretch; border: 1px solid #DA0B2A; border-radius: 4px; overflow: hidden; text-align: left; }
.audiocard .al { display: flex; align-items: center; gap: 8px; padding: 14px 16px; background: #DA0B2A; color: #fff; font-size: 15px; font-weight: 800; letter-spacing: .08em; }
.audiocard .al svg { width: 20px; height: 20px; flex: none; }
.audiocard .ar { flex: 1; display: flex; align-items: center; padding: 14px 16px; background: #000; color: #fff; font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }
.ta-add { color: #FF7A8C; }
