/* ==========================================================================
   Açılış ekranı ve ana menü (referans: tasarım sayfasındaki ana menü karesi)
   ========================================================================== */
#menu {
  --pad: clamp(16px, 4.5vmin, 60px);
  position: fixed;
  inset: 0;
  z-index: 50;
  overflow: hidden;
  background: #07040d;
  transition: background-color 0.4s ease;
}
#menu.leaving { background-color: transparent; pointer-events: none; }

/* Oyun arayüzü menü açıkken gizli */
#app.in-menu { overflow: hidden !important; }
#app.in-menu .hud-top,
#app.in-menu .hud-angels,
#app.in-menu .hud-ranking,
#app.in-menu .hud-cards,
#app.in-menu #toasts,
#app.in-menu .damage-plate,
#app.in-menu #statues,
#app.in-menu #dmgLayer { opacity: 0; }
.hud-top, .hud-angels, .hud-ranking, .hud-cards, .damage-plate, #statues {
  transition: opacity 0.5s ease 0.7s;
}

/* ---------------- Arka plan sahnesi ---------------- */
.menu-scene {
  position: absolute;
  left: 0;
  top: 0;
  width: 1010px;
  height: 700px;
  transform-origin: 0 0;
  will-change: transform, opacity;
}
.menu-scene > img { width: 100%; height: 100%; }
.ms-glow { position: absolute; border-radius: 50%; pointer-events: none; }
.ms-core {
  left: 433px; top: 362px; width: 240px; height: 240px; margin: -120px 0 0 -120px;
  background: radial-gradient(closest-side, rgba(230, 190, 255, 0.5), rgba(150, 80, 240, 0.18) 55%, transparent);
  animation: msPulse 3.2s ease-in-out infinite;
}
.ms-spire {
  left: 433px; top: 96px; width: 320px; height: 230px; margin: -115px 0 0 -160px;
  background: radial-gradient(closest-side, rgba(205, 150, 255, 0.34), transparent);
  animation: msPulse 4.6s ease-in-out infinite 0.8s;
}
@keyframes msPulse { 50% { opacity: 0.55; transform: scale(1.12); } }
.ms-motes i {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0 25%, rgba(196, 130, 255, 0.85) 45%, transparent 72%);
  opacity: 0;
  animation: msMote 6s linear infinite;
}
.ms-motes i:nth-child(1) { left: 280px; top: 500px; animation-delay: 0s; }
.ms-motes i:nth-child(2) { left: 330px; top: 470px; animation-delay: 1.4s; }
.ms-motes i:nth-child(3) { left: 380px; top: 520px; animation-delay: 2.6s; }
.ms-motes i:nth-child(4) { left: 420px; top: 480px; animation-delay: 0.7s; }
.ms-motes i:nth-child(5) { left: 455px; top: 510px; animation-delay: 3.4s; }
.ms-motes i:nth-child(6) { left: 495px; top: 470px; animation-delay: 1.9s; }
.ms-motes i:nth-child(7) { left: 540px; top: 505px; animation-delay: 4.2s; }
.ms-motes i:nth-child(8) { left: 590px; top: 480px; animation-delay: 2.2s; }
.ms-motes i:nth-child(9) { left: 360px; top: 430px; animation-delay: 4.9s; }
.ms-motes i:nth-child(10) { left: 510px; top: 430px; animation-delay: 5.4s; }
.ms-motes i:nth-child(11) { left: 160px; top: 500px; animation-delay: 3.0s; }
.ms-motes i:nth-child(12) { left: 760px; top: 500px; animation-delay: 0.4s; }
@keyframes msMote {
  0% { opacity: 0; transform: translate(0, 0) scale(0.6); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translate(14px, -280px) scale(1.1); }
}

.menu-shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 46%, transparent 42%, rgba(5, 2, 10, 0.72) 100%),
    linear-gradient(90deg, rgba(5, 2, 10, 0.55), transparent 26%, transparent 64%, rgba(5, 2, 10, 0.62));
  transition: opacity 0.5s ease;
}
#menu.leaving .menu-shade { opacity: 0; }

