/* ==========================================================================
   جمال تي في — Jamal TV
   هوية بصرية مطابقة لتطبيق مواقيتي: النعناعي، الذهبي، خطوط Almarai و Amiri
   ========================================================================== */

@font-face {
  font-family: "Almarai";
  src: url("assets/fonts/almarai-light.ttf") format("truetype");
  font-weight: 300;
  font-display: swap;
}
@font-face {
  font-family: "Almarai";
  src: url("assets/fonts/almarai-regular.ttf") format("truetype");
  font-weight: 400 500;
  font-display: swap;
}
@font-face {
  font-family: "Almarai";
  src: url("assets/fonts/almarai-bold.ttf") format("truetype");
  font-weight: 600 700;
  font-display: swap;
}
@font-face {
  font-family: "Almarai";
  src: url("assets/fonts/almarai-extrabold.ttf") format("truetype");
  font-weight: 800;
  font-display: swap;
}
@font-face {
  font-family: "Amiri";
  src: url("assets/fonts/amiri-regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

/* ---------- المتغيرات (نفس لوحة مواقيتي) ---------- */
:root {
  --bg: #f4faf7;
  --bg-2: #ecf6f0;
  --card: #ffffff;
  --card-2: #f2f9f5;
  --ink: #0c2a21;
  --muted: #5c7770;
  --border: #e1efe9;
  --primary: #0e7c60;
  --primary-deep: #0a5b46;
  --primary-darkest: #063a2c;
  --mint: #2fbf8f;
  --mint-soft: #e4f5ee;
  --gold: #d2a75c;
  --gold-deep: #8a5f1c;
  --gold-soft: #fbf3e2;
  --ring-gold: #f2ce8f;
  --danger: #c0453e;
  --shadow: 0 26px 60px -34px rgba(6, 58, 44, 0.38);
  --shadow-soft: 0 18px 42px -28px rgba(6, 58, 44, 0.38);
  --topbar-bg: rgba(244, 250, 247, 0.86);
  --hero-top: #063a2c;
  --hero-mid: #0a5b46;
  --hero-bottom: #0f8063;
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #061410;
  --bg-2: #0a1c16;
  --card: #0c211a;
  --card-2: #102a21;
  --ink: #e8f5f0;
  --muted: #9db8af;
  --border: #1d3b30;
  --primary: #4fd6a8;
  --primary-deep: #0a5b46;
  --primary-darkest: #04231a;
  --mint: #2fbf8f;
  --mint-soft: #123829;
  --gold: #e5bf78;
  --gold-deep: #e5bf78;
  --gold-soft: #2a2418;
  --ring-gold: #f2ce8f;
  --danger: #e07973;
  --shadow: 0 26px 60px -34px rgba(0, 0, 0, 0.8);
  --shadow-soft: 0 18px 42px -28px rgba(0, 0, 0, 0.72);
  --topbar-bg: rgba(6, 20, 16, 0.87);
  --hero-top: #04231a;
  --hero-mid: #0a4d3b;
  --hero-bottom: #0d6b51;
  color-scheme: dark;
}

/* ---------- أساسيات ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: "Almarai", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; }
button { font-family: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
input, textarea { font-family: inherit; }

/* خاصية hidden لها الأولوية دائماً — حاسم للطبقات */
[hidden] { display: none !important; }

::selection { background: var(--mint-soft); color: var(--ink); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--mint); }

/* ---------- البنية العامة ---------- */
#app {
  display: grid;
  grid-template-columns: 250px 1fr;
  grid-template-rows: 64px 1fr;
  grid-template-areas:
    "rail topbar"
    "rail main";
  min-height: 100dvh;
}

/* ---------- الشريط الجانبي ---------- */
.rail {
  grid-area: rail;
  background: var(--card);
  border-inline-start: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow-y: auto;
}

.rail-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 10px 22px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}

.rail-logo-img {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  box-shadow: var(--shadow-soft);
}

.rail-logo-text b {
  display: block;
  font-size: 17px;
  font-weight: 800;
  color: var(--primary-deep);
}

html[data-theme="dark"] .rail-logo-text b { color: var(--primary); }

.rail-logo-text span {
  font-size: 11.5px;
  color: var(--muted);
  display: block;
}

.rail-nav { display: flex; flex-direction: column; gap: 4px; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 14px;
  color: var(--muted);
  font-weight: 700;
  font-size: 14.5px;
  transition: all 0.18s ease;
  position: relative;
}

.nav-link svg { width: 21px; height: 21px; fill: currentColor; opacity: 0.85; }

