/* ==========================================================================
   AuraFlicks — Netflix-style design system (test bed: series.auraflicks.top)
   Authority: MASTER-PLAN.md §3, ARCHITECTURE.md §3, research/brand-visual-system.md
   One family: Figtree only (400/600/700/800). One chromatic UI colour:
   Netflix Red #E50914 (+ amber #FFC857 / green #46D369 as functional states).
   Flat #141414 page — no rose glow, no plum tint, no emoji, no frameworks.
   ========================================================================== */

/* ---- 3.1 Tokens -------------------------------------------------------- */
:root {
  --bg: #141414;
  --bg-deep: #000000;
  --bg-elev-1: #1f1f1f;
  --bg-elev-2: #2f2f2f;
  --bg-elev-3: #3a3a3a;
  --line: rgba(255, 255, 255, .14);
  --line-strong: rgba(255, 255, 255, .30);
  --text: #ffffff;
  --text-muted: #b3b3b3;
  --text-faint: #8c8c8c;
  --accent: #e50914;
  --accent-hover: #f6121d;
  --accent-pressed: #b20710;
  --accent-soft: rgba(229, 9, 20, .16);
  --accent-line: rgba(229, 9, 20, .45);
  --amber: #ffc857;
  --amber-soft: rgba(255, 200, 87, .10);
  --green: #46d369;
  --green-dark: #15803d; /* white text on this green passes AA (4.6:1); #46D369 does not */
  --error-text: #ff8ba0;
  --overlay: rgba(0, 0, 0, .75);
  --overlay-heavy: rgba(0, 0, 0, .92);
  --alpha-04: rgba(255, 255, 255, .04);
  --alpha-08: rgba(255, 255, 255, .08);
  --shadow-btn: 0 8px 26px rgba(229, 9, 20, .30);
  --shadow-modal: 0 20px 60px rgba(0, 0, 0, .65);
  --shadow-card: 0 8px 24px rgba(0, 0, 0, .45);
  --radius: 16px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 24px;
  --r-pill: 999px;
  --font-sans: 'Figtree', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-display: 'Figtree', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;
  --header-h: 64px;
  --tabbar-h: 56px;
}

/* ---- Base -------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg); /* flat — no radial glow */
  color: var(--text);
  font: 400 16px/1.55 var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; min-width: 0; }
img, video { max-width: 100%; }
img { -webkit-user-drag: none; }
a { color: var(--text); }
h1, h2, h3, h4, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* Focus-visible: white 2px outline, 2px offset, on EVERY interactive element.
   (Mobile-ux audit A4: the old site had no focus style anywhere.) */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible,
summary:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

/* Skip link (audit A14). */
.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 100;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 14px;
  padding: 10px 16px; border-radius: var(--r-pill); text-decoration: none;
  transition: top .2s ease;
}
.skip-link:focus { top: 12px; }

/* Visually hidden (screen-reader only). `.sr-only` is the same recipe —
   F2's homepage H1 uses it. */
.sr-only, .visually-hidden {
  position: absolute !important; width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}

/* ---- 3.2 Typography ---------------------------------------------------- */
.hero-title, .detail-title {
  font: 800 clamp(40px, 6vw, 72px)/1 var(--font-display);
  letter-spacing: -.04em; text-wrap: balance;
}
h1, .h1 { font: 800 clamp(28px, 4vw, 40px)/1.1 var(--font-display); letter-spacing: -.03em; text-wrap: balance; }
h2, .h2 { font: 700 clamp(24px, 3.2vw, 32px)/1.15 var(--font-display); letter-spacing: -.02em; }
h3, .h3, .modal-title { font: 800 22px/1.2 var(--font-display); letter-spacing: -.02em; }
.lead { font-size: 17px; color: var(--text-muted); }
.description { font-size: 17px; line-height: 1.55; color: var(--text-muted); max-width: 62ch; }
.eyebrow {
  font: 800 12px/1.4 var(--font-display); letter-spacing: .14em;
  text-transform: uppercase; color: var(--accent-hover);
}
.meta { font: 600 13px/1.4 var(--font-sans); color: var(--text-muted); }
.caption { font: 600 12px/1.4 var(--font-sans); letter-spacing: .02em; color: var(--text-faint); }

/* Red is never body text below 20px (3.84:1 fails AA) — eyebrow kickers only. */
.text-accent { color: var(--accent-hover); }
.text-muted { color: var(--text-muted); }
.text-faint { color: var(--text-faint); }
/* `.muted` — the class the markup actually uses (series unlock note,
   comments, top/genre/episode pages). Same de-emphasis as .text-muted. */
.muted { color: var(--text-muted); }
.text-amber { color: var(--amber); }
.text-green { color: var(--green); }

/* ---- 3.3 Layout -------------------------------------------------------- */
.wrap { max-width: 1240px; margin: 0 auto; padding-left: clamp(16px, 4vw, 36px); padding-right: clamp(16px, 4vw, 36px); }
.section { margin: clamp(32px, 5vw, 48px) 0; }
.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; margin-bottom: 32px;
}
.section-head h2 { margin: 0; }
.section-head p { color: var(--text-muted); margin-top: 7px; }
.see-all {
  background: none; border: 0; color: var(--text-muted);
  font: 700 15px/1 var(--font-sans); padding: 8px 12px; white-space: nowrap;
  text-decoration: none; display: inline-flex; align-items: center; gap: 4px;
}
.see-all:hover { color: #fff; }

/* 404 page: centre the content instead of leaving a black void. */
.wrap-404 {
  min-height: 60vh; display: flex; flex-direction: column;
  justify-content: center; align-items: center; text-align: center;
}

/* ---- Icons ------------------------------------------------------------- */
.ic { width: 1em; height: 1em; vertical-align: -.12em; display: inline-block; flex: none; }
/* QA fix 2026-11-12: series.php markup uses class "icon" (lock + Save
   icons), but only .ic was sized — an unsized <svg> defaults to 300x150
   and blew out every locked episode row (horizontal overflow at 390px).
   .icon mirrors .ic so both class names are safe. */
.icon { width: 1em; height: 1em; vertical-align: -.12em; display: inline-block; flex: none; }
.btn .icon { width: 18px; height: 18px; }
.ic-sm { width: 16px; height: 16px; }
.ic-md { width: 20px; height: 20px; }
.ic-lg { width: 52px; height: 52px; }
.ic-xl { width: 28px; height: 28px; }
svg.ic use { fill: none; }
/* Sprite symbols are stroke icons (currentColor) except i-play, which is a
   filled path. The <use> inherits stroke/fill from the symbol definition. */

/* ---- Buttons ----------------------------------------------------------- */
/* v6 shared button system — ONE system. The old oversized red pills
   (pill radius + red shadow) and the bare-link button styles are gone.
   Metrics: 46px tall, 12px radius, Figtree 600 15px, 8px icon gap.
   Variants: primary (red), secondary (quiet fill), ghost (transparent),
   danger (red — destructive by label/context, not by shape), sm (38px),
   icon (44px square). Bare `.btn` defaults to the primary treatment:
   lib/rows.php + lib/app-prompts.php still ship bare `.btn` conversion
   links, so the base keeps them red instead of going transparent.
   .btn-white / .btn-grey are the two legacy on-image variants the hero
   keeps (frontend.php, lib/rows.php); same metrics, no shadow. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 20px; border-radius: 12px;
  border: 1px solid transparent;
  font: 600 15px/1 var(--font-sans);
  cursor: pointer; white-space: nowrap; text-decoration: none;
  background: #E50914; color: #fff;
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:active { transform: scale(.98); }
.btn-primary, .btn-danger, .btn.danger { background: #E50914; color: #fff; }
.btn-primary:hover, .btn-danger:hover, .btn.danger:hover { background: #EC0F1B; }
.btn-primary:focus-visible, .btn-danger:focus-visible, .btn.danger:focus-visible {
  outline: 2px solid rgba(229, 9, 20, .55); outline-offset: 2px;
}
.btn-secondary {
  background: rgba(255, 255, 255, .08); color: #fff;
  border-color: rgba(255, 255, 255, .18);
}
.btn-secondary:hover { background: rgba(255, 255, 255, .14); }
.btn-ghost { background: transparent; color: #fff; border-color: transparent; }
.btn-ghost:hover { background: rgba(255, 255, 255, .08); }
.btn-sm { height: 38px; padding: 0 16px; font-size: 14px; }
.btn-icon {
  width: 44px; height: 44px; padding: 0; border-radius: 12px;
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .16);
  color: #fff;
}
.btn-icon:hover { background: rgba(255, 255, 255, .12); }
.btn .ic, .btn .icon { width: 18px; height: 18px; flex: none; }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; }
/* Legacy on-image variants (hero "Play Episode 1" / "More Info"): same
   metrics as the system, flat — no shadow. */
.btn-white { background: #fff; color: #141414; }
.btn-white:hover { background: rgba(255, 255, 255, .85); }
.btn-grey { background: rgba(255, 255, 255, .25); color: #fff; }
.btn-grey:hover { background: rgba(255, 255, 255, .35); }
/* Legacy text-button alias (library.php "Remove"): the transparent
   treatment of .btn-ghost with tighter padding — not a bare link. */
.btn-text {
  background: transparent; border-color: transparent; color: var(--text-muted);
  padding: 0 12px;
}
.btn-text:hover { background: transparent; color: #fff; }

/* v6 header app button: labelled .btn-secondary on desktop; a refined
   44px icon-only treatment (same metrics as .btn-icon) wherever the
   label is hidden — ≤480px and the 981–1050px band. Never a solid
   red dot. The icon-only sizing lives in the breakpoint blocks below. */

/* ---- Header ------------------------------------------------------------ */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: transparent; border-bottom: 1px solid transparent;
  transition: background-color .2s ease, border-color .2s ease;
}
.site-header.is-scrolled {
  background: rgba(20, 20, 20, .92);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-bottom-color: var(--line);
}
.header-inner {
  display: flex; align-items: center; gap: 28px;
  min-height: var(--header-h); padding-top: 14px; padding-bottom: 14px;
}
.brand {
  display: inline-flex; align-items: center; gap: 11px; flex: none;
  font: 800 24px/1 var(--font-display); letter-spacing: -.03em;
  color: var(--text); text-decoration: none; min-height: 44px;
}
/* Concept 3 "Wordmark" (user-picked 2026-11-12): HTML text brand.
   F3 removed the .brand-mark play-square markup from lib/shell.php,
   so the .brand-mark rules are deleted with it (admin has its own
   inline .brand-mark styles and does not load this sheet). */
.brand-word {
  font: 800 24px/1 var(--font-display); letter-spacing: -.03em;
  color: #fff; white-space: nowrap;
}
.brand-word-red { color: var(--accent); }
.site-nav { display: flex; align-items: center; gap: 26px; margin-left: auto; }
.site-nav a {
  color: var(--text-muted); font: 600 15px/1.4 var(--font-sans);
  text-decoration: none; padding: 10px 2px; min-height: 44px;
  display: inline-flex; align-items: center;
}
.site-nav a:hover { color: #fff; }
.site-nav a.is-active { color: #fff; border-bottom: 2px solid var(--accent); padding-bottom: 4px; }
.header-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.site-nav + .header-actions { margin-left: 0; }
/* S2: a long logged-in username must not blow out the header — ellipsis. */
#accountName { max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-search { position: relative; }
.header-search .search-input { width: 220px; }
.search-wrap { position: relative; }

/* ---- Search / forms ---------------------------------------------------- */
.search-input, .field input, .field select, .field textarea {
  width: 100%; padding: 12px 16px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--bg-elev-2);
  color: var(--text); font: 400 15px/1.5 var(--font-sans); min-height: 44px;
}
.search-input { border-radius: var(--r-pill); padding: 14px 18px; background: var(--bg-elev-1); min-height: 47px; }
.search-input::placeholder, .field input::placeholder { color: var(--text-faint); }
.search-input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(229, 9, 20, .25); outline: none;
}
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 8px; }
.field-error { color: var(--error-text); font-size: 14px; margin: 8px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 16px; min-height: 44px; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: var(--bg-elev-1);
  color: var(--text-muted); font: 600 14px/1 var(--font-sans); text-decoration: none;
}
.chip:hover { border-color: var(--line-strong); color: #fff; }
.chip.on, .chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Search results panel (rendered below the search bar by app.js). */
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 60;
  background: var(--bg-elev-1); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-modal); padding: 16px; max-height: 70vh; overflow-y: auto;
}
.search-results:empty { display: none; }
.search-results .search-group-title {
  font: 800 12px/1.4 var(--font-display); letter-spacing: .14em; text-transform: uppercase;
  color: var(--text-faint); margin: 12px 0 8px;
}
.search-results .search-group-title:first-child { margin-top: 0; }
.search-result-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 8px; min-height: 44px; border-radius: var(--r-md);
  background: none; border: 0; color: var(--text); text-align: left; text-decoration: none;
}
.search-result-item:hover { background: var(--alpha-08); }
.search-result-item img { width: 32px; height: 48px; object-fit: cover; border-radius: 4px; flex: none; }
.search-result-item .sr-title { font-weight: 700; font-size: 15px; }
.search-result-item .sr-meta { color: var(--text-muted); font-size: 13px; }
.search-empty { color: var(--text-muted); font-size: 14px; }
.search-empty .search-recents { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

/* ---- Hero billboard ---------------------------------------------------- */
.hero {
  position: relative; min-height: 480px; display: flex; align-items: flex-end;
  overflow: hidden; border-radius: 0;
}
.hero-art {
  position: absolute; inset: 0; width: 100%; height: 100%;
  background-size: cover; background-position: center 20%; background-repeat: no-repeat;
  /* D6: heavier blur + darker overlay — covers with baked-in titles
     (DRIVING DESIRE) must read as texture, not a giant ghost title
     behind the poster. */
  transform: scale(1.15); filter: blur(8px) brightness(.5);
}
.hero-art-sharp {
  position: absolute; inset: 0; width: 100%; height: 100%;
  background-size: cover; background-position: center 20%; background-repeat: no-repeat;
}
.hero-gradient {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(20, 20, 20, .85), transparent 60%),
    linear-gradient(180deg, rgba(20, 20, 20, .25) 0%, transparent 30%, transparent 55%, rgba(20, 20, 20, .85) 80%, var(--bg) 100%);
}
.hero-content { position: relative; z-index: 2; padding: 48px 0; }
.hero-eyebrow {
  margin-bottom: 12px;
  font: 800 12px/1.4 var(--font-display); letter-spacing: .14em;
  text-transform: uppercase; color: var(--accent-hover);
}
.hero-title { margin-bottom: 16px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 12px; }
.hero-desc {
  font-size: 17px; color: var(--text-muted); max-width: 46ch; margin-bottom: 24px;
}
/* Description Show more / Show less (user verdict 2026-11-12): the full
   text ships in the markup; the clamp only applies while collapsed. */
