/* ===============================
   ANIMAZIONI GLOBALI
   =============================== */
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes glowPulseOpacity {
  0% { opacity: 0.7; }
  50% { opacity: 1; }
  100% { opacity: 0.7; }
}

@keyframes fadeOverlay {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ADS */
.ad-container {
  margin: 50px 0;
  text-align: center;
  min-height: 100px;
}

/* LINK "custom-link" */
.custom-link {
  color: #ff9f1a;
  text-decoration: none;
  font-weight: 600;
  padding: 3px 0;
  position: relative;
  transition: color 0.3s ease, text-shadow 0.3s ease;
  font-size: 16px;
}

.custom-link:hover {
  color: #ffffff;
  text-shadow: 0 0 8px #ff9f1a;
}

.custom-link::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 2px;
  background: #ff9f1a;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s ease;
}

.custom-link:hover::before {
  transform: scaleX(1);
  transform-origin: left;
}

/* =============================
   FOOTER
   ============================= */
.footer-powered {
  margin: 0;
  padding: 45px 0 20px;
  font-size: 12px;
  color: #e5e7eb;
  text-align: center;
  font-family: 'Orbitron', sans-serif;
  background: transparent;
  border-top: none;
  transition: all 0.3s ease;
}

.footer-powered-by {
  margin: -10px 0 6px 0;
  font-size: 12px;
  color: #bbb;
  font-weight: 500;
  letter-spacing: 0.7px;
}

.footer-links {
  margin-bottom: -1px;
}

.footer-links a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  margin: 0 8px;
  position: relative;
  padding: 3px 0;
  transition: color 0.3s ease, text-shadow 0.3s ease;
  font-size: 7px;
}

.footer-links a:not(:last-child)::after {
  content: "|";
  margin-left: 5px;
  color: rgba(255,255,255,0.3);
}

.footer-links a:hover {
  color: #fff;
  text-shadow: 0 0 8px var(--glow);
}

.footer-links a::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 2px;
  background: var(--primary);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s ease;
}

.footer-links a:hover::before {
  transform: scaleX(1);
  transform-origin: left;
}

.footer-copyright,
.footer-developer {
  margin: 6px 0;
  font-size: 7px;
  letter-spacing: 0.5px;
}

.footer-copyright {
  font-weight: 600;
  color: #ff9f1a;
  text-shadow: 0 0 6px rgba(255,159,26,0.4);
}

.footer-developer {
  font-style: italic;
  color: #d1d5db;
  opacity: 0.85;
}

@media (max-width: 600px) {
  .footer-powered {
    padding: 0px 10px;
    font-size: 10px;
  }

  .footer-powered-by {
    font-size: 10px;
    margin: -6px 0 0px 0;
  }

  .footer-links {
    margin-bottom: -10px;
  }

  .footer-links a {
    display: inline-block;
    margin: 5px 6px;
    font-size: 7px;
  }

  .footer-links a:not(:last-child)::after {
    margin-left: 8px;
  }

  .footer-copyright,
  .footer-developer {
    font-size: 7px;
  }
}

/* =============================
   MENU / HEADER MOBILE
   ============================= */
#game-info {
  position: sticky;
  top: calc(100vh - 28px);
  background: transparent;
  z-index: 10;
  pointer-events: none;
}

.supporter-overlay.hidden,
#intro-popup.hidden {
  pointer-events: none;
}

@media (orientation: landscape) and (max-height: 500px) {
  #game-info {
    display: none;
  }
}

/* RECORD GIORNALIERO (menu.php) */
.daily-challenge {
  margin: 21px 0 21px;
  font-size: 10px;
  color: #FFD700;
  text-shadow: 0 0 8px rgba(255,215,0,0.5);
  animation: glowPulseOpacity 2s infinite;
}

.daily-challenge.hide-daily {
  display: none;
}

/* =====================================================
   ANIMETECH – HAMBURGER MENU SYSTEM
   ===================================================== */
