/* AniSlate — AniList-inspired theme, distinct identity.
   Two full themes driven by CSS variables on <html data-theme>:
   dark (default) and light. Every color in this file goes through a
   variable so both themes stay polished and readable. */

:root {
  /* pure-black (OLED) dark theme: page and panels all the way down */
  --bg: #000000;
  --bg-2: #000000;
  --panel: #0a0a0c;
  --panel-2: #151518;
  --line: #23232a;
  --text: #dbe7ee;
  --text-dim: #b9c9d4;
  --muted: #7a8b99;
  --accent: #02a9ff;
  --accent-2: #3db4f5;
  --on-accent: #04121d;      /* text on solid accent surfaces */
  --green: #02e676;
  --red: #ff6b81;
  --chip-bg: rgba(0, 0, 0, .82);
  --topbar-bg: rgba(0, 0, 0, .92);
  --backdrop: rgba(0, 0, 0, .72);
  --hero-fade: rgba(0, 0, 0, .15);
  --radius: 8px;
  --shadow: 0 8px 30px rgba(0, 0, 0, .45);
  --sk-a: var(--panel);
  --sk-b: var(--panel-2);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html[data-theme="light"] {
  --bg: #f4f7fb;
  --bg-2: #e8eef6;
  --panel: #ffffff;
  --panel-2: #eef2f8;
  --line: #dbe3ee;
  --text: #17222e;
  --text-dim: #3c4b5a;
  --muted: #64748a;
  --accent: #0286d4;
  --accent-2: #0273b8;
  --on-accent: #ffffff;
  --green: #05965a;
  --red: #d63c56;
  --chip-bg: rgba(255, 255, 255, .88);
  --topbar-bg: rgba(244, 247, 251, .92);
  --backdrop: rgba(20, 30, 45, .45);
  --hero-fade: rgba(244, 247, 251, .1);
  --shadow: 0 8px 26px rgba(23, 34, 46, .14);
  --sk-a: #e6ecf4;
  --sk-b: #f2f5fa;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; overflow-x: hidden; }
/* pull-to-refresh off on the ROOT scroller. It must NOT sit on <body>:
   `html{overflow-x:hidden}` + `body{overscroll-behavior-y:none}` breaks
   TOUCH scrolling on Android entirely (wheel/programmatic still work). */
html { overscroll-behavior-y: none; }
/* Root-level scroll lock (a body-only lock is ignored once <html> has
   overflow-x: hidden — the viewport keeps scrolling behind the modal). */
html.lock, html.lock body { overflow: hidden; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  min-height: 100dvh;            /* mobile URL bar / webview: bottom stays reachable */
  transition: background .25s ease, color .25s ease;
}
a { color: var(--accent-2); text-decoration: none; }
img { display: block; max-width: 100%; }

#app { max-width: 1180px; margin: 0 auto; padding: 0 16px;
       min-height: 100vh; min-height: 100dvh;
       display: flex; flex-direction: column; }

/* ── top bar ── */
.topbar { position: sticky; top: 0; z-index: 30;
  background: var(--topbar-bg); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line); margin: 0 -16px;
  padding-top: var(--safe-top); }
.topbar-inner { max-width: 1180px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 18px; min-width: 0; }
.brand { font-size: 21px; font-weight: 800; letter-spacing: .4px;
  color: var(--text); display: flex; align-items: center; gap: 9px;
  flex: 0 0 auto; }
.brand span { color: var(--accent); }
/* the name is ONE flex item so "AniSlate" stays a tight word — the
   flex gap only separates it from the logo */