.hero-desc.desc-clamped { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.detail-desc.desc-clamped { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hero-desc:has(+ .desc-toggle) { margin-bottom: 8px; }
/* S8: 44px tap target; white text (15.9:1 on #141414) with a red
   underline — the old red #E50914 text was 3.84:1, below AA 4.5:1. */
.desc-toggle { display: inline-block; background: none; border: none; padding: 12px 0; min-height: 44px; color: #fff; text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; font: 700 15px/1.4 var(--font-sans); cursor: pointer; }
.hero-content .desc-toggle { margin-bottom: 24px; }
.detail-info .desc-toggle { margin-bottom: 12px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-stats {
  display: flex; flex-wrap: wrap; gap: 28px;
  padding: 24px 0; border-bottom: 1px solid var(--line);
}
/* QA fix 2026-11-12: the markup is <ul><li><strong>93</strong><span>series</span></li>
   — the old .stat-num/.stat-label classes matched nothing, and the bare
   inline <strong>+<span> rendered jammed ("93series"). Style the real elements. */
.hero-stats ul { display: flex; flex-wrap: wrap; gap: 28px; margin: 0; padding: 0; list-style: none; }
.hero-stats li { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.hero-stats li strong { font: 800 25px/1.2 var(--font-display); }
.hero-stats li span { color: var(--text-muted); font-size: 13px; }

/* ---- Rows / rails ------------------------------------------------------ */
.row { position: relative; }
.row-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.row-head h2 { margin: 0; }
.row-track {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(160px, 200px);
  gap: 16px; overflow-x: auto; padding: 4px clamp(16px, 4vw, 36px) 16px;
  scroll-snap-type: x proximity; scrollbar-width: none;
  scroll-padding: 0 clamp(16px, 4vw, 36px);
}
/* v3 — the first card must start exactly where the row heading starts.
   Full-bleed rows (direct children of <main>, e.g. the series. homepage):
   the heading sits in a centred 1240px box, so the track needs the same
   centred offset as its left padding. Wrapped rows (inside .wrap, e.g.
   "More Like This"): the wrap's own padding IS the gutter, so the track
   adds none. The v2 blanket 36px track padding aligned neither case at
   desktop width (series. cards at ~37px vs headings at ~368px; wrapped
   cards 36px right of their headings). */
main > .row > .row-track {
  padding-left: max(clamp(16px, 4vw, 36px), calc((100% - 1240px) / 2 + 36px));
  scroll-padding-left: max(clamp(16px, 4vw, 36px), calc((100% - 1240px) / 2 + 36px));
}
.wrap .row-track {
  padding-left: 0;
  scroll-padding-left: 0;
}
.row-track::-webkit-scrollbar { display: none; }
.row-track > * { scroll-snap-align: start; }
.row-fade {
  position: absolute; top: 0; right: 0; bottom: 16px; width: 48px; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--bg) 90%);
  display: none;
}
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 32px 16px;
}
.row-empty { color: var(--text-muted); padding: 24px 0; }

/* ---- Series cards ------------------------------------------------------ */
.card { position: relative; display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--text); min-width: 0; }
/* QA fix 2026-11-12: .card MUST be positioned — the FREE badge, NEW/HOT
   badges and Top 10 rank numerals are absolutely positioned children of
   .card. Without this they anchored to .row and stacked over the headers. */
.card-poster {
  position: relative; aspect-ratio: 2/3; border-radius: var(--radius);
  overflow: hidden; background: var(--bg-elev-1); border: 1px solid var(--line);
}
/* ---- Grid ad cards (v9, 2026-11-14) ------------------------------------
   Adsterra banner slotted into .grid listings as a poster-shaped card:
   same 2/3 aspect + radius + border as .card-poster, so it reads as a
   poster like its neighbours. The banner unit is a 468x60 leaderboard:
   .grid-ad-body centres it (the card's overflow clips the sides) and
   the "Ad" label pins to the top-left. The .ad-banner wrapper carries
   an inline margin:22px auto (af_adsterra_banner) — killed here so the
   banner sits centred in the card instead of pushed down. */
.grid-ad-card { position: relative; aspect-ratio: 2/3; border-radius: var(--radius); overflow: hidden; background: var(--bg-elev-1); border: 1px solid var(--line); min-width: 0; }
.grid-ad-label { position: absolute; z-index: 2; left: 8px; top: 8px; background: rgba(0, 0, 0, .65); color: #fff; border: 1px solid rgba(255, 255, 255, .25); border-radius: 999px; padding: 3px 8px; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
/* v10.2 (2026-11-15): .grid-ad-body used to be a fixed 468px-wide box
   centred in the card (left:50% + translate -50%) — the exact frame
   the v10.1 fitter's left:50% + translateX(-50%) on the iframe then
   shifted against, so any creative that was not exactly 468px wide was
   pushed right out of the card (a 160px-wide creative showed only a
   45px sliver at the card's right edge). The body now fills the card
   and flex-centres its content; assets/js/app.js fitGridCard() scales
   the iframe to fit entirely inside the card instead. */
.grid-ad-body { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.grid-ad-card .ad-banner { margin: 0 !important; display: flex; align-items: center; justify-content: center; }
.grid-ad-card .ad-banner iframe { flex: none; }
/* v10.2 (2026-11-15): the flex centring above is what actually
   centres the iframe — it is wider than the card, so margin:auto
   would leave it left-aligned (over-constrained margins resolve to
   0). And the iframe MUST NOT shrink: as a flex item it shrinks to
   fit the 236px banner, but the automatic minimum size floors it at
   the iframe default of 300px, so a 468px-wide creative laid out at
   300px and the fitter's scale (computed from the 468 attribute)
   rendered only 151px of it. flex:none keeps the attribute width, so
   the scale shows the whole creative. (An inline width:468px does NOT
   fix it — the shrink is a flex rule, not a width rule.) */
/* v10 extension (2026-11-15): the 60px ad strip inside the series-page
   episode list (.eps is a single-column grid, so the strip spans the
   full width by itself); the banner's inline 22px margin is tightened
   so the strip stays a slim 60px-high row in the dense list. */
.ep-list-ad .ad-banner { margin: 4px auto !important; }
/* ---- Endless grid (2026-11-15) --------------------------------------- */
/* 1px sentinel for the IntersectionObserver in app.js; invisible. */
.infinite-sentinel { display: block; min-height: 1px; }
/* QA fix 2026-11-12: the class lands ON the <img> itself
   (af_poster_img default 'class' => 'card-poster'), so the old
   `.card-poster img` descendant rule matched nothing and unloaded
   posters reserved no box (layout shift + rank numerals over titles).
   Target the img directly: width 100% + aspect-ratio 2/3 reserves the
   box before the cover loads. The old .card-poster::after gradient is
   deleted — ::after never renders on a replaced element (<img>). */
img.card-poster { width: 100%; height: auto; aspect-ratio: 2/3; object-fit: cover; display: block; transition: transform .35s ease; }
/* Ranked cards wrap the poster link in .card-poster-wrap: make the link
   a block so the img's width:100% resolves against the full card width. */
.card-poster-wrap a { display: block; }
.card-title {
  font: 700 16px/1.3 var(--font-sans);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
/* Card titles render underlined everywhere (UA default on the inner <a>). */
.card-title, .card a { text-decoration: none; }
.card-genres { color: var(--text-muted); font: 600 13px/1.4 var(--font-sans); }
.card-meta { color: var(--text); font: 600 13px/1.4 var(--font-sans); }
.card-stats { color: var(--text-faint); font: 600 12px/1.4 var(--font-sans); }
.card-desc {
  color: var(--text-muted); font-size: 13px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
/* Ranked list (views/top.php + views/genre-landing.php): compact rows —
   numeral anchored to its own card, fixed 2:3 thumb, flexible info.
   The <li> is the positioned ancestor, so .rank-num (absolute, bottom-left
   of the poster — same pattern as .card-poster-wrap) can never pile up at
   the viewport corner again. */
.ranked-list { display: grid; gap: 16px; margin: 20px 0 24px; }
.ranked-list li { position: relative; display: flex; align-items: center; gap: 16px; min-width: 0; }
.ranked-list li > a { flex: none; display: block; }
.ranked-list .rank-num { left: 6px; bottom: 6px; font-size: 44px; }
.ranked-thumb {
  position: relative; width: 96px; height: 144px; flex: none;
  object-fit: cover; display: block; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--bg-elev-1);
}
.ranked-info { flex: 1; min-width: 0; }
.ranked-info > a { font: 700 17px/1.3 var(--font-sans); text-decoration: none; }
.ranked-info .muted { display: block; margin-top: 4px; font-size: 13px; }
/* Badges in a ranked row (F2 adds HOT/FREE to views/top.php) must never
   be absolute overlays — the <li> is positioned, so an absolute badge
   would pile onto the numeral/thumb. In-flow pills instead. */
.ranked-list .badge-new, .ranked-list .badge-hot, .ranked-list .badge-free { position: static; }
/* .rank-num also appears in-flow inside .ep-cell on the genre
   top-episodes page — keep it static there, never absolute. */
.ep-cell .rank-num { position: static; font-size: 20px; flex: none; }
.card-poster-wrap { position: relative; }
.card-poster-wrap .rank-num { left: 10px; bottom: 8px; }
.rank-num {
  position: absolute; left: 10px; bottom: 8px; z-index: 2;
  font: 800 56px/1 var(--font-display); letter-spacing: -.02em; color: #fff;
  text-shadow: 0 3px 16px rgba(0, 0, 0, .75);
}
.rank-label {
  position: absolute; left: 10px; bottom: 58px; z-index: 2;
  font: 800 10px/1 var(--font-display); letter-spacing: .10em; color: var(--text-muted);
}
/* Badges */
.badge-free, .badge-new, .badge-hot, .badge-top10 {
  position: absolute; z-index: 2; padding: 3px 9px; border-radius: var(--r-pill);
  font: 800 11px/1.4 var(--font-sans); letter-spacing: .06em; text-transform: uppercase;
}
.badge-free { top: 10px; right: 10px; background: var(--accent); color: #fff; }
.badge-new { top: 10px; left: 10px; background: #fff; color: #141414; }
.badge-hot { top: 10px; left: 10px; background: var(--accent); color: #fff; }
/* NEW + HOT on one card: HOT drops to a second row instead of stacking
   on NEW. (NOT "NEW top-right" as first drafted — FREE already occupies
   top:10px right:10px on every card, so a right-side NEW would hide
   behind FREE; and on 150px rail cards three pills cannot fit one row
   at all — HOT at left:64px overlapped FREE by 13px at 390px.) */
.badge-new + .badge-hot { top: 44px; left: 10px; }
/* Ranked (Top 10) cards also carry the TOP 10 pill at top-left, so their
   NEW/HOT pills drop to the second row too — otherwise HOT covers
   "TOP 10" and only the "0" peeks out beside it. On the second row NEW
   and HOT sit side by side (no FREE there to collide with). */
#row-top10 .card-badges .badge-new, #row-top10 .card-badges .badge-hot { top: 44px; }
#row-top10 .badge-new + .badge-hot { top: 44px; left: 64px; }
/* F2 only emits <p class="card-badges"> when badges exist; hide it outright
   if it ever renders empty so no blank line appears under a card. */
.card-badges:empty { display: none; }
.badge-top10 { top: 10px; left: 10px; background: var(--accent); color: #fff; }
.badge-choice {
  position: absolute; left: 10px; bottom: 10px; z-index: 2;
  background: rgba(0, 0, 0, .72); border: 1px solid var(--line);
  padding: 3px 9px; border-radius: var(--r-pill); font: 700 11px/1.4 var(--font-sans);
}
/* Re-QA fix 2026-11-12 (defect B): the old .card-top10 rules below were
   dead — the class was never applied to any markup — so the rank numeral
   fell back to the card-relative bottom:2px. Deleted; the numeral now
   anchors to .card-poster-wrap (above). */

/* ---- Series detail ----------------------------------------------------- */
/* NETWORK-UNIFY fix 2026-11-12 (D2): .detail-billboard had no background
   at all — when the cover fails to load the page showed ~340px of pure
   black void above the poster. A dark red-tinted gradient keeps the band
   intentional-looking even with no image; the blurred cover still paints
   over it in production. */
.detail-billboard { position: relative; min-height: 380px; overflow: hidden; display: flex; align-items: flex-end; background: radial-gradient(120% 120% at 50% 0%, #3a1a1a 0%, #141414 75%); }
.detail-overlap { position: relative; z-index: 2; margin-top: -64px; }
/* QA fix 2026-11-12: views/series.php emits .detail-head (not .detail-grid),
   which had no CSS at all — the poster stacked above full-width info at
   every width. .detail-head now carries the 300px + 1fr grid; .detail-grid
   keeps the same layout so both class names work. */
.detail-head, .detail-grid { display: grid; grid-template-columns: 300px 1fr; gap: clamp(28px, 5vw, 62px); align-items: start; }
.detail-info { min-width: 0; }
.detail-desc { font-size: 17px; line-height: 1.55; color: var(--text-muted); max-width: 62ch; margin: 12px 0; }
/* Detail badges render in flow beside the meta (not absolute over the
   poster — the old absolute positioning floated them off the poster edge
   and stacked NEW under HOT). */
.detail-badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.detail-badges .badge-new, .detail-badges .badge-hot { position: static; }
.detail-badges:empty { display: none; }
.detail-poster { width: 300px; max-width: 100%; border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; background: var(--bg-elev-1); }
.detail-poster img { width: 100%; aspect-ratio: 2/3; object-fit: cover; display: block; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 12px 0; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 20px 0; }
.stats-3up { display: flex; gap: 26px; margin-top: 26px; flex-wrap: wrap; }
/* QA fix 2026-11-12: same jam as .hero-stats — markup is
   <div><strong>x</strong><span>y</span></div>, not .stat-num/.stat-label. */
.stats-3up > div { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.stats-3up > div strong { font: 800 22px/1.2 var(--font-display); }
.stats-3up > div span { color: var(--text-muted); font-size: 13px; }

/* ---- Episodes ---------------------------------------------------------- */
/* v10.1 (2026-11-15): minmax(0,1fr) — the implicit auto column sized
   itself to its widest item, which is the 468px ad strip, so the whole
   episode list grew to 468px and overflowed its 448px wrap on phones
   (the strip slot then measured 468 and the fitter saw nothing to fit).
   One explicit 1fr track is exactly the container width. */
.eps { display: grid; grid-template-columns: minmax(0,1fr); gap: 9px; }
/* Chunk panels carry [hidden] — an author display rule beats the UA
   [hidden] rule, so without this both panels render at once and the
   chunk tabs can never hide anything. */
.eps[hidden] { display: none; }
.ep-chunks { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
/* Chunk tabs were unstyled native buttons (light grey, 24px tall).
   Styled like .chip; selected tab takes the accent. */
.ep-chunk-tab {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 10px 18px; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: var(--bg-elev-1);
  color: var(--text-muted); font: 700 14px/1 var(--font-sans);
}
.ep-chunk-tab:hover { border-color: var(--line-strong); color: #fff; }
.ep-chunk-tab[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.ep-cell {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 13px 16px; min-height: 44px; border-radius: var(--r-lg);
  background: var(--bg-elev-1); border: 1px solid var(--line);
  color: var(--text); text-decoration: none; text-align: left;
  transition: border-color .15s ease, transform .15s ease;
}
.ep-cell:hover { border-color: var(--accent); transform: translateY(-1px); }
.ep-cell .ep-badge {
  width: 42px; height: 42px; flex: none; border-radius: var(--r-md);
  background: var(--bg-elev-2); display: inline-flex; align-items: center; justify-content: center;
  font: 800 16px/1 var(--font-display);
}
.ep-cell .ep-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
/* Locked rows use .ep-num + .ep-lock-label (not .ep-badge/.ep-title):
   the number must never wrap ("Ep" / "2" on two lines at 390px) and the
   label takes the remaining space instead of squeezing the number. */
.ep-cell .ep-num { white-space: nowrap; flex: none; font: 700 15px/1.4 var(--font-sans); }
.ep-cell .ep-lock-label { flex: 1; min-width: 0; font-size: 14px; line-height: 1.4; color: var(--text-muted); }
.ep-cell .ep-time { color: var(--text-muted); font-size: 13px; flex: none; }
.ep-cell .ep-play { flex: none; display: inline-flex; align-items: center; gap: 6px; background: var(--accent); color: #fff; padding: 6px 14px; border-radius: var(--r-pill); font: 800 12px/1.4 var(--font-sans); letter-spacing: .03em; }
.ep-cell.locked { opacity: 1; } /* text stays readable — dim the surface, not the text (audit §4.1) */
.ep-cell.locked .ep-title, .ep-cell.locked .ep-time { color: var(--text-muted); }
.ep-cell.locked { background: var(--bg-elev-1); border-color: var(--line); }
.ep-cell.locked .ep-badge { background: var(--bg-elev-2); color: var(--text-muted); } /* #b3b3b3 on #2f2f2f = 6.39:1 (was #8c8c8c = 3.98:1) */
.ep-cell.watched { border-left: 3px solid var(--amber); }
.ep-cell.current { background: var(--accent); border-color: var(--accent); color: #fff; }
.ep-cell.current .ep-badge { background: rgba(255, 255, 255, .2); }
.ep-cell.current .ep-time { color: #fff; } /* solid white on accent = 4.79:1 (was rgba .85 = 4.28:1) */
.ep-cell .ep-lock { position: absolute; top: 5px; right: 6px; }
.ep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.ep-grid .ep-cell { justify-content: center; aspect-ratio: 1.4; padding: 8px 4px; font-weight: 800; }
.ep-cell .ep-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--bg-elev-2); }
.ep-cell .ep-progress i { display: block; height: 100%; background: var(--accent); }

/* Episode page hero poster: capped like the series detail poster. */
.episode-hero { max-width: 300px; }

/* ---- Player shell (Phase 1: native controls, restyled shell) -----------
   v9 (2026-11-14): the base shell is VERTICAL from first paint — dramas
   are always vertical, and the old 16/9 base only became the centred
   vertical player once video metadata loaded (slow on 0-5 KB/s, so it
   sat as a wide flat bar). The JS orientation switch still adds
   .vertical/.landscape on metadata; .landscape restores 16/9 for a
   genuinely landscape video. */
.player-shell { position: relative; background: #000; border-radius: var(--r-lg); overflow: hidden; aspect-ratio: 9/16; max-height: 78vh; max-width: 480px; margin: 0 auto; }
.player-shell.vertical { aspect-ratio: 9/16; max-height: 78vh; max-width: 480px; }
.player-shell.landscape { aspect-ratio: 16/9; max-height: 72vh; max-width: none; }
/* D1: the ≤640px 9/16 rule lives HERE, after the 16/9 base rule — the
   same rule in watch.php's inline <style> was defeated by this base
   rule (app.css is linked in <body> after the inline <style>, equal
   specificity, later wins). Landscape videos keep 16/9 via the
   .landscape override the JS orientation switch applies. */
@media (max-width: 640px) {
  .player-shell { aspect-ratio: 9/16; max-height: 80vh; max-width: 100%; }
  .player-shell.landscape { aspect-ratio: 16/9; max-height: 72vh; }
}
.player-shell video { width: 100%; height: 100%; display: block; }
.player-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255, 255, 255, .3); z-index: 2; }
.player-progress i { display: block; height: 100%; background: var(--accent); width: 0; }

/* ---- Modals / popups --------------------------------------------------- */
.modal {
  position: fixed; inset: 0; z-index: 300; display: none;
  background: var(--overlay-heavy); padding: 16px;
  align-items: center; justify-content: center;
}
.modal.open { display: flex; }
.modal-panel {
  position: relative; width: 100%; max-width: 520px;
  background: var(--bg-elev-1); border: 1px solid var(--accent-line);
  border-radius: var(--r-xl); box-shadow: var(--shadow-modal);
  max-height: calc(100dvh - 32px); max-height: calc(100vh - 32px);
  overflow-y: auto; padding: 24px;
  animation: modal-in .25s ease;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.modal-close {
  position: absolute; top: 14px; right: 14px;
  width: 44px; height: 44px; min-width: 44px; min-height: 44px;
  border-radius: 50%; border: 0; background: var(--alpha-04); color: var(--text-muted);
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.modal-close:hover { background: var(--alpha-08); color: #fff; }
.modal-close .ic { width: 24px; height: 24px; }
.modal-title { margin-bottom: 10px; padding-right: 48px; }
.modal-body { color: var(--text-muted); font-size: 15px; }
.modal-body p { margin-bottom: 12px; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.timer-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent); color: #fff; font: 800 15px/1.4 var(--font-sans);
  padding: 6px 14px; border-radius: var(--r-pill);
}
.timer-pill.done { background: var(--green-dark); } /* white on #46D369 is 2.28:1 — use dark green */
.progress-track { height: 4px; background: var(--bg-elev-2); border-radius: 99px; margin: 12px 0; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); width: 0; transition: width .2s linear; }
.ad-frame { background: #000; margin-top: 12px; min-height: 400px; border-radius: var(--r-md); overflow: hidden; }
.ad-frame iframe { width: 100%; height: 400px; border: 0; display: block; background: #000; }
.ad-fail { text-align: center; padding: 24px 0 8px; }
.ad-fail p { color: var(--text-muted); margin-bottom: 16px; }

/* App popup + smart banner (ADS owns behaviour; DESIGN owns the look). */
.app-popup {
  position: fixed; inset: 0; z-index: 200; display: none;
  background: var(--overlay); padding: 20px; align-items: center; justify-content: center;
}
.app-popup.open { display: flex; }
.app-popup .modal-panel { max-width: 420px; padding: 32px 28px; text-align: center; animation: popup-up .3s ease; }
@keyframes popup-up { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.app-popup .benefits { display: grid; gap: 8px; text-align: left; margin: 16px 0; font-size: 15px; }
.app-popup .benefits li { display: flex; gap: 10px; align-items: flex-start; }
.app-popup .benefits .ic { color: var(--accent-hover); margin-top: 2px; }
.smart-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: var(--bg-elev-1); border-top: 1px solid var(--line);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  display: none; align-items: center; gap: 12px;
}
.smart-banner.open { display: flex; }
.smart-banner .sb-text { flex: 1; min-width: 0; font-size: 14px; }
.smart-banner .sb-text b { display: block; font-size: 15px; }
.qr-box {
  background: #fff; padding: 12px; border-radius: var(--r-md);
  display: inline-block; line-height: 1.45;
  /* Re-QA fix 2026-11-12 (defect A): the placeholder APK URL is ~90
     unbroken chars; without wrapping it forced the layout viewport to
     576px on a 390px phone. Constrain the box and let the URL wrap. */
  max-width: 100%; box-sizing: border-box;
  /* Final-verification fix 2026-11-12: the box is white but its text
     inherited the dark theme's white — the placeholder rendered as a
     blank white rectangle. Dark text on the white box. */
  color: #141414;
}
.qr-box img { width: 160px; height: 160px; display: block; }
.qr-placeholder { max-width: 100%; }
.qr-placeholder-url { overflow-wrap: anywhere; word-break: break-all; }
.qr-caption { color: #141414; font-weight: 600; }
.qr-subline { color: #555; }
/* Final-verification fix 2026-11-12: the "Copy app link" button inside the
   white box is .btn-ghost (white text, 4% white bg) — invisible on white.
   Dark ghost variant scoped to the QR box only. */
.qr-box .btn-ghost { background: #f2f2f2; border-color: #d9d9d9; color: #141414; }
.qr-box .btn-ghost:hover { background: #e6e6e6; border-color: #c9c9c9; }

/* Notice / alert */
.notice {
  margin-top: 18px; padding: 13px 18px; border-radius: var(--r-md);
  border: 1px solid rgba(255, 200, 87, .35); background: var(--amber-soft); color: #ffe1a1;
}
.alert-error { color: var(--error-text); font-size: 14px; }

/* ---- Footer / tab bar -------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--line); padding: 40px 0 48px;
  margin-top: 64px; color: var(--text-muted);
}
/* v2 four-column footer: brand ~2fr, Browse 1fr, Genres 1fr, Legal 1fr.
   Phone ≤700px: single column, brand first, each group a vertical list
   with 44px tap targets. Label/small-print colour #b3b3b3 (not #8c8c8c). */
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 28px; }
.footer-col { display: flex; flex-direction: column; align-items: flex-start; }
.footer-heading {
  font: 800 12px/1.4 var(--font-display); letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-muted); margin: 0 0 6px;
}
.footer-col a {
  color: var(--text-muted); text-decoration: none;
  display: inline-flex; align-items: center; min-height: 44px; padding: 10px 0;
}
.footer-col a:hover { color: #fff; }
.site-footer small { display: block; margin-top: 18px; color: var(--text-muted); }
.site-footer small a { white-space: nowrap; } /* keep "auraflicks.top" together */
.site-footer small .nowrap { white-space: nowrap; } /* keep "Watch on auraflicks.top" on one line (V12: the link alone on line 2 at 390px) */
.tab-bar {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(20, 20, 20, .96); border-top: 1px solid var(--line);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.tab-bar a, .tab-bar button {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; background: none; border: 0; color: var(--text-faint);
  font: 600 11px/1.2 var(--font-sans); text-decoration: none; min-height: 44px; padding: 6px 0;
}
.tab-bar .ic { width: 22px; height: 22px; }
.tab-bar a.is-active, .tab-bar button.is-active { color: var(--accent); }
.tab-bar a.is-active .tab-label, .tab-bar button.is-active .tab-label { color: #fff; }

/* ---- Hamburger + drawer (v2, mobile ≤980px only) ----------------------- */
.menu-btn {
  display: none; align-items: center; justify-content: center;
  width: 44px; height: 44px; min-width: 44px; min-height: 44px; flex: none;
  border-radius: 50%; border: 1px solid var(--line);
  background: var(--alpha-04); color: var(--text); padding: 0;
}
.menu-btn:hover { background: var(--alpha-08); border-color: var(--line-strong); }
.menu-btn .ic { width: 22px; height: 22px; }
.drawer-backdrop {
  position: fixed; inset: 0; z-index: 80; background: rgba(0, 0, 0, .6);
}
.drawer-backdrop[hidden] { display: none; }
.drawer {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 90;
  width: min(320px, 85vw); background: var(--bg-elev-1);
  transform: translateX(-102%); transition: transform .2s ease;
  overflow-y: auto; padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}
.drawer.open { transform: none; }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.drawer-close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; min-width: 44px; min-height: 44px;
  border-radius: 50%; border: 1px solid var(--line);
  background: var(--alpha-04); color: var(--text); padding: 0;
}
.drawer-close:hover { background: var(--alpha-08); border-color: var(--line-strong); }
.drawer-close .ic { width: 22px; height: 22px; }
.drawer-section { padding: 12px 0; border-bottom: 1px solid var(--line); }
.drawer-heading {
  font: 800 12px/1.4 var(--font-display); letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-muted);
  padding: 0 20px 4px; margin: 0;
}
.drawer-section a, .drawer-section button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: 44px; padding: 12px 20px;
  background: none; border: 0; color: var(--text); text-decoration: none;
  font: 600 15px/1.4 var(--font-sans); text-align: left;
}
.drawer-section a:hover, .drawer-section button:hover { background: var(--alpha-08); }
.drawer-section a .ic, .drawer-section button .ic { width: 20px; height: 20px; color: var(--text-muted); }
.drawer-foot { padding: 16px 20px; }
.drawer-foot .btn { width: 100%; }
body.menu-open { overflow: hidden; }
/* Search overlay close (S9): only inside the open mobile overlay. */
.search-close { display: none; }
@media (max-width: 980px) {
  .menu-btn { display: inline-flex; }
}

/* ---- Skeletons --------------------------------------------------------- */
.skel { position: relative; overflow: hidden; background: var(--bg-elev-1); border-radius: var(--r-lg); }
.skel-card { aspect-ratio: 2/3; }
.skel-line { height: 12px; border-radius: 6px; background: var(--bg-elev-1); margin-top: 8px; }
.skel-line.short { width: 60%; }
.skel-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(160px, 200px); gap: 16px; overflow: hidden; }
.skel-hero { min-height: 480px; background: var(--bg-elev-1); border-radius: 0; }
.skel::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .06), transparent);
  transform: translateX(-100%); animation: shimmer 1.4s infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }

/* ---- Comments ---------------------------------------------------------- */
.comment-form { display: flex; gap: 10px; margin: 16px 0; }
.comment-form input { flex: 1; }
.comment-item { padding: 14px 0; border-bottom: 1px solid var(--line); }
.comment-item .c-name { font-size: 14px; font-weight: 700; }
.comment-item .c-meta { color: var(--text-faint); font-size: 12px; margin-left: 8px; }
.comment-item .c-body { margin-top: 6px; font-size: 15px; line-height: 1.5; }

/* ---- Motion: desktop only ---------------------------------------------- */
@media (hover: hover) and (pointer: fine) {
  img.card-poster { transition: transform .35s ease; }
  .card:hover .card-poster { box-shadow: var(--shadow-card); }
  .card:hover img.card-poster { transform: scale(1.05); }
  .row-track { scroll-snap-type: x mandatory; }
  .row-fade { display: block; }
}
@media (hover: none), (pointer: coarse) {
  img.card-poster { transition: none; }
}

/* ---- Breakpoints: 480 / 620 / 700 / 880 / 980 ------------------------- */
/* M1a — header overflow 701–977px: nav + 220px search + "Get the app" need
   ~977px min-content (measured 893px content + 61px wrap padding at 768px,
   doc scrollWidth 924). Below 980px the desktop nav hides and the bottom
   tab bar takes over (same destinations), and the search shrinks to 180px.
   At 981px+ the full header fits (981 − 72 wrap padding = 909 ≥ 893).
   NOTE: this block sits BEFORE the 880/700/620/480 blocks on purpose —
   the ≤700px 170px search width and the ≤480px 100% overlay width must
   win over the 180px here. */
@media (max-width: 980px) {
  .site-nav { display: none; } /* nav lives in the bottom tab bar */
  .tab-bar { display: flex; }
  /* S10: tab bar is calc(56px + safe-area) tall (~90px on notched
     phones) — clearance must include the safe area too. */
  body { padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)); } /* mobile tab-bar clearance */
  .site-footer { padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
  .header-inner { gap: 16px; }
  .header-search .search-input { width: 180px; }
  /* With the nav hidden the base `.site-nav + .header-actions
     { margin-left: 0 }` still matches (display:none does not break the
     sibling selector), stranding the button mid-header — measured
     btnRight 522 at 768px, 246px of dead space. Restore the auto margin
     so search + button sit at the right edge in this band. */
  .site-nav + .header-actions { margin-left: auto; }
}
@media (max-width: 880px) {
  /* A1: on phones the poster shrinks to a 96px thumb BESIDE the title
     (was a 280px poster above the info, pushing Play ~1000px down),
     and the billboard band drops to ~140px. */
  .detail-head, .detail-grid { grid-template-columns: 96px 1fr; gap: 16px; }
  .detail-poster { width: 96px; max-width: 96px; }
  .hero { min-height: 420px; }
  .detail-billboard { min-height: 140px; }
  .detail-overlap { margin-top: -110px; }
}
@media (max-width: 700px) {
  .footer-grid { grid-template-columns: 1fr; gap: 8px; }
  .header-search .search-input { width: 170px; padding: 12px 14px; } /* was 140px: "Search dramas" placeholder clipped to "Search dram" */
  .header-inner { gap: 10px; }
  .brand { font-size: 19px; }
  .brand-word { font-size: 19px; }
  .hero-gradient { background: linear-gradient(180deg, rgba(20, 20, 20, .25) 0%, transparent 30%, transparent 55%, rgba(20, 20, 20, .85) 80%, var(--bg) 100%); }
  .hero-content { padding: 24px 0; }
  .search-results { position: fixed; top: var(--header-h); left: 16px; right: 16px; }
}
@media (max-width: 620px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: 24px 12px; }
  .row-track { grid-auto-columns: minmax(150px, 160px); }
  /* D3: durations were hidden on ALL .ep-cell rows on phones. Scope the
     hide to .ep-grid only — the watch/series lists use .eps, so their
     durations now show. */
  .ep-grid .ep-cell .ep-time { display: none; }
  .player-shell { border-radius: 0; }
  .modal-panel { padding: 24px 20px; }
}
@media (max-width: 560px) {
  /* v10.1 (2026-11-15): the icon-only app button used to switch on only
     at ≤480px, so at 481–560px the labelled button (~149px) + 170px
     search + Log in overflowed the header by ~98px (measured docScroll
     598 at a 500px viewport on every page). Same 44px treatment, wider
     band — the labelled button returns above 560px where it fits. */
  .header-app-btn {
    width: 44px; height: 44px; padding: 0; border-radius: 12px;
    background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .16);
  }
  .header-app-btn .btn-label { display: none; }
}
@media (max-width: 480px) {
  .hero-actions .btn { width: 100%; }
  .detail-actions .btn { width: 100%; }
  /* v6 header app button, icon-only: the labelled secondary button
     becomes the refined 44px icon treatment (same metrics as
     .btn-icon) so the 44px hamburger + brand + app + Log in fit at
     390px. Label hidden, aria-label kept. (Rule itself now lives in the
     ≤560px block above; this block keeps the rest of the ≤480px rules.) */
  /* S9: explicit close (X) inside the open search overlay. */
  .header-search.open .search-close {
    display: inline-flex; align-items: center; justify-content: center;
    position: absolute; top: 12px; right: 16px; z-index: 2;
    width: 44px; height: 44px; border-radius: 50%;
    border: 1px solid var(--line); background: var(--bg-elev-1); color: var(--text);
  }
  .header-search.open .search-close .ic { width: 20px; height: 20px; }
  .header-search.open .search-input { padding-right: 56px; }
  /* Mobile search is an overlay panel, not a permanently hidden input:
     the old `display: none` is gone. Hidden by default (fixed + invisible,
     out of header flow); F4's tab-bar Search toggles .open on
     .header-search to show it full-width under the header. */
  .header-search {
    position: fixed; top: var(--header-h); left: 0; right: 0; z-index: 60;
    background: var(--bg); padding: 12px 16px; border-bottom: 1px solid var(--line);
    visibility: hidden; opacity: 0; pointer-events: none; transform: translateY(-8px);
    transition: opacity .15s ease, transform .15s ease, visibility .15s;
  }
  .header-search.open {
    visibility: visible; opacity: 1; pointer-events: auto; transform: none;
  }
  .header-search .search-input { width: 100%; }
  .header-search.open .search-results { position: static; margin-top: 12px; max-height: 60vh; }
  .ad-frame, .ad-frame iframe { height: 320px; min-height: 320px; }
}

/* v10.1 (2026-11-15): the 468×60 Adsterra banner iframe is wider than a
   phone screen — centre it, so the crop shows the middle of the creative,
   not the left edge. app.js (fitAdFrames) scales it to fit each slot and
   fixes the slot height; this is the no-JS baseline, and JS overrides the
   transform inline when it runs. The old scale(.83) hack is gone: it
   cropped the right side on 360px screens, anchored left, and left a gap
   below the creative. CORRECTED (Selenium, 2026-11-15): the first baseline
   used left:50% + translateX(-50%) — but the slot already centres its
   inline content (text-align:center), so the shift landed ON TOP of the
   centring and pushed every wide-slot iframe flush RIGHT (measured
   800..1268 in a 1268px slot). A block iframe with auto margins centres
   in any slot with no double shift. */
.ad-banner iframe { display: block; margin: 0 auto; }

/* ---- Browse tools (shared by the homepage Browse All block and the
   /series page in browse.php — moved here from frontend.php's inline
   <style> so both pages get them) --------------------------------------- */
.tools { display: grid; gap: 16px; margin-bottom: 30px; }
.search { position: relative; max-width: 460px; }
.search input {
  width: 100%; padding: 14px 18px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg-elev-1);
  color: var(--text); font: inherit;
}
.search input:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.filters { display: flex; gap: 8px; overflow-x: auto; padding: 2px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.empty {
  display: none; border: 1px dashed var(--line); border-radius: 12px;
  padding: 38px; text-align: center; color: var(--text-muted);
}
.notfound { text-align: center; padding: 90px 0; }
.notfound h1 { font: 800 52px var(--font-display); }
.notfound .lead { color: var(--text-muted); margin: 16px auto 26px; }
/* A5: the series share row is one horizontal scroll row, never 2+2. */
.share-row { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.share-row::-webkit-scrollbar { display: none; }
.share-row .btn { flex: none; }

/* ---- integration fix 2026-11-12: Save-to-Library icon swap + CTA sublines.
   app.js toggles [data-saved] on [data-save-series]; the button ships both
   icons and CSS shows the right one. The hero/series app-CTA sublines
   (P2/P3) had no styles — muted 13px, matching card meta. */
[data-save-series] .icon-check { display: none; }
[data-save-series][data-saved="true"] .icon-check { display: inline-block; }
[data-save-series][data-saved="true"] .icon-plus { display: none; }
.hero-app-cta { margin-top: 16px; }
.hero-app-subline, .series-app-subline { color: var(--text-muted); font-size: 13px; font-weight: 600; margin: 8px 0 0; max-width: 62ch; }
.series-app-cta { margin: 4px 0 20px; }

/* ---- M1 mop-up (QA sweep 2026-11-12) ------------------------------------ */
/* M1b — .row-head / .hero-stats sat flush to the viewport edges (no .wrap
   gutter): give them the same centred 1240px + clamp gutter as .wrap.
   Scoped to direct children of <main> so rows already inside a .wrap
   (e.g. series "More Like This") do NOT get a doubled gutter.
   .hero-content had the same defect (measured left:0 at 1280px) — same
   centred 1240px container + clamp gutter. The 640px text-column cap lives
   on the CHILDREN, not the container: the old rule put the wide-screen
   gutter padding INSIDE a 640px border-box max-width, which squeezed the
   text column to ~0px at 1920px (hero meta + app subline wrapped one word
   per line; repro + fix verified 2026-11-12). */
main > .row > .row-head,
main > .hero-stats {
  max-width: 1240px;
  margin-left: auto; margin-right: auto;
  padding-left: clamp(16px, 4vw, 36px);
  padding-right: clamp(16px, 4vw, 36px);
}
.hero-content {
  width: 100%;
  max-width: 1240px;
  margin-left: auto; margin-right: auto;
  padding-left: clamp(16px, 4vw, 36px);
  padding-right: clamp(16px, 4vw, 36px);
}
.hero-content > * { max-width: 640px; }

/* M1c — comments markup (views/series.php) uses .comments/.comment/
   .comment-meta/.comment-text, but only .comment-item/.c-* were styled.
   Mirror the .comment-item visual language for the real classes. */
.comments { margin: 32px 0; }
.comment { padding: 14px 0; border-bottom: 1px solid var(--line); }
.comment-meta { font-size: 14px; font-weight: 700; }
.comment-meta .muted { color: var(--text-faint); font-size: 12px; font-weight: 400; margin-left: 8px; }
.comment-text { margin-top: 6px; font-size: 15px; line-height: 1.5; }

/* ---- prefers-reduced-motion -------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; transition-delay: 0s !important;
  }
  img.card-poster { transform: none !important; }
  .skel::after { animation: none; }
}

/* ==========================================================================
   Phase 3 main-site compat (2026-11-12, LAYOUT worker).
   The restyle above is byte-identical to build v2. This section maps the
   MAIN SITE's existing markup onto the new system so layout.php's
   af_series_card() and the current frontend/watch/library/pages markup
   keep rendering under app.css alone:
   - .btn-primary: the old pages' primary button (the restyle's .btn IS
     the red primary; .btn-primary is the old name for it).
   - .series-card/.poster/.free-badge/.choice-badge/.rank: the old card
     markup (af_series_card, frontend renderContinue clones) -> the new
     .card visual language. data-search/data-genres attributes are
     untouched — the catalog filter in app.js reads them.
   - .ep-progress (standalone): watch.php saveLocal() progress + the CW
     cards app.js renders (the restyle only styled .ep-cell .ep-progress).
   - .description/.genre-row/.notice/.field: old detail/legal pages.
   - Legacy token aliases (--rose/--rose2/--disp/--sans) for page-level
     CSS that still references them.
   Tap-highlight transparent, scroll-snap proximity, hero-content fix
   and desc-clamp rules from v2 above are kept verbatim.
   ========================================================================== */
:root {
  --rose: #e50914;
  --rose2: #f6121d;
  --disp: 'Figtree', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}
/* .btn-primary is defined in the v6 Buttons section above; the old
   duplicate definition (red + shadow) was deleted with it. */
.series-card { position: relative; display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--text); min-width: 0; scroll-snap-align: start; }
.series-card .poster { position: relative; display: block; aspect-ratio: 2/3; border-radius: var(--r-lg); overflow: hidden; background: var(--bg-elev-1); border: 1px solid var(--line); }
.series-card .poster img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.series-card:hover .poster img { transform: scale(1.05); }
.series-card .poster::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, .55)); }
.series-card .free-badge { position: absolute; z-index: 2; right: 10px; top: 10px; background: var(--accent); color: #fff; border-radius: var(--r-pill); padding: 3px 9px; font: 800 11px/1.4 var(--font-sans); letter-spacing: .06em; text-transform: uppercase; }
.series-card .choice-badge { position: absolute; z-index: 2; left: 10px; bottom: 10px; background: rgba(10, 5, 12, .72); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 3px 9px; font-size: 11px; font-weight: 700; }
.series-card .rank { position: absolute; z-index: 2; left: 10px; bottom: 2px; font: 800 58px/1 var(--font-sans); text-shadow: 0 3px 16px rgba(0, 0, 0, .75); }
.series-card .badge-new, .series-card .badge-hot { position: absolute; z-index: 2; }
.series-card .card-sub, .series-card .card-stats { color: var(--text-muted); font-size: 13px; }
.series-card .card-stats { font-size: 12px; }
.series-card .card-meta { color: var(--text); font-size: 13px; font-weight: 600; }
.series-card .card-desc { color: var(--text-muted); font-size: 13px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ep-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--bg-elev-2); }
.ep-progress i { display: block; height: 100%; background: var(--accent); }
.description { color: var(--text-muted); font-size: 17px; max-width: 62ch; }
.genre-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 20px 0; }
.genre-row span { border: 1px solid var(--line); border-radius: var(--r-pill); padding: 5px 11px; color: var(--text-muted); font-size: 13px; }
.notice { margin-top: 18px; padding: 13px 18px; border: 1px solid rgba(255, 200, 87, .35); background: rgba(255, 200, 87, .1); border-radius: 14px; color: #ffe1a1; }

/* ==========================================================================
   v2 — Account page (/account) + library guest note
   ========================================================================== */
.acct { max-width: 720px; }
.acct-head { display: flex; gap: 18px; align-items: center; margin: 8px 0 24px; }
.acct-avatar { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; border: 3px solid var(--accent); background: var(--bg-elev-1); flex: none; }
.acct-card { background: var(--bg-elev-1); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.acct-card h2 { margin: 0 0 4px; font-size: 19px; }
.acct-card .row { display: flex; gap: 10px; flex-wrap: wrap; }
.acct-facts { margin: 12px 0 0; display: grid; gap: 0; }
.acct-facts > div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-top: 1px solid var(--line); }
.acct-facts > div:first-child { border-top: 0; }
.acct-facts dt { color: var(--text-muted); font-size: 14px; }
.acct-facts dd { margin: 0; font-size: 14px; text-align: right; min-width: 0; }
.acct-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-top: 12px; }
.acct-stats > div { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px 8px; text-align: center; }
.acct-stats b { display: block; font-size: 22px; }
.acct-stats span { display: block; font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.avatar-grid { display: grid; grid-template-columns: repeat(5, 64px); gap: 10px; }
.avatar-pick { width: 64px; height: 64px; padding: 0; border-radius: 50%; border: 3px solid transparent; background: none; cursor: pointer; overflow: hidden; }
.avatar-pick img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-pick.is-selected { border-color: var(--accent); }
.avatar-pick:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.acct-msg { padding: 12px 14px; border-radius: 12px; margin: 0 0 14px; font-size: 14px; }
.acct-msg-ok { background: rgba(6, 214, 160, .12); border: 1px solid rgba(6, 214, 160, .4); color: #7df0d2; }
.acct-msg-error { background: rgba(229, 9, 20, .12); border: 1px solid rgba(229, 9, 20, .45); color: #ff8ba0; }
.acct-danger { border-color: rgba(229, 9, 20, .5); }
.guest-note { background: var(--bg-elev-1); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 20px; font-size: 14px; color: var(--text-muted); }
.guest-note .btn-text { color: var(--accent); font-weight: 700; }
@media (max-width: 560px) {
  .acct-stats { grid-template-columns: repeat(3, 1fr); }
  .acct-head { gap: 14px; }
  .acct-avatar { width: 72px; height: 72px; }
  .avatar-grid { grid-template-columns: repeat(5, 1fr); }
  .avatar-pick { width: 100%; height: auto; aspect-ratio: 1; }
}

/* ---- S12 (2026-11-13): content protection — moved here from the
   af_base_css() shim in layout.php when the shim was stripped to its
   :root token aliases. These rules existed ONLY in the shim; without
   them text selection / long-press callout / image drag would come back. */
body { user-select: none; -webkit-user-select: none; -moz-user-select: none; -webkit-touch-callout: none; }
input, textarea, select { user-select: text; -webkit-user-select: text; -moz-user-select: text; -webkit-touch-callout: default; }
img, video { -webkit-user-drag: none; user-drag: none; }

/* === v3 E: username picker/link-google === */
/* Keys stat removed from the account page (v3 E): 4 stats remain, so the
   stats grid is 4 columns (overrides the 5-column rule above). The
   narrow-screen rule below still drops to 3 columns. */
.acct-stats { grid-template-columns: repeat(4, 1fr); }
/* Username read-only value + picker note. */
#usernameValue { overflow-wrap: anywhere; }
#usernameCard .acct-msg { margin-top: 0; }
/* Link Google section: the Google Identity Services button keeps its
   own sizing; the hint sits under it. */
#googleBtnWrap { min-height: 40px; }
#googleBtnWrap > div { display: inline-block; }
/* Choose-username page: the picker card is centred by .pick-wrap. */
.pick-wrap .acct-card { margin-bottom: 0; }

/* === v3 D: watch player-first === */
/* Compact series info block on the watch page (watch.php #seriesInfo):
   poster thumb + title + meta + stats + Save to Library on one row,
   description + genre pills below. Replaces the old billboard header
   that sat above the player. */
.series-info-compact { margin-top: 22px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-elev-1); }
.sic-head { display: flex; gap: 16px; align-items: flex-start; }
.sic-poster { flex: none; width: 84px; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); background: var(--bg-elev-2); }
.sic-poster img { width: 100%; aspect-ratio: 2/3; object-fit: cover; display: block; }
.sic-body { min-width: 0; }
.sic-title { font: 800 20px/1.2 var(--font-display); letter-spacing: -.02em; margin: 0 0 2px; }
.sic-title a { color: var(--text); text-decoration: none; }
.sic-stats { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 10px 0 12px; color: var(--text-muted); font-size: 14px; }
.sic-stats strong { color: var(--text); font-weight: 800; }
/* Tighten the reused detail classes inside the compact block. */
.series-info-compact .detail-meta { margin: 6px 0; }
.series-info-compact .detail-badges { margin: 8px 0; }
.series-info-compact .detail-desc { margin: 14px 0 0; }
.series-info-compact .chips { margin: 12px 0 0; }
@media (max-width: 640px) {
  .series-info-compact { padding: 14px; }
  .sic-poster { width: 72px; }
  .sic-title { font-size: 18px; }
}

/* === v3 B: series share row === */
/* v3 B — RESTORE v1 series-page structure (revert v2 A1). The ≤880px rules
   above shrink the poster to a 96px thumb beside the title (grid 96px 1fr,
   gap 16px) and drop the billboard to 140px; v1 — the layout the user
   verified as good — stacks a 280px poster above the info under a 200px
   billboard. This block sits later in the file at equal specificity, so it
   wins over the v2 rules. (.detail-overlap -110px is identical in v1/v2,
   no override needed.) */
@media (max-width: 880px) {
  .detail-head, .detail-grid { grid-template-columns: 1fr; gap: clamp(28px, 5vw, 62px); }
  .detail-poster { width: 280px; max-width: 280px; }
  .detail-billboard { min-height: 200px; }
}
/* v3 B — SHARE ROW: one clean, organized row. Replaces the v2 single
   horizontal scroll row (.share-row { flex-wrap: nowrap; overflow-x: auto; }
   above) and the "Share:" label that sat inside it (removed from the
   markup in frontend.php). The 4 actions — WhatsApp / Facebook / Copy link /
   Share — are equal-width columns via grid-auto-flow: column +
   grid-auto-columns: 1fr, so the row stays equal-width whether the native
   Share button is shown (4 cols, navigator.share supported) or stays hidden
   (3 cols). The .cta-row.share-row selector (0,2,0) overrides both the
   inline .cta-row { display: flex; } in frontend.php's <style> and the v2
   .share-row scroll rules. Buttons get consistent height/padding and the
   same visual weight; "Copied!" feedback text is shorter than "Copy link",
   so it fits the same column. */
.cta-row.share-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 8px;
  overflow: visible;
}
.cta-row.share-row .btn {
  min-width: 0;
  padding: 11px 4px;
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* v3 B — safety net for very narrow screens (≤360px): 4 columns would
   squeeze "WhatsApp" below its readable width, so fall back to a clean
   2×2 grid. At 390px the 4-column row above applies. */
@media (max-width: 360px) {
  .cta-row.share-row { grid-auto-flow: row; grid-template-columns: 1fr 1fr; }
}

/* === v3 C: header/nav/avatar === */
/* Compact 40px circular avatar button replacing the old full-name pill
   (#accountBtn + #accountName). The ID-qualified selectors below beat
   .btn (padding 12px 24px, min-height 44px) and the <=480px
   .header-actions .btn rule, so the button stays 40px at every width —
   the 390px header (hamburger + brand + icon-only app button + avatar)
   still fits. The <img> is filled by AFWeb.renderAuth() from
   user.avatarUrl (else the avatarId image at /assets/avatars/avN.png);
   .avatar-fallback is the person icon when there is no avatar. NOTE:
   the [hidden] rule is required — an author display value would
   otherwise beat the UA [hidden] display:none. */
#accountBtn.avatar-btn {
  width: 40px; height: 40px; min-height: 40px; flex: none;
  padding: 0; border-radius: 50%; overflow: hidden;
}
#accountBtn.avatar-btn .avatar-img { width: 100%; height: 100%; object-fit: cover; }
#accountBtn.avatar-btn .avatar-img[hidden] { display: none; }
#accountBtn.avatar-btn .avatar-fallback { display: inline-flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
#accountBtn.avatar-btn .avatar-fallback .ic { width: 20px; height: 20px; }
/* Desktop fit (scoped >=981px ONLY, so it cannot leak into the <=980px
   180px / <=700px 170px / <=480px overlay search widths): the new
   Library nav link (+~81px) is paid for by the pill -> 40px avatar
   swap (-~75px); the nav gap and search shrink a touch so the full
   header still fits from 981px (M1a measured 893px content vs 903px
   available at 981px). */
@media (min-width: 981px) {
  .site-nav { gap: 18px; }
  .header-search .search-input { width: 200px; }
}

/* Recommendation popup (v3 D addition, watch.php #recoPopup): non-modal
   top card, shown once per series on episode 3+. Fixed at the TOP
   (below the sticky 64px header) so it never covers the player
   controls, which sit at the player's bottom. It never pauses the
   video and never intercepts taps outside the card (outside-tap close
   is a document click listener that does not cancel the tap).
   z-index 95: above header (40) / tab bar (50) / drawer (90), below
   the auth modal (100). */
.reco-popup { position: fixed; top: 76px; left: 50%; transform: translateX(-50%); width: calc(100% - 32px); max-width: 480px; z-index: 95; background: var(--bg-elev-1); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px 16px; box-shadow: 0 20px 60px rgba(0, 0, 0, .65); }
.reco-close { position: absolute; top: 10px; right: 12px; background: none; border: none; color: var(--text-muted); font-size: 24px; line-height: 1; cursor: pointer; padding: 4px 6px; }
.reco-title { font: 800 19px/1.25 var(--font-display); letter-spacing: -.02em; margin: 0 0 10px; padding-right: 28px; }
.reco-item { margin-top: 12px; }
.reco-item p { color: var(--text-muted); font-size: 14px; line-height: 1.5; margin: 0 0 8px; }
.reco-item p b { color: var(--text); }
.reco-item .btn { width: 100%; }
@media (max-width: 640px) {
  .reco-popup { top: 72px; padding: 16px 16px 14px; }
}

/* === v3 A: hero/cards/CW/toast === */
/* ITEM 1b — hero backdrop must show NO legible text: the old blur(8px)
   brightness(.5) still left baked-in poster titles (e.g. DRIVING
   DESIRE) readable twice behind the real title. Much stronger blur +
   darkening, a darker gradient, and a uniform scrim (::after sits
   above the art/gradient, below the content at z-index 2). */
.hero-art { filter: blur(20px) brightness(.35); transform: scale(1.25); }
.hero-gradient {
  background:
    linear-gradient(90deg, rgba(20, 20, 20, .92), rgba(20, 20, 20, .45) 60%, rgba(20, 20, 20, .25)),
    linear-gradient(180deg, rgba(20, 20, 20, .6) 0%, rgba(20, 20, 20, .35) 30%, rgba(20, 20, 20, .6) 55%, rgba(20, 20, 20, .92) 80%, var(--bg) 100%);
}
.hero::after { content: ""; position: absolute; inset: 0; z-index: 1; background: rgba(20, 20, 20, .35); pointer-events: none; }
/* ITEM 8a — card badges: ONE strip, max 2 pills (TOP 10 > NEW > HOT >
   FREE, capped server-side in af_card_html), pinned to the poster's
   top edge so it never covers title art. Pills are static in-flow
   flex children — the old absolute pile-up (TOP 10 + NEW + HOT +
   FREE stacked over the artwork) cannot happen. space-between puts
   two pills at opposite corners (TOP 10 left / FREE right, as
   before); a lone FREE is pushed right by margin-left:auto. */
.card-badge-strip { position: absolute; top: 8px; left: 8px; right: 8px; z-index: 2; display: flex; flex-wrap: wrap; gap: 6px; justify-content: space-between; pointer-events: none; }
.card-badge-strip .badge-top10, .card-badge-strip .badge-new, .card-badge-strip .badge-hot, .card-badge-strip .badge-free { position: static; }
.card-badge-strip .badge-free:only-child { margin-left: auto; }
/* ITEM 8a — rank numeral: small dark corner chip (20px) at the
   poster's bottom-left, replacing the 56px numeral that sprawled
   over the artwork. Scoped to .card-poster-wrap so the ranked-list
   (44px) and .ep-cell (static 20px) numerals are untouched. */
.card-poster-wrap .rank-num { left: 8px; bottom: 8px; font-size: 20px; line-height: 1; padding: 5px 10px; background: rgba(0, 0, 0, .72); border: 1px solid var(--line); border-radius: var(--r-pill); text-shadow: none; }
/* ITEM 8b — Continue Watching Remove: a chip ON its own poster
   (bottom-right corner of .card-poster-wrap), so it can never read
   as a detached text row or slip under the tab bar. Sibling of the
   poster link, never nested inside it. */
.card-poster-wrap .cw-remove { position: absolute; right: 8px; bottom: 8px; z-index: 3; min-height: 36px; padding: 6px 12px; background: rgba(0, 0, 0, .72); border: 1px solid var(--line); border-radius: var(--r-pill); color: #fff; font: 700 12px/1.2 var(--font-sans); cursor: pointer; }
.card-poster-wrap .cw-remove:hover { background: rgba(0, 0, 0, .88); }
.card-poster-wrap .cw-remove:active { opacity: .8; }
/* ITEM 8c — library-save toast: fixed at the bottom of the viewport,
   ABOVE the tab bar (56px + safe-area + 16px gap), centred, never
   covering episode rows mid-screen. pointer-events:none so it never
   blocks taps; .show fades it in, JS removes .show after 2.8s.
   z-index 96: above tab bar (40) / drawer (90) / reco-popup (95),
   below the auth modal (100). */
#af-toast { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 16px); transform: translateX(-50%) translateY(8px); z-index: 96; max-width: calc(100% - 32px); background: var(--bg-elev-1); border: 1px solid var(--line); border-radius: var(--r-pill); color: var(--text); font: 600 14px/1.4 var(--font-sans); padding: 12px 18px; box-shadow: 0 12px 32px rgba(0, 0, 0, .5); opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; text-align: center; }
#af-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* === v3 coordinator: header fit 981-1050px === */
/* At the desktop breakpoint's lower edge the 6-link nav + 200px search +
   "Get the app" + Log in/avatar overflow the viewport (measured: actions
   right edge 1047px logged-out / 1003px logged-in at 981px; logged-out
   still 1047px at 1024px). The app button collapses to the same refined
   44px icon treatment as at ≤480px — saving ~118px, so every nav
   destination stays and the app button stays. */
@media (min-width: 981px) and (max-width: 1050px) {
  .header-app-btn {
    width: 44px; height: 44px; padding: 0; border-radius: 12px;
    background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .16);
  }
  .header-app-btn .btn-label { display: none; }
}

/* ===== v4: DROPDOWN+MODAL ===== */
/* Worker C — profile dropdown + login/register modal redesign (look only).
   Root cause of the reported breakage: layout.php's dropdown and modal
   panel used inline background:var(--panel), but --panel is defined only
   by the af_base_css() shim, which the home page (frontend.php) never
   emits — so the backgrounds resolved to transparent, hero/grid text
   bled through, and the plain <a> items kept the browser's default
   underline. The fix moves all visuals into these rules with literal
   #1f1f1f fallbacks, so the surfaces are solid even where a token is
   missing. Only `display` stays inline in the markup: the toggle JS
   clears/sets style.display, and these rules supply display when open. */

/* --- Profile dropdown: solid opaque card anchored under the avatar --- */
#accountMenu.account-menu { position: relative; display: inline-flex; align-items: center; }
/* inline-flex (not the old stretch) so the wrapper hugs the 40px avatar
   button: the dropdown's top:calc(100% + 8px) then sits exactly 8px
   below the button. NOTE: renderAuth() clears the inline display when
   logged in, so this stylesheet display is what applies when open;
   the inline display:none still hides it while logged out. */
#accountDropdown.account-dropdown {
  display: block;
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 70;
  min-width: 230px; max-width: calc(100vw - 32px);
  padding: 6px;
  background: #1f1f1f;
  background: var(--bg-elev-1, #1f1f1f);
  border: 1px solid var(--line, rgba(255, 255, 255, .14));
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .6);
  overflow: hidden;
}
#accountDropdown .account-dropdown-item {
  display: flex; align-items: center; gap: 12px;
  min-height: 44px; padding: 10px 12px;
  border-radius: 10px;
  color: #fff;
  color: var(--text, #fff);
  font: 600 15px/1.4 var(--font-sans);
  text-decoration: none;
  white-space: nowrap;
}
#accountDropdown .account-dropdown-item .ic {
  width: 20px; height: 20px; flex: none;
  color: #b3b3b3;
  color: var(--text-muted, #b3b3b3);
}
#accountDropdown .account-dropdown-item:hover,
#accountDropdown .account-dropdown-item:focus-visible {
  background: rgba(255, 255, 255, .08);
  background: var(--alpha-08, rgba(255, 255, 255, .08));
  color: #fff;
  text-decoration: none;
  outline: none;
}
#accountDropdown .account-dropdown-item:focus-visible {
  outline: 2px solid #fff; outline-offset: -2px;
}
#accountDropdown .account-dropdown-item:active {
  background: rgba(255, 255, 255, .12);
}
/* Divider before the destructive actions. */
#accountDropdown #logoutLink {
  border-top: 1px solid var(--line, rgba(255, 255, 255, .14));
  margin-top: 6px;
  border-radius: 0 0 10px 10px;
}
#accountDropdown #logoutAllLink { color: #ffb3ba; }
#accountDropdown #logoutAllLink .ic { color: #ffb3ba; }

/* --- Auth modal: opaque panel, near-black backdrop, roomy spacing --- */
#authModal.auth-modal {
  /* Fully opaque black: even rgba(0,0,0,.98) left a whisper of the
     large hero title visible in the render, so no alpha below 1 meets
     "page content must not show through". */
  background: #000;
}
#authModal .auth-modal-panel {
  background: #1f1f1f;
  background: var(--bg-elev-1, #1f1f1f);
  border: 1px solid var(--line, rgba(255, 255, 255, .14));
  border-radius: 20px;
  max-width: 400px; width: 100%;
  padding: 32px 28px 28px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .65);
  box-shadow: var(--shadow-modal, 0 20px 60px rgba(0, 0, 0, .65));
}
#authModal .auth-modal-close {
  position: absolute; top: 12px; right: 12px;
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; padding: 0;
  background: none; border: none; border-radius: 50%;
  color: #b3b3b3;
  color: var(--text-muted, #b3b3b3);
  cursor: pointer;
}
#authModal .auth-modal-close:hover {
  background: rgba(255, 255, 255, .08);
  color: #fff;
}
#authModal .auth-tabs {
  display: flex; gap: 8px; margin-bottom: 24px;
  padding-right: 32px; /* clear the close button */
}
#authModal .auth-tabs .btn { flex: 1; min-height: 48px; }
#authModal .auth-google-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 48px;
  background: #fff; color: #141414;
  margin-bottom: 16px; text-decoration: none;
  box-shadow: none;
}
#authModal .auth-google-btn:hover { background: rgba(255, 255, 255, .85); }
#authModal .auth-divider-text {
  font-size: 13px; line-height: 1.5;
  margin: 0 0 20px; text-align: center;
}
#authModal .field { margin-bottom: 18px; }
#authModal .field input { min-height: 48px; }
#authModal form .btn[type="submit"] {
  width: 100%; min-height: 48px; margin-top: 4px;
}
#authModal #loginError, #authModal #regError { margin: 10px 0 12px; }
/* "Forgot password?" on its own row; the app note on its own line below. */
#authModal .auth-forgot-row {
  margin: 18px 0 0; text-align: center;
  font-size: 14px; line-height: 1.5;
}
#authModal .auth-forgot-row a {
  color: #fff; font-weight: 600; text-decoration: none;
}
#authModal .auth-forgot-row a:hover { text-decoration: underline; }
#authModal .auth-app-note {
  font-size: 13px; line-height: 1.5;
  margin: 6px 0 0; text-align: center;
}
#authModal .auth-app-note a {
  color: #fff; font-weight: 600; text-decoration: none;
}
#authModal .auth-app-note a:hover { text-decoration: underline; }
@media (max-width: 480px) {
  #authModal.auth-modal { padding: 16px; }
  #authModal .auth-modal-panel { padding: 28px 20px 24px; }
  #accountDropdown.account-dropdown { min-width: 210px; }
}

