/* ==========================================================
   ZamanToon Web — design system (mirrors the Flutter app)
   ========================================================== */
:root {
  --bg: #0A0A0F;
  --bg-2: #0F1115;
  --surface: #181A20;
  --surface-2: #20232B;
  --line: rgba(255, 255, 255, .08);
  --line-2: rgba(255, 255, 255, .14);
  --text: #FFFFFF;
  --text-2: rgba(255, 255, 255, .72);
  --text-3: rgba(255, 255, 255, .48);
  --primary: #FF9800;
  --primary-2: #FF6D00;
  --secondary: #2196F3;
  --danger: #FF4D4F;
  --success: #22C55E;
  --grad: linear-gradient(135deg, #FFB300 0%, #FF9800 40%, #FF6D00 100%);
  --glow: 0 10px 40px -10px rgba(255, 152, 0, .55);
  --radius: 14px;
  --radius-lg: 22px;
  --nav-h: 68px;
  --tab-h: 64px;
  --title-h: 0px;
  --gutter: clamp(16px, 4vw, 56px);
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Cairo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100vh;
  padding-top: var(--title-h);
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input { font: inherit; color: inherit; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }
::selection { background: var(--primary); color: #000; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; border-radius: 8px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a2d36; border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #3a3e4a; }

/* ---------- Desktop title bar (Electron) ---------- */
body.is-desktop { --title-h: 34px; }
.titlebar {
  position: fixed; inset: 0 0 auto 0; height: var(--title-h); z-index: 1000;
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(10, 10, 15, .92); backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--line);
  direction: ltr;
}
.titlebar-drag { -webkit-app-region: drag; flex: 1; height: 100%; display: flex; align-items: center; gap: 8px; padding-inline: 12px; font-size: 12px; font-weight: 700; color: var(--text-2); letter-spacing: .3px; }
.titlebar-drag img { width: 16px; height: 16px; border-radius: 4px; }
.titlebar-btns { display: flex; height: 100%; -webkit-app-region: no-drag; }
.titlebar-btns button { width: 46px; height: 100%; display: grid; place-items: center; color: var(--text-2); transition: background .15s; }
.titlebar-btns button:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.titlebar-btns button.close:hover { background: #E81123; }
.titlebar-btns svg { width: 12px; height: 12px; stroke-width: 1.2; }
body.player-fullscreen .titlebar { display: none; }

/* ---------- Top navigation ---------- */
.nav {
  position: fixed; top: var(--title-h); inset-inline: 0; height: var(--nav-h); z-index: 100;
  display: flex; align-items: center; gap: 28px; padding-inline: var(--gutter);
  background: linear-gradient(180deg, rgba(10, 10, 15, .9) 0%, rgba(10, 10, 15, 0) 100%);
  transition: background .3s var(--ease), border-color .3s;
  border-bottom: 1px solid transparent;
}
.nav.scrolled { background: rgba(10, 10, 15, .82); backdrop-filter: blur(18px) saturate(1.4); border-bottom-color: var(--line); }
.nav-logo { display: flex; align-items: center; gap: 10px; direction: ltr; }
.nav-logo img { height: 46px; width: 46px; filter: drop-shadow(0 4px 14px rgba(255, 152, 0, .35)); transition: transform .4s var(--ease); }
.nav-logo:hover img { transform: rotate(-8deg) scale(1.06); }
.nav-logo span { font-size: 22px; font-weight: 900; letter-spacing: -.3px; color: #FFC233; }
.nav-logo span b { color: #4FC3F7; }
.nav-links { display: flex; gap: 6px; }
.nav-links a { padding: 8px 14px; border-radius: 999px; font-weight: 600; color: var(--text-2); transition: color .2s, background .2s; }
.nav-links a:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.nav-links a.active { color: #fff; background: rgba(255, 152, 0, .14); box-shadow: inset 0 0 0 1px rgba(255, 152, 0, .35); }
.nav-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 10px; position: relative; }
.search-box {
  display: flex; align-items: center; gap: 8px; height: 42px; padding-inline: 14px; width: 280px;
  background: rgba(255, 255, 255, .06); border: 1px solid var(--line); border-radius: 999px;
  transition: border-color .2s, background .2s, width .3s var(--ease);
}
.search-box:focus-within { border-color: rgba(255, 152, 0, .6); background: rgba(255, 255, 255, .09); width: 340px; }
.search-box svg { width: 18px; height: 18px; color: var(--text-3); }
.search-box input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; font-size: 14px; }
.search-box input::placeholder { color: var(--text-3); }
.search-box input::-webkit-search-cancel-button { filter: invert(1) opacity(.5); }
.icon-btn, .avatar-btn {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255, 255, 255, .06); border: 1px solid var(--line); font-weight: 800; font-size: 13px;
  transition: background .2s, border-color .2s, transform .2s;
}
.icon-btn:hover, .avatar-btn:hover { background: rgba(255, 255, 255, .12); border-color: var(--line-2); }
.avatar-btn { background: var(--grad); border: 0; color: #111; font-size: 16px; box-shadow: var(--glow); }
.avatar-btn.guest { background: rgba(255, 255, 255, .06); color: var(--text-2); box-shadow: none; border: 1px solid var(--line); }
.menu {
  position: absolute; top: calc(100% + 10px); inset-inline-end: 0; min-width: 240px; padding: 8px;
  background: rgba(24, 26, 32, .96); backdrop-filter: blur(20px); border: 1px solid var(--line-2);
  border-radius: 16px; box-shadow: 0 20px 60px rgba(0, 0, 0, .6); animation: pop .18s var(--ease);
}
.menu-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-head b { display: block; font-size: 15px; }
.menu-head small { color: var(--text-3); word-break: break-all; }
.menu a, .menu button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--text-2); font-weight: 600; text-align: start; }
.menu a:hover, .menu button:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.menu svg { width: 18px; height: 18px; }
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.98); } }