.nav-link:hover { background: var(--mint-soft); color: var(--primary-deep); }
html[data-theme="dark"] .nav-link:hover { color: var(--primary); }

.nav-link.active {
  background: linear-gradient(135deg, var(--primary-deep), var(--primary));
  color: #fff;
  box-shadow: var(--shadow-soft);
}

html[data-theme="dark"] .nav-link.active { color: #04231a; }

.nav-badge {
  margin-inline-start: auto;
  background: var(--gold);
  color: var(--primary-darkest);
  font-style: normal;
  font-size: 11px;
  font-weight: 800;
  min-width: 22px;
  height: 20px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  padding: 0 6px;
}

.rail-foot { margin-top: auto; padding-top: 20px; }

.rail-foot-card {
  background: linear-gradient(145deg, var(--hero-mid), var(--hero-top));
  border-radius: 18px;
  padding: 18px;
  text-align: center;
  color: #fff;
  box-shadow: var(--shadow-soft);
}

.rail-foot-card b {
  display: block;
  font-size: 24px;
  font-weight: 800;
  color: var(--ring-gold);
  font-family: "Amiri", serif;
}

.rail-foot-card span { font-size: 12px; opacity: 0.85; }

.rail-copy {
  margin-top: 14px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  line-height: 1.9;
}

/* ---------- الشريط العلوي ---------- */
.topbar {
  grid-area: topbar;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 22px;
  background: var(--topbar-bg);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar-brand { display: none; align-items: center; gap: 10px; font-size: 17px; font-weight: 800; }
.topbar-brand-img { width: 34px; height: 34px; border-radius: 10px; }

.searchbox {
  flex: 1;
  max-width: 560px;
  margin-inline-start: auto;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  inset-inline-start: 14px;
  width: 19px;
  height: 19px;
  fill: var(--muted);
  pointer-events: none;
}

#searchInput {
  width: 100%;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 15px;
  padding: 10px 44px 10px 44px;
  font-size: 14.5px;
  color: var(--ink);
  outline: none;
  transition: all 0.2s ease;
}

#searchInput:focus {
  border-color: var(--mint);
  box-shadow: 0 0 0 4px var(--mint-soft);
}

.search-clear {
  position: absolute;
  inset-inline-end: 10px;
  background: var(--mint-soft);
  color: var(--muted);
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  font-size: 12px;
}

.icon-btn {
  background: var(--card);
  border: 1.5px solid var(--border);
  width: 40px;
  height: 40px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  color: var(--muted);
  transition: all 0.2s ease;
}

.icon-btn:hover { color: var(--primary); border-color: var(--mint); transform: translateY(-1px); }
.icon-btn svg { width: 20px; height: 20px; fill: currentColor; }

/* ---------- المحتوى ---------- */
#main {
  grid-area: main;
  padding: 26px 28px 100px;
  max-width: 1600px;
  width: 100%;
  margin-inline: auto;
  animation: viewIn 0.28s ease;
}

@keyframes viewIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.view-head { margin-bottom: 20px; }

.view-title {
  font-size: 26px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
}

.view-title .vemoji { font-size: 22px; }

.view-sub { color: var(--muted); font-size: 13.5px; margin-top: 4px; }

/* ---------- البطل (الواجهة الرئيسية) ---------- */
.hero {
  position: relative;
  border-radius: 26px;
  padding: 46px 42px 40px;
  overflow: hidden;
  background: linear-gradient(160deg, var(--hero-top), var(--hero-mid) 55%, var(--hero-bottom));
  color: #fff;
  box-shadow: var(--shadow);
  margin-bottom: 30px;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 420px 200px at 88% -10%, rgba(242, 206, 143, 0.22), transparent 60%),
    radial-gradient(ellipse 300px 260px at 0% 110%, rgba(79, 214, 168, 0.16), transparent 60%);
  pointer-events: none;
}

.hero-grid {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  flex-wrap: wrap;
}

.hero-title {
  font-family: "Amiri", "Almarai", serif;
  font-size: clamp(34px, 5vw, 52px);
  font-weight: 400;
  line-height: 1.25;
}

.hero-title em { color: var(--ring-gold); font-style: normal; }

.hero-sub {
  margin-top: 10px;
  font-size: 15px;
  opacity: 0.88;
  max-width: 520px;
}

.hero-by {
  margin-top: 18px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(242, 206, 143, 0.35);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  backdrop-filter: blur(6px);
}

.hero-by b { color: var(--ring-gold); }