/* ===== v4: PROFILE ===== */
/* Profile-page reorganization (Worker D, 2026-11-13): consistent section
   spacing, @handle display with copy button, Security sub-sections.
   APPENDED ONLY — no earlier rule in this file is edited in place;
   later rules with equal specificity override earlier ones. */
.acct-card { margin-bottom: 20px; }
.acct-facts dd { overflow-wrap: anywhere; }
/* Username: large @handle + copy affordance. */
.username-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.username-handle { font-size: 26px; font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; }
/* .btn-sm is defined in the v6 Buttons section above (38px / 16px /
   14px); the old v4 override (36px / 14px / 13px) was deleted. */
/* Security: one card, sub-sections divided by hairlines. */
.acct-security > h2 { margin-bottom: 16px; }
.acct-sec { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.acct-sec:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }
.acct-sec h3 { margin: 0 0 10px; font-size: 16px; }
.acct-sec-danger h3 { color: #ff8ba0; }
@media (max-width: 560px) {
  /* 4 stats fit 2x2 better than 3+1 at phone width. */
  .acct-stats { grid-template-columns: repeat(2, 1fr); }
  .username-handle { font-size: 24px; }
}

/* ===== v4: HERO ===== */
/* Worker B (2026-11-13): retune the v3 hero treatment — the v3 stack
   (blur(20px) brightness(.35) + .92/.45/.25 gradients + .35 scrim)
   multiplied the loaded poster down to ~2% luminance, so the hero
   read as solid black behind the title (confirmed in a real
   loaded-cover render of Driving Desire). The blur is what hides the
   poster's baked-in title text, so it STAYS at 20px (with the 1.25
   scale that hides the blur's edge bleed); only the light is raised:
   brightness .35 -> .85, gradients lightened, scrim .35 -> .10.
   Text legibility is kept by the 90deg left darkening (.60, where the
   text column sits) and the 180deg bottom darkening (.60 at 82%),
   while the right side and upper band (.05 / transparent) let the
   poster read clearly. APPENDED ONLY — no earlier rule edited. */
.hero-art { filter: blur(20px) brightness(.85); transform: scale(1.25); }
.hero-gradient {
  background:
    linear-gradient(90deg, rgba(20, 20, 20, .60), rgba(20, 20, 20, .20) 60%, rgba(20, 20, 20, .05)),
    linear-gradient(180deg, rgba(20, 20, 20, .10) 0%, transparent 25%, transparent 55%, rgba(20, 20, 20, .60) 82%, var(--bg) 100%);
}
.hero::after { content: ""; position: absolute; inset: 0; z-index: 1; background: rgba(20, 20, 20, .10); pointer-events: none; }
@media (max-width: 700px) {
  /* v4: keep BOTH gradient layers on phones too — the old <=700px rule
     dropped the 90deg layer, which would leave the white title/desc
     over the brightened image with nothing behind them. Same values
     as the desktop stack above; this block is last, so it wins. */
  .hero-gradient {
    background:
      linear-gradient(90deg, rgba(20, 20, 20, .60), rgba(20, 20, 20, .20) 60%, rgba(20, 20, 20, .05)),
      linear-gradient(180deg, rgba(20, 20, 20, .10) 0%, transparent 25%, transparent 55%, rgba(20, 20, 20, .60) 82%, var(--bg) 100%);
  }
}

/* ==================================================================
   v6 merged partials (coordinator assembly 2026-11-13): library card
   redesign + account page redesign. Appended after all shared rules.
   ================================================================== */
/* ==========================================================================
   AuraFlicks — Library page, v6 card redesign.
   MERGE: append to assets/css/app.css AFTER the shared .card / .grid /
   .btn rules (equal-specificity overrides below rely on later position).
   Everything is scoped to .lib, so no other page is affected.
   Depends on the v6 button system (.btn / .btn-primary / .btn-ghost /
   .btn-sm) and the shared .card / .badge-free / .progress-track rules.
   Tokens: Netflix Red #E50914, canvas #141414, Figtree only. No emoji.
   ========================================================================== */

/* ---- Login wall -------------------------------------------------------- */
.lib #needLogin {
  max-width: 560px;
  margin: 0 auto;
  text-align: center;
  padding: 60px 20px;
}
.lib-wall-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin-bottom: 20px;
  border-radius: 50%;
  background: rgba(229, 9, 20, .12);
  border: 1px solid rgba(229, 9, 20, .35);
  color: #f6121d;
}
.lib-wall-icon .ic { width: 28px; height: 28px; }