/* ---------- Bottom tab bar (mobile) ---------- */
.tabbar {
  display: none; position: fixed; inset: auto 0 0 0; z-index: 100; height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(12, 12, 18, .9); backdrop-filter: blur(20px) saturate(1.4); border-top: 1px solid var(--line);
}
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--text-3); transition: color .2s; }
.tabbar a svg { width: 22px; height: 22px; transition: transform .2s var(--ease); }
.tabbar a.active { color: var(--primary); }
.tabbar a.active svg { transform: translateY(-2px); filter: drop-shadow(0 4px 10px rgba(255, 152, 0, .6)); }

/* ---------- Layout ---------- */
#app { min-height: 100vh; outline: 0; padding-bottom: 60px; }
.page { padding-top: calc(var(--nav-h) + 20px); animation: fadeUp .45s var(--ease); }
.wrap { padding-inline: var(--gutter); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } }
.section { margin-top: 38px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; padding-inline: var(--gutter); }
.section-title { margin: 0; font-size: clamp(18px, 2vw, 24px); font-weight: 800; display: flex; align-items: center; gap: 10px; }
.section-title::before { content: ''; width: 5px; height: 22px; border-radius: 4px; background: var(--grad); box-shadow: var(--glow); }
.see-all { color: var(--primary); font-weight: 700; font-size: 14px; display: inline-flex; align-items: center; gap: 4px; }
.see-all:hover { text-decoration: underline; }
.page-title { font-size: clamp(26px, 3.4vw, 40px); font-weight: 900; margin: 0 0 6px; }
.page-sub { color: var(--text-3); margin: 0 0 24px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: 50px; padding-inline: 26px;
  border-radius: 999px; font-weight: 800; font-size: 15px; white-space: nowrap;
  transition: transform .2s var(--ease), box-shadow .2s, background .2s, border-color .2s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--grad); color: #111; box-shadow: var(--glow); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 16px 50px -10px rgba(255, 152, 0, .75); }