.hero-stats {
  position: relative;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-stat {
  background: rgba(6, 58, 44, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
  border-radius: 18px;
  padding: 14px 22px;
  text-align: center;
  min-width: 110px;
}

.hero-stat b {
  display: block;
  font-size: 26px;
  font-weight: 800;
  color: var(--ring-gold);
  font-family: "Amiri", serif;
}

.hero-stat span { font-size: 12px; opacity: 0.8; }

/* ---------- صفوف المحتوى ---------- */
.row { margin-bottom: 34px; }

.row-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.row-title {
  font-size: 19px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.row-emoji { font-size: 20px; }

.row-link {
  margin-inline-start: auto;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--mint-soft);
  transition: all 0.15s ease;
}

.row-link:hover { background: var(--mint); color: #fff; }

.scroller {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 178px;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 10px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}

.scroller > * { scroll-snap-align: start; }

/* ---------- بطاقات القنوات ---------- */
.ch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(172px, 1fr));
  gap: 16px;
}

.ch-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  position: relative;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.ch-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-soft);
  border-color: var(--mint);
}

.ch-logo-wrap {
  width: 84px;
  height: 84px;
  border-radius: 18px;
  background: var(--card-2);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
}

.ch-logo-wrap img {
  max-width: 100%;
  max-height: 100%;
  padding: 10px;
  object-fit: contain;
}

.ch-fallback {
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  font-family: "Amiri", serif;
}

.ch-name {
  font-size: 13.5px;
  font-weight: 700;
  text-align: center;
  line-height: 1.5;
  min-height: 42px;
  display: flex;
  align-items: center;
  word-break: break-word;
}

.ch-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--muted);
  flex-wrap: wrap;
  justify-content: center;
}

.ch-meta .flag { font-size: 15px; line-height: 1; }

.ch-tag {
  background: var(--mint-soft);
  color: var(--primary-deep);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 10.5px;
  font-weight: 700;
}

html[data-theme="dark"] .ch-tag { color: var(--primary); }

.ch-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, rgba(6, 58, 44, 0.55), rgba(10, 91, 70, 0.65));
  border-radius: 19px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.ch-card:hover .ch-play { opacity: 1; }

.ch-play-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--gold);
  display: grid;
  place-items: center;
  box-shadow: 0 10px 24px -8px rgba(0, 0, 0, 0.5);
}

.ch-play-btn svg { width: 24px; height: 24px; fill: var(--primary-darkest); margin-inline-start: 2px; }

.ch-fav {
  position: absolute;
  top: 9px;
  inset-inline-end: 9px;
  width: 32px;
  height: 32px;
  border-radius: 11px;
  border: none;
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 15px;
  display: grid;
  place-items: center;
  z-index: 2;
  transition: all 0.15s ease;
  opacity: 0;
}

.ch-card:hover .ch-fav, .ch-fav.active { opacity: 1; }
.ch-fav.active { background: var(--gold); color: var(--primary-darkest); }
.ch-fav:active { transform: scale(0.9); }

/* ---------- بطاقات الدول ---------- */
.co-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}

.co-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px 14px;
  text-align: center;
  cursor: pointer;
  transition: all 0.18s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.co-card:hover {
  transform: translateY(-3px);
  border-color: var(--mint);
  box-shadow: var(--shadow-soft);
}

.co-flag { font-size: 34px; line-height: 1.2; }

.co-name { font-weight: 800; font-size: 14.5px; }

.co-count { font-size: 11.5px; color: var(--muted); }

.co-count b { color: var(--gold-deep); }
html[data-theme="dark"] .co-count b { color: var(--gold); }

/* ---------- شبكات الفئات ---------- */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}

.cat-card {
  background: linear-gradient(150deg, var(--card), var(--card-2));
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.18s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.cat-card:hover {
  transform: translateY(-3px);
  border-color: var(--gold);
  box-shadow: var(--shadow-soft);
}

.cat-emoji { font-size: 30px; }

.cat-name { font-weight: 800; font-size: 14.5px; }

.cat-count { font-size: 11.5px; color: var(--muted); }

/* ---------- رقائق سريعة ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 9px; }

.chip {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.chip:hover { border-color: var(--mint); color: var(--primary); transform: translateY(-1px); }
.chip .flag { font-size: 16px; }
.chip b { color: var(--gold-deep); font-size: 11px; }
html[data-theme="dark"] .chip b { color: var(--gold); }

/* ---------- عناصر عامة ---------- */
.section-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--primary-deep);
  margin: 30px 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

html[data-theme="dark"] .section-title { color: var(--primary); }

.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