/* ---- Section heads ----------------------------------------------------- */
/* Copy is unchanged. A hairline under each head gives the two sections a
   deliberate separation instead of headings floating over the lists. */
.lib .section-head {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.lib .section-head p { margin-top: 6px; }

/* ---- Continue Watching rail -------------------------------------------- */
.lib .row-track { padding-left: 0; padding-right: 0; scroll-padding: 0; }
.lib .card .progress-track { margin: 8px 0 0; }
.lib .card-title { margin-top: 2px; }

/* ---- My Library: horizontal rows --------------------------------------- */
/* The grid becomes a list — one column on phones, two columns of
   horizontal cards on desktop. A saved drama is a row: thumb on the
   left, title / meta / actions on the right, so the two actions always
   sit on one calm baseline instead of fighting for space under a poster. */
.lib #libGrid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
/* v10 extension: the library-list ad row spans the full width of
   #libGrid (1 col on phone, 2 cols on desktop) after every 8th
   saved drama. */
.lib .lib-ad-row { grid-column: 1 / -1; }
@media (min-width: 900px) {
  .lib #libGrid { grid-template-columns: 1fr 1fr; gap: 16px; }
}

.lib .lib-card {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 14px;
  padding: 12px;
  background: var(--bg-elev-1);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.lib .lib-card:hover { border-color: var(--line-strong); }

/* Poster thumb: fixed 2:3 thumb that stretches to the card height, so
   the art always fills the row. The FREE badge anchors to this wrap
   (the .card-poster-wrap pattern from rows.php), never to the card. */
.lib .lib-poster {
  position: relative;
  flex: 0 0 96px;
  width: 96px;
  align-self: stretch;
}
@media (min-width: 900px) {
  .lib .lib-poster { flex-basis: 112px; width: 112px; }
}
.lib .lib-poster-link {
  display: block;
  height: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-elev-2);
}
.lib .lib-poster img.card-poster {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  border: 0;
  border-radius: 0;
  object-fit: cover;
}
.lib .lib-poster .badge-free { top: 8px; right: 8px; }

/* Body: title, one meta line, actions pinned to the card's bottom edge
   so rows with one-line and two-line titles still line their buttons up. */
.lib .lib-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 2px 0;
}
.lib .lib-card .card-title { margin-top: 0; }
.lib .lib-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 8px;
  min-width: 0;
}
/* Dot separator only when both parts exist (adjacent-sibling guard:
   no genres, no stray leading dot). */