.brand .word { color: var(--text); }
.brand-logo { width: 28px; height: 28px; border-radius: 8px; flex: 0 0 auto; }
.tabs { display: flex; gap: 4px; flex: 1 1 auto; min-width: 0;
  overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { color: var(--muted); font-weight: 600; font-size: 14px; white-space: nowrap;
  padding: 8px 14px; border-radius: var(--radius); transition: color .15s, background .15s; }
.tab:hover { color: var(--text); background: var(--panel); }
.tab.active { color: var(--text); background: var(--panel); }
.topbar-right { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.me-wrap { position: relative; }
.me { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted);
  min-width: 0; cursor: pointer; }
.me span { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me img { width: 28px; height: 28px; border-radius: 50%; flex: 0 0 auto; }
.me-fb { width: 28px; height: 28px; border-radius: 50%; flex: 0 0 auto;
  background: var(--panel-2); color: var(--accent-2); font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; }
.me-pop { position: absolute; right: 0; top: calc(100% + 12px); z-index: 45;
  min-width: 205px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px;
  animation: fade .15s ease; }
.me-pop .who { display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
  min-width: 0; }
.me-pop .who img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover;
  background: var(--panel-2); flex: 0 0 auto; }
.me-pop .who .nm { font-size: 13.5px; font-weight: 700; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.me-pop .who .un { font-size: 12px; color: var(--muted); }
.me-pop .btn { width: 100%; }

/* theme toggle */
.theme-toggle { width: 34px; height: 34px; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel); color: var(--accent-2);
  display: flex; align-items: center; justify-content: center;
  transition: transform .2s ease, background .15s, color .15s, border-color .15s;
  flex: 0 0 auto; padding: 0; }
.theme-toggle:hover { transform: rotate(15deg) scale(1.06); color: var(--accent); }
.theme-toggle .ic-sun { display: none; }
html[data-theme="light"] .theme-toggle .ic-sun { display: block; }
html[data-theme="light"] .theme-toggle .ic-moon { display: none; }

/* ── view / sections ── */
.view { flex: 1; padding: 20px 0 40px; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.section-head { display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; margin: 6px 0 14px; flex-wrap: wrap; }
.section-head h2 { font-size: 19px; font-weight: 700; margin: 0; }
.section-head .sub { color: var(--muted); font-size: 12.5px; }

/* ── featured slider (top-airing) ── */
/* full-bleed scroller: -16px matches #app's side padding so slides run
   to the screen edge; scroll-snap + the soft mask fade are the "more
   this way" affordance — pure CSS, no JS scroll listeners. */
.featwrap { margin: 4px 0 18px; }
.featwrap:empty { display: none; margin: 0; }
.feat { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
  margin: 0 -16px; padding: 2px 16px 6px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 16px,
    #000 calc(100% - 16px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 16px,
    #000 calc(100% - 16px), transparent); }
.feat::-webkit-scrollbar { display: none; }
.fslide { flex: 0 0 148px; scroll-snap-align: start; position: relative;
  aspect-ratio: 2 / 3; border-radius: var(--radius); overflow: hidden;
  background: var(--panel); box-shadow: var(--shadow); cursor: pointer;
  transition: transform .18s ease; }
.fslide:hover { transform: translateY(-4px); }
.fslide:active { transform: scale(.97); }
.fslide img { position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; z-index: 1; background: none; animation: none; }
.fslide .noimg { position: absolute; inset: 0; z-index: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 11.5px; text-align: center; padding: 8px; }
.fslide .fmeta { position: absolute; inset: auto 0 0 0; z-index: 2;
  padding: 26px 9px 8px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .93)); }
html[data-theme="light"] .fslide .fmeta {
  background: linear-gradient(transparent, rgba(255, 255, 255, .94)); }
.fslide .ftitle { font-size: 11.5px; font-weight: 700; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; }
.fslide .fbadge { position: absolute; left: 7px; top: 7px; z-index: 2; }
.fslide .fscore { position: absolute; right: 7px; top: 7px; z-index: 2;
  font-size: 10.5px; font-weight: 700; padding: 3px 7px; border-radius: 4px;
  background: var(--chip-bg); color: var(--accent-2); }

/* ── poster grid ── */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 18px 14px; }
.card { cursor: pointer; transition: transform .18s ease; min-width: 0; }
.card:hover { transform: translateY(-4px); }
.card .poster { position: relative; border-radius: var(--radius); overflow: hidden;
  background: var(--panel); aspect-ratio: 2/3; box-shadow: var(--shadow); }
.card .poster img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s ease;
  /* sits ABOVE the title underlay; no own background — until the pixels
     arrive the title shows through instead of a dead black rectangle */
  position: relative; z-index: 1; background: none; animation: none; }
.card:hover .poster img { transform: scale(1.05); }
.card .poster .noimg { position: absolute; inset: 0; z-index: 0;
  display: flex; align-items: center;
  justify-content: center; color: var(--muted); font-size: 12px; text-align: center; padding: 8px; }
