/* ============================================================
   مرکز بازی البرزروز — Game Hub (namespaced: agh-)
   Dark theme · Purple brand · No-scroll · RTL
   ============================================================ */

:root {
  --agh-purple: #6b21a8;
  --agh-purple-mid: #91007c;
  --agh-purple-light: #a855f7;
  --agh-purple-bright: #c084fc;
  --agh-purple-soft: rgba(168, 85, 247, 0.18);
  --agh-navy: #0f0818;
  --agh-white: #ffffff;
  --agh-gold: #fbbf24;
  --agh-text: #f3eef9;
  --agh-muted: #b5a8c9;
  --agh-bg: #12081c;
  --agh-surface: #1c1030;
  --agh-surface-2: #261640;
  --agh-btn: rgb(145 0 124 / 92%);
  --agh-btn-active: rgb(165 20 145 / 95%);
  --agh-line: rgba(192, 132, 252, 0.28);
  --agh-shadow: 0 22px 50px rgba(0, 0, 0, 0.45);
  --agh-safe-t: env(safe-area-inset-top, 0px);
  --agh-safe-b: env(safe-area-inset-bottom, 0px);
  --agh-safe-l: env(safe-area-inset-left, 0px);
  --agh-safe-r: env(safe-area-inset-right, 0px);
  --agh-font: 'Vazirmatn', Tahoma, sans-serif;
  --agh-portal: clamp(168px, 30vmin, 300px);
  --agh-portal-gap: clamp(2.75rem, 10vw, 6.5rem);
  --agh-header-h: clamp(52px, 9vh, 72px);
  --agh-footer-h: clamp(16px, 2.6vh, 22px);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
}

body.agh-body {
  font-family: var(--agh-font);
  color: var(--agh-text);
  background: var(--agh-bg);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
}

.agh-page {
  position: relative;
  isolation: isolate;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  height: 100svh;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  display: grid;
  grid-template-rows: var(--agh-header-h) 1fr var(--agh-footer-h);
  padding:
    var(--agh-safe-t)
    max(0.75rem, var(--agh-safe-r))
    var(--agh-safe-b)
    max(0.75rem, var(--agh-safe-l));
}

/* ---------- Background ---------- */
.agh-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(ellipse 65% 50% at 50% 28%, rgba(145, 0, 124, 0.38), transparent 68%),
    radial-gradient(ellipse 45% 40% at 12% 78%, rgba(107, 33, 168, 0.28), transparent 60%),
    radial-gradient(ellipse 40% 35% at 88% 18%, rgba(168, 85, 247, 0.18), transparent 55%),
    linear-gradient(180deg, #1a0b2e 0%, #12081c 52%, #0c0614 100%);
}

.agh-bg-mountain {
  position: absolute;
  left: 50%;
  bottom: 6%;
  width: min(92vw, 920px);
  height: 26%;
  transform: translateX(-50%);
  opacity: 0.22;
  background:
    radial-gradient(ellipse 40% 80% at 50% 100%, var(--agh-purple-light) 0%, transparent 70%);
  clip-path: polygon(0% 100%, 12% 62%, 22% 78%, 38% 42%, 50% 58%, 62% 38%, 78% 70%, 88% 55%, 100% 100%);
}

.agh-bubble {
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid rgba(192, 132, 252, 0.28);
  background: rgba(168, 85, 247, 0.12);
  animation: aghFloat 9s ease-in-out infinite;
}

.agh-bubble--1 { width: 18px; height: 18px; top: 18%; right: 12%; animation-delay: 0s; }
.agh-bubble--2 { width: 12px; height: 12px; top: 42%; left: 8%; animation-delay: -2s; }
.agh-bubble--3 { width: 22px; height: 22px; bottom: 22%; right: 18%; animation-delay: -4s; }
.agh-bubble--4 { width: 10px; height: 10px; top: 28%; left: 22%; animation-delay: -1s; }
.agh-bubble--5 { width: 14px; height: 14px; bottom: 30%; left: 14%; animation-delay: -3.5s; }

