/* ============================================================
   ⭐ Star radial menu — v2 homepage
   Square (core) → leagues (level 1) → sections (level 2) → teams (card)

   IMPORTANT: every node is a DIRECT child of .star-stage so that
   no ancestor transform becomes the containing block (which would
   break the absolute positioning). Visibility is driven by the
   .is-open class toggled from public/js/star-menu.js.
   ============================================================ */

.star-stage {
  --star-core: 116px;
  --pill-radius: 999px;
  position: relative;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  height: 404px;
  isolation: isolate;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* soft glow behind the whole star */
.star-stage::before {
  content: "";
  position: absolute;
  inset: 6% 8%;
  background:
    radial-gradient(closest-side, rgba(16, 185, 129, 0.16), transparent 72%),
    radial-gradient(closest-side, rgba(245, 158, 11, 0.09), transparent 78%);
  background-position: center, center;
  background-repeat: no-repeat;
  filter: blur(6px);
  pointer-events: none;
  z-index: 0;
}

/* connector lines */
.star-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
  overflow: visible;
}
.star-lines line {
  stroke: rgba(16, 185, 129, 0.4);
  stroke-width: 1.5;
  stroke-dasharray: 4 5;
  opacity: 0;
  transition: stroke 0.3s ease, opacity 0.3s ease;
}
/* faint orbit rings behind everything */
.star-lines circle.star-ring-guide {
  fill: none;
  stroke: rgba(16, 185, 129, 0.13);
  stroke-width: 1;
  stroke-dasharray: 3 8;
}
html.dark .star-lines circle.star-ring-guide { stroke: rgba(52, 211, 153, 0.14); }
.star-stage:hover .star-lines line.line-l1,
.star-stage[data-pinned="1"] .star-lines line.line-l1 { opacity: 1; }
.star-lines line.line-l2.on { opacity: 1; stroke: rgba(245, 158, 11, 0.6); }
html.dark .star-lines line { stroke: rgba(52, 211, 153, 0.35); }

/* no leagues yet — keep the card compact */
.star-stage--empty { height: 250px; }
.star-stage--empty::before { inset: 0; }

/* ── core square ─────────────────────────────────────────── */
.star-core {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: var(--star-core);
  height: var(--star-core);
  z-index: 60;
  border: 0;
  border-radius: 26px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: #fff;
  background: linear-gradient(140deg, #34d399 0%, #10b981 45%, #047857 100%);
  box-shadow:
    0 24px 48px -16px rgba(5, 150, 105, 0.65),
    0 2px 6px rgba(15, 23, 42, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.35s ease;
}
.star-core:hover,
.star-core:focus-visible {
  transform: translate(-50%, -50%) scale(1.06);
  box-shadow:
    0 30px 60px -16px rgba(5, 150, 105, 0.75),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  outline: none;
}
.star-core__icon { font-size: 30px; line-height: 1; }
.star-core__label { font-size: 13px; font-weight: 800; }
.star-core__hint {
  font-size: 9px;
  font-weight: 600;
  opacity: 0.88;
  background: rgba(255, 255, 255, 0.2);
  padding: 1px 7px;
  border-radius: 999px;
}

/* pulsing ring while idle */
.star-stage::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--star-core);
  height: var(--star-core);
  transform: translate(-50%, -50%);
  border-radius: 26px;
  border: 2px solid rgba(16, 185, 129, 0.45);
  z-index: 55;
  pointer-events: none;
  animation: starPulse 2.6s ease-out infinite;
}
.star-stage[data-open="1"]::after { animation: none; opacity: 0; }

@keyframes starPulse {
  0%   { transform: translate(-50%, -50%) scale(1);    opacity: 0.7; }
  70%  { transform: translate(-50%, -50%) scale(1.65); opacity: 0; }
  100% { transform: translate(-50%, -50%) scale(1.65); opacity: 0; }
}

/* ── nodes ───────────────────────────────────────────────── */
.star-ring { margin: 0; padding: 0; list-style: none; }

.star-node {
  position: absolute;
  left: var(--x, 0px);
  top: var(--y, 0px);
  transform: translate(-50%, -50%) scale(var(--s, 0));
  opacity: var(--o, 0);
  pointer-events: none;
  z-index: 20;
  transition:
    transform 0.42s cubic-bezier(0.34, 1.4, 0.64, 1),
    opacity 0.28s ease;
  transition-delay: var(--d, 0ms);
}
/* open state */
.star-node.is-open,
.star-stage:hover .star-ring--1 > .star-node,
.star-stage[data-pinned="1"] .star-ring--1 > .star-node {
  --s: 1;
  --o: 1;
  pointer-events: auto;
}
.star-ring--2 > .star-node { z-index: 30; }