/* shimmer placeholder only for imgs WITHOUT a title underlay (avatars,
   schedule rows); hides itself the moment the bitmap paints */
img[data-fb]:not(.cvr) { background: linear-gradient(100deg, var(--panel) 25%, var(--chip-bg) 50%, var(--panel) 75%);
  background-size: 200% 100%; animation: img-load 1.4s linear infinite; }
@keyframes img-load { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
  img[data-fb] { animation: none; }
  .sk-card::after, .sk::after { animation: none; }
}
.badge { position: absolute; left: 6px; top: 6px; z-index: 2; display: flex; gap: 4px; flex-wrap: wrap;
  max-width: calc(100% - 12px); }
.chip { font-size: 10.5px; font-weight: 700; padding: 3px 7px; border-radius: 4px;
  background: var(--chip-bg); color: var(--accent-2); }
/* no backdrop-filter here (or .store-chip/.modal-close):24 cards ×2
   chips = up to48 blur surfaces — each re-blurs whatever scrolls beneath
   it on the GPU, a known jank source on budget Android webviews. The
   chip background is82% opaque; the blur was invisible anyway. */
.chip.res { color: var(--green); }
.card .meta { padding: 8px 2px 0; min-width: 0; }
.card .t { font-size: 13.5px; font-weight: 600; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .s { color: var(--muted); font-size: 12px; margin-top: 2px; }
.score { color: var(--green); font-weight: 700; }

/* ── schedule ── */
.daytabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 10px;
  scrollbar-width: none; }
.daytabs::-webkit-scrollbar { display: none; }
.daytab { flex: 0 0 auto; padding: 7px 14px; border-radius: 999px; font-size: 13px;
  font-weight: 600; color: var(--muted); background: var(--panel); border: 1px solid transparent;
  cursor: pointer; transition: all .15s; }
.daytab.active { color: var(--on-accent); background: var(--accent); }
.sched-row { display: flex; align-items: center; gap: 12px; padding: 11px 12px;
  border-radius: var(--radius); background: var(--panel); margin-bottom: 8px;
  transition: background .15s; min-width: 0; }
.sched-row:hover { background: var(--panel-2); }
.sched-row img { width: 42px; height: 58px; object-fit: cover; border-radius: 6px;
  flex: 0 0 auto; background: var(--panel-2); }
.sched-time { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--accent-2);
  min-width: 46px; flex: 0 0 auto; }
.sched-title { flex: 1 1 auto; min-width: 0; font-weight: 600; font-size: 14px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sched-title a { color: var(--text); }
.sched-page { font-size: 12px; color: var(--muted); }
.ok { color: var(--green); font-weight: 700; flex: 0 0 auto; }
/* rows joined to one of our shows open the home-style detail sheet */
.sched-row.link { cursor: pointer; }
.sched-row.link:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
/* episode-precise mark context — "EP 03" beside the ✅, like the channel */
.sched-ep { font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--muted); background: var(--panel-2); padding: 3px 6px;
  border-radius: 4px; flex: 0 0 auto; }

/* ── search ── */
.searchbar { display: flex; gap: 8px; margin-bottom: 18px; }
.searchbar input { flex: 1 1 auto; min-width: 0; background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text); border-radius: var(--radius); padding: 11px 14px; font-size: 15px;
  outline: none; transition: border .15s; }
.searchbar input:focus { border-color: var(--accent); }
.searchbar button { background: var(--accent); border: 0; color: var(--on-accent);
  font-weight: 700; border-radius: var(--radius); padding: 0 18px; cursor: pointer; }
.store-chip { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 3px 7px;
  border-radius: 4px; background: var(--chip-bg); color: var(--green); }

/* ── modal (media page) ── */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center;
  justify-content: center; }
.modal-backdrop { position: absolute; inset: 0; background: var(--backdrop);
  backdrop-filter: blur(3px); animation: fade .15s ease; }
.modal-sheet { position: relative; width: min(880px, 100%);
  max-height: 92vh; max-height: 92dvh;
  overflow-y: auto; overflow-x: hidden; background: var(--bg); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow); animation: pop .18s ease; }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(8px); } to { opacity: 1; transform: none; } }
.modal-sheet::-webkit-scrollbar { width: 8px; }
.modal-sheet::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }

.hero { position: relative; height: 200px; overflow: hidden; }
.hero img { width: 100%; height: 100%; object-fit: cover; }
/* No AniList banner for this show → the hero is built from the MAL
   image or cover art: scaled slightly and softly blurred so the tall
   poster fills the wide strip; the same fade gradient melts it into
   the page. Kept light so the artwork stays recognizable. */
.hero-blur img { transform: scale(1.25); filter: blur(8px); }
.hero::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, var(--hero-fade) 0%, var(--bg) 96%); }
.modal-close { position: absolute; right: 12px; top: 12px; z-index: 2;
  width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--chip-bg); color: var(--text); font-size: 16px; line-height: 1; }

.m-head { display: flex; gap: 18px; padding: 0 22px; margin-top: -90px; position: relative;
  z-index: 1; min-width: 0; }
/* No hero banner above (media missing / MAL fallback): the -90px pull
   would slide the head under the sheet's top edge and clip the cover
   ("profile pic in half") — sit flush below the ✕ instead. */
.m-head.no-hero { margin-top: 14px; }
.m-head.no-hero .m-titlebox { padding-top: 40px; }
.m-cover { width: 130px; flex: 0 0 130px; border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); background: var(--panel); aspect-ratio: 2/3;
  position: relative; }
.m-cover img { width: 100%; height: 100%; object-fit: cover;
  position: relative; z-index: 1; background: none; animation: none; }
.m-cover .noimg { position: absolute; inset: 0; z-index: 0;
  display: flex; align-items: center;
  justify-content: center; color: var(--muted); font-size: 12px; text-align: center; padding: 8px; }
.m-titlebox { padding-top: 74px; min-width: 0; flex: 1 1 auto; }
.m-title { font-size: 22px; font-weight: 800; line-height: 1.25; overflow-wrap: anywhere; }
.m-romaji { color: var(--muted); font-size: 13.5px; margin-top: 2px; overflow-wrap: anywhere; }
.m-facts { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px;
  font-size: 13px; color: var(--muted); }
.m-facts b { color: var(--text); font-weight: 600; }
.m-body { padding: 18px 22px 26px; }
.genres { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.genre { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--panel);
  color: var(--accent-2); border: 1px solid var(--line); }
.m-cols { display: grid; grid-template-columns: 1fr; gap: 20px; min-width: 0; }
/* Grid items default to an `auto` (content) minimum: the 12-person
   characters strip (~1000px) inflated the `1fr` column way past the sheet,
   pushing the download buttons off-screen on mobile ("tab doesn't fit").
   Zero the automatic minimum so `1fr` means the available width, and let
   long unbroken words wrap instead of widening the column. */
.m-cols > * { min-width: 0; overflow-wrap: anywhere; }
@media (min-width: 720px) { .m-cols { grid-template-columns: 1.6fr 1fr; } }
.desc { color: var(--text-dim); font-size: 14px; white-space: pre-line; margin: 0; }
.desc.clamped { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical;
  overflow: hidden; }
.desc-more { background: none; border: 0; color: var(--accent); cursor: pointer;
  font-size: 13px; padding: 4px 0; font-weight: 600; }
.subhead { font-size: 13px; text-transform: uppercase; letter-spacing: .8px;
  color: var(--muted); font-weight: 700; margin: 18px 0 10px; }

.people { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.people::-webkit-scrollbar { display: none; }
.person { flex: 0 0 74px; text-align: center; min-width: 0; }
.person img, .person .av-fb { width: 60px; height: 60px; border-radius: 50%; margin: 0 auto 6px;
  object-fit: cover; background: var(--panel); }
.person .av-fb { display: flex; align-items: center; justify-content: center;
  color: var(--accent-2); font-weight: 800; font-size: 22px; }
.person .n { font-size: 11.5px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; }
.person .j { font-size: 10.5px; color: var(--muted); line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.staff-row { display: flex; align-items: center; gap: 10px; padding: 7px 0;
  border-bottom: 1px solid var(--line); font-size: 13px; min-width: 0; }
.staff-row img, .staff-row .av-fb { width: 34px; height: 34px; border-radius: 50%;
  object-fit: cover; flex: 0 0 auto; background: var(--panel); }
.staff-row .av-fb { display: flex; align-items: center; justify-content: center;
  color: var(--accent-2); font-weight: 800; font-size: 14px; }
.staff-row .who { flex: 1 1 auto; min-width: 0; }
.staff-row .who .sn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.staff-row .r { color: var(--muted); text-align: right; flex: 0 1 auto; font-size: 12px; }

/* episodes / downloads */
.eps { margin-top: 6px; }
.ep-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--panel); border-radius: var(--radius); margin-bottom: 8px; min-width: 0; }
.ep-no { font-weight: 800; color: var(--accent-2); min-width: 58px; flex: 0 0 auto;
  font-variant-numeric: tabular-nums; }