.lib .lib-meta .card-genres + .card-meta::before {
  content: "\00B7";
  margin-right: 8px;
  color: var(--text-faint);
}

/* Actions: two real buttons from the system, never a bare text link
   next to a pill. Stacked full-width on phones (thumb-friendly);
   side by side on desktop, Resume primary, Remove secondary — clearly
   secondary, same 38px height, 8px apart. */
.lib .lib-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
  padding-top: 10px;
}
.lib .lib-actions .btn { width: 100%; }
@media (min-width: 900px) {
  .lib .lib-actions { flex-direction: row; align-items: center; }
  .lib .lib-actions .btn { width: auto; flex: 0 0 auto; }
}

/* ---- Empty states ------------------------------------------------------ */
/* Structured blocks (icon + title + copy) instead of a bare muted line.
   :has() keeps the block full-width: #histList is a horizontal rail and
   #libGrid is two columns on desktop, and an empty block must span both. */
.lib #histList:has(.lib-empty) { display: block; }
.lib #libGrid:has(.lib-empty) { grid-template-columns: 1fr; }
.lib .lib-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  padding: 40px 20px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  background: var(--bg-elev-1);
}
.lib .lib-empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin-bottom: 8px;
  border-radius: 50%;
  background: var(--alpha-08);
  border: 1px solid var(--line);
  color: var(--text-muted);
}
.lib .lib-empty-icon .ic { width: 26px; height: 26px; }
.lib .lib-empty-title {
  font: 700 17px/1.3 var(--font-sans);
  color: var(--text);
}
.lib .lib-empty p.muted { font-size: 14px; }
.lib .lib-empty .btn { margin-top: 12px; }