/* ── pills ───────────────────────────────────────────────── */
.star-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: var(--pill-radius);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  text-decoration: none;
  border: 1px solid transparent;
  box-shadow: 0 6px 16px -6px rgba(15, 23, 42, 0.35);
  transition: box-shadow 0.25s ease, transform 0.25s ease, background 0.25s ease;
}
/* اسم الدوري: يتقص بـellipsis (الاسم الكامل فـtitle) */
.star-pill > span:not([class]) {
  display: inline-block;
  max-width: 132px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}
.star-pill:hover { transform: translateY(-2px) scale(1.04); }

.star-pill--league {
  background: linear-gradient(135deg, #ffffff, #f1f5f9);
  color: #0f172a;
  border-color: rgba(16, 185, 129, 0.5);
}
.star-pill--league:hover {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 12px 26px -8px rgba(5, 150, 105, 0.6);
}

.star-pill--section {
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: #e2e8f0;
  font-size: 10.5px;
  padding: 5px 11px;
}
.star-pill--section:hover {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
}
.star-pill--more {
  background: #fff;
  color: #047857;
  border: 1px dashed rgba(16, 185, 129, 0.6);
  font-size: 11px;
  padding: 5px 11px;
}
.star-pill--more:hover { background: #059669; color: #fff; border-style: solid; }

.star-pill__logo {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
  background: #e2e8f0;
}
.star-pill__dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 900;
  color: #fff;
}
.star-pill__count {
  font-size: 10px;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.15);
  color: #047857;
}
.star-pill--league:hover .star-pill__count {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

/* ── level 3: teams card ─────────────────────────────────── */
.star-teams {
  position: absolute;
  left: var(--x, 0px);
  top: var(--y, 0px);
  transform: translate(-50%, -50%) scale(0.85);
  width: 178px;
  max-height: 236px;
  overflow-y: auto;
  padding: 8px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 18px 40px -12px rgba(15, 23, 42, 0.4);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.star-teams.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}
.star-teams__title {
  font-size: 10px;
  font-weight: 800;
  color: #0f172a;
  padding: 2px 4px 6px;
  border-bottom: 1px dashed rgba(15, 23, 42, 0.15);
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.star-teams__list { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
.star-team {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 5px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  color: #334155;
  text-decoration: none;
  overflow: hidden;
}
.star-team:hover { background: #ecfdf5; color: #047857; }
.star-team__logo {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
  background: #e2e8f0;
}
.star-team__dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 7px;
  font-weight: 900;
  color: #fff;
}
.star-team__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.star-teams__more {
  display: block;
  margin-top: 5px;
  padding-top: 5px;
  border-top: 1px dashed rgba(15, 23, 42, 0.15);
  text-align: center;
  font-size: 10px;
  font-weight: 800;
  color: #047857;
  text-decoration: none;
}

/* ── dark mode ───────────────────────────────────────────── */
html.dark .star-pill--league {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  color: #e2e8f0;
  border-color: rgba(52, 211, 153, 0.4);
}
html.dark .star-pill--league:hover {
  background: linear-gradient(135deg, #10b981, #047857);
  color: #fff;
}
html.dark .star-pill__count { background: rgba(52, 211, 153, 0.18); color: #6ee7b7; }
html.dark .star-pill--league:hover .star-pill__count { background: rgba(255, 255, 255, 0.22); color: #fff; }
html.dark .star-teams {
  background: rgba(15, 23, 42, 0.98);
  border-color: rgba(148, 163, 184, 0.25);
}
html.dark .star-teams__title { color: #e2e8f0; border-bottom-color: rgba(148, 163, 184, 0.25); }
html.dark .star-team { color: #cbd5e1; }
html.dark .star-team:hover { background: rgba(6, 78, 59, 0.55); color: #6ee7b7; }

/* ── responsive ──────────────────────────────────────────── */
@media (max-width: 640px) {
  .star-stage { height: 420px; }
  .star-stage { --star-core: 96px; }
  .star-core__icon { font-size: 25px; }
  .star-core__label { font-size: 11px; }
  .star-core__hint { display: inline-block !important; font-size: 8px; padding: 1px 5px; }
  .star-pill { font-size: 11px; padding: 6px 11px; }
  .star-pill > span:not([class]) { max-width: 104px; }
  .star-teams { width: 152px; }
}

@media (hover: none) {
  .star-stage::after { animation: none; opacity: 0.35; }
}


/* ═══ 💡 تلميح أول زيارة (النجمة) ═══════════════════════════ */
.star-core__hint .hint-touch { display: none; }
@media (hover: none) {
  .star-core__hint .hint-hover { display: none; }
  .star-core__hint .hint-touch { display: inline; }
}
.star-stage.is-hint .star-core {
  animation: starHintPulse 2.2s ease-in-out infinite;
  border-color: #34d399;
}
@keyframes starHintPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.65); transform: scale(1); }
  50%      { box-shadow: 0 0 0 16px rgba(52, 211, 153, 0); transform: scale(1.07); }
}
@media (prefers-reduced-motion: reduce) {
  .star-stage.is-hint .star-core { animation: none; }
}