.ep-size { color: var(--muted); font-size: 12.5px; flex: 1 1 auto; min-width: 0; }
.dl { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700;
  padding: 7px 12px; border-radius: 6px; background: var(--accent); color: var(--on-accent);
  transition: filter .15s; flex: 0 0 auto; }
.dl:hover { filter: brightness(1.12); }
.dl.alt { background: var(--panel-2); color: var(--accent-2); border: 1px solid var(--line); }
.empty { color: var(--muted); font-size: 13.5px; padding: 14px; text-align: center;
  background: var(--panel); border-radius: var(--radius); }
.m-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

/* ── denied / login / retry overlays ── */
.denied { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center;
  justify-content: center; background: var(--bg); padding: 20px; }
.denied-card { text-align: center; max-width: 380px; }
.denied-avatar { width: 108px; height: 108px; border-radius: 50%; margin: 0 auto 18px;
  object-fit: cover; border: 3px solid var(--line); background: var(--panel);
  display: flex; align-items: center; justify-content: center; color: var(--muted);
  font-size: 40px; font-weight: 800; }
.denied-card h2 { margin: 0 0 8px; font-size: 21px; }
.denied-card p { color: var(--muted); margin: 0 0 20px; }
.denied-actions { display: flex; flex-direction: column; gap: 8px; }
.btn { display: block; padding: 11px 16px; border-radius: var(--radius); font-weight: 700;
  font-size: 14px; border: 0; cursor: pointer; text-align: center; font-family: inherit; }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.ghost { background: var(--panel); color: var(--text); border: 1px solid var(--line); }
.login-logo-img { width: 72px; height: 72px; border-radius: 18px; margin: 0 auto 12px; }
.login-logo { font-size: 30px; font-weight: 800; margin-bottom: 10px; }
.login-logo span { color: var(--accent); }
.denied-card p.hint { color: var(--red); font-size: 13px; }
/* .tg-auth-button: intentionally unstyled here — the OFFICIAL
   telegram-login.js?6 lib injects its own complete button skin
   (its #119af5 pill, its plane ::before icon, click ripple) and
   wires document-level clicks by walking up to .tg-auth-button.
   A custom skin with :active transform was dropping taps: scale
   shrinks the button under the finger, so edge taps resolved to
   the PARENT at pointerup and the walk missed — "sometimes not
   clickable". Stock markup + zero overrides = official behaviour. */
.tg-widget { display: flex; justify-content: center; margin: 10px 0 14px; min-height: 44px; }
/* dark/light toggle pinned to the sign-in overlay (the header one is
   hidden behind it) — same button, same cycle, top-right corner */
.login-toggle { position: absolute; top: calc(12px + var(--safe-top)); right: 14px; }
.retry-icon { font-size: 44px; margin-bottom: 10px; }

/* ── skeleton / toast / foot ── */
.skeleton-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 18px 14px; padding-top: 8px; }
/* home skeleton — mirrors the widgets the page actually paints: the
   Top Airing strip (same 148px slide geometry, full-bleed) + the
   section head + the release grid, so first paint flows straight
   into content with no layout jump */
.feat-skel { display: flex; gap: 10px; margin: 0 -16px 16px; padding: 2px 16px 6px; }
.sk-fslide { flex: 0 0 148px; aspect-ratio: 2 / 3; border-radius: var(--radius); }
.skel-head { width: 150px; height: 18px; margin: 0 0 14px; }
/* encodes — SubsPlease-style A→Z index logic, AniSlate skin */
.enc-skel { display: flex; flex-direction: column; gap: 15px; padding-top: 8px; }
.sk-row { height: 15px; border-radius: 6px; }
.sk-row:nth-child(even) { width: 72%; }
.enc-az { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  padding: 2px 0 12px; }
.enc-az::-webkit-scrollbar { display: none; }
.enc-az button { flex: 0 0 auto; min-width: 30px; height: 30px; padding: 0 7px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--panel);
  color: var(--text-dim); font: inherit; font-size: 12.5px; font-weight: 700;
  cursor: pointer; transition: color .15s, background .15s, border-color .15s; }