/* ==========================================================================
   AuraFlicks — Account page visual redesign (website-fix v6, Worker 3).
   MERGE NOTE (coordinator): append this whole file to assets/css/app.css,
   AFTER the existing .acct rules (v2 + v3 E + v4 blocks). Every rule below
   is prefixed with `.acct` so it outranks the earlier equal rules at any
   merge position. It assumes the v6 button system from the button worker
   (.btn base, .btn-primary, .btn-secondary, .btn-ghost, .btn-danger,
   .btn-sm) — it defines NO button styles of its own.
   Tokens: Netflix Red #E50914, canvas #141414, Figtree only, no emoji.
   Behaviour/copy meaning unchanged; only layout, spacing and wording
   tightness change. All #ids and class hooks used by account.php JS are
   preserved (.avatar-pick.is-selected, #usernameValue, #googleLinkedValue,
   .acct-msg, .acct-sec, .acct-sec-danger, .acct-stats, .acct-facts).
   ========================================================================== */

/* ---- Page column: one narrow settings column, not a full-width stack. --- */
/* Centred: .section's `margin: ... 0` shorthand zeroes the .wrap auto
   margins, so the 680px column sat left-aligned at desktop width. */
.acct { max-width: 680px; margin-left: auto; margin-right: auto; }

/* ---- Header: eyebrow + name + email + provider pill, hairline below. --- */
.acct .acct-head {
  gap: 20px;
  align-items: center;
  margin: 4px 0 8px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.acct .acct-eyebrow {
  margin: 0 0 6px;
  font: 800 12px/1.4 var(--font-sans);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent-hover);
}
.acct .acct-head h1 { letter-spacing: -.03em; }
.acct .acct-head .acct-email { font-size: 15px; }
.acct .acct-avatar {
  width: 88px;
  height: 88px;
  border: 2px solid var(--line-strong);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
}
.acct .acct-provider {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--alpha-08);
  color: var(--text-muted);
  font: 700 11px/1.6 var(--font-sans);
  letter-spacing: .1em;
  text-transform: uppercase;
}