.agh-wave {
  position: absolute;
  bottom: 0;
  left: -10%;
  width: 120%;
  height: 16%;
  opacity: 0.28;
  background:
    radial-gradient(ellipse 60% 100% at 20% 100%, rgba(96, 165, 250, 0.22), transparent 70%),
    radial-gradient(ellipse 50% 100% at 70% 100%, rgba(168, 85, 247, 0.3), transparent 70%);
  animation: aghWave 12s ease-in-out infinite;
}

@keyframes aghFloat {
  0%, 100% { transform: translateY(0); opacity: 0.45; }
  50% { transform: translateY(-14px); opacity: 0.85; }
}

@keyframes aghWave {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(-3%); }
}

/* ---------- Header ---------- */
.agh-header {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.35rem 0.25rem;
}

.agh-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  border-radius: 10px;
}

.agh-logo img {
  display: block;
  height: clamp(28px, 5.5vh, 44px);
  width: auto;
  max-width: min(42vw, 180px);
  object-fit: contain;
  filter: brightness(1.08) drop-shadow(0 4px 14px rgba(0, 0, 0, 0.35));
}

.agh-home-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.9rem;
  min-height: 44px;
  border-radius: 12px;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  background: var(--agh-btn);
  color: var(--agh-white);
  font-family: inherit;
  font-size: clamp(0.72rem, 1.6vw, 0.88rem);
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 8px 22px rgba(145, 0, 124, 0.4);
  transition: transform 0.15s, background 0.2s;
}

.agh-home-btn:hover { background: var(--agh-btn-active); transform: translateY(-1px); }
.agh-home-btn:active { transform: scale(0.98); background: var(--agh-btn-active); }
.agh-home-btn:focus-visible {
  outline: 3px solid var(--agh-purple-bright);
  outline-offset: 2px;
}

.agh-home-btn svg {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
}

.agh-home-label-short { display: none; }

/* ---------- Main ---------- */
.agh-main {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-rows: auto 1fr;
  align-content: center;
  gap: clamp(0.45rem, 1.8vh, 1.15rem);
  min-height: 0;
  padding: 0.15rem 0.25rem;
}

.agh-identity {
  text-align: center;
  animation: aghIn 0.55s ease both;
  margin-top: clamp(0.55rem, 2.2vh, 1.35rem);
}

.agh-title {
  font-size: clamp(1.35rem, 4.4vw, 2.25rem);
  font-weight: 700;
  color: var(--agh-white);
  line-height: 1.25;
  letter-spacing: -0.01em;
  text-shadow: 0 6px 28px rgba(145, 0, 124, 0.35);
}

.agh-sub {
  margin-top: 0.65rem;
  font-size: clamp(0.78rem, 1.7vw, 0.98rem);
  color: var(--agh-muted);
  line-height: 1.45;
}

.agh-sub-mobile { display: none; }

.agh-lead {
  margin: calc(0.45rem + 10px) auto 0;
  max-width: min(36rem, 88vw);
  font-size: clamp(0.78rem, 1.65vw, 0.95rem);
  line-height: 1.65;
  color: rgba(181, 168, 201, 0.82);
}

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

@keyframes aghPulse {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50% { transform: scale(1.25); opacity: 1; }
}

/* ---------- Portals ---------- */
.agh-hub {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding-block: 0.35rem;
}

.agh-orbit {
  position: absolute;
  width: min(86vw, 720px);
  height: min(48vh, 320px);
  border: 1.5px dashed rgba(192, 132, 252, 0.2);
  border-radius: 50%;
  pointer-events: none;
  animation: aghSpin 48s linear infinite;
}

.agh-connector {
  position: absolute;
  width: min(28vw, 160px);
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(192, 132, 252, 0.45), transparent);
  pointer-events: none;
}

.agh-portals {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--agh-portal-gap);
  width: 100%;
  max-width: 1100px;
}

.agh-portal {
  --tilt-x: 0deg;
  --tilt-y: 0deg;
  position: relative;
  width: var(--agh-portal);
  aspect-ratio: 1;
  text-decoration: none;
  color: inherit;
  border-radius: 50%;
  transform: perspective(800px) rotateX(var(--tilt-x)) rotateY(var(--tilt-y));
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  animation: aghPortalIn 0.65s cubic-bezier(0.34, 1.2, 0.64, 1) both;
}