/* ---------------- Yükleme ekranı ---------------- */
.menu-loader {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: radial-gradient(ellipse at 50% 45%, rgba(60, 25, 110, 0.55), #07040d 70%);
}
#menu.is-booting .menu-loader { display: flex; }
#menu.is-booting .menu-ui { visibility: hidden; }
.menu-loader .emblem svg { height: clamp(80px, 16vmin, 150px); width: auto; filter: drop-shadow(0 0 18px rgba(168, 85, 247, 0.9)); animation: emblemPulse 1.8s ease-in-out infinite; }
@keyframes emblemPulse { 50% { filter: drop-shadow(0 0 30px rgba(200, 140, 255, 1)); transform: scale(1.04); } }
.menu-loader b { font-size: clamp(22px, 4.4vmin, 44px); letter-spacing: 0.08em; color: #fff; text-shadow: 0 0 16px rgba(168, 85, 247, 0.9); }
.ml-bar { width: min(280px, 60vw); height: 6px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.ml-bar > i { display: block; height: 100%; transform-origin: 0 50%; transform: scaleX(0); background: linear-gradient(90deg, #6d28d9, #d8b4fe); box-shadow: 0 0 10px #a855f7; transition: transform 0.25s ease; }
.menu-loader span { font-size: 14px; color: var(--text-dim); font-variant-numeric: tabular-nums; }

/* ---------------- Menü arayüzü ---------------- */
/* Canlı çevrim içi oyuncu göstergesi (logonun altında) */
.menu-online {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  margin-top: 0.55em;
  padding: 0.3em 0.9em 0.3em 0.75em;
  font-size: clamp(13px, 1.9vmin, 18px);
  line-height: 1.2;
  color: #e7f9ef;
  border-radius: 999px;
  border: 1px solid rgba(110, 231, 160, 0.38);
  background: rgba(8, 20, 14, 0.62);
  box-shadow: 0 0 14px rgba(52, 211, 120, 0.22), inset 0 0 8px rgba(52, 211, 120, 0.08);
  backdrop-filter: blur(4px);
  white-space: nowrap;
}
.menu-online[hidden] { display: none; }
.menu-online b { font-weight: 700; font-variant-numeric: tabular-nums; color: #fff; }
.menu-online span { color: #bfe9cf; }
.mo-dot { position: relative; width: 0.62em; height: 0.62em; border-radius: 50%; background: #34d378; box-shadow: 0 0 8px #34d378; }
.mo-dot::after { content: ''; position: absolute; inset: 0; border-radius: 50%; background: #34d378; animation: moPing 1.8s ease-out infinite; }
@keyframes moPing { 0% { transform: scale(1); opacity: 0.75; } 100% { transform: scale(2.8); opacity: 0; } }
.menu-online.bump b { display: inline-block; animation: moBump 0.45s ease; }
@keyframes moBump { 40% { transform: scale(1.25); color: #8ff0b8; } }
@media (prefers-reduced-motion: reduce) { .mo-dot::after, .menu-online.bump b { animation: none; } }
.menu-ui { position: absolute; inset: 0; }

.menu-logo {
  position: absolute;
  left: max(var(--pad), env(safe-area-inset-left, 0px));
  top: max(var(--pad), env(safe-area-inset-top, 0px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.menu-logo .emblem svg { height: clamp(58px, 12vmin, 132px); width: auto; filter: drop-shadow(0 0 14px rgba(168, 85, 247, 0.85)); }
.menu-logo h1 {
  font-size: clamp(22px, 4.3vmin, 50px);
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1;
  color: #fff;
  text-shadow: 0 0 14px rgba(168, 85, 247, 0.95), 0 2px 3px #000;
}

.menu-panel,
.menu-bye,
.menu-auth {
  position: absolute;
  right: max(var(--pad), env(safe-area-inset-right, 0px));
  top: 50%;
  width: clamp(240px, 27vw, 430px);
  padding: clamp(16px, 3vmin, 32px);
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.7vmin, 18px);
  border-radius: 10px;
  border: 1px solid rgba(200, 175, 245, 0.42);
  background: linear-gradient(180deg, rgba(22, 14, 38, 0.82), rgba(10, 6, 18, 0.88));
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.6), inset 0 0 0 4px rgba(120, 90, 180, 0.08), 0 0 40px rgba(100, 40, 200, 0.32), 0 20px 50px rgba(0, 0, 0, 0.6);
  transform: translateY(-50%);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.menu-bye { display: none; text-align: center; align-items: center; }
#menu.bye .menu-panel { display: none; }
#menu.bye .menu-bye { display: flex; }
.menu-bye h2 { font-size: clamp(22px, 3.8vmin, 38px); font-weight: 600; color: #fff; text-shadow: 0 0 12px rgba(168, 85, 247, 0.8); }
.menu-bye p { font-size: clamp(14px, 2.2vmin, 19px); color: var(--text-2); line-height: 1.4; }
.menu-bye .menu-btn { width: 100%; }

.menu-btn {
  --hx: clamp(12px, 2vmin, 22px);
  position: relative;
  height: clamp(44px, 7.6vmin, 80px);
  display: grid;
  grid-template-columns: 1.25em 1fr;
  align-items: center;
  column-gap: 0.9em;
  padding: 0 1.3em 0 1.5em;
  font-size: clamp(17px, 3.3vmin, 34px);
  font-weight: 600;
  text-align: left;
  color: #fff;
  text-shadow: 0 1px 2px rgba(30, 0, 70, 0.9);
  isolation: isolate;
  filter: drop-shadow(0 0 7px rgba(150, 80, 240, 0.45));
  transition: transform 0.18s ease, filter 0.2s ease;
}
.menu-btn::before,
.menu-btn::after {
  content: '';
  position: absolute;
  clip-path: polygon(var(--hx) 0, calc(100% - var(--hx)) 0, 100% 50%, calc(100% - var(--hx)) 100%, var(--hx) 100%, 0 50%);
  z-index: -1;
}
.menu-btn::before { inset: 0; background: linear-gradient(180deg, #e6d4ff, #8f66d9 50%, #5a35a8); }
.menu-btn::after {
  inset: 2px;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(255, 255, 255, 0.16), transparent 55%),
    linear-gradient(180deg, #6a3bc7 0%, #4b2496 55%, #34176e 100%);
}
.menu-btn.primary::after {
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(255, 255, 255, 0.24), transparent 55%),
    linear-gradient(180deg, #8f4ff2 0%, #6d2fd6 48%, #4a1c9e 100%);
}
.menu-btn svg { width: 1.15em; height: 1.15em; color: #efe6ff; filter: drop-shadow(0 0 4px rgba(220, 190, 255, 0.6)); }
.menu-btn:hover,
.menu-btn:focus-visible { transform: translateX(-5px); filter: drop-shadow(0 0 16px rgba(190, 120, 255, 0.95)) brightness(1.1); outline: none; }
.menu-btn:active { transform: translateX(-3px) scale(0.98); }

.menu-season {
  position: absolute;
  left: max(var(--pad), env(safe-area-inset-left, 0px));
  bottom: max(var(--pad), env(safe-area-inset-bottom, 0px));
  display: flex;
  align-items: center;
  gap: 0.7em;
  padding: 0.55em 1.2em 0.55em 0.8em;
  font-size: clamp(14px, 2.3vmin, 24px);
  border-radius: 8px;
  border: 1px solid rgba(200, 175, 245, 0.25);
  background: rgba(10, 6, 18, 0.72);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.menu-season .hourglass-gold svg { height: 2.5em; width: auto; filter: drop-shadow(0 0 8px rgba(246, 190, 60, 0.45)); }
.menu-season .mhg-stream { animation: sand 0.6s linear infinite; }
.menu-season span { display: block; color: #fff; font-weight: 500; }
.menu-season b { display: block; font-size: 1.45em; line-height: 1.15; font-weight: 600; color: #f6cf5b; text-shadow: 0 0 10px rgba(246, 190, 60, 0.45); font-variant-numeric: tabular-nums; }

/* Giriş animasyonu */
#menu.ready .menu-logo { animation: mIn 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) backwards; --dx: -24px; }
#menu.ready .menu-season { animation: mIn 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) 0.15s backwards; --dx: -24px; }
#menu.ready .menu-panel .menu-btn { animation: mBtn 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) backwards; animation-delay: calc(0.12s + var(--i) * 0.07s); }
@keyframes mIn { from { opacity: 0; translate: var(--dx) 0; } to { opacity: 1; translate: 0 0; } }
@keyframes mBtn { from { opacity: 0; translate: 30px 0; } to { opacity: 1; translate: 0 0; } }

/* Çıkış animasyonu (Oyna) */
#menu.leaving .menu-logo,
#menu.leaving .menu-season,
#menu.leaving .menu-panel .menu-btn { animation: none; }
#menu.leaving .menu-logo { opacity: 0; transform: translateX(-30px); }
#menu.leaving .menu-season { opacity: 0; transform: translateX(-30px); }
#menu.leaving .menu-panel { opacity: 0; transform: translate(40px, -50%); }

/* ---------------- Hesap: Kayıt Ol / Giriş Yap ---------------- */
.menu-auth { display: none; width: clamp(300px, 30vw, 440px); max-height: calc(100% - 2 * var(--pad)); overflow-y: auto; gap: 12px; }
#menu.auth .menu-panel,
#menu.auth .menu-bye { display: none; }
#menu.auth .menu-auth { display: flex; }
#menu.ready .menu-auth { animation: mIn 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) 0.1s backwards; --dx: 30px; }
.ma-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 9px; background: rgba(0, 0, 0, 0.38); border: 1px solid rgba(200, 175, 245, 0.18); }
.menu-auth[data-view="reset"] .ma-tabs { display: none; }
.ma-tab { height: 40px; border-radius: 6px; font-size: clamp(16px, 2.2vmin, 19px); font-weight: 600; color: var(--text-dim); transition: color 0.2s, background-color 0.2s; }
.ma-tab:hover { color: #fff; }
.ma-tab.on { color: #fff; background: linear-gradient(180deg, #7c3aed, #4c1d95); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 0 12px rgba(168, 85, 247, 0.45); }
.ma-tab:focus-visible { outline: 2px solid var(--violet-2); outline-offset: 2px; }
.ma-form { display: flex; flex-direction: column; gap: 10px; }
.ma-lead { font-size: clamp(15px, 2vmin, 17px); line-height: 1.35; color: var(--text-2); }
.ma-field { position: relative; display: flex; flex-direction: column; gap: 4px; }
.ma-field label { font-size: 14px; font-weight: 500; color: var(--text-dim); }
.ma-field input { width: 100%; height: 46px; padding: 0 12px; font-size: 17px; border-radius: 8px; border: 1px solid rgba(200, 170, 255, 0.42); background: rgba(8, 5, 15, 0.9); color: #fff; outline: none; transition: border-color 0.2s, box-shadow 0.2s; }
.ma-field input::placeholder { color: var(--text-mute); }
.ma-field input:focus { border-color: var(--violet-2); box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.32); }
.ma-field.pw input { padding-right: 78px; }
.ma-eye { position: absolute; right: 6px; bottom: 7px; height: 32px; padding: 0 10px; border-radius: 6px; font-size: 14px; color: var(--text-2); background: rgba(60, 40, 100, 0.55); border: 1px solid rgba(170, 140, 225, 0.3); }
.ma-eye:focus-visible { outline: 2px solid var(--violet-2); }
.ma-msg { font-size: 15px; line-height: 1.35; color: var(--danger); }
.ma-msg:empty { display: none; }
.ma-msg.ok { color: var(--ok); }
.ma-form .menu-btn { width: 100%; margin-top: 4px; }
.ma-form .menu-btn:disabled { cursor: progress; filter: saturate(0.6) brightness(0.85); transform: none; }
.ma-link { align-self: center; padding: 4px 8px; font-size: 15px; color: var(--violet-2); text-decoration: underline; text-underline-offset: 3px; }
.ma-captcha:empty { display: none; }
.ma-captcha { display: flex; justify-content: center; }
.menu-auth[data-view="reset"] .ma-captcha { display: none; }
.ma-check { display: grid; grid-template-columns: 22px 1fr; gap: 8px; align-items: start; font-size: 14px; line-height: 1.4; color: var(--text-2); }
.ma-check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: #8b5cf6; }
.ma-check a { color: var(--violet-2); }
.ma-link:hover { color: #fff; }

/* ---------------- Dikey (telefon) ---------------- */
@media (max-aspect-ratio: 4/5) {
  .menu-ui {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: max(var(--pad), env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(var(--pad), env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  }
  .menu-logo, .menu-season { position: static; transform: none; }
  .menu-panel, .menu-bye, .menu-auth { position: relative; top: auto; right: auto; transform: none; }
  .menu-logo .emblem svg { height: 84px; }
  .menu-logo h1 { font-size: 30px; }
  .menu-season { font-size: 15px; }
  .menu-panel, .menu-bye, .menu-auth { margin-top: auto; width: min(100%, 420px); padding: 18px; gap: 10px; }
  .menu-auth { max-height: none; overflow: visible; margin-bottom: auto; }
  #menu.auth .menu-ui { overflow-y: auto; }
  #menu.auth .menu-season { display: none; }
  .menu-btn { height: 54px; font-size: 21px; }
  #menu.leaving .menu-panel { transform: translateY(40px); }
  #menu.leaving .menu-logo, #menu.leaving .menu-season { transform: translateY(-20px); }
}
.menu-season em { display: block; margin-top: 2px; font-style: normal; font-size: .72em; color: #d9c6ff; }
.menu-season em:empty { display: none; }