/* ---- Cards: one consistent treatment, clear title + one-line sub. ------ */
.acct .acct-card {
  padding: 24px;
  margin-bottom: 16px;
  border-radius: 20px;
  box-shadow: var(--shadow-card);
}
.acct .acct-card-head { margin-bottom: 20px; }
.acct .acct-card-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.02em;
}
.acct .acct-card-sub {
  margin: 6px 0 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-muted);
  max-width: 56ch;
}
/* Cards without a .acct-card-head keep the old h2 spacing sane. */
.acct .acct-card > h2 { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.acct .acct-msg { margin: 0 0 16px; }
.acct .acct-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.acct .acct-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 12px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
}
.acct .acct-note .ic { width: 16px; height: 16px; flex: none; margin-top: 1px; }

/* ---- Avatar picker: deliberate selected state, not just a red ring. ---- */
.acct .avatar-grid {
  grid-template-columns: repeat(5, 72px);
  gap: 12px;
}
.acct .avatar-pick {
  position: relative;
  width: 72px;
  height: 72px;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--bg);
  overflow: visible;
  transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.acct .avatar-pick img { border-radius: 50%; }
.acct .avatar-pick:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.acct .avatar-pick:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.acct .avatar-pick.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px rgba(229, 9, 20, .25);
}
.acct .avatar-check {
  position: absolute;
  right: -3px;
  bottom: -3px;
  display: none;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--bg-elev-1);
  background: var(--accent);
  color: #fff;
}
.acct .avatar-check .ic { width: 14px; height: 14px; }
.acct .avatar-pick.is-selected .avatar-check { display: inline-flex; }
.acct .avatar-hint { margin: 12px 0 0; font-size: 13px; color: var(--text-muted); }