.btn-ghost { background: rgba(255, 255, 255, .1); border: 1px solid var(--line-2); backdrop-filter: blur(10px); }
.btn-ghost:hover { background: rgba(255, 255, 255, .16); }
.btn-ghost.on { color: var(--primary); border-color: rgba(255, 152, 0, .5); background: rgba(255, 152, 0, .12); }
.btn svg { width: 20px; height: 20px; }
.btn-primary svg.fill { fill: #111; stroke: none; }
.btn-sm { height: 40px; padding-inline: 18px; font-size: 14px; }
.btn-block { width: 100%; }

/* ---------- Hero ---------- */
.hero { position: relative; min-height: min(86vh, 760px); display: flex; align-items: flex-end; overflow: hidden; isolation: isolate; }
.hero-slide { position: absolute; inset: 0; opacity: 0; transition: opacity .9s var(--ease); display: flex; align-items: flex-end; }
.hero-slide.active { opacity: 1; z-index: 1; }
.hero-bg { position: absolute; inset: -40px; background-size: cover; background-position: center 30%; filter: blur(38px) saturate(1.5) brightness(.55); transform: scale(1.1); z-index: -2; }
.hero-slide::after {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(0deg, var(--bg) 0%, rgba(10, 10, 15, .4) 45%, rgba(10, 10, 15, .2) 70%, rgba(10, 10, 15, .7) 100%),
    radial-gradient(ellipse at 20% 40%, transparent 30%, rgba(10, 10, 15, .5) 100%);
}
.hero-inner { width: 100%; display: flex; align-items: center; gap: clamp(24px, 5vw, 72px); padding: calc(var(--nav-h) + 40px) var(--gutter) 70px; }
.hero-poster {
  width: clamp(170px, 20vw, 290px); aspect-ratio: 2/3; border-radius: var(--radius-lg); overflow: hidden; flex: none;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .1);
  transform: perspective(900px) rotateY(var(--tilt, -6deg)); transition: transform .6s var(--ease);
}
[dir="ltr"] .hero-poster { --tilt: 6deg; }
.hero-poster:hover { transform: perspective(900px) rotateY(0) scale(1.02); }
.hero-poster img { width: 100%; height: 100%; object-fit: cover; }
.hero-text { max-width: 640px; }
.hero-badge { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: rgba(255, 152, 0, .16); border: 1px solid rgba(255, 152, 0, .4); color: var(--primary); font-weight: 800; font-size: 13px; margin-bottom: 14px; }
.hero-badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 10px var(--primary); animation: pulse 1.8s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.hero-title { font-size: clamp(30px, 5vw, 64px); line-height: 1.15; font-weight: 900; margin: 0 0 12px; text-shadow: 0 4px 30px rgba(0, 0, 0, .6); }
.hero-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; color: var(--text-2); font-weight: 600; font-size: 14px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; background: rgba(255, 255, 255, .08); border: 1px solid var(--line); font-size: 13px; font-weight: 700; color: var(--text-2); }
.chip svg { width: 15px; height: 15px; }
.chip.hot { color: var(--primary); border-color: rgba(255, 152, 0, .35); background: rgba(255, 152, 0, .1); }
.hero-desc { color: var(--text-2); font-size: 16px; margin: 0 0 24px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-dots { position: absolute; z-index: 3; bottom: 28px; inset-inline-start: var(--gutter); display: flex; gap: 8px; }
.hero-dots button { width: 9px; height: 9px; border-radius: 9px; background: rgba(255, 255, 255, .3); transition: width .35s var(--ease), background .3s; }
.hero-dots button.active { width: 30px; background: var(--primary); box-shadow: var(--glow); }

/* ---------- Rails ---------- */
.rail { position: relative; }
.rail-track {
  display: grid; grid-auto-flow: column; grid-auto-columns: clamp(132px, 15vw, 200px); gap: clamp(10px, 1.3vw, 18px);
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scroll-padding-inline: var(--gutter);
  padding: 10px var(--gutter) 22px; scrollbar-width: none;
}
.rail-track::-webkit-scrollbar { display: none; }
.rail-track > * { scroll-snap-align: start; }
.rail.wide .rail-track { grid-auto-columns: clamp(250px, 26vw, 360px); }
.rail-arrow {
  position: absolute; top: 10px; bottom: 22px; width: var(--gutter); min-width: 44px; z-index: 5; display: grid; place-items: center;
  opacity: 0; transition: opacity .25s; color: #fff;
}
.rail:hover .rail-arrow { opacity: 1; }
.rail-arrow.prev { inset-inline-start: 0; background: linear-gradient(to var(--dir-end, left), transparent, rgba(10, 10, 15, .92)); }
.rail-arrow.next { inset-inline-end: 0; background: linear-gradient(to var(--dir-start, right), transparent, rgba(10, 10, 15, .92)); }
[dir="rtl"] .rail-arrow.prev { background: linear-gradient(to left, transparent, rgba(10, 10, 15, .92)); }
[dir="rtl"] .rail-arrow.next { background: linear-gradient(to right, transparent, rgba(10, 10, 15, .92)); }
[dir="ltr"] .rail-arrow.prev { background: linear-gradient(to right, rgba(10, 10, 15, .92), transparent); }
[dir="ltr"] .rail-arrow.next { background: linear-gradient(to left, rgba(10, 10, 15, .92), transparent); }
.rail-arrow span { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: rgba(24, 26, 32, .9); border: 1px solid var(--line-2); transition: transform .2s, background .2s; }
.rail-arrow:hover span { transform: scale(1.1); background: var(--primary); color: #111; }
[dir="rtl"] .rail-arrow svg { transform: scaleX(-1); }

/* ---------- Cards ---------- */
.card { position: relative; display: block; border-radius: var(--radius); outline-offset: 4px; }
.card-poster {
  position: relative; aspect-ratio: 2/3; border-radius: var(--radius); overflow: hidden; background: var(--surface);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .4), 0 0 0 1px var(--line); transition: transform .35s var(--ease), box-shadow .35s var(--ease);
}
.card-poster img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease), opacity .4s; opacity: 0; }
.card-poster img.loaded { opacity: 1; }
.card-poster::after { content: ''; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(0, 0, 0, .85) 0%, transparent 45%); opacity: .8; transition: opacity .3s; }
.card:hover .card-poster, .card:focus-visible .card-poster { transform: translateY(-6px) scale(1.03); box-shadow: 0 20px 44px rgba(0, 0, 0, .6), 0 0 0 2px var(--primary), var(--glow); }
.card:hover .card-poster img { transform: scale(1.08); }
.card-play {
  position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; opacity: 0; transition: opacity .3s;
}
.card-play span { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: var(--grad); box-shadow: var(--glow); transform: scale(.7); transition: transform .35s var(--ease); }
.card-play svg { fill: #111; stroke: none; width: 22px; height: 22px; margin-inline-start: 3px; }
[dir="rtl"] .card-play svg { margin-inline-start: 0; margin-inline-end: 3px; transform: scaleX(-1); }
.card:hover .card-play { opacity: 1; }
.card:hover .card-play span { transform: scale(1); }
.card-badge { position: absolute; z-index: 2; top: 8px; inset-inline-start: 8px; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; background: rgba(10, 10, 15, .75); backdrop-filter: blur(8px); border: 1px solid var(--line-2); }
.card-badge.movie { color: var(--primary); }
.card-fav { position: absolute; z-index: 3; top: 8px; inset-inline-end: 8px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: rgba(10, 10, 15, .7); color: var(--primary); }
.card-fav svg { width: 15px; height: 15px; fill: var(--primary); stroke: none; }
.card-title { margin: 10px 2px 0; font-weight: 700; font-size: 14px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-sub { margin: 2px 2px 0; color: var(--text-3); font-size: 12px; font-weight: 600; }
.card-progress { position: absolute; z-index: 3; inset: auto 10px 10px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .2); overflow: hidden; }
.card-progress i { display: block; height: 100%; background: var(--grad); border-radius: 4px; }

/* Continue-watching wide card */
.cw-card { display: flex; gap: 14px; align-items: center; padding: 10px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); transition: border-color .25s, transform .25s var(--ease), background .25s; }
.cw-card:hover { border-color: rgba(255, 152, 0, .5); transform: translateY(-3px); background: var(--surface-2); }
.cw-thumb { position: relative; width: 74px; aspect-ratio: 2/3; border-radius: 10px; overflow: hidden; flex: none; background: var(--surface-2); }
.cw-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cw-thumb .card-progress { inset: auto 5px 5px; height: 3px; }
.cw-info { min-width: 0; flex: 1; }
.cw-info b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cw-info small { color: var(--text-3); font-weight: 600; }
.cw-play { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 152, 0, .15); color: var(--primary); flex: none; transition: background .2s, color .2s; }
.cw-card:hover .cw-play { background: var(--primary); color: #111; }
.cw-play svg { fill: currentColor; stroke: none; width: 16px; height: 16px; }
[dir="rtl"] .cw-play svg { transform: scaleX(-1); }

/* ---------- Grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(clamp(130px, 14vw, 190px), 1fr)); gap: clamp(14px, 1.6vw, 24px); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 24px; }
.seg { display: inline-flex; padding: 4px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.seg button { padding: 7px 16px; border-radius: 999px; font-weight: 700; font-size: 14px; color: var(--text-2); transition: background .2s, color .2s; }
.seg button.active { background: var(--grad); color: #111; }
.select { height: 42px; padding-inline: 16px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: #fff; font: inherit; font-weight: 700; font-size: 14px; outline: 0; cursor: pointer; }
.select option { background: var(--surface); }
.count { color: var(--text-3); font-weight: 600; margin-inline-start: auto; }

/* ---------- Details ---------- */
.details-hero { position: relative; overflow: hidden; isolation: isolate; }
.details-hero .hero-bg { filter: blur(50px) saturate(1.5) brightness(.45); }
.details-hero::after { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(0deg, var(--bg) 0%, rgba(10, 10, 15, .55) 50%, rgba(10, 10, 15, .75) 100%); }
.details-inner { display: grid; grid-template-columns: auto 1fr; gap: clamp(24px, 4vw, 56px); align-items: end; padding: calc(var(--nav-h) + 48px) var(--gutter) 40px; }
.details-inner .hero-poster { transform: none; }
.details-title { font-size: clamp(28px, 4.2vw, 54px); font-weight: 900; line-height: 1.2; margin: 0 0 12px; }
.details-sub { margin: -6px 0 14px; color: var(--text-3); font-weight: 700; font-size: 15px; letter-spacing: .3px; }
.hero-bg.sharp { filter: saturate(1.2) brightness(.5); inset: 0; transform: none; }
.details-desc { color: var(--text-2); max-width: 820px; margin: 0 0 22px; white-space: pre-line; }
.details-desc.clamp { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.more-btn { color: var(--primary); font-weight: 700; margin-top: -14px; margin-bottom: 20px; display: inline-block; }
.ep-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.ep-search { display: flex; align-items: center; gap: 8px; height: 42px; padding-inline: 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.ep-search input { background: none; border: 0; outline: 0; width: 140px; }
.ep-search svg { width: 18px; height: 18px; color: var(--text-3); }
.ep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.ep {
  display: flex; align-items: center; gap: 14px; padding: 10px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line);
  transition: background .2s, border-color .2s, transform .2s var(--ease); text-align: start; width: 100%;
}
.ep:hover, .ep:focus-visible { background: var(--surface-2); border-color: rgba(255, 152, 0, .45); transform: translateY(-2px); }
.ep.current { border-color: var(--primary); background: rgba(255, 152, 0, .08); }
.ep-thumb { position: relative; width: 104px; aspect-ratio: 16/9; border-radius: 10px; overflow: hidden; flex: none; background: var(--surface-2); }
.ep-thumb img { width: 100%; height: 100%; object-fit: cover; filter: brightness(.6) blur(1px); transform: scale(1.1); }
.ep-thumb b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 22px; font-weight: 900; text-shadow: 0 2px 10px rgba(0, 0, 0, .8); }
.ep-thumb .card-progress { inset: auto 6px 6px; height: 3px; }
.ep-info { min-width: 0; flex: 1; }
.ep-info b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ep-info small { color: var(--text-3); font-weight: 600; font-size: 12px; }
.ep-icon { color: var(--text-3); }
.ep:hover .ep-icon { color: var(--primary); }
.ep-icon svg { width: 18px; height: 18px; fill: currentColor; stroke: none; }
[dir="rtl"] .ep-icon svg { transform: scaleX(-1); }
.ep-more { margin: 18px auto 0; display: flex; }

/* ---------- Player ---------- */
.player-page { position: fixed; inset: var(--title-h) 0 0 0; z-index: 200; background: #000; display: flex; padding-bottom: 62px; animation: fadeIn .3s; }
body.player-fullscreen .player-page { inset: 0; }
@keyframes fadeIn { from { opacity: 0; } }
.player { position: relative; flex: 1; min-width: 0; background: #000; overflow: hidden; user-select: none; -webkit-user-select: none; direction: ltr; }
.player video { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }
.player.hide-ui { cursor: none; }
.p-top, .p-bottom { position: absolute; inset-inline: 0; z-index: 5; transition: opacity .3s, transform .3s var(--ease); }
.player.hide-ui .p-top, .player.hide-ui .p-bottom, .player.hide-ui .p-center { opacity: 0; pointer-events: none; }
.player.hide-ui .p-top { transform: translateY(-10px); }
.player.hide-ui .p-bottom { transform: translateY(10px); }
.p-top { top: 0; display: flex; align-items: center; gap: 14px; padding: 18px 22px 50px; background: linear-gradient(180deg, rgba(0, 0, 0, .8), transparent); }
.p-title { min-width: 0; flex: 1; }
.p-title b { display: block; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-title small { color: var(--text-2); font-weight: 600; }
.p-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: #fff; transition: background .2s, transform .15s; flex: none; position: relative; }
.p-btn:hover { background: rgba(255, 255, 255, .14); }
.p-btn:active { transform: scale(.9); }
.p-btn svg { width: 24px; height: 24px; }
.p-btn svg.fill { fill: #fff; stroke: none; }
.p-btn .tip { position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); white-space: nowrap; padding: 4px 10px; border-radius: 8px; background: rgba(20, 20, 26, .95); font-size: 12px; font-weight: 700; opacity: 0; pointer-events: none; transition: opacity .15s; font-family: 'Cairo', sans-serif; }
.p-btn:hover .tip { opacity: 1; }
.p-center { position: absolute; inset: 0; z-index: 4; display: flex; align-items: center; justify-content: center; gap: clamp(30px, 8vw, 90px); pointer-events: none; transition: opacity .3s; }
.p-center .p-btn { pointer-events: auto; width: 64px; height: 64px; background: rgba(0, 0, 0, .35); backdrop-filter: blur(6px); }
.p-center .p-btn svg { width: 30px; height: 30px; }
.p-center .p-big { width: 86px; height: 86px; background: var(--grad); box-shadow: 0 0 0 10px rgba(255, 152, 0, .15), var(--glow); }
.p-center .p-big svg { fill: #111; stroke: none; width: 36px; height: 36px; }
.p-center .p-big:hover { background: var(--grad); transform: scale(1.06); }
.p-skip-label { position: absolute; font-size: 10px; font-weight: 900; margin-top: 2px; }
.p-bottom { bottom: 0; padding: 60px 20px 14px; background: linear-gradient(0deg, rgba(0, 0, 0, .88), transparent); }
.p-seek { position: relative; height: 22px; display: flex; align-items: center; cursor: pointer; touch-action: none; }
.p-seek-rail { position: relative; width: 100%; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .22); transition: height .15s; }
.p-seek:hover .p-seek-rail, .p-seek.drag .p-seek-rail { height: 7px; }
.p-buffer, .p-played, .p-hoverbar { position: absolute; inset-block: 0; left: 0; border-radius: 4px; }
.p-buffer { background: rgba(255, 255, 255, .35); }
.p-hoverbar { background: rgba(255, 255, 255, .2); opacity: 0; }
.p-seek:hover .p-hoverbar { opacity: 1; }
.p-played { background: var(--grad); }
.p-thumb { position: absolute; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px rgba(255, 152, 0, .5); transform: scale(0); transition: transform .15s; }
.p-seek:hover .p-thumb, .p-seek.drag .p-thumb { transform: scale(1); }
.p-tooltip { position: absolute; bottom: 26px; transform: translateX(-50%); padding: 4px 10px; border-radius: 8px; background: rgba(20, 20, 26, .95); font-size: 13px; font-weight: 700; opacity: 0; pointer-events: none; font-variant-numeric: tabular-nums; }
.p-seek:hover .p-tooltip, .p-seek.drag .p-tooltip { opacity: 1; }
.p-row { display: flex; align-items: center; gap: 4px; margin-top: 6px; }
.p-time { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text-2); padding-inline: 8px; white-space: nowrap; }
.p-spacer { flex: 1; }
.p-vol { display: flex; align-items: center; }
.p-vol input { width: 0; opacity: 0; transition: width .25s var(--ease), opacity .2s; accent-color: var(--primary); cursor: pointer; }
.p-vol:hover input, .p-vol input:focus { width: 90px; opacity: 1; margin-inline: 4px 8px; }
.p-speed-label { font-weight: 900; font-size: 14px; }
.p-popup { position: absolute; bottom: 70px; right: 20px; z-index: 8; min-width: 200px; padding: 8px; border-radius: 14px; background: rgba(20, 20, 26, .96); backdrop-filter: blur(20px); border: 1px solid var(--line-2); animation: pop .15s var(--ease); font-family: 'Cairo', sans-serif; }
.p-popup h4 { margin: 4px 10px 6px; font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: .5px; }
.p-popup button { display: flex; justify-content: space-between; width: 100%; padding: 8px 12px; border-radius: 9px; font-weight: 700; font-size: 14px; }
.p-popup button:hover { background: rgba(255, 255, 255, .08); }
.p-popup button.on { color: var(--primary); }
.p-popup button.on::after { content: '✓'; }
.p-spinner { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; pointer-events: none; }
.p-spinner i { width: 64px; height: 64px; border-radius: 50%; border: 4px solid rgba(255, 255, 255, .15); border-top-color: var(--primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.p-flash { position: absolute; top: 50%; z-index: 6; transform: translateY(-50%); width: 110px; height: 110px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .14); backdrop-filter: blur(6px); font-weight: 900; font-size: 15px; opacity: 0; pointer-events: none; text-align: center; line-height: 1.1; }
.p-flash.left { left: 12%; } .p-flash.right { right: 12%; } .p-flash.mid { left: 50%; transform: translate(-50%, -50%); }
.p-flash.show { animation: flash .6s var(--ease); }
@keyframes flash { 0% { opacity: 0; transform: translateY(-50%) scale(.8); } 30% { opacity: 1; transform: translateY(-50%) scale(1); } 100% { opacity: 0; } }
.p-flash.mid.show { animation: flashMid .6s var(--ease); }
@keyframes flashMid { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.8); } 30% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; } }
.player:has(.p-error) .p-center, .player:has(.p-error) .p-spinner { display: none; }
.p-error, .p-next { position: absolute; z-index: 9; font-family: 'Cairo', sans-serif; }
.p-error { inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, .82); text-align: center; padding: 24px; }
.p-error > div { max-width: 460px; }
.p-error h3 { font-size: 22px; margin: 12px 0 6px; }
.p-error p { color: var(--text-2); margin: 0 0 20px; }
.p-error .err-ico { width: 72px; height: 72px; margin: auto; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 77, 79, .15); color: var(--danger); }
.p-error .err-ico svg { width: 34px; height: 34px; }
.p-error .row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.p-next { right: 24px; bottom: 110px; width: 320px; max-width: calc(100% - 48px); padding: 14px; border-radius: 16px; background: rgba(20, 20, 26, .95); backdrop-filter: blur(20px); border: 1px solid var(--line-2); display: flex; gap: 12px; align-items: center; animation: pop .25s var(--ease); }
.p-next img { width: 54px; aspect-ratio: 2/3; border-radius: 8px; object-fit: cover; }
.p-next small { color: var(--text-3); font-weight: 700; }
.p-next b { display: block; font-size: 14px; }
.p-next .ring { position: relative; width: 46px; height: 46px; flex: none; margin-inline-start: auto; }
.p-next .ring svg { width: 46px; height: 46px; transform: rotate(-90deg); }
.p-next .ring circle { stroke-width: 3; }
.p-next .ring span { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 900; }
.p-resume { position: absolute; z-index: 8; left: 24px; bottom: 110px; padding: 10px 10px 10px 18px; border-radius: 999px; background: rgba(20, 20, 26, .95); border: 1px solid var(--line-2); display: flex; align-items: center; gap: 12px; font-weight: 700; animation: pop .25s var(--ease); font-family: 'Cairo', sans-serif; }