#menuToggle.menu-toggle {
  position: fixed;
  top: 18px;
  right: 18px;
  width: 23px;
  height: 20px;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 20000;
  display: flex !important;
  flex-direction: column;
  justify-content: space-between;
  padding: 0;
  outline: none;
  box-shadow: none;
  -webkit-tap-highlight-color: transparent;
}

#menuToggle.menu-toggle span {
  height: 3px;
  width: 100%;
  background: var(--primary);
  border-radius: 4px;
  box-shadow: 0 0 12px var(--glow);
  transition: all 0.3s ease;
}

body.game-running .mobile-header,
body.game-running .menu-drawer,
body.game-running .footer-powered {
  display: none !important;
}

body.menu-open #menuToggle span:nth-child(1) {
  transform: rotate(45deg) translateY(10px);
}

body.menu-open #menuToggle span:nth-child(2) {
  opacity: 0;
}

body.menu-open #menuToggle span:nth-child(3) {
  transform: rotate(-45deg) translateY(-10px);
}

body.menu-open::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 19990;
  animation: fadeOverlay 0.25s ease;
}

body.menu-open {
  overflow: hidden;
}

#mainMenu.menu-drawer {
  position: fixed;
  top: 0;
  right: -420px;
  width: 280px;
  max-width: 90vw;
  height: 100%;
  background: linear-gradient(160deg, #020617, #020617);
  box-shadow: -30px 0 80px rgba(0,0,0,.85);
  transition: right 0.35s cubic-bezier(.77,0,.18,1);
  z-index: 19995;
  padding: 100px 24px 40px;
  border-left: 1px solid rgba(255,255,255,0.05);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
}

#mainMenu.menu-drawer.open {
  right: 0;
  opacity: 1;
  visibility: visible;
}

#mainMenu .menu-content {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
}

#mainMenu .menu-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  width: 100%;
  padding: 10px;
  font-size: 12px;
  letter-spacing: 0.5px;
  color: var(--text-light);
  text-decoration: none;
  background: rgba(255,255,255,0.04);
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.06);
  cursor: pointer;
  transition: all 0.25s ease;
  overflow: hidden;
  user-select: none;
  appearance: none;
  -webkit-appearance: none;
}

#mainMenu .menu-item::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(249,115,22,0.3), transparent);
  transform: translateX(-100%);
  transition: transform 0.45s ease;
  z-index: 0;
}

#mainMenu .menu-item > * {
  position: relative;
  z-index: 1;
}

#mainMenu .menu-item:hover {
  background: rgba(255,255,255,0.07);
  border-color: rgba(249,115,22,0.5);
  box-shadow: 0 0 25px rgba(249,115,22,0.35);
  color: #fff;
}

#mainMenu .menu-item:hover::before {
  transform: translateX(100%);
}

#mainMenu .menu-item.active,
#mainMenu .menu-subitem.active,
#mainMenu .menu-dropdown-link.active {
  background: rgba(249,115,22,0.25);
  border-color: rgba(249,115,22,0.8);
  box-shadow: 0 0 25px rgba(249,115,22,0.6);
  color: #fff;
}

#mainMenu #menuSupporter,
#mainMenu #menuSupporterDesktop {
  background: linear-gradient(135deg, rgba(249,115,22,0.25), rgba(249,115,22,0.08));
  border: 1px solid rgba(249,115,22,0.6);
  box-shadow: 0 0 30px rgba(249,115,22,0.4);
  font-weight: 700;
}

#mainMenu .menu-divider {
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(255,255,255,0.25), transparent);
  margin: 10px 0 6px;
}

/* Utility visibilità menu */
.menu-desktop-only {
  display: none;
}

.menu-mobile-only {
  display: flex;
}

.menu-mobile-stack {
  flex-direction: column;
  gap: 18px;
  width: 100%;
}

.menu-caret {
  display: inline-flex;
  align-items: center;
  margin-left: auto;
  font-size: 11px;
  transition: transform 0.25s ease;
}

/* =============================
   MOBILE GROUP
   ============================= */
.menu-mobile-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.menu-mobile-group-toggle {
  justify-content: flex-start;
}

.menu-mobile-group-toggle[aria-expanded="true"] .menu-caret {
  transform: rotate(180deg);
}