/* ---- Fields: inset canvas inputs on the card, 48px, red focus ring. ---- */
.acct .field { margin-bottom: 18px; }
.acct .field:last-of-type { margin-bottom: 0; }
.acct .field label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--text);
  margin-bottom: 8px;
}
.acct .field label small { color: var(--text-muted); font-weight: 600; }
.acct .field input,
.acct .field textarea {
  min-height: 48px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  background: var(--bg);
}
.acct .field textarea { min-height: 88px; resize: vertical; line-height: 1.5; }
.acct .field input:focus,
.acct .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(229, 9, 20, .25);
}
/* @-prefixed username input: one inset field, @ as a fixed adornment. */
.acct .acct-prefix-input {
  display: flex;
  align-items: center;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.acct .acct-prefix-input > span {
  flex: none;
  padding-left: 16px;
  color: var(--text-faint);
  font-weight: 700;
  font-size: 15px;
}
.acct .acct-prefix-input input {
  min-height: 46px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding-left: 4px;
}
.acct .acct-prefix-input:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(229, 9, 20, .25);
}
.acct .acct-prefix-input input:focus { border-color: transparent; box-shadow: none; }

/* ---- Username: handle in an inset box, actions to the right. ----------- */
.acct .username-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
}
.acct .username-handle { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.acct .acct-change-row { margin: 14px 0 0; }

/* ---- Account details: roomier rows, values carry the weight. ----------- */
.acct .acct-facts { margin: 4px 0 0; }
.acct .acct-facts > div {
  align-items: baseline;
  padding: 14px 0;
}
.acct .acct-facts dt { font-size: 14px; }
.acct .acct-facts dd {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.acct .acct-facts dd.acct-fact-id { font-size: 14px; font-weight: 600; color: var(--text-muted); }

/* ---- Watch stats: inset tiles, big number, small caps label. ----------- */
.acct .acct-stats { gap: 12px; margin-top: 4px; }
.acct .acct-stats > div {
  padding: 18px 8px 16px;
  border-radius: 14px;
  background: var(--bg);
}
.acct .acct-stats b {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1;
}
.acct .acct-stats span {
  margin-top: 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  line-height: 1.4;
  text-transform: uppercase;
}
.acct .acct-stats-foot { margin: 16px 0 0; }

/* ---- Security sub-sections: hairline-divided, even rhythm. ------------- */
.acct .acct-security > h2 { margin-bottom: 20px; }
.acct .acct-sec { margin-top: 24px; padding-top: 24px; }
.acct .acct-sec:first-of-type { margin-top: 0; padding-top: 0; }
.acct .acct-sec h3 { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.acct .acct-sec .acct-sec-sub { margin: 0 0 16px; font-size: 14px; line-height: 1.55; color: var(--text-muted); }
.acct .acct-sec .acct-sec-note { font-size: 13px; line-height: 1.5; color: var(--text-muted); margin: 16px 0 0; }
.acct .acct-sec .acct-sec-note .btn { margin-left: 4px; vertical-align: middle; }

/* Google link status: dot + label + value, colour follows the state. */
.acct .acct-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  font-size: 15px;
}
.acct .acct-status-dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-faint);
}
.acct .acct-status[data-linked="true"] .acct-status-dot { background: var(--green); }
.acct .acct-status .acct-status-label { color: var(--text-muted); }
.acct .acct-status b { font-weight: 700; }
.acct #googleBtnWrap { min-height: 40px; }

/* Danger zone: boxed red-tinted area, not just a red heading. */
.acct .acct-sec.acct-sec-danger {
  margin-top: 24px;
  padding: 20px;
  border: 1px solid rgba(229, 9, 20, .28);
  border-radius: var(--r-lg);
  background: rgba(229, 9, 20, .06);
}
.acct .acct-sec-danger h3 { color: #ff8ba0; }
.acct .acct-sec-danger .acct-sec-sub { margin-bottom: 16px; }

/* ---- Logged-out state: centred, same column. ---------------------------- */
.acct #needLogin { padding: 72px 20px; }

/* ---- Phone: 5-across avatars, 2x2 stats, full-width primary save. ------ */
@media (max-width: 560px) {
  .acct .acct-head { gap: 16px; padding-bottom: 20px; }
  .acct .acct-avatar { width: 72px; height: 72px; }
  .acct .acct-card { padding: 20px 16px; border-radius: 18px; }
  .acct .avatar-grid { grid-template-columns: repeat(5, 1fr); gap: 10px; }
  .acct .avatar-pick { width: 100%; height: auto; aspect-ratio: 1; }
  .acct .avatar-check { width: 22px; height: 22px; }
  .acct .acct-stats { grid-template-columns: repeat(2, 1fr); }
  .acct .username-handle { font-size: 22px; }
  .acct .username-box { padding: 14px 16px; }
  .acct .acct-save-row .btn-primary { flex: 1; }
  .acct .acct-sec.acct-sec-danger { padding: 16px; }
}