.enc-az button:hover { color: var(--accent); }
.enc-az button:active { transform: scale(.94); }
.enc-az button:disabled { opacity: .32; cursor: default; }
.enc-az button:disabled:active { transform: none; }
.enc-az button.on { color: var(--on-accent); background: var(--accent);
  border-color: var(--accent); }
.enc-letter { font-size: 15px; font-weight: 800; color: var(--accent);
  margin: 16px 0 4px; scroll-margin-top: calc(58px + var(--safe-top)); }
.enc-list { display: flex; flex-direction: column; }
.enc-row { display: flex; align-items: center; gap: 10px; padding: 11px 2px;
  border-bottom: 1px solid var(--line); cursor: pointer; min-width: 0;
  transition: background .15s ease; }
.enc-row:hover { background: var(--panel); }
.enc-row:active { background: var(--panel-2); }
.enc-row .t { flex: 1 1 auto; min-width: 0; font-weight: 600; font-size: 14px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.enc-row .s { flex: 0 0 auto; color: var(--muted); font-size: 12px; }
/* Shimmer runs as a TRANSFORM on a pseudo-element — the GPU compositor
   sweeps it with zero repaints. The old way animated background-position,
   which repaints every skeleton block on the MAIN thread every frame:
   six poster-sized blocks (plus the sheet skeleton) fought the scroll
   for CPU time on budget Android webviews. */
.sk-card, .sk { position: relative; overflow: hidden; background: var(--sk-a); }
.sk-card { aspect-ratio: 2/3.5; border-radius: var(--radius); }
.sk { border-radius: 8px; }
.sk-card::after, .sk::after { content: ""; position: absolute; inset: 0;
  border-radius: inherit;
  background: linear-gradient(100deg, transparent 25%, var(--sk-b) 50%, transparent 75%);
  transform: translateX(-100%); animation: shimmer 1.3s infinite linear; }
@keyframes shimmer { to { transform: translateX(100%); } }
.sk-hero { height: 200px; border-radius: 0; }
.m-skel .m-cover .sk-fill { position: absolute; inset: 0; border-radius: var(--radius); }
.sk-line { height: 13px; margin: 9px 0; border-radius: 6px; }
.m-skel .w25 { width: 25%; } .m-skel .w30 { width: 30%; }
.m-skel .w40 { width: 40%; } .m-skel .w55 { width: 55%; }
.m-skel .w60 { width: 60%; } .m-skel .w70 { width: 70%; }
.m-skel .w85 { width: 85%; }
/* schedule skeleton — day-tab bar + rows in the paintSchedule geometry */
.sched-skel { padding-top: 8px; }
.sk-tab { width: 58px; height: 31px; border-radius: 999px; flex: 0 0 auto; }
.sk-thumb { width: 42px; height: 58px; border-radius: 6px; flex: 0 0 auto; }
.sk-t { width: 46px; height: 14px; flex: 0 0 auto; }
.sk-title { flex: 1 1 auto; height: 14px; min-width: 0; }
.sk-mark { width: 14px; height: 14px; border-radius: 50%; flex: 0 0 auto; }

.toast { position: fixed; left: 50%; bottom: calc(24px + var(--safe-bottom));
  transform: translateX(-50%); background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); padding: 10px 18px; border-radius: 999px; z-index: 70;
  font-size: 13.5px; box-shadow: var(--shadow); animation: fade .2s ease; max-width: 90vw; }

.foot { padding: 18px 0 calc(18px + var(--safe-bottom)); color: var(--muted);
  font-size: 12.5px; text-align: center; border-top: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center; gap: 10px; }