.menu-mobile-group-panel {
  display: none;
  flex-direction: column;
  gap: 10px;
  padding-left: 14px;
}

.menu-mobile-group-panel.open {
  display: flex;
  animation: fadeIn 0.2s ease;
}

.menu-subitem {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text-light);
  font-size: 11px;
  letter-spacing: 0.4px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.05);
  transition: all 0.25s ease;
}

.menu-subitem:hover {
  background: rgba(249,115,22,0.10);
  border-color: rgba(249,115,22,0.35);
  color: #fff;
  transform: translateX(4px);
}

/* =============================
   MOBILE / TABLET
   ============================= */
@media (max-width: 1023px) {
  .mobile-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: #020617;
    z-index: 20001;
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }

  .mobile-header-inner {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 16px;
  }

  .mobile-logo {
    color: #f97316;
    font-weight: 700;
    letter-spacing: 1px;
    font-size: 18px;
    text-decoration: none;
    flex-shrink: 0;
  }

  body {
    padding-top: 64px;
  }

  #menuToggle.menu-toggle {
    position: relative;
    top: auto;
    right: auto;
    flex-shrink: 0;
  }

  #mainMenu.menu-drawer {
    top: 0;
    height: calc(100dvh - 64px);
  }

  .menu-desktop-only {
    display: none !important;
  }

  .menu-mobile-only {
    display: flex !important;
  }

  #mainMenu .menu-item:hover {
    transform: translateX(6px);
  }
}

/* =============================
   DESKTOP
   ============================= */
@media (min-width: 1024px) {
  .mobile-header {
    display: none;
  }

  body {
    padding-top: 0;
  }

  #menuToggle.menu-toggle {
    display: none !important;
  }

  body.menu-open::before {
    display: none !important;
  }

  body.menu-open {
    overflow: auto;
  }

  .menu-mobile-only {
    display: none !important;
  }

  .menu-desktop-only.desktop-menu-row {
    display: flex !important;
  }

  #mainMenu.menu-drawer {
    position: relative;
    top: auto;
    right: auto;
    width: 100%;
    height: auto;
    max-width: none;
    background: transparent;
    box-shadow: none;
    border: none;
    padding: 0;
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
    overflow: visible;
  }

  #mainMenu .menu-content {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    overflow: visible;
  }

  .desktop-menu-row {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: nowrap;
    width: auto;
  }

  #mainMenu .menu-item {
    width: auto;
    padding: 8px 14px;
    font-size: 13px;
    border-radius: 8px;
    border: none;
    box-shadow: none;
    transform: none;
    white-space: nowrap;
    justify-content: center;
  }

  #mainMenu .menu-item:hover {
    transform: none;
    box-shadow: none;
  }

  #mainMenu .menu-divider {
    display: none;
  }

  /* DROPDOWN GUIDE */
  .menu-dropdown {
    position: relative;
    display: flex;
    align-items: center;
  }

  .menu-dropdown-toggle {
    justify-content: center;
    width: auto !important;
  }

  .menu-dropdown-toggle .menu-caret {
    margin-left: 6px;
  }

  .menu-dropdown:hover .menu-caret,
  .menu-dropdown:focus-within .menu-caret {
    transform: rotate(180deg);
  }

  .menu-dropdown-panel {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    min-width: 250px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(2, 6, 23, 0.98);
    border: 1px solid rgba(249,115,22,0.22);
    border-radius: 14px;
    box-shadow: 0 18px 50px rgba(0,0,0,0.45);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
    z-index: 30000;
  }

  .menu-dropdown:hover .menu-dropdown-panel,
  .menu-dropdown:focus-within .menu-dropdown-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .menu-dropdown-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--text-light);
    background: rgba(255,255,255,0.03);
    transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
    border: 1px solid rgba(255,255,255,0.05);
    font-size: 12px;
    white-space: nowrap;
  }

  .menu-dropdown-link:hover {
    background: rgba(249,115,22,0.14);
    color: #fff;
    border-color: rgba(249,115,22,0.35);
  }
}