.agh-portal:nth-child(1) { animation-delay: 0.08s; }
.agh-portal:nth-child(2) { animation-delay: 0.18s; }

.agh-portal:hover,
.agh-portal:focus-visible {
  transform: perspective(800px) rotateX(var(--tilt-x)) rotateY(var(--tilt-y)) scale(1.03);
  z-index: 3;
}

.agh-portal:focus-visible {
  outline: 3px solid var(--agh-purple-bright);
  outline-offset: 6px;
}

.agh-portal.is-pressed {
  transform: scale(0.98);
}

.agh-portal-ring {
  position: absolute;
  inset: -6%;
  border-radius: 50%;
  border: 2px solid rgba(192, 132, 252, 0.28);
  animation: aghSpin 28s linear infinite;
  pointer-events: none;
}

.agh-portal-ring--dots {
  inset: -12%;
  border-style: dashed;
  border-color: rgba(145, 0, 124, 0.32);
  animation-duration: 40s;
  animation-direction: reverse;
}

.agh-portal-face {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 22%, rgba(168, 85, 247, 0.28), transparent 48%),
    linear-gradient(180deg, #2a1748 0%, #1a0f30 55%, #140a24 100%);
  border: 2px solid rgba(192, 132, 252, 0.35);
  box-shadow:
    var(--agh-shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 0 1px rgba(145, 0, 124, 0.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 10% 11% 14%;
  overflow: hidden;
  text-align: center;
}

.agh-portal:hover .agh-portal-face,
.agh-portal:focus-visible .agh-portal-face {
  box-shadow:
    0 26px 56px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 0 0 1px rgba(192, 132, 252, 0.45),
    0 0 40px rgba(145, 0, 124, 0.25);
}

.agh-portal-art {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 0;
  max-height: 46%;
  pointer-events: none;
}

.agh-portal-art-primary {
  display: block;
  width: auto;
  height: auto;
  max-width: 70%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.4));
  animation: aghBob 3.6s ease-in-out infinite;
}

.agh-portal--football .agh-portal-art-primary { animation-duration: 2.8s; max-width: 66%; }
.agh-portal--water .agh-portal-art-primary { animation-duration: 4.2s; max-width: 56%; }

.agh-portal-art-secondary {
  position: absolute;
  width: 24%;
  max-height: 40%;
  object-fit: contain;
  opacity: 0.72;
  bottom: 0;
  left: 8%;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.35));
  animation: aghBob 4.5s ease-in-out infinite reverse;
}

.agh-portal--water .agh-portal-art-secondary {
  width: 20%;
  left: auto;
  right: 10%;
  bottom: 4%;
  opacity: 0.78;
}

.agh-portal-title {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  margin-top: 0.15rem;
  font-size: clamp(0.8rem, 1.9vw, 1.08rem);
  font-weight: 700;
  color: var(--agh-white);
  line-height: 1.3;
  max-width: 90%;
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}

.agh-portal-cta {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  margin-top: 0.35rem;
  padding: 0.4rem 0.95rem;
  border-radius: 999px;
  background: var(--agh-btn);
  color: var(--agh-white);
  font-size: clamp(0.68rem, 1.4vw, 0.82rem);
  font-weight: 700;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 6px 16px rgba(145, 0, 124, 0.4);
  transition: transform 0.15s, background 0.2s;
  flex-shrink: 0;
}

.agh-portal:hover .agh-portal-cta,
.agh-portal:focus-visible .agh-portal-cta {
  background: var(--agh-btn-active);
  transform: scale(1.04);
}

