/* ==========================================================================
   GST Gaming — Header / Footer condivisi
   Usato da tutte le pagine del sito (home, /games/, pagine gioco, ecc.)
   Contiene: reset base, sfondo ambientale, navbar, footer, scroll-top.
   Le regole specifiche di ogni pagina restano nel <style> della singola pagina.
   ========================================================================== */

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

/* Su iOS Safari l'overflow-x: hidden impostato solo sul body non blocca il
   trascinamento orizzontale della pagina: va applicato anche a html, con la
   larghezza vincolata. overscroll-behavior-x evita inoltre il "rimbalzo"
   laterale e la navigazione con swipe accidentale. */
html {
  background: #0a0a0e;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  /* La barra di scorrimento verticale resta sempre riservata: se comparisse
     o sparisse a runtime (es. per una minima variazione d'altezza durante
     un'animazione), il contenuto non si sposterebbe più a scatti verso
     destra. scrollbar-gutter e' il modo moderno; overflow-y e' il
     fallback per i browser che non lo supportano ancora. */
  overflow-y: scroll;
  scrollbar-gutter: stable;
}
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-page);
  background-attachment: fixed;
  color: var(--text-primary);
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  line-height: 1.6;
}

.container { max-width: 1440px; margin: 0 auto; padding: 0 24px; position: relative; z-index: 1; }

/* ========== AMBIENT BACKGROUND ========== */
.ambient-bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
/* Gli orb colorati creavano le sfumature ai bordi anche con lo sfondo
   chiaro impostato a tinta piatta: restano visibili solo in modalità
   scura, dove il contrasto li rende un dettaglio voluto. */
