:root {
  --navy: #050c22;
  --navy-2: #0a1636;
  --card: rgba(16, 28, 62, 0.72);
  --card-border: rgba(110, 160, 255, 0.14);
  --blue: #3d8bff;
  --blue-2: #59b4ff;
  --accent: #6cc4ff;
  --text: #ffffff;
  --muted: #a9b8d8;
  --app-h: var(--tg-viewport-stable-height, 100dvh);
  --safe-b: env(safe-area-inset-bottom, 0px);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", Roboto,
    "Noto Sans", "Noto Sans Arabic", "Noto Sans Devanagari", "Mukta", Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--navy); color: var(--text); overflow: hidden; }
body { -webkit-font-smoothing: antialiased; user-select: none; -webkit-user-select: none; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* Space background with glow + stars */
.bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(48% 26% at 50% 21%, rgba(40, 110, 255, 0.30), transparent 75%),
    radial-gradient(70% 30% at 50% 100%, rgba(35, 100, 255, 0.22), transparent 70%),
    radial-gradient(1px 1px at 12% 8%, #9cc8ff 50%, transparent 51%),
    radial-gradient(1px 1px at 82% 12%, #cfe3ff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 70% 46%, #7fb4ff 50%, transparent 51%),
    radial-gradient(1px 1px at 22% 52%, #bcd6ff 50%, transparent 51%),
    radial-gradient(1px 1px at 90% 62%, #8fbcff 50%, transparent 51%),
    radial-gradient(1px 1px at 8% 78%, #a8c8ff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 60% 88%, #9cc8ff 50%, transparent 51%),
    linear-gradient(180deg, #040a1d 0%, #071233 55%, #050c22 100%);
}

.screen {
  position: relative; z-index: 1;
  height: var(--app-h);
  max-width: 480px; margin: 0 auto;
  display: flex; flex-direction: column;
  padding: 8px 16px calc(14px + var(--safe-b));
}

/* Close button */
.close {
  position: absolute; top: 12px; inset-inline-end: 14px; z-index: 3;
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  background: rgba(30, 44, 80, 0.75); border: 1px solid rgba(255,255,255,0.08);
  color: #e6eeff; backdrop-filter: blur(8px);
}
.close:active { transform: scale(0.94); }

/* Hero illustration: shrinks on short viewports */
.hero {
  flex: 1 1 auto; min-height: 110px; max-height: 300px;
  display: flex; align-items: center; justify-content: center;
  margin: 4px -8px 0;
}
.hero img {
  width: 100%; height: 100%; object-fit: contain;
  -webkit-mask-image: radial-gradient(ellipse 58% 56% at 50% 50%, #000 72%, transparent 100%);
  mask-image: radial-gradient(ellipse 58% 56% at 50% 50%, #000 72%, transparent 100%);
  animation: float 6s ease-in-out infinite;
}
@keyframes float { 50% { transform: translateY(-4px); } }

/* Title */
.heading { text-align: center; flex: none; margin-top: 2px; }
h1 {
  margin: 0; font-size: 34px; line-height: 1.06; font-weight: 800; letter-spacing: -0.5px;
  text-shadow: 0 2px 18px rgba(80, 150, 255, 0.25);
}
h1 .accent {
  display: block;
  background: linear-gradient(180deg, #8fd6ff, #4fa8ff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: none; filter: drop-shadow(0 0 14px rgba(80, 170, 255, 0.35));
}
.subtitle { margin: 6px 0 0; color: var(--muted); font-size: 15px; line-height: 1.3; }

/* Language list */
.langs { flex: none; margin-top: 14px; }
.lang-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.lang {
  position: relative; display: flex; align-items: center; gap: 10px;
  min-width: 0; height: 46px; padding: 0 12px 0 8px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--card-border);
  text-align: start; cursor: pointer;
  transition: border-color .18s, background .18s, box-shadow .18s, transform .12s;
}
.lang:active { transform: scale(0.98); }
.lang .name {
  flex: 1; min-width: 0; font-size: 15px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; unicode-bidi: isolate;
}
.flag {
  flex: none; width: 28px; height: 28px; border-radius: 7px; overflow: hidden;
  display: inline-block; box-shadow: 0 0 0 1px rgba(255,255,255,0.12), 0 2px 6px rgba(0,0,0,0.35);
}
.flag svg { display: block; width: 100%; height: 100%; }

.radio {
  flex: none; width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid rgba(160, 185, 230, 0.45); position: relative; transition: border-color .18s;
}
.radio::after {
  content: ""; position: absolute; inset: 3px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #bfe6ff, #47a6ff);
  transform: scale(0); transition: transform .18s;
}

.lang[aria-checked="true"] {
  background: linear-gradient(180deg, rgba(36, 86, 190, 0.55), rgba(20, 50, 125, 0.55));
  border-color: rgba(100, 175, 255, 0.85);
  box-shadow: 0 0 0 1px rgba(90, 165, 255, 0.35), 0 0 18px rgba(60, 140, 255, 0.45), inset 0 0 14px rgba(90, 170, 255, 0.18);
}
.lang[aria-checked="true"] .radio { border-color: #7cc6ff; box-shadow: 0 0 8px rgba(110, 190, 255, 0.7); }
.lang[aria-checked="true"] .radio::after { transform: scale(1); }

/* Detected card: centered pill spanning ~66% width, preselected */
.lang.detected {
  grid-column: 1 / -1; justify-self: center; width: 66%;
  height: 56px; padding: 0 16px; gap: 12px; border-radius: 999px;
  justify-content: center; margin-bottom: 4px;
}
.lang.detected .flag { width: 34px; height: 34px; border-radius: 50%; }
.lang.detected .name { flex: 0 1 auto; font-size: 18px; font-weight: 700; }
.lang.detected .radio { width: 22px; height: 22px; }
.lang.detected .radio::after { inset: 4px; }

/* Continue button */
.actions { flex: none; margin-top: 16px; }
.cta {
  width: 100%; height: 56px; border-radius: 18px; border: 1px solid rgba(170, 220, 255, 0.6);
  position: relative; display: flex; align-items: center; justify-content: center; cursor: pointer;
  font-size: 18px; font-weight: 700; color: #06142f;
  background: linear-gradient(180deg, #8fd3ff 0%, #4aa3ff 55%, #2f7dff 100%);
  box-shadow: 0 0 22px rgba(60, 150, 255, 0.6), 0 8px 26px rgba(30, 100, 255, 0.35), inset 0 1px 0 rgba(255,255,255,0.6);
  transition: transform .12s, box-shadow .2s;
}
.cta:active { transform: scale(0.985); }
.cta .arrow { position: absolute; inset-inline-end: 20px; }
[dir="rtl"] .cta .arrow { transform: scaleX(-1); }
[dir="rtl"] .chips {
  -webkit-mask-image: linear-gradient(270deg, transparent 0, #000 10px, #000 calc(100% - 18px), transparent);
  mask-image: linear-gradient(270deg, transparent 0, #000 10px, #000 calc(100% - 18px), transparent);
}

/* ---------- Channel list screen ---------- */
.screen.list { padding: 10px 0 0; }
.topbar { flex: none; display: flex; align-items: center; gap: 10px; padding: 0 16px; height: 48px; }
.logo { width: 32px; height: 32px; border-radius: 9px; box-shadow: 0 0 0 1px rgba(255,255,255,.08), 0 0 14px rgba(251,191,36,.25); }
.list-title { flex: 1; min-width: 0; margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -.2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 0 16px rgba(80,150,255,.3); }
.icon-btn {
  flex: none; height: 38px; padding: 0 10px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px;
  background: rgba(30, 44, 80, 0.75); border: 1px solid rgba(110,170,255,.22); color: #cfe6ff; cursor: pointer;
}
.icon-btn:active { transform: scale(.95); }
.lang-code { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; }

/* v5: Filters on its own row above the category chips (start-aligned; RTL via logical props) */
.toolbar { flex: none; display: flex; flex-direction: column; align-items: stretch; gap: 8px; margin-top: 8px; }
.filters-row { display: flex; justify-content: flex-start; }
.filters-btn {
  flex: none; position: relative; height: 36px; margin-inline-start: 16px; padding: 0 12px; border-radius: 12px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; color: #cfe6ff;
  background: rgba(20, 44, 100, .6); border: 1px solid rgba(100,175,255,.5); box-shadow: 0 0 12px rgba(60,140,255,.22);
}
.filters-btn.on { border-color: #7cc6ff; box-shadow: 0 0 14px rgba(80,170,255,.5); }
.filters-btn:active { transform: scale(.96); }
.badge-n {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; display: inline-grid; place-items: center;
  font-size: 11px; font-weight: 800; color: #06142f; background: linear-gradient(180deg, #8fd3ff, #3d8bff);
}
.chips {
  flex: 1 1 auto; min-width: 0; display: flex; gap: 8px; overflow-x: auto; padding-block: 4px; padding-inline: 16px; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 10px, #000 calc(100% - 18px), transparent);
  mask-image: linear-gradient(90deg, transparent 0, #000 10px, #000 calc(100% - 18px), transparent);
  -webkit-overflow-scrolling: touch; scroll-padding-inline: 16px;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 34px; padding: 0 13px; border-radius: 999px; cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: #cfe0ff;
  background: var(--card); border: 1px solid var(--card-border); transition: background .15s, border-color .15s, box-shadow .15s;
}
.chip .e { font-size: 15px; line-height: 1; }
.chip[aria-pressed="true"] {
  color: #06142f; border-color: rgba(170,220,255,.7);
  background: linear-gradient(180deg, #8fd3ff, #3d8bff); box-shadow: 0 0 14px rgba(60,150,255,.5);
}

.list-scroll {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: 12px 16px calc(20px + var(--safe-b));
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 10px); mask-image: linear-gradient(180deg, transparent 0, #000 10px);
}
.cat-info { margin: 0 2px 12px; }
.cat-name { margin: 0; font-size: 16px; font-weight: 800; display: flex; align-items: center; gap: 7px; }
.cat-name .e { font-size: 17px; }
.cat-desc { margin: 4px 0 0; font-size: 13px; line-height: 1.4; color: var(--muted); }
/* ---------- v6: Featured carousel ---------- */
.feat { margin: 0 0 14px; }
.feat-title { margin: 0 2px 8px; font-size: 13px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase;
  display: flex; align-items: center; gap: 6px; color: #ffd36b; text-shadow: 0 0 12px rgba(251,191,36,.35); }
.feat-title .e { font-size: 14px; text-transform: none; }
.feat-row {
  display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  margin-inline: -16px; padding: 4px 16px 10px; scroll-snap-type: x mandatory; scroll-padding-inline: 16px;
}
.feat-row::-webkit-scrollbar { display: none; }
.ch.ch-feat {
  flex: none; width: 158px; scroll-snap-align: start; padding: 16px 12px 13px; position: relative;
  background: linear-gradient(180deg, rgba(58, 46, 18, .55) 0%, rgba(14, 26, 62, .92) 55%) padding-box,
              linear-gradient(160deg, #ffe08a, rgba(251,191,36,.55) 40%, rgba(110,170,255,.35)) border-box;
  border: 1.5px solid transparent;
  box-shadow: 0 0 16px rgba(251,191,36,.22), inset 0 1px 0 rgba(255,236,170,.12);
}
.ch-feat .av { width: 66px; height: 66px; box-shadow: 0 0 0 2px rgba(255,211,107,.85), 0 0 18px rgba(251,191,36,.45); }
.ch-feat .av .ini { font-size: 23px; }
.ch-feat .ch-name { font-size: 15px; }
.sp-tag {
  position: absolute; top: 7px; inset-inline-start: 8px; padding: 2px 7px; border-radius: 999px;
  font-size: 9.5px; font-weight: 800; letter-spacing: .3px; text-transform: uppercase; line-height: 1.5;
  color: #2a1a00; background: linear-gradient(180deg, #ffe08a, #f5b82e); box-shadow: 0 0 8px rgba(251,191,36,.45);
}
.ch-feat:not(.promo) { padding-top: 32px; }
.ch.promo {
  justify-content: center; gap: 10px; cursor: pointer; color: #ffe7a8; font: inherit;
  background: radial-gradient(120% 80% at 50% 0%, rgba(251,191,36,.16), rgba(14,26,62,.55) 70%);
  border: 1.5px dashed rgba(255,211,107,.7); box-shadow: 0 0 14px rgba(251,191,36,.15);
}
.ch.promo .promo-star { font-size: 30px; filter: drop-shadow(0 0 10px rgba(251,191,36,.6)); }
.ch.promo .promo-text { font-size: 14.5px; font-weight: 800; line-height: 1.3; }
.ch.promo svg { opacity: .9; }
[dir="rtl"] .ch.promo svg { transform: scaleX(-1); }
.ch.promo:active { transform: scale(.97); }
.ch.promo.solo { width: 100%; flex-direction: row; min-height: 64px; padding: 12px 16px; }
.ch.promo.solo .promo-star { font-size: 22px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.ch {
  min-width: 0; display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 14px 10px 12px; border-radius: 18px; background: var(--card); border: 1px solid var(--card-border);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}
.av {
  position: relative; width: 58px; height: 58px; border-radius: 50%; flex: none; background: radial-gradient(circle at 35% 30%, #23407e, #13224a);
  box-shadow: 0 0 0 2px rgba(90,165,255,.35), 0 0 16px rgba(60,140,255,.35);
}
.av img, .av .ini { width: 100%; height: 100%; border-radius: 50%; display: block; object-fit: cover; }
.av .ini { display: grid; place-items: center; font-size: 21px; font-weight: 800; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.3); }
.av .lflag {
  position: absolute; bottom: -2px; inset-inline-end: -4px; width: 22px; height: 22px; border-radius: 50%; overflow: hidden;
  box-shadow: 0 0 0 2px #0b1736; background: #1b2b55; display: grid; place-items: center; font-size: 11px;
}
.av .lflag svg { width: 100%; height: 100%; display: block; }
.ch-name {
  margin-top: 10px; font-size: 14.5px; font-weight: 700; line-height: 1.25; min-height: 2.5em; width: 100%;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; unicode-bidi: plaintext;
}
.ch-meta { margin-top: 3px; min-height: 16px; font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.ch-meta svg { opacity: .8; }
.join {
  margin-top: 10px; width: 100%; height: 32px; border-radius: 999px; cursor: pointer;
  font-size: 13.5px; font-weight: 700; color: #06142f; border: 1px solid rgba(170,220,255,.55);
  background: linear-gradient(180deg, #8fd3ff, #3d8bff); box-shadow: 0 0 12px rgba(60,150,255,.35);
}
.join:active { transform: scale(.97); }

.empty { text-align: center; color: var(--muted); margin: 22px 0 6px; font-size: 14px; }
.empty p { margin: 0 0 10px; }
.link-btn { background: none; border: 0; color: #7cc6ff; font-weight: 700; font-size: 14px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.all-btn .cnt { opacity: .7; font-weight: 600; }

/* ---------- Filters bottom sheet ---------- */
.sheet { position: fixed; inset-inline: 0; top: 0; height: var(--app-h); z-index: 40; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(2, 6, 18, .6); backdrop-filter: blur(3px); opacity: 0; transition: opacity .2s; }
.sheet-panel {
  position: absolute; inset-inline: 0; bottom: 0; max-width: 480px; margin: 0 auto; max-height: calc(100% - 16px);
  display: flex; flex-direction: column; border-radius: 24px 24px 0 0;
  background: linear-gradient(180deg, #0d1c45 0%, #081436 100%); border: 1px solid rgba(110,170,255,.25); border-bottom: 0;
  box-shadow: 0 -10px 40px rgba(30, 100, 255, .35); transform: translateY(100%); transition: transform .22s ease-out;
}
.sheet.open .sheet-backdrop { opacity: 1; }
.sheet.open .sheet-panel { transform: translateY(0); }
.sheet-handle { width: 40px; height: 4px; border-radius: 4px; background: rgba(160,190,240,.35); margin: 8px auto 0; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px 4px 20px; }
.sheet-head h2 { margin: 0; font-size: 20px; font-weight: 800; }
.sheet-x { position: static; width: 36px; height: 36px; }
.sheet-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 4px 16px 14px; }
.f-sec { margin-top: 12px; }
.f-label { display: block; margin: 0 2px 8px; font-size: 12px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: #8fb2ea; }
.f-search {
  height: 46px; border-radius: 14px; display: flex; align-items: center; gap: 8px; padding: 0 14px;
  background: rgba(6, 14, 38, .7); border: 1px solid var(--card-border); color: #8ea6d4;
}
.f-search:focus-within { border-color: rgba(100,175,255,.75); box-shadow: 0 0 12px rgba(60,140,255,.3); }
.f-search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--text); font: inherit; font-size: 15px; user-select: text; -webkit-user-select: text; }
.f-search input::placeholder { color: #7f93bd; }
/* v7: sort options (segmented control) */
.f-segs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.f-seg {
  min-width: 0; min-height: 44px; padding: 6px 8px; border-radius: 13px; cursor: pointer; text-align: center;
  font: inherit; font-size: 13.5px; font-weight: 700; line-height: 1.2; color: #cfe0ff;
  background: var(--card); border: 1px solid var(--card-border);
}
.f-seg[aria-checked="true"] {
  color: #fff; background: linear-gradient(180deg, rgba(36, 86, 190, 0.55), rgba(20, 50, 125, 0.55));
  border-color: rgba(100, 175, 255, 0.85); box-shadow: 0 0 14px rgba(60, 140, 255, 0.4);
}
.f-seg:active { transform: scale(.97); }
.f-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.f-opt {
  display: flex; align-items: center; gap: 9px; min-width: 0; height: 44px; padding: 0 10px 0 8px; border-radius: 13px; cursor: pointer;
  background: var(--card); border: 1px solid var(--card-border); text-align: start;
}
.f-opt .flag { width: 26px; height: 26px; border-radius: 50%; }
.f-opt .flag.globe { padding: 3px; color: #9fd0ff; background: rgba(40,80,160,.5); }
.f-opt .name { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.f-opt .radio { width: 18px; height: 18px; }
.f-opt[aria-checked="true"] {
  background: linear-gradient(180deg, rgba(36, 86, 190, 0.55), rgba(20, 50, 125, 0.55)); border-color: rgba(100, 175, 255, 0.85);
  box-shadow: 0 0 14px rgba(60, 140, 255, 0.4);
}
.f-opt[aria-checked="true"] .radio { border-color: #7cc6ff; }
.f-opt[aria-checked="true"] .radio::after { transform: scale(1); }
.sheet-foot { flex: none; display: flex; gap: 10px; padding: 12px 16px calc(14px + var(--safe-b)); border-top: 1px solid rgba(110,170,255,.12); background: rgba(6, 16, 44, .96); }
.btn-ghost, .btn-primary { flex: 1; height: 50px; border-radius: 16px; font-size: 16px; font-weight: 700; cursor: pointer; }
.btn-ghost { background: transparent; border: 1px solid rgba(110,175,255,.5); color: #cfe6ff; }
.btn-primary {
  flex: 1.4; color: #06142f; border: 1px solid rgba(170,220,255,.6);
  background: linear-gradient(180deg, #8fd3ff 0%, #4aa3ff 55%, #2f7dff 100%); box-shadow: 0 0 18px rgba(60,150,255,.5);
}
.all-btn {
  margin: 16px 0 4px; width: 100%; height: 50px; border-radius: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 15px; font-weight: 700; color: #cfe6ff;
  background: rgba(20, 44, 100, .55); border: 1px solid rgba(100,175,255,.6);
  box-shadow: 0 0 16px rgba(60,140,255,.3), inset 0 0 12px rgba(90,170,255,.12);
}
.all-btn:active { transform: scale(.985); }

/* Slightly tighter on short screens (e.g. Telegram compact mode) */
@media (max-height: 700px) {
  h1 { font-size: 29px; }
  .subtitle { font-size: 14px; }
  .langs { margin-top: 10px; }
  .lang { height: 42px; }
  .lang.detected { height: 50px; }
  .actions { margin-top: 12px; }
  .cta { height: 52px; }
}

/* "All languages" option spans the full row in the filters sheet */
.f-opt[data-chlang="all"] { grid-column: 1 / -1; }

/* ====================== v8: favorites heart, tab bar, My profile ====================== */
.ch { position: relative; }
.fav {
  position: absolute; top: 6px; inset-inline-end: 6px; z-index: 2; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer; background: rgba(5, 12, 34, .35); color: #fff;
}
.fav svg path { fill: none; stroke: #fff; transition: fill .15s, stroke .15s; }
.fav[aria-pressed="true"] svg path { fill: #ff3d6e; stroke: #ff3d6e; }
.fav[aria-pressed="true"] { filter: drop-shadow(0 0 6px rgba(255, 61, 110, .55)); }
.fav.pop svg { animation: favpop .32s ease-out; }
@keyframes favpop { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }

:root { --tabbar-h: 62px; }
body.has-tabbar .list-scroll { padding-bottom: calc(var(--tabbar-h) + 20px + var(--safe-b)); }
.tabbar {
  position: fixed; z-index: 15; inset-inline: 0; bottom: 0; max-width: 480px; margin: 0 auto;
  height: calc(var(--tabbar-h) + var(--safe-b)); padding: 6px 18px var(--safe-b); display: flex; gap: 10px;
  background: linear-gradient(180deg, rgba(8, 18, 48, .88), rgba(5, 12, 34, .97)); backdrop-filter: blur(12px);
  border-top: 1px solid rgba(110, 170, 255, .18); box-shadow: 0 -8px 24px rgba(0, 0, 0, .35);
}
.tab {
  flex: 1; height: 50px; border: 0; border-radius: 16px; cursor: pointer; background: transparent; color: #8ea6d4;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 12px; font-weight: 700;
  transition: color .15s, background .15s;
}
.tab[aria-selected="true"] { color: #8fd3ff; background: rgba(40, 90, 200, .22); box-shadow: inset 0 0 0 1px rgba(100,175,255,.35), 0 0 14px rgba(60,140,255,.25); }
.tab[aria-selected="true"] svg { filter: drop-shadow(0 0 6px rgba(110,190,255,.6)); }
.tab:active { transform: scale(.96); }

.screen.profile { padding: 0; }
.p-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: 18px 16px calc(var(--tabbar-h) + 22px + var(--safe-b)); }
.p-head {
  display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 20px;
  background: linear-gradient(135deg, rgba(36, 86, 190, .45), rgba(14, 26, 62, .85)); border: 1px solid rgba(100,175,255,.35);
  box-shadow: 0 0 22px rgba(60,140,255,.22), inset 0 1px 0 rgba(255,255,255,.06);
}
.p-av { flex: none; width: 62px; height: 62px; border-radius: 50%; overflow: hidden; background: linear-gradient(135deg, #59b4ff, #2f6fe0);
  box-shadow: 0 0 0 2px rgba(143,211,255,.7), 0 0 18px rgba(80,170,255,.5); }
.p-av img, .p-av .ini { width: 100%; height: 100%; display: grid; place-items: center; object-fit: cover; font-size: 26px; font-weight: 800; color: #fff; }
.p-who { min-width: 0; }
.p-hello { margin: 0; font-size: 14px; color: var(--muted); font-weight: 600; }
.p-name { margin: 2px 0 0; font-size: 22px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-full { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.p-test { display: inline-block; margin: 6px 0 0; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; color: #ffd36b; background: rgba(251,191,36,.12); border: 1px solid rgba(251,191,36,.35); }
.p-sec { margin-top: 20px; }
.p-title { margin: 0 2px 10px; font-size: 16px; font-weight: 800; display: flex; align-items: center; gap: 7px; }
.p-title .e { font-size: 16px; }
.p-count { color: var(--muted); font-weight: 700; font-size: 14px; }
.p-empty { text-align: center; padding: 22px 18px 18px; border-radius: 18px; background: var(--card); border: 1px dashed rgba(110,170,255,.3); }
.p-empty-ic { font-size: 34px; line-height: 1; color: #8fd3ff; text-shadow: 0 0 14px rgba(110,190,255,.6); }
.p-empty-t { margin: 10px 0 4px; font-size: 16px; font-weight: 800; }
.p-empty-d { margin: 0 0 14px; font-size: 13.5px; color: var(--muted); line-height: 1.4; }
.p-explore { width: auto; height: 44px; padding: 0 22px; font-size: 15px; }
.p-add {
  width: 100%; display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 18px; cursor: pointer; text-align: start;
  color: #fff; background: rgba(20, 44, 100, .55); border: 1px solid rgba(100,175,255,.6);
  box-shadow: 0 0 16px rgba(60,140,255,.3), inset 0 0 12px rgba(90,170,255,.12);
}
.p-add:active, .p-promo:active { transform: scale(.985); }
.p-add-ic { flex: none; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; color: #06142f;
  background: linear-gradient(180deg, #8fd3ff, #3d8bff); box-shadow: 0 0 14px rgba(60,150,255,.5); }
.p-add-tx, .p-promo-tx { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.p-add-tx b { font-size: 16px; }
.p-add-tx small, .p-promo-tx small { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.p-sec[data-sec="promote"] { margin-top: 12px; }
.p-promo {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 14px; cursor: pointer; text-align: start;
  color: #e9dcb4; background: transparent; border: 1px solid rgba(255,211,107,.22);
}
.p-promo .e { font-size: 18px; }
.p-promo-tx { flex: 1; }
.p-promo-tx b { font-size: 14px; font-weight: 700; }
.p-promo .chev { flex: none; opacity: .6; }
[dir="rtl"] .p-promo .chev { transform: scaleX(-1); }

/* ====================== v9: "Add a channel" form ====================== */
.screen.addform { padding: 10px 0 0; }
.a-top { flex: none; display: flex; align-items: center; gap: 10px; padding: 0 16px; height: 48px; }
.a-back { width: 40px; padding: 0; justify-content: center; }
[dir="rtl"] .a-back svg { transform: scaleX(-1); }
.a-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 0 16px 20px; }
.a-body .f-sec { margin-top: 16px; }
.a-test { margin: 6px 0 0; padding: 6px 10px; border-radius: 10px; font-size: 12px; font-weight: 700; color: #ffd36b; background: rgba(251,191,36,.1); border: 1px solid rgba(251,191,36,.3); }
.a-input .a-at { display: grid; place-items: center; color: #7f93bd; }
.a-input input { direction: ltr; text-align: left; }
.invalid, .f-search.invalid { border-color: rgba(255, 99, 120, .85) !important; box-shadow: 0 0 10px rgba(255, 80, 110, .25) !important; }
.a-err { margin: 6px 4px 0; font-size: 12.5px; font-weight: 600; color: #ff8fa0; line-height: 1.35; }
.a-send-err { text-align: center; }
.a-norm { margin: 6px 4px 0; font-size: 12.5px; font-weight: 700; color: #7fe0b0; text-align: start; }
.a-hint { margin: 6px 4px 0; font-size: 12.5px; color: var(--muted); }
.a-prev {
  margin-top: 10px; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px;
  background: var(--card); border: 1px solid var(--card-border);
}
.a-prev.ok { border-color: rgba(110, 220, 170, .45); box-shadow: 0 0 14px rgba(80, 220, 160, .15); }
.a-prev.bad { border-color: rgba(255, 99, 120, .5); }
.a-prev-av { flex: none; width: 50px; height: 50px; border-radius: 50%; overflow: hidden; background: radial-gradient(circle at 35% 30%, #23407e, #13224a);
  box-shadow: 0 0 0 2px rgba(90,165,255,.35); display: grid; place-items: center; }
.a-prev-av img, .a-prev-av .ini { width: 100%; height: 100%; object-fit: cover; display: grid; place-items: center; font-weight: 800; font-size: 20px; }
.a-prev-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.a-prev-tx b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; unicode-bidi: plaintext; text-align: start; }
.a-prev-tx small { font-size: 12.5px; color: var(--muted); }
.a-ok-tag { font-size: 11px; font-weight: 800; color: #7fe0b0; text-transform: uppercase; letter-spacing: .4px; }
.a-prev-ic { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; color: #fff; background: rgba(255, 80, 110, .8); }
.sk { display: block; border-radius: 6px; background: linear-gradient(90deg, rgba(110,160,255,.12), rgba(110,160,255,.28), rgba(110,160,255,.12)); background-size: 200% 100%; animation: sk 1.1s linear infinite; }
.a-prev-av.sk { border-radius: 50%; }
.sk1 { width: 60%; height: 13px; } .sk2 { width: 40%; height: 11px; margin-top: 5px; }
@keyframes sk { to { background-position: -200% 0; } }
.a-spin { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid rgba(143,211,255,.25); border-top-color: #8fd3ff; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.a-select {
  width: 100%; height: 48px; display: flex; align-items: center; gap: 10px; padding: 0 14px; border-radius: 14px; cursor: pointer; text-align: start;
  background: rgba(6, 14, 38, .7); border: 1px solid var(--card-border); color: var(--text); font-size: 15px; font-weight: 600;
}
.a-select[aria-expanded="true"] { border-color: rgba(100,175,255,.75); box-shadow: 0 0 12px rgba(60,140,255,.3); }
.a-select[aria-expanded="true"] svg { transform: rotate(180deg); }
.a-select .e { font-size: 18px; }
.a-sel-tx { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.a-sel-tx.ph { color: #7f93bd; font-weight: 500; }
.a-options { margin-top: 6px; max-height: 280px; overflow-y: auto; padding: 6px; border-radius: 14px; background: #0b1838; border: 1px solid rgba(100,175,255,.35); box-shadow: 0 10px 30px rgba(0,0,0,.45); }
.a-opt { width: 100%; display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 10px; border: 0; border-radius: 10px; background: transparent; cursor: pointer; text-align: start; font-size: 14.5px; font-weight: 600; color: #dbe7ff; }
.a-opt .e { font-size: 17px; width: 22px; text-align: center; }
.a-opt[aria-selected="true"] { background: linear-gradient(180deg, rgba(36, 86, 190, 0.55), rgba(20, 50, 125, 0.55)); color: #fff; }
.a-catdesc { margin: 8px 4px 0; font-size: 13px; line-height: 1.4; color: var(--muted); }
.a-langs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.a-lang { min-width: 0; height: 40px; display: flex; align-items: center; gap: 7px; padding: 0 8px; border-radius: 12px; cursor: pointer;
  background: var(--card); border: 1px solid var(--card-border); font-size: 13px; font-weight: 600; color: #dbe7ff; }
.a-lang span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.a-lang .flag { width: 20px; height: 20px; flex: none; border-radius: 50%; overflow: hidden; }
.a-lang .flag svg { width: 100%; height: 100%; display: block; }
.a-lang[aria-checked="true"] { background: linear-gradient(180deg, rgba(36, 86, 190, 0.55), rgba(20, 50, 125, 0.55)); border-color: rgba(100, 175, 255, 0.85); box-shadow: 0 0 12px rgba(60, 140, 255, 0.35); color: #fff; }
.a-opt-l { text-transform: none; letter-spacing: 0; font-weight: 600; color: #7f93bd; }
.a-ta { position: relative; }
.a-ta textarea { width: 100%; min-height: 88px; resize: none; padding: 12px 14px 26px; border-radius: 14px; font: inherit; font-size: 15px; color: var(--text);
  background: rgba(6, 14, 38, .7); border: 1px solid var(--card-border); outline: 0; user-select: text; -webkit-user-select: text; }
.a-ta textarea:focus { border-color: rgba(100,175,255,.75); box-shadow: 0 0 12px rgba(60,140,255,.3); }
.a-ta textarea::placeholder { color: #7f93bd; }
.a-count { position: absolute; bottom: 8px; inset-inline-end: 12px; font-size: 11.5px; font-weight: 700; color: #7f93bd; }
.a-count.max { color: #ffb36b; }
.a-check { width: 100%; display: flex; align-items: flex-start; gap: 12px; padding: 12px; border-radius: 14px; cursor: pointer; text-align: start;
  background: var(--card); border: 1px solid var(--card-border); }
.a-check .box { flex: none; width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; color: transparent; border: 2px solid rgba(143,190,255,.6); }
.a-check[aria-checked="true"] .box { color: #06142f; border-color: #8fd3ff; background: linear-gradient(180deg, #8fd3ff, #3d8bff); box-shadow: 0 0 10px rgba(80,170,255,.5); }
.a-check-tx { font-size: 13.5px; line-height: 1.45; color: #cfe0ff; }
.a-foot { flex: none; padding: 10px 16px calc(12px + var(--safe-b)); border-top: 1px solid rgba(110,170,255,.12); background: rgba(5, 12, 34, .85); }
.a-foot .btn-primary { width: 100%; }
.a-foot .btn-primary:disabled { opacity: .7; }
.a-done { text-align: center; padding-top: 18px; }
.a-done-ic { width: 84px; height: 84px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; color: #06142f;
  background: linear-gradient(180deg, #8ff0c4, #2fbf7f); box-shadow: 0 0 0 6px rgba(80,220,160,.12), 0 0 30px rgba(80,220,160,.45); }
.a-done-t { margin: 18px 0 6px; font-size: 24px; font-weight: 800; }
.a-done-d { margin: 0 8px; font-size: 14.5px; line-height: 1.45; color: var(--muted); }
.a-sum { margin-top: 20px; text-align: start; }
.a-pending { flex: none; align-self: flex-start; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; color: #2a1a00; background: linear-gradient(180deg, #ffe08a, #f5b82e); }
.a-done-btn { width: 100%; margin-top: 12px; }
.a-done .a-test { margin-top: 14px; }
.a-done .btn-primary.a-done-btn { margin-top: 22px; }

/* ====================== v11: filters sheet: reset link, Cancel/Apply, language dropdown ====================== */
body.sheet-open .tabbar { visibility: hidden; }
.sheet-head { gap: 10px; }
.sheet-head h2 { flex: 1; min-width: 0; }
.sheet-reset {
  flex: none; padding: 6px 4px; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 700; color: #7cc6ff; text-decoration: underline; text-underline-offset: 3px;
}
.sheet-reset:active { opacity: .7; }
.f-dd { position: relative; }
.f-dd-btn {
  width: 100%; height: 48px; display: flex; align-items: center; gap: 10px; padding: 0 12px 0 10px; cursor: pointer;
  border-radius: 14px; background: rgba(6, 14, 38, .7); border: 1px solid var(--card-border); color: var(--text); font: inherit; text-align: start;
}
.f-dd.open .f-dd-btn, .f-dd-btn:focus-visible { border-color: rgba(100,175,255,.75); box-shadow: 0 0 12px rgba(60,140,255,.3); outline: 0; }
.f-dd-cur { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.f-dd .flag { flex: none; width: 26px; height: 26px; border-radius: 50%; overflow: hidden; }
.f-dd .flag.globe { padding: 3px; color: #9fd0ff; background: rgba(40,80,160,.5); }
.f-dd .name { flex: 1; min-width: 0; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.f-dd .chev { flex: none; color: #8fb2ea; transition: transform .18s; }
.f-dd.open .chev { transform: rotate(180deg); }
.f-dd-list {
  list-style: none; margin: 6px 0 0; padding: 6px; max-height: 264px; overflow-y: auto; overscroll-behavior: contain;
  border-radius: 14px; background: #0a1a44; border: 1px solid rgba(100,175,255,.45); box-shadow: 0 10px 28px rgba(0,0,0,.45), 0 0 14px rgba(60,140,255,.2);
}
.f-dd-opt {
  width: 100%; height: 44px; display: flex; align-items: center; gap: 10px; padding: 0 10px; border: 0; border-radius: 10px; cursor: pointer;
  background: transparent; color: #dbe7ff; font: inherit; text-align: start;
}
.f-dd-opt:active { background: rgba(60, 120, 230, .18); }
@media (hover: hover) { .f-dd-opt:hover { background: rgba(60, 120, 230, .18); } }
.f-dd-opt .tick { flex: none; color: #7cc6ff; visibility: hidden; }
.f-dd-opt[aria-selected="true"] { background: linear-gradient(180deg, rgba(36, 86, 190, 0.55), rgba(20, 50, 125, 0.55)); color: #fff; }
.f-dd-opt[aria-selected="true"] .tick { visibility: visible; }

/* ====================== v14: active filter chips next to "Filtros" ====================== */
.filters-row { align-items: center; gap: 8px; min-width: 0; }
.active-chips {
  flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 6px; overflow-x: auto; scrollbar-width: none;
  padding-block: 3px; padding-inline: 0 16px; -webkit-overflow-scrolling: touch;
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 18px), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 18px), transparent);
}
[dir="rtl"] .active-chips { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 18px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 18px), transparent); }
.active-chips::-webkit-scrollbar { display: none; }
.active-chips[hidden] { display: none; }
.a-chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding-inline: 6px 4px; border-radius: 999px;
  font-size: 13px; font-weight: 700; color: #e6f0ff; white-space: nowrap;
  background: rgba(36, 86, 190, .38); border: 1px solid rgba(100, 175, 255, .55); box-shadow: 0 0 10px rgba(60,140,255,.18);
}
.a-chip:not(:has(.flag)) { padding-inline-start: 11px; }
.a-chip .flag { flex: none; width: 20px; height: 20px; border-radius: 50%; overflow: hidden; }
.a-chip-x {
  flex: none; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; cursor: pointer; display: grid; place-items: center;
  color: #fff; background: rgba(255, 255, 255, .14);
}
.a-chip-x:active { transform: scale(.9); background: rgba(255,255,255,.28); }