.agh-portal--football .agh-portal-face::before {
  content: '';
  position: absolute;
  inset: 12% 12% auto;
  height: 34%;
  background: radial-gradient(ellipse at center, rgba(22, 163, 74, 0.12), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.agh-portal--water .agh-portal-face::before {
  content: '';
  position: absolute;
  inset: 12% 12% auto;
  height: 34%;
  background: radial-gradient(ellipse at center, rgba(96, 165, 250, 0.14), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

@keyframes aghPortalIn {
  from { opacity: 0; transform: scale(0.88) translateY(16px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes aghBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

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

/* ---------- Attract ---------- */
.agh-attract {
  position: absolute;
  left: 50%;
  bottom: calc(var(--agh-footer-h) + 1.2rem);
  transform: translateX(-50%);
  z-index: 4;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  background: rgba(145, 0, 124, 0.88);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.agh-attract.is-on { opacity: 1; }

.agh-portal.is-attract .agh-portal-ring {
  border-color: rgba(251, 191, 36, 0.55);
  box-shadow: 0 0 24px rgba(251, 191, 36, 0.25);
}

/* ---------- Footer ---------- */
.agh-footer {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.5rem;
  min-height: 0;
  line-height: 1;
}

.agh-copy {
  margin: 0;
  font-size: clamp(0.52rem, 1.05vw, 0.62rem);
  font-weight: 400;
  color: rgba(181, 168, 201, 0.68);
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* ---------- Transition overlay ---------- */
.agh-transition {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: rgba(18, 8, 28, 0.78);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
}

.agh-transition.is-on {
  opacity: 1;
  pointer-events: auto;
}

.agh-transition-card {
  padding: 1.1rem 1.4rem;
  border-radius: 18px;
  background: var(--agh-surface);
  border: 1px solid var(--agh-line);
  box-shadow: var(--agh-shadow);
  text-align: center;
  font-weight: 700;
  color: var(--agh-white);
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  :root {
    --agh-portal: clamp(156px, 34vmin, 250px);
    --agh-portal-gap: clamp(2.5rem, 8vw, 5rem);
  }
}

@media (max-width: 720px), (max-height: 720px) {
  :root {
    --agh-portal: clamp(136px, 34vmin, 200px);
    --agh-portal-gap: clamp(2rem, 6vw, 3.5rem);
    --agh-header-h: clamp(48px, 8vh, 60px);
    --agh-footer-h: clamp(16px, 2.4vh, 20px);
  }

  .agh-orbit { display: none; }
  .agh-connector { width: min(14vw, 70px); }
  .agh-portal-ring { inset: -5%; }
  .agh-portal-ring--dots { inset: -9%; }
  .agh-portal-cta { min-height: 36px; }
}

/* Mobile portrait — stacked portals with real breathing room */
@media (max-width: 560px) {
  :root {
    --agh-header-h: clamp(46px, 7.5vh, 56px);
    --agh-footer-h: clamp(16px, 2.4vh, 20px);
    --agh-portal: min(
      48vw,
      210px,
      calc((100dvh - var(--agh-header-h) - var(--agh-footer-h) - 6.5rem) / 2.45)
    );
    --agh-portal-gap: clamp(2.25rem, 5.5vh, 3.25rem);
  }

  .agh-page {
    padding-inline: max(0.65rem, var(--agh-safe-r));
  }

  .agh-home-label { display: none; }
  .agh-home-label-short { display: inline; }
  .agh-home-btn {
    min-height: 40px;
    padding: 0.45rem 0.7rem;
  }

  .agh-main {
    gap: clamp(0.35rem, 1.2vh, 0.7rem);
    align-content: start;
    justify-content: center;
  }

  .agh-identity {
    padding-inline: 0.25rem;
  }

  .agh-title {
    font-size: clamp(1.2rem, 6.2vw, 1.55rem);
  }

  .agh-sub { display: none; }
  .agh-sub-mobile {
    display: block;
    margin-top: 0.45rem;
    font-size: clamp(0.72rem, 3.4vw, 0.82rem);
    color: var(--agh-muted);
  }

  .agh-lead {
    margin-top: calc(0.35rem + 10px);
    font-size: 0.78rem;
    max-width: 92vw;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .agh-hub {
    align-items: stretch;
    padding-block: 0.25rem 0.5rem;
  }

  .agh-portals {
    flex-direction: column;
    justify-content: center;
    gap: var(--agh-portal-gap);
    max-width: none;
  }

  .agh-connector { display: none; }

  .agh-portal {
    flex-shrink: 0;
    margin-inline: auto;
  }

  .agh-portal-ring { inset: -4%; }
  .agh-portal-ring--dots { inset: -8%; }

  .agh-portal-face {
    padding: 11% 13% 13%;
    justify-content: flex-start;
    gap: 0.28rem;
  }

  .agh-portal-art {
    flex: 0 1 auto;
    max-height: 40%;
    margin-bottom: 0.1rem;
  }

  .agh-portal-art-primary {
    max-width: 58%;
  }

  .agh-portal--football .agh-portal-art-primary { max-width: 54%; }
  .agh-portal--water .agh-portal-art-primary { max-width: 48%; }

  .agh-portal-art-secondary {
    width: 20%;
    opacity: 0.55;
  }

  .agh-portal-title {
    margin-top: 0.2rem;
    margin-bottom: 0.05rem;
    font-size: clamp(0.78rem, 3.9vw, 0.95rem);
    line-height: 1.35;
    max-width: 86%;
  }

  .agh-portal-cta {
    margin-top: auto;
    min-height: 38px;
    padding: 0.35rem 0.85rem;
    font-size: clamp(0.68rem, 3.4vw, 0.78rem);
  }

  .agh-bubble--4,
  .agh-bubble--5 { display: none; }

  .agh-attract {
    bottom: calc(var(--agh-footer-h) + 0.65rem);
    font-size: 0.72rem;
    padding: 0.35rem 0.75rem;
  }

  .agh-copy {
    white-space: normal;
    font-size: clamp(0.5rem, 2.6vw, 0.58rem);
    line-height: 1.4;
    padding-inline: 0.5rem;
  }
}

/* Short phones (e.g. 360×640 / SE) */
@media (max-width: 560px) and (max-height: 740px) {
  :root {
    --agh-portal: min(
      44vw,
      180px,
      calc((100dvh - var(--agh-header-h) - var(--agh-footer-h) - 5.2rem) / 2.55)
    );
    --agh-portal-gap: clamp(1.75rem, 4vh, 2.4rem);
  }

  .agh-sub-mobile { display: none; }
  .agh-lead { display: none; }
  .agh-portal-face { padding: 10% 12% 12%; gap: 0.18rem; }
  .agh-portal-art { max-height: 36%; }
  .agh-portal-cta { min-height: 34px; }
}

@media (max-height: 740px) {
  .agh-lead { display: none; }
}

@media (max-height: 640px) {
  .agh-sub, .agh-sub-mobile { display: none; }
  .agh-lead { display: none; }
  .agh-bg-mountain { opacity: 0.12; height: 18%; }
  :root {
    --agh-portal: clamp(120px, 32vmin, 170px);
    --agh-portal-gap: clamp(1.75rem, 5vw, 3rem);
  }
  .agh-portal-cta { min-height: 32px; padding: 0.28rem 0.7rem; }
  .agh-portal-face { padding: 8% 10% 11%; }
  .agh-portal-art { max-height: 38%; }
  .agh-portal-ring { inset: -4%; }
  .agh-portal-ring--dots { inset: -7%; }
}

@media (max-height: 560px) and (orientation: landscape) {
  .agh-portals {
    flex-direction: row;
  }
  .agh-identity { margin-bottom: 0; }
  :root {
    --agh-portal: clamp(112px, 28vmin, 158px);
    --agh-portal-gap: clamp(2.25rem, 7vw, 4.5rem);
    --agh-header-h: 42px;
    --agh-footer-h: 16px;
  }
  .agh-portal-cta { min-height: 30px; padding: 0.24rem 0.6rem; }
  .agh-portal-title { font-size: clamp(0.7rem, 1.7vw, 0.88rem); }
  .agh-portal-face { padding: 8% 10% 11%; }
  .agh-portal-art { max-height: 38%; }
  .agh-portal-art-secondary { display: none; }
  .agh-copy { font-size: 0.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .agh-orbit,
  .agh-portal-ring,
  .agh-bubble,
  .agh-wave { animation: none !important; }
}