/* Episode side panel */
.p-side { width: 360px; flex: none; background: #0d0e13; border-inline-start: 1px solid var(--line); display: flex; flex-direction: column; transition: margin .35s var(--ease); }
.p-side.closed { margin-inline-end: -360px; }
.p-side-head { padding: 18px 18px 12px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.p-side-head b { font-size: 16px; }
.p-side-list { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.p-side .ep-thumb { width: 92px; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art { position: relative; overflow: hidden; display: flex; align-items: flex-end; padding: 56px; isolation: isolate; }
.auth-art .mosaic { position: absolute; inset: -10%; display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; transform: rotate(-8deg) scale(1.15); z-index: -2; opacity: .5; }
.auth-art .mosaic img { width: 100%; aspect-ratio: 2/3; object-fit: cover; border-radius: 12px; }
.auth-art::after { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(0deg, var(--bg) 5%, rgba(10, 10, 15, .5) 60%, rgba(10, 10, 15, .8)); }
[dir="rtl"] .auth-art::before, [dir="ltr"] .auth-art::before { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(to var(--fade-dir, left), transparent 60%, var(--bg)); }
[dir="rtl"] .auth-art { --fade-dir: left; }
[dir="ltr"] .auth-art { --fade-dir: right; }
.auth-art h1 { font-size: clamp(30px, 3.6vw, 52px); line-height: 1.2; margin: 0 0 10px; font-weight: 900; }
.auth-art h1 em { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-art p { color: var(--text-2); font-size: 17px; margin: 0; max-width: 520px; }
.auth-panel { display: grid; place-items: center; padding: calc(var(--nav-h) + 20px) var(--gutter) 40px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .logo { height: 70px; width: auto; margin-bottom: 18px; }
.auth-card h2 { font-size: 28px; margin: 0 0 4px; font-weight: 900; }
.auth-card > p { color: var(--text-3); margin: 0 0 26px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; color: var(--text-2); }
.field input {
  width: 100%; height: 52px; padding-inline: 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line-2); outline: 0;
  transition: border-color .2s, box-shadow .2s;
}
.field input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(255, 152, 0, .15); }
.form-err { background: rgba(255, 77, 79, .12); border: 1px solid rgba(255, 77, 79, .35); color: #ff8a8c; padding: 10px 14px; border-radius: 12px; font-weight: 600; font-size: 14px; margin-bottom: 14px; }
.form-ok { background: rgba(34, 197, 94, .12); border: 1px solid rgba(34, 197, 94, .35); color: #6ee79a; padding: 10px 14px; border-radius: 12px; font-weight: 600; font-size: 14px; margin-bottom: 14px; }
.auth-switch { text-align: center; margin-top: 18px; color: var(--text-3); }
.auth-switch button, .link { color: var(--primary); font-weight: 800; }
.or { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 13px; margin: 18px 0; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* ---------- Empty / states ---------- */
.empty { text-align: center; padding: 80px 20px; color: var(--text-3); }
.empty .ico { width: 96px; height: 96px; margin: 0 auto 18px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 152, 0, .1); color: var(--primary); }
.empty .ico svg { width: 42px; height: 42px; }
.empty h3 { color: #fff; font-size: 22px; margin: 0 0 6px; }
.empty p { margin: 0 0 22px; }
.skeleton { background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius); }
@keyframes shimmer { to { background-position: -200% 0; } }
.sk-card { aspect-ratio: 2/3; }
.sk-line { height: 12px; margin-top: 10px; width: 80%; border-radius: 6px; }
.loader { min-height: 60vh; display: grid; place-items: center; }
.loader i { width: 54px; height: 54px; border-radius: 50%; border: 4px solid rgba(255, 255, 255, .1); border-top-color: var(--primary); animation: spin .8s linear infinite; }

/* ---------- Toast & offline ---------- */
.toast-wrap { position: fixed; z-index: 2000; bottom: 24px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { padding: 12px 20px; border-radius: 14px; background: rgba(30, 32, 40, .96); backdrop-filter: blur(20px); border: 1px solid var(--line-2); box-shadow: 0 16px 40px rgba(0, 0, 0, .5); font-weight: 700; display: flex; gap: 10px; align-items: center; animation: toastIn .35s var(--ease); }
.toast.err { border-color: rgba(255, 77, 79, .5); }
.toast.ok svg { color: var(--success); }
.toast.out { animation: toastOut .3s forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px); } }
.offline-bar { position: fixed; z-index: 1500; top: calc(var(--title-h) + var(--nav-h)); inset-inline: 0; text-align: center; padding: 8px; background: var(--danger); font-weight: 800; font-size: 14px; }

/* ---------- Footer ---------- */
.footer { margin-top: 70px; padding: 30px var(--gutter) 40px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; color: var(--text-3); font-size: 14px; }
.footer img { height: 54px; width: auto; opacity: .95; }

/* ==========================================================
   Responsive
   ========================================================== */
@media (max-width: 1100px) {
  .search-box { width: 200px; }
  .search-box:focus-within { width: 240px; }
  .p-side { position: absolute; inset-block: 0; inset-inline-end: 0; z-index: 10; box-shadow: -20px 0 60px rgba(0, 0, 0, .6); }
}
@media (max-width: 900px) {
  :root { --nav-h: 60px; }
  .nav-links, .search-box { display: none; }
  .tabbar { display: flex; }
  #app { padding-bottom: calc(var(--tab-h) + 30px + env(safe-area-inset-bottom)); }
  .toast-wrap { bottom: calc(var(--tab-h) + 18px + env(safe-area-inset-bottom)); }
  .nav-logo img { height: 40px; width: 40px; }
  .nav-logo span { font-size: 19px; }
  .rail-arrow { display: none; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .footer { margin-bottom: var(--tab-h); }
}
@media (max-width: 640px) {
  body { font-size: 14px; }
  .hero { min-height: 78vh; }
  .hero-inner { flex-direction: column; align-items: flex-start; gap: 18px; padding-bottom: 60px; }
  .hero-poster { width: 132px; transform: none; border-radius: 14px; }
  .hero-desc { -webkit-line-clamp: 2; font-size: 14px; margin-bottom: 18px; }
  .hero-actions .btn { flex: 1; height: 46px; padding-inline: 16px; }
  .hero-dots { bottom: 22px; }
  .details-inner { grid-template-columns: 1fr; justify-items: start; padding-top: calc(var(--nav-h) + 24px); gap: 18px; }
  .details-inner .hero-poster { width: 150px; }
  .details-inner .hero-actions { width: 100%; }
  .details-inner .hero-actions .btn { flex: 1; }
  .ep-grid { grid-template-columns: 1fr; }
  .ep-search input { width: 100px; }
  .grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .card-title { font-size: 12.5px; }
  .card-sub { font-size: 11px; }
  .toolbar .count { width: 100%; margin: 0; }
  .p-top { padding: 12px 10px 40px; }
  .p-bottom { padding: 40px 8px 6px; }
  .p-btn { width: 40px; height: 40px; }
  .p-btn svg { width: 22px; height: 22px; }
  .p-vol input, .p-btn .tip, .hide-sm { display: none; }
  .p-time { font-size: 12px; padding-inline: 4px; }
  .p-center .p-btn { width: 54px; height: 54px; }
  .p-center .p-big { width: 72px; height: 72px; }
  .p-side { width: 100%; }
  .p-side.closed { margin-inline-end: -100%; }
  .p-next { right: 12px; bottom: 90px; }
  .p-resume { left: 12px; bottom: 90px; }
  .p-popup { right: 8px; bottom: 60px; }
}
@media (max-width: 380px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}
@media (hover: none) {
  .card-play, .rail-arrow { display: none; }
  .card:hover .card-poster { transform: none; box-shadow: 0 8px 24px rgba(0, 0, 0, .4), 0 0 0 1px var(--line); }
}
/* ==========================================================
   Header v2: live search suggestions, language menu
   ========================================================== */
.nav { gap: clamp(14px, 2vw, 28px); }
.nav-links a { display: inline-flex; align-items: center; gap: 6px; font-size: 14.5px; }
.search-wrap { position: relative; }
.kbd { font: 700 11px/1 'Cairo', sans-serif; padding: 3px 7px; border-radius: 6px; border: 1px solid var(--line-2); color: var(--text-3); background: rgba(255, 255, 255, .04); }
.search-box:focus-within .kbd { display: none; }
.suggest {
  position: absolute; top: calc(100% + 10px); inset-inline-end: 0; width: min(420px, 92vw); max-height: min(70vh, 560px); overflow-y: auto;
  padding: 8px; border-radius: 18px; background: rgba(20, 21, 28, .97); backdrop-filter: blur(24px); border: 1px solid var(--line-2);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .65); animation: pop .16s var(--ease); z-index: 120;
}
.sg-item { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 12px; transition: background .15s; }
.sg-item:hover, .sg-item.active { background: rgba(255, 255, 255, .07); }
.sg-item img { width: 42px; aspect-ratio: 2/3; object-fit: cover; border-radius: 8px; flex: none; background: var(--surface-2); }
.sg-item b { display: block; font-size: 14px; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-item small { color: var(--text-3); font-weight: 600; font-size: 12px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-info { min-width: 0; flex: 1; }
.sg-all { display: flex; justify-content: center; gap: 6px; margin-top: 4px; padding: 10px; border-radius: 12px; color: var(--primary); font-weight: 800; font-size: 14px; border-top: 1px solid var(--line); }
.sg-all:hover, .sg-all.active { background: rgba(255, 152, 0, .08); }
.sg-empty { padding: 22px; text-align: center; color: var(--text-3); font-weight: 600; }
.lang-wrap { position: relative; }
.lang-btn { height: 42px; padding-inline: 12px 14px; border-radius: 999px; display: inline-flex; align-items: center; gap: 7px; background: rgba(255, 255, 255, .06); border: 1px solid var(--line); font-weight: 800; font-size: 13px; transition: background .2s; }
.lang-btn:hover { background: rgba(255, 255, 255, .12); }
.lang-btn svg { width: 18px; height: 18px; color: var(--text-2); }
.lang-menu { min-width: 190px; }
.lang-menu button { justify-content: space-between; }
.lang-menu button small { color: var(--text-3); font-size: 12px; }
.lang-menu button[aria-checked="true"] { color: var(--primary); background: rgba(255, 152, 0, .1); }
.mobile-only { display: none; }

/* Home: library strip under the hero */
.lib-strip { display: flex; flex-wrap: wrap; gap: 10px; padding: 0 var(--gutter); margin-top: -18px; position: relative; z-index: 3; }
.lib-pill { display: inline-flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 14px; background: rgba(24, 26, 32, .8); backdrop-filter: blur(14px); border: 1px solid var(--line); }
.lib-pill b { font-size: 20px; font-weight: 900; font-variant-numeric: tabular-nums; }
.lib-pill span { color: var(--text-3); font-weight: 700; font-size: 13px; }
.lib-pill svg { width: 20px; height: 20px; color: var(--primary); }
a.lib-pill:hover { border-color: rgba(255, 152, 0, .5); }

/* ==========================================================
   Stats dashboard
   ========================================================== */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { position: relative; overflow: hidden; padding: 18px 20px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); }
.kpi::after { content: ""; position: absolute; inset: auto -40px -60px auto; width: 140px; height: 140px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 152, 0, .14), transparent 70%); }
.kpi .ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: rgba(255, 152, 0, .12); color: var(--primary); margin-bottom: 12px; }
.kpi .ico svg { width: 20px; height: 20px; }
.kpi b { display: block; font-size: clamp(28px, 3vw, 38px); font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -.5px; }
.kpi span { color: var(--text-3); font-weight: 700; font-size: 13.5px; }
.kpi.kpi-main { background: linear-gradient(135deg, rgba(255, 152, 0, .18), rgba(255, 109, 0, .06)), var(--surface); border-color: rgba(255, 152, 0, .35); }
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.chart-card { padding: 20px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.chart-card.wide { grid-column: 1 / -1; }
.chart-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.chart-head h3 { margin: 0; font-size: 16px; font-weight: 800; }
.chart-head small { color: var(--text-3); font-weight: 600; }
.table-toggle { color: var(--text-3); font-weight: 700; font-size: 12.5px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; }
.table-toggle:hover { color: #fff; border-color: var(--line-2); }
.hbars { display: flex; flex-direction: column; gap: 8px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 34%) 1fr auto; align-items: center; gap: 12px; font-size: 13.5px; border-radius: 8px; padding: 2px 0; }
.hbar a { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700; color: var(--text-2); }
.hbar a:hover { color: #fff; }
.hbar-track { height: 12px; border-radius: 6px; background: rgba(255, 255, 255, .04); }
.hbar-fill { height: 100%; border-start-end-radius: 4px; border-end-end-radius: 4px; background: var(--primary); transform-origin: left; animation: growX .7s var(--ease) both; }
[dir="rtl"] .hbar-fill { transform-origin: right; }
.hbar b { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--text-2); min-width: 34px; text-align: end; }
.hbar:hover .hbar-fill { background: #FFB300; }
@keyframes growX { from { transform: scaleX(0); } }
.cols { position: relative; height: 220px; display: flex; align-items: flex-end; gap: 6px; padding-bottom: 26px; border-bottom: 1px solid var(--line); direction: ltr; }
.cols::before { content: ""; position: absolute; inset: 0 0 26px; background: repeating-linear-gradient(0deg, transparent 0 calc(25% - 1px), rgba(255, 255, 255, .05) calc(25% - 1px) 25%); pointer-events: none; }
.col { position: relative; flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; min-width: 0; }
.col i { display: block; width: min(100%, 34px); border-radius: 4px 4px 0 0; background: var(--primary); min-height: 2px; transform-origin: bottom; animation: growY .7s var(--ease) both; }
.col:hover i { background: #FFB300; }
.col span { position: absolute; bottom: -24px; font-size: 11.5px; font-weight: 700; color: var(--text-3); white-space: nowrap; }
.col em { font-style: normal; font-size: 11.5px; font-weight: 800; color: var(--text-2); margin-bottom: 4px; font-variant-numeric: tabular-nums; }
@keyframes growY { from { transform: scaleY(0); } }
.chart-tip { position: fixed; z-index: 3000; pointer-events: none; padding: 8px 12px; border-radius: 10px; background: rgba(20, 21, 28, .97); border: 1px solid var(--line-2); box-shadow: 0 12px 30px rgba(0, 0, 0, .5); font-size: 13px; font-weight: 700; transform: translate(-50%, calc(-100% - 12px)); white-space: nowrap; }
.chart-tip small { display: block; color: var(--text-3); font-weight: 600; }
.data-table { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 13.5px; }
.data-table th, .data-table td { padding: 8px 10px; text-align: start; border-bottom: 1px solid var(--line); }
.data-table th { color: var(--text-3); font-weight: 700; }
.data-table td:last-child, .data-table th:last-child { text-align: end; font-variant-numeric: tabular-nums; }

@media (max-width: 900px) {
  .mobile-only { display: grid; }
  .lang-btn span { display: none; }
  .lang-btn { width: 42px; padding: 0; justify-content: center; }
  .chart-grid { grid-template-columns: 1fr; }
  .lib-strip { margin-top: -8px; }
}
@media (max-width: 640px) {
  .kpis { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi { padding: 14px; }
  .kpi .ico { width: 32px; height: 32px; margin-bottom: 8px; }
  .lib-pill { padding: 8px 12px; }
  .lib-pill b { font-size: 17px; }
  .hbar { grid-template-columns: minmax(80px, 38%) 1fr auto; font-size: 12.5px; }
  .cols { height: 180px; gap: 3px; }
  .col span { font-size: 10px; }
  .col em { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Episode downloads, reporting and source attribution. */
.episode-card { min-width: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.episode-card > .ep { border: 0; border-radius: 0; width: 100%; }
.episode-actions { display: flex; gap: 4px; padding: 6px 10px; flex-wrap: wrap; }
.episode-action { display: inline-flex; align-items: center; gap: 6px; padding: 7px 9px; border: 0; border-radius: 7px; background: transparent; color: var(--text-2); font: inherit; font-size: 12px; cursor: pointer; }
.episode-action:hover, .episode-action:focus-visible { color: var(--accent, #ff9800); background: rgba(255,152,0,.10); }
.episode-action svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.player-episode-tools { position: absolute; inset-inline: 0; bottom: 0; min-height: 62px; padding: 4px 16px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; background: #11121a; border-top: 1px solid #292a32; font-size: 12px; z-index: 5; }
.player-episode-tools .episode-actions { padding: 0; }
.player-episode-tools > a { color: #ffb14a; margin-inline-start: auto; }
.episode-dialog { width: min(520px, calc(100vw - 28px)); height: fit-content; margin: auto; inset: 0; max-height: 88dvh; overflow: auto; padding: 24px; border: 1px solid #34353f; border-radius: 18px; background: #15161e; color: #f4f4f5; box-shadow: 0 24px 100px #0009; }
.episode-dialog::backdrop { background: #000b; }
.episode-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.episode-dialog-head h2 { font-size: 22px; margin: 0; }
.episode-dialog p { margin-block: 16px; line-height: 1.7; }
.episode-report-form { margin-top: 20px; display: grid; gap: 14px; }
.episode-report-form label { display: grid; gap: 8px; }
.episode-report-form select, .episode-report-form textarea { width: 100%; padding: 12px; border: 1px solid #444550; background: #0d0e14; color: #fff; border-radius: 8px; font: inherit; }
.report-status { color: #ff9d99; }
.sources-page article { max-width: 850px; margin: 26px 0; padding: 24px; background: var(--surface, #15161e); border: 1px solid var(--line); border-radius: 16px; }
.sources-page article p { line-height: 1.9; margin-top: 12px; color: var(--text-2); }
.sources-page h2 { font-size: 23px; }
.source-links { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
@media(max-width: 600px) { .player-episode-tools { gap: 2px 12px; padding: 5px 10px; } .player-episode-tools > span { display: none; } .player-episode-tools .episode-action { font-size: 11px; padding: 7px 5px; } .player-episode-tools > a { font-size: 11px; } }