.empty-icon { font-size: 52px; margin-bottom: 12px; }
.empty h3 { color: var(--ink); font-size: 18px; margin-bottom: 6px; }
.empty p { font-size: 13.5px; }

.load-more {
  grid-column: 1 / -1;
  justify-self: center;
  margin-top: 10px;
  padding: 12px 40px;
  background: var(--mint-soft);
  color: var(--primary-deep);
  border: none;
  border-radius: 999px;
  font-weight: 800;
  font-size: 14px;
  transition: all 0.15s ease;
}

html[data-theme="dark"] .load-more { color: var(--primary); }
.load-more:hover { background: var(--mint); color: #fff; }

/* ---------- الإعدادات ---------- */
.settings-list { display: flex; flex-direction: column; gap: 14px; max-width: 720px; }

.set-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px 22px;
}

.set-card h3 {
  font-size: 15.5px;
  font-weight: 800;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.set-card p { font-size: 13px; color: var(--muted); margin-bottom: 14px; }

.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.set-label { font-size: 14px; font-weight: 700; }

/* مفتاح تبديل */
.switch { position: relative; width: 50px; height: 28px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }

.slider-track {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.slider-track::before {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  inset-inline-end: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.switch input:checked + .slider-track {
  background: linear-gradient(135deg, var(--primary-deep), var(--mint));
}

.switch input:checked + .slider-track::before { transform: translateX(-22px); }
html[dir="ltr"] .switch input:checked + .slider-track::before { transform: translateX(22px); }

.btn {
  border: none;
  border-radius: 14px;
  padding: 11px 22px;
  font-size: 14px;
  font-weight: 800;
  transition: all 0.15s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-deep), var(--primary));
  color: #fff;
  box-shadow: var(--shadow-soft);
}

html[data-theme="dark"] .btn-primary { color: #04231a; }

.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.08); }

.btn-ghost {
  background: var(--mint-soft);
  color: var(--primary-deep);
}

html[data-theme="dark"] .btn-ghost { color: var(--primary); }

.btn-danger { background: rgba(192, 69, 62, 0.12); color: var(--danger); }

.select {
  background: var(--card-2);
  border: 1.5px solid var(--border);
  color: var(--ink);
  border-radius: 12px;
  padding: 9px 14px;
  font-size: 13.5px;
  font-weight: 700;
  outline: none;
}

.about-brand {
  text-align: center;
  padding: 30px 20px 10px;
  color: var(--muted);
}

.about-brand .amiri {
  font-family: "Amiri", serif;
  font-size: 30px;
  color: var(--primary-deep);
}

html[data-theme="dark"] .about-brand .amiri { color: var(--primary); }

/* ---------- المشغل ---------- */
.player {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #04120d;
  display: flex;
}

.player-stage {
  position: relative;
  flex: 1;
  display: grid;
  place-items: center;
  background: #000;
}

#video { width: 100%; height: 100%; object-fit: contain; background: #000; }

.player-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: #e8f5f0;
  background: rgba(4, 18, 13, 0.82);
  backdrop-filter: blur(4px);
  z-index: 5;
}

.player-loading p { font-size: 14px; opacity: 0.85; }

.spinner {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 4px solid rgba(79, 214, 168, 0.2);
  border-top-color: var(--mint);
  animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.player-error {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #e8f5f0;
  background: rgba(4, 18, 13, 0.92);
  z-index: 6;
  text-align: center;
  padding: 20px;
}

.player-error-icon { font-size: 54px; }
.player-error h3 { font-size: 20px; }
.player-error p { font-size: 13.5px; opacity: 0.7; }

.player-error-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; justify-content: center; }