.foot-brand { display: flex; align-items: center; gap: 9px; }
.foot-logo { width: 26px; height: 26px; border-radius: 7px; }
.foot-brand b { color: var(--text); }
.foot-links { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.foot-links a { color: var(--muted); font-weight: 600; transition: color .15s; }
.foot-links a:hover { color: var(--accent); }

.hidden { display: none !important; }
.state { text-align: center; color: var(--muted); padding: 60px 10px; }
.state .btn { display: inline-block; margin-top: 14px; padding: 9px 22px; }

/* ── bottom navigation (mobile + Telegram Mini App) ─────────────────────
   Floating, rounded container in the site's own design language: panel
   surface, line border, the shared shadow token, accent highlight.
   display:none by default — desktop keeps the header tabs. */
.botnav { position: fixed; left: 10px; right: 10px; bottom: calc(10px + var(--safe-bottom));
  z-index: 40;                      /* above content, below modal(50)/denied(60) */
  display: none; padding: 6px; align-items: stretch;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 20px; box-shadow: var(--shadow); }
.bn-item { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px; padding: 7px 2px 5px;
  border: 0; border-radius: 14px; background: none; color: var(--muted);
  font: inherit; cursor: pointer; text-align: center; text-decoration: none;
  transition: color .18s ease, background .18s ease, transform .1s ease; }
.bn-item svg { display: block; }
.bn-item span { font-size: 10.5px; font-weight: 600; letter-spacing: .2px;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bn-item:active { transform: scale(.94); }
.bn-item.active { color: var(--accent); background: var(--panel-2); }
@media (prefers-reduced-motion: reduce) { .bn-item { transition: none; } }

/* ── mobile ─────────────────────────────────────────────────────────── */
@media (max-width: 719px) {
  /* phones + Telegram Mini App: the bottom bar is the navigation */
  .botnav { display: flex; }
  .tabs { display: none; }          /* header keeps brand + theme + avatar */
  .topbar-right { margin-left: auto; }
  /* clearance so the fixed bar never covers cards, links or the footer */
  #app { padding-bottom: calc(82px + var(--safe-bottom)); }
  .toast { bottom: calc(94px + var(--safe-bottom)); }  /* above the bar */
}
@media (max-width: 560px) {
  .topbar-inner { gap: 10px; }
  .brand { font-size: 17px; gap: 7px; }
  .brand-logo { width: 24px; height: 24px; }
  .tabs { gap: 0; }
  .tab { padding: 8px 10px; font-size: 13px; }
  .me span { display: none; }
  .grid, .skeleton-grid { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    gap: 14px 10px; }
  .m-head { padding: 0 14px; margin-top: -80px; gap: 12px; }
  .m-cover { width: 96px; flex-basis: 96px; }
  .m-titlebox { padding-top: 60px; }
  .m-title { font-size: 17px; }
  .m-body { padding: 14px 14px 22px; }
  .hero, .sk-hero { height: 150px; }
  .modal { align-items: flex-end; }
  .modal-sheet { max-height: 94vh; max-height: 94dvh; border-radius: 14px 14px 0 0; }
  /* solid topbar on phones: sticky + backdrop-filter causes scroll
     jank/freezes on budget Android webviews (Mini App + Chrome) */
  .topbar { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--bg); }
  /* the modal scrim is a72% dark wash — blurring it is imperceptible
     but forces a full-screen backdrop re-blur during the sheet's open
     animation on budget GPUs (the "laggy window opening") */
  .modal-backdrop { backdrop-filter: none; -webkit-backdrop-filter: none; }
  .ep-row { flex-wrap: wrap; }
  .sched-row { gap: 10px; padding: 10px; }
  .sched-time { min-width: 42px; }
  .sched-title { font-size: 13.5px; }
}

/* very narrow phones (iPhone SE etc.) — keep everything on-screen */
@media (max-width: 380px) {
  /* keep the bottom-nav clearance through the shorthand reset */
  #app { padding: 0 10px calc(82px + var(--safe-bottom)); }
  .topbar { margin: 0 -10px; }
  .topbar-inner { padding: 8px 10px; gap: 8px; }
  .brand { gap: 6px; }               /* "AniSlate" stays whole, tight to the logo */
  .tab { padding: 8px 8px; font-size: 12.5px; }
  .grid, .skeleton-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px 8px; }
  .m-head { flex-wrap: wrap; }
  .m-cover { width: 84px; flex-basis: 84px; }
  .m-titlebox { padding-top: 54px; }
}