html:not([data-theme="dark"]) .ambient-bg { display: none; }
.orb { position: absolute; border-radius: 50%; filter: blur(120px); opacity: 0.35; }
.orb-1 { width: 600px; height: 600px; background: #4f46e5; top: -10%; left: -10%; animation: float1 20s infinite ease-in-out; }
.orb-2 { width: 500px; height: 500px; background: #06b6d4; bottom: 5%; right: -10%; animation: float2 25s infinite ease-in-out; }
.orb-3 { width: 400px; height: 400px; background: #8b5cf6; top: 40%; left: 50%; animation: float3 22s infinite ease-in-out; }
@keyframes float1 { 0%,100% { transform: translate(0,0); } 50% { transform: translate(60px,40px); } }
@keyframes float2 { 0%,100% { transform: translate(0,0); } 50% { transform: translate(-40px,-60px); } }
@keyframes float3 { 0%,100% { transform: translate(0,0); } 50% { transform: translate(50px,-50px); } }
@media (max-height: 500px) and (orientation: landscape) { .ambient-bg { display: none; } }

/* ========== NAVBAR ========== */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(10,10,14,0.6);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.navbar .nav-links a { color: rgba(255,255,255,0.75); }
.navbar .nav-links a:hover, .navbar .nav-links a.active { color: #ffffff; }
.navbar .lang-btn { color: rgba(255,255,255,0.75); border-color: rgba(255,255,255,0.15); }
.navbar .lang-btn:hover { color: #ffffff; border-color: rgba(255,255,255,0.35); }
.navbar .hamburger-btn .icon-line { background: #ffffff; }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.logo-img { height: 40px; width: auto; display: block; }
.nav-right { display: flex; align-items: center; gap: 24px; }
.nav-links { display: flex; gap: 20px; }
.nav-links a {
  font-family: 'Poppins', sans-serif; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-secondary); text-decoration: none; font-weight: 600;
  font-size: 0.85rem; transition: color 0.2s; position: relative;
}
.nav-links a::after {
  content: ''; position: absolute; bottom: -6px; left: 0; width: 0; height: 2px;
  background: var(--accent-purple-light); transition: width 0.3s; border-radius: 2px;
}
.nav-links a:hover { color: var(--text-white); }
.nav-links a:hover::after { width: 100%; }
.nav-links a.active { color: var(--text-white); }
.nav-links a.active::after { width: 100%; }

.lang-switcher { display: flex; gap: 6px; }
.lang-btn {
  background: transparent; border: 1px solid rgba(255,255,255,0.1); color: var(--text-secondary);
  padding: 6px 12px; border-radius: 8px; font-size: 0.8rem; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
}
.lang-btn:hover { border-color: rgba(255,255,255,0.3); color: var(--text-white); }
.lang-btn.active { background: var(--accent-purple); border-color: var(--accent-purple); color: var(--text-white); }

.hamburger-btn {
  display: none; position: relative; width: 38px; height: 38px; flex-shrink: 0;
  background: transparent; border: 1px solid rgba(255,255,255,.1); border-radius: 8px;
  cursor: pointer; align-items: center; justify-content: center; transition: all .2s;
}
.hamburger-btn:hover { border-color: rgba(255,255,255,.3); }
.hamburger-btn .icon-line {
  position: absolute; left: 9px; width: 20px; height: 2px;
  background: var(--text-white); border-radius: 2px; transition: all .25s ease;
}
.hamburger-btn .icon-line:nth-child(1) { top: 13px; }
.hamburger-btn .icon-line:nth-child(2) { top: 18px; }
.hamburger-btn .icon-line:nth-child(3) { top: 23px; }
.hamburger-btn.open .icon-line:nth-child(1) { top: 18px; transform: rotate(45deg); }
.hamburger-btn.open .icon-line:nth-child(2) { opacity: 0; }
.hamburger-btn.open .icon-line:nth-child(3) { top: 18px; transform: rotate(-45deg); }

.mobile-menu {
  display: none; flex-direction: column; padding: 8px 24px 18px; gap: 2px;
  border-top: 1px solid rgba(255,255,255,.08); background: rgba(10,10,14,.96);
  backdrop-filter: blur(10px);
  /* Il menu e' dentro una navbar a posizione fissa: se il contenuto supera
     l'altezza dello schermo (tipico in orizzontale su mobile), senza
     questo diventerebbe irraggiungibile, non solo compresso. */
  max-height: calc(100vh - 72px); max-height: calc(100dvh - 72px);
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.mobile-menu.open { display: flex; }
.mobile-menu a {
  color: rgba(255,255,255,.7); text-decoration: none; font-weight: 500; font-size: 1rem;
  padding: 14px 4px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.mobile-menu a:last-child { border-bottom: none; }
.mobile-menu a.active, .mobile-menu a:hover { color: #ffffff; }
.mobile-lang-switcher {
  display: none; gap: 10px; padding: 16px 4px 4px;
}
.mobile-lang-switcher .lang-btn {
  flex: 1; padding: 10px 0; font-size: .9rem; text-align: center;
  color: rgba(255,255,255,.75); border-color: rgba(255,255,255,.15);
}
.mobile-lang-switcher .lang-btn:hover { color: #ffffff; border-color: rgba(255,255,255,.35); }

@media (max-width: 900px) {
  .nav-right { gap: 16px; }
  .nav-links { display: none; }
  .lang-switcher { display: none; }
  .hamburger-btn { display: flex; }
  .mobile-lang-switcher { display: flex; }
}
@media (max-width: 600px) {
  .logo-img { height: 32px; }
}

/* ========== FOOTER ========== */
.site-footer {
  background: var(--bg-footer);
  border-top: 1px solid var(--border-footer);
  position: relative;
  margin-top: 60px;
}
.site-footer::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg,#7cb3ff,#3a82ed 40%,rgba(58,130,237,.55) 60%,#7cb3ff); }
.footer-main { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 60px; padding-top: 80px; padding-bottom: 64px; align-items: start; }
.footer-logos { display: flex; align-items: center; gap: 20px; margin-bottom: 20px; }
.footer-brand .footer-logo { height: 42px; width: auto; opacity: .9; margin-bottom: 0; }
.footer-brand .footer-cert { height: 56px; width: auto; display: block; margin-bottom: 0; }
.footer-col h4 { color: var(--text-footer-heading); font-size: .85rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 24px; }
.footer-col a { display: block; color: var(--text-footer); text-decoration: none; font-size: .9rem; margin-bottom: 14px; transition: color .2s; }
.footer-col a:hover { color: var(--accent-purple-light); }
.footer-col a.active { color: var(--accent-purple-light); font-weight: 600; }
.footer-contact-item { display: flex; align-items: center; gap: 10px; color: var(--text-footer); font-size: .9rem; margin-bottom: 12px; }
.footer-contact-item svg { width: 16px; height: 16px; color: var(--accent-purple-light); flex-shrink: 0; }
.footer-bottom { border-top: 1px solid var(--border-footer); padding: 40px 0; text-align: center; }
.footer-bottom p { color: var(--text-footer-muted); font-size: .85rem; }

@media (max-width: 900px) { .footer-main { grid-template-columns: 1fr; gap: 40px; } }
@media (orientation: portrait) {
  /* Lo spazio sopra il logo va imposto qui (e non solo sotto i 600px):
     cosi' vale su qualsiasi dispositivo in verticale, anche quelli con
     viewport piu' larga come i tablet. */
  .footer-main { justify-items: center !important; text-align: center !important; padding-top: 84px !important; }
  .footer-brand { display: flex !important; flex-direction: column !important; align-items: center !important; text-align: center !important; }
  .footer-col { display: flex !important; flex-direction: column !important; align-items: center !important; text-align: center !important; }
  .footer-col a { text-align: center !important; }
  .footer-logos { justify-content: center !important; }
  .footer-contact-item { justify-content: center !important; text-align: center !important; }
}
@media (max-width: 600px) {
  .site-footer { margin-top: 32px; }
  .footer-main { padding-top: 84px; padding-bottom: 44px; gap: 44px; }
  .footer-logos { margin-bottom: 20px; }
  .footer-brand .footer-cert { height: 46px; }
  .footer-col h4 { margin-bottom: 20px; }
  .footer-col a { margin-bottom: 18px; }
  .footer-contact-item { margin-bottom: 18px; }
  .footer-bottom { padding: 32px 0; }
}

/* ========== SCROLL TOP ========== */
.scroll-top {
  position: fixed; bottom: 24px; right: 24px; width: 48px; height: 48px; border-radius: 50%;
  background: var(--accent-sky); color: var(--text-white); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 15px rgba(14,165,233,.4); z-index: 200;
  opacity: 1; visibility: visible; transform: translateY(0);
  transition: opacity .3s ease, visibility .3s ease, transform .3s ease, background .3s ease;
}
/* Nascosto quando si è già in cima alla pagina: comparirà scorrendo. */
.scroll-top.st-hidden {
  opacity: 0; visibility: hidden; transform: translateY(12px); pointer-events: none;
}
.scroll-top:hover { transform: translateY(-4px); background: var(--accent-cyan); }
.scroll-top svg { width: 22px; height: 22px; }

/* ========== REVEAL ON SCROLL (usato da più pagine) ========== */
.reveal { opacity: 0; transform: translateY(30px); transition: all .7s ease-out; }
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ========== PAGE TRANSITION OVERLAY ========== */
.page-transition {
  position: fixed; inset: 0; z-index: 9999;
  background: #000000;
  display: flex; align-items: center; justify-content: center;
  opacity: 1; visibility: visible;
  transition: opacity 1s ease, visibility 0s linear 0s;
}
.page-transition.pt-hidden {
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 1s ease, visibility 0s linear 1s;
}
.page-transition-loader { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.pt-logo {
  /* Larghezza e altezza restano "auto" e si usano solo i massimi: cosi' il
     browser scala mantenendo le proporzioni. Con height fissa + max-width,
     su schermi stretti l'immagine veniva compressa in orizzontale. */
  width: auto; height: auto;
  max-height: 110px; max-width: min(80vw, 420px);
  object-fit: contain; opacity: .95;
  animation: ptPulse 1.3s ease-in-out infinite;
}
.pt-bar {
  width: 160px; height: 3px; border-radius: 999px; overflow: hidden;
  background: rgba(255,255,255,.08);
}
.pt-bar span {
  display: block; height: 100%; width: 40%; border-radius: 999px;
  background: var(--gradient-primary);
  animation: ptSlide 1.1s ease-in-out infinite;
}
@keyframes ptPulse { 0%,100% { opacity: .85; } 50% { opacity: 1; } }
@keyframes ptSlide { 0% { transform: translateX(-120%); } 50% { transform: translateX(60%); } 100% { transform: translateX(220%); } }
@media (prefers-reduced-motion: reduce) {
  .pt-logo, .pt-bar span { animation: none; }
}

/* ========== AGE GATE (verifica maggiore età) ========== */
body.age-gate-lock { overflow: hidden; }
.age-gate {
  position: fixed; inset: 0; z-index: 10001;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(4,8,20,.94);
  opacity: 1; visibility: visible;
  transition: opacity .4s ease, visibility 0s linear 0s;
}
.age-gate.age-gate-hidden {
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .4s ease, visibility 0s linear .4s;
}
.age-gate-card {
  background: rgba(18,22,42,.94);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 24px;
  padding: 40px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.age-gate-logo { height: 40px; width: auto; margin: 0 auto 18px; display: block; }
.age-gate-icon {
  width: 64px; height: 64px; margin: 0 auto 20px;
  border-radius: 50%;
  border: 3px solid #ef4444;
  color: #ef4444;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.15rem;
}
.age-gate-title { font-size: 1.4rem; font-weight: 800; color: #ffffff; margin-bottom: 12px; }
.age-gate-text { color: rgba(255,255,255,.78); font-size: .95rem; line-height: 1.6; margin-bottom: 24px; }
.age-gate-actions { display: flex; gap: 12px; justify-content: center; margin-bottom: 20px; flex-wrap: wrap; }
.age-gate-btn {
  flex: 1; min-width: 120px;
  padding: 12px 24px; border-radius: 12px; border: none;
  font-weight: 700; font-size: .95rem; cursor: pointer;
  transition: all .2s;
}
.age-gate-yes { background: var(--gradient-primary); color: #ffffff; box-shadow: var(--shadow-glow-purple); }
.age-gate-yes:hover { transform: translateY(-2px); box-shadow: var(--shadow-glow-purple-hover); }
.age-gate-no { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.3); color: #ffffff; }
.age-gate-no:hover { border-color: rgba(255,255,255,.5); background: rgba(255,255,255,.14); }
.age-gate-footnote { font-size: .78rem; color: rgba(255,255,255,.5); line-height: 1.5; }
@media (max-width: 480px) {
  .age-gate-card { padding: 28px 22px; }
  .age-gate-actions { flex-direction: column; }
}
/* In orizzontale su mobile l'altezza disponibile e' poca: la card veniva
   sproporzionata rispetto allo schermo. Si riduce padding, icona, testi
   e spaziature, mantenendo tutto leggibile ma piu' compatto. */
@media (orientation: landscape) and (max-height: 500px) {
  .age-gate { padding: 16px; }
  .age-gate-card { padding: 20px 24px; max-width: 480px; }
  .age-gate-logo { height: 28px; margin-bottom: 10px; }
  .age-gate-icon { width: 44px; height: 44px; margin-bottom: 10px; font-size: .9rem; border-width: 2px; }
  .age-gate-title { font-size: 1.1rem; margin-bottom: 6px; }
  .age-gate-text { font-size: .82rem; line-height: 1.45; margin-bottom: 14px; }
  .age-gate-actions { margin-bottom: 10px; gap: 8px; }
  .age-gate-btn { padding: 9px 18px; font-size: .85rem; min-width: 100px; }
  .age-gate-footnote { font-size: .7rem; line-height: 1.35; }
}

/* ========== COOKIE BANNER ========== */
.cookie-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 9000;
  background: var(--bg-footer);
  border-top: 1px solid var(--border-footer);
  padding: 20px 24px;
  transform: translateY(100%);
  transition: transform .45s ease;
  box-shadow: 0 -10px 40px rgba(0,0,0,.4);
}
.cookie-banner.cookie-banner-visible { transform: translateY(0); }
.cookie-banner-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; flex-wrap: wrap;
}
.cookie-banner-text { color: var(--text-footer); font-size: .9rem; line-height: 1.6; max-width: 720px; }
.cookie-banner-text a { color: var(--accent-purple-light); text-decoration: none; margin-left: 4px; }
.cookie-banner-text a:hover { text-decoration: underline; }
.cookie-banner-actions { display: flex; gap: 10px; flex-shrink: 0; }
.cookie-btn {
  padding: 10px 22px; border-radius: 10px; font-weight: 600; font-size: .88rem;
  cursor: pointer; transition: all .2s; border: none;
}
.cookie-accept { background: var(--gradient-primary); color: var(--text-white); box-shadow: var(--shadow-glow-purple); }
.cookie-accept:hover { transform: translateY(-2px); box-shadow: var(--shadow-glow-purple-hover); }
.cookie-reject { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.3); color: #ffffff; }
.cookie-reject:hover { border-color: rgba(255,255,255,.5); background: rgba(255,255,255,.14); }
@media (max-width: 700px) {
  .cookie-banner-inner { flex-direction: column; align-items: stretch; }
  .cookie-banner-actions { justify-content: flex-end; }
}

/* ========== TOGGLE TEMA CHIARO / SCURO ========== */
.theme-toggle {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 38px; height: 38px; flex: 0 0 auto; padding: 0;
  border-radius: 10px; cursor: pointer;
  background: transparent; border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.75); transition: all .2s;
}
.theme-toggle:hover { color: #ffffff; border-color: rgba(255,255,255,0.35); background: rgba(255,255,255,0.08); }
.theme-toggle svg { width: 18px; height: 18px; }
/* Di giorno si offre la luna (passa a scuro), di notte il sole. */
.theme-toggle .theme-icon-moon { display: block; }
.theme-toggle .theme-icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .theme-icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .theme-icon-sun { display: block; }
.theme-toggle-text { display: none; }
.theme-toggle-mobile {
  width: 100%; height: auto; justify-content: flex-start;
  padding: 12px 14px; margin-top: 12px; border-radius: 12px;
  font-weight: 600; font-size: .95rem;
}
.theme-toggle-mobile .theme-toggle-text { display: inline; }
/* Landscape su mobile: poca altezza disponibile. Oltre allo scroll (sempre
   attivo come rete di sicurezza), si riducono gli spazi cosi' il menu
   intero ci sta quasi sempre senza dover scorrere. */
@media (orientation: landscape) and (max-height: 500px) {
  /* La barra a 72px era pensata per desktop/portrait: in orizzontale su
     mobile, dove l'altezza dello schermo e' gia' poca, si riduce. */
  .nav-inner { height: 48px; }
  .logo-img { height: 26px; }
  .hamburger-btn { width: 32px; height: 32px; }
  .hamburger-btn .icon-line { left: 7px; width: 18px; }
  .hamburger-btn .icon-line:nth-child(1) { top: 11px; }
  .hamburger-btn .icon-line:nth-child(2) { top: 15px; }
  .hamburger-btn .icon-line:nth-child(3) { top: 19px; }
  .hamburger-btn.open .icon-line:nth-child(1) { top: 15px; }
  .hamburger-btn.open .icon-line:nth-child(3) { top: 15px; }
  .mobile-menu { padding: 4px 20px 12px; max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); }
  .mobile-menu a { padding: 8px 4px; font-size: .92rem; }
  .mobile-lang-switcher { padding: 8px 4px 2px; }
  .mobile-lang-switcher .lang-btn { padding: 7px 0; font-size: .82rem; }
  .theme-toggle-mobile { padding: 8px 12px; margin-top: 6px; font-size: .88rem; }
}
@media (max-width: 900px) {
  .nav-right .theme-toggle { display: none; }
}

/* ========== ADATTAMENTI TEMA SCURO ==========
   Poche regole mirate per gli elementi che nelle singole pagine hanno
   colori chiari scritti direttamente (non tramite variabili). */
html[data-theme="dark"] .game-card,
html[data-theme="dark"] .game-card-thumb { background: #151b2b; }
html[data-theme="dark"] .stats-card,
html[data-theme="dark"] .contact-card,
html[data-theme="dark"] .contact-info-card {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.12);
  box-shadow: 0 24px 60px rgba(0,0,0,0.45);
}
html[data-theme="dark"] .contact-field input,
html[data-theme="dark"] .contact-field textarea { background: rgba(255,255,255,0.06); }
html[data-theme="dark"] .contact-field input:focus,
html[data-theme="dark"] .contact-field textarea:focus { background: rgba(255,255,255,0.10); }
html[data-theme="dark"] .sort-control select option { background: #141a2a; color: #e6ecf7; }
html[data-theme="dark"] .flag-chip,
html[data-theme="dark"] .coin-chip { background: rgba(124,179,255,0.12); border-color: rgba(124,179,255,0.28); color: #7cb3ff; }
html[data-theme="dark"] .coin-chip-lead { background: var(--gradient-primary); border-color: transparent; color: #fff; }
html[data-theme="dark"] .coin-chip-more { background: transparent; color: var(--text-muted); }
html[data-theme="dark"] .stat-icon { background: rgba(124,179,255,0.12); border-color: rgba(124,179,255,0.28); }