.player-top {
  position: absolute;
  top: 0;
  inset-inline: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: linear-gradient(180deg, rgba(4, 18, 13, 0.88), transparent);
  z-index: 10;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.player.hidden-ui .player-top { opacity: 0; transform: translateY(-10px); pointer-events: none; }

.player-info {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(6, 58, 44, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 8px 16px;
  min-width: 0;
}

#pLogo { width: 40px; height: 40px; object-fit: contain; border-radius: 10px; background: rgba(255,255,255,0.08); padding: 4px; }

.player-info-text b { display: block; color: #fff; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-info-text span { font-size: 11.5px; color: #9db8af; }

.player-top-actions { margin-inline-start: auto; display: flex; gap: 8px; }

.pbtn {
  background: rgba(6, 58, 44, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  font-size: 17px;
  display: grid;
  place-items: center;
  transition: all 0.15s ease;
  backdrop-filter: blur(10px);
}

.pbtn:hover { background: var(--mint); color: var(--primary-darkest); }
.pbtn-close { background: rgba(192, 69, 62, 0.85); border-color: transparent; }
.pbtn-close:hover { background: #c0453e; color: #fff; }

.player-controls {
  position: absolute;
  bottom: 0;
  inset-inline: 0;
  padding: 16px 20px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  background: linear-gradient(0deg, rgba(4, 18, 13, 0.9), transparent);
  z-index: 10;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.player.hidden-ui .player-controls { opacity: 0; transform: translateY(12px); pointer-events: none; }

.controls-row {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 900px;
  margin-inline: auto;
}

.cbtn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fff;
  min-width: 44px;
  height: 44px;
  padding: 0 12px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  transition: all 0.15s ease;
  backdrop-filter: blur(10px);
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.cbtn svg { width: 22px; height: 22px; fill: currentColor; }
.cbtn:hover { background: var(--mint); color: var(--primary-darkest); }

#volRange {
  width: 110px;
  accent-color: var(--mint);
  cursor: pointer;
}

.live-badge {
  background: rgba(210, 167, 92, 0.18);
  border: 1px solid rgba(242, 206, 143, 0.5);
  color: var(--ring-gold);
  font-size: 11.5px;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 999px;
  animation: pulse 2.2s ease infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(242, 206, 143, 0.4); }
  50% { box-shadow: 0 0 0 7px rgba(242, 206, 143, 0); }
}

.controls-spacer { flex: 1; }

/* ---------- النافذة المنبثقة ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(4, 18, 13, 0.7);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 24px;
  width: min(640px, 100%);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}

.modal-head h3 { font-size: 16.5px; font-weight: 800; }

.modal-body { padding: 20px 22px; }

.modal-note {
  font-size: 13px;
  color: var(--muted);
  background: var(--mint-soft);
  border-radius: 14px;
  padding: 12px 16px;
  margin-bottom: 14px;
  line-height: 1.9;
}

.pl-row { display: flex; gap: 10px; margin-bottom: 12px; }

.pl-row input {
  flex: 1;
  background: var(--card-2);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--ink);
  outline: none;
}

.pl-row input:focus { border-color: var(--mint); }

#plText {
  width: 100%;
  background: var(--card-2);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 12.5px;
  color: var(--ink);
  outline: none;
  resize: vertical;
  font-family: ui-monospace, monospace;
  margin-bottom: 12px;
}

#plText:focus { border-color: var(--mint); }

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13.5px;
  cursor: pointer;
}

.check-row input { accent-color: var(--primary); width: 17px; height: 17px; }

.modal-foot {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 16px 22px;
  border-top: 1px solid var(--border);
}

/* ---------- التوست ---------- */
.toast {
  position: fixed;
  bottom: 90px;
  inset-inline: 0;
  margin-inline: auto;
  width: max-content;
  max-width: 90vw;
  background: var(--primary-darkest);
  color: #fff;
  border: 1px solid var(--mint);
  padding: 12px 26px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 700;
  z-index: 200;
  box-shadow: var(--shadow);
  animation: toastIn 0.25s ease;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* ---------- الشريط السفلي (جوال) ---------- */
.bottomnav { display: none; }

@media (max-width: 920px) {
  #app {
    grid-template-columns: 1fr;
    grid-template-areas:
      "topbar"
      "main";
  }

  .rail { display: none; }

  .topbar {
    padding: 0 14px;
    gap: 10px;
  }

  .topbar-brand { display: flex; }

  #main {
    padding: 18px 14px 120px;
  }

  .hero { padding: 32px 22px; border-radius: 22px; }

  .hero-stats { width: 100%; }

  .bottomnav {
    display: flex;
    position: fixed;
    bottom: 0;
    inset-inline: 0;
    background: var(--topbar-bg);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    z-index: 60;
  }

  .bn-link {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 7px 4px;
    border-radius: 14px;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 700;
    transition: all 0.15s ease;
  }

  .bn-link svg { width: 22px; height: 22px; fill: currentColor; }

  .bn-link.active {
    color: var(--primary);
    background: var(--mint-soft);
  }

  .ch-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
  .co-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .scroller { grid-auto-columns: 152px; }

  #volRange { width: 70px; }
  .player-info-text b { max-width: 40vw; }
}

/* ---------- شاشات صغيرة جداً ---------- */
@media (max-width: 380px) {
  .hero-stat { min-width: 90px; padding: 10px 12px; }
  .hero-stat b { font-size: 20px; }
  .ch-grid { grid-template-columns: repeat(2, 1fr); }
}
