:root{ --neon-blue: #00f3ff; --neon-pink: #ff00ff; --neon-purple: #bc13fe; }
body.reanda-auth-active [data-ui], body.reanda-auth-active [data-hud], body.reanda-auth-active .hud,
body.reanda-auth-active .reanda-hud, body.reanda-auth-active .chat-root, body.reanda-auth-active .topbar { display:none!important; }

.auth-wrap {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: url('../../assets/welcometoplayreanda.webp') center/cover no-repeat fixed;
  font-family: system-ui, -apple-system, sans-serif;
  overflow: hidden;
}
@media (max-width: 768px) {
  .auth-wrap { background: url('../../assets/mobilewelcometoplayreanda.webp') center/cover no-repeat fixed; }
}

/* Overlay scurito per leggibilità */
.auth-overlay {
  position: absolute; inset: 0;
  background: radial-gradient(circle at center, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.85) 100%);
  backdrop-filter: blur(3px);
}

/* Header */
.auth-header {
  position: relative; z-index: 2;
  text-align: center; margin-bottom: 30px;
  animation: fadeInDown 0.8s ease-out;
}
.auth-title-main {
  font-size: clamp(2.8rem, 8vw, 5rem);
  font-weight: 900;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 4px;
  margin: 0;
  line-height: 1;
  animation: glowPulse 2s ease-in-out infinite alternate;
}
@keyframes glowPulse {
  0% {
    text-shadow: 
      0 0 4px #fff,
      0 0 10px rgba(0, 243, 255, 0.9),
      0 0 25px rgba(0, 243, 255, 0.7),
      0 0 50px rgba(0, 243, 255, 0.5),
      0 0 90px rgba(0, 243, 255, 0.3);
  }
  100% {
    text-shadow: 
      0 0 2px #fff,
      0 0 8px rgba(0, 243, 255, 0.8),
      0 0 20px rgba(0, 243, 255, 0.6),
      0 0 40px rgba(0, 243, 255, 0.4),
      0 0 80px rgba(0, 243, 255, 0.2);
  }
}
.auth-subtitle {
  font-size: clamp(0.9rem, 3vw, 1.1rem);
  color: rgba(255,255,255,0.95);
  font-weight: 400;
  letter-spacing: 2px;
  margin-top: 12px;
  text-transform: uppercase;
  text-shadow: 0 2px 4px rgba(0,0,0,0.9);
}

/* Container centrale */
.auth-container {
  position: relative; z-index: 2;
  width: min(420px, 90vw);
  background: rgba(12, 18, 35, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.7), inset 0 0 0 1px rgba(255,255,255,0.08);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  padding: 24px;
  animation: zoomIn 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
  overflow: hidden;
}
@media (max-width: 480px) {
  .auth-container {
      width: auto;
      margin: 5px 15px; /* Side margins */
      padding: 10px 15px 15px 15px; /* Increased bottom padding for "Problemi di accesso" space */
  }
  .auth-title-main { font-size: 2.8rem; letter-spacing: 1px; line-height: 1; }
  .auth-subtitle { font-size: 0.7rem; margin-top: 2px; }
  .auth-header { margin-bottom: 5px; }
  .auth-toggle-btn { padding: 6px; font-size: 10px; }
  .auth-input { padding: 4px 8px; font-size: 11px; height: 28px; } /* Slightly shorter inputs */
  .auth-action-btn { 
    padding: 0; 
    font-size: 11px; 
    margin-top: 5px; /* Distance from register border */
    height: 34px; 
    display: flex; align-items: center; justify-content: center;
  }
  .auth-input-group { margin-bottom: 2px; } /* Compact vertical space */
  .auth-toggle-bar { margin-bottom: 5px; }
  .reg-row { gap: 3px; margin-bottom: 0; }
  
  /* Mobile Checkbox Optimizations - Forced Single Line */
  .checkbox-container { 
    gap: 2px!important; 
    flex-direction: row!important;
    justify-content: center;
    flex-wrap: nowrap!important;
    width: 100%;
    margin-bottom: 4px!important; /* Compact space */
  }
  .checkbox-label {
    font-size: 8px!important; 
    padding: 1px 3px!important;
    white-space: nowrap;
    background: transparent!important;
    border: none!important;
    margin: 0!important;
  }
  .checkbox-input {
    width: 10px!important;
    height: 10px!important;
    margin-right: 2px!important;
  }
  
  .alt-link {
    margin-top: 15px; /* Lift "Problemi di accesso" slightly */
    margin-bottom: 5px;
  }
}

/* Toggle Bar */
.auth-toggle-bar {
  display: flex;
  background: rgba(0,0,0,0.3);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 20px;
  position: relative;
}
.auth-toggle-btn {
  flex: 1;
  text-align: center;
  padding: 12px;
  font-size: 13px;
  font-weight: 800;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  border-radius: 10px;
  transition: all 0.3s;
  letter-spacing: 1px;
}
.auth-toggle-btn.active {
  background: rgba(255,255,255,0.1);
  color: #fff;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

/* Forms */
.auth-form-section { display: none; animation: fadeIn 0.4s; }
.auth-form-section.active { display: block; }

.auth-input-group { margin-bottom: 16px; position: relative; }
.auth-input {
  width: 100%;
  padding: 12px 14px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  color: #fff;
  font-size: 14px;
  font-family: inherit;
  transition: all 0.25s;
  box-sizing: border-box;
}
.auth-input:focus {
  outline: none;
  border-color: var(--neon-blue);
  box-shadow: 0 0 0 4px rgba(0,243,255,0.1);
  background: rgba(0,0,0,0.6);
}
.auth-input::placeholder { color: rgba(255,255,255,0.3); }

/* Checkbox Styling (Desktop Default) */
.checkbox-container {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  gap: 15px; /* Spacing between items */
  margin-bottom: 20px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, 0.7); /* Light gray for contrast */
  font-size: 12px; /* Smaller font */
  cursor: pointer;
  transition: color 0.2s;
  user-select: none;
}

.checkbox-label:hover {
  color: #fff;
}

.checkbox-input {
  appearance: none;
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.3);
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  margin: 0;
}

.checkbox-input:checked {
  background: var(--neon-blue);
  border-color: var(--neon-blue);
  box-shadow: 0 0 8px rgba(0, 243, 255, 0.4);
}

.checkbox-input:checked::after {
  content: '✔';
  font-size: 10px;
  color: #000;
  font-weight: bold;
}

/* Action Button */
.auth-action-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(90deg, #00c6ff, #0072ff);
  color: white;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 6px 20px rgba(0,114,255,0.35);
  position: relative; overflow: hidden;
  margin-top: 10px;
}
.auth-action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 35px rgba(0,114,255,0.5), 0 0 25px rgba(0,198,255,0.4);
}
.auth-action-btn:active { transform: translateY(1px); }
.auth-action-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* Register Specifics */
.reg-row { display: flex; gap: 12px; }
.reg-row .auth-input-group { flex: 1; }

/* Footer Legal */
.auth-footer {
  position: fixed; bottom: 25px; left: 0; right: 0;
  display: flex; justify-content: center; gap: 30px;
  z-index: 20;
  flex-wrap: wrap;
  padding: 0 20px;
}
.legal-link {
  color: rgba(255,255,255,0.5);
  text-decoration: none;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  cursor: pointer;
  transition: all 0.2s;
  background: transparent; border: none; padding: 5px;
}
.legal-link:hover { 
  color: #fff; 
  text-shadow: 0 0 10px rgba(255,255,255,0.6);
  transform: scale(1.05);
}

/* Animations */
@keyframes fadeInDown { from { opacity:0; transform:translateY(-40px); } to { opacity:1; transform:translateY(0); } }
@keyframes zoomIn { from { opacity:0; transform:scale(0.92); } to { opacity:1; transform:scale(1); } }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }

/* Modals (Legal, OTP, etc) */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.85); backdrop-filter: blur(12px);
  z-index: 12000; display: none; align-items: center; justify-content: center;
  animation: fadeIn 0.3s ease;
}
.modal-backdrop.show { display: flex; }
.modal-content {
  background: #151a29; color: #fff; border-radius: 20px; padding: 24px;
  width: min(500px, 88vw); max-height: 80vh; overflow-y: auto;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 25px 80px rgba(0,0,0,0.6);
}
.modal-content h2 { color: var(--neon-blue); margin-top: 0; font-size: 1.8rem; text-transform: uppercase; letter-spacing: 1px; }
.modal-close-btn {
  margin-top: 25px; background: rgba(255,255,255,0.1); border: none; color: #fff;
  padding: 12px 24px; border-radius: 10px; cursor: pointer; font-weight: bold; text-transform: uppercase; letter-spacing: 1px;
  transition: background 0.2s;
}
.modal-close-btn:hover { background: rgba(255,255,255,0.2); }

/* OTP Specifics */
.otp-inputs { display:flex; gap:10px; justify-content:center; margin: 25px 0; }
.otp-inputs input { width:45px; height:55px; text-align:center; font-size:26px; font-weight:bold; background:#0f172a; border:2px solid #334155; color:#fff; border-radius:10px; transition: border-color 0.2s; }
.otp-inputs input:focus { border-color: var(--neon-blue); outline:none; box-shadow: 0 0 15px rgba(0,243,255,0.1); }

.warn-border { border-color: #ef4444 !important; animation: shake 0.4s ease; }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-4px)} 75%{transform:translateX(4px)} }

.alt-link {
  display: block; text-align: center; margin-top: 15px;
  color: rgba(255,255,255,0.4); font-size: 13px; text-decoration: none; cursor: pointer;
  transition: color 0.2s;
}
.alt-link:hover { color: #fff; text-decoration: underline; }

/* Access Modal Specifics */
.access-modal-content {
  text-align: center;
  max-width: 450px;
  border: 1px solid rgba(0, 243, 255, 0.2);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8), 0 0 20px rgba(0, 243, 255, 0.1);
}
.access-desc {
  color: rgba(255,255,255,0.6);
  margin-bottom: 25px;
  font-size: 14px;
}
.access-form-row {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  align-items: stretch;
}
.access-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.5);
  border-color: rgba(255,255,255,0.1);
  margin: 0;
}
.access-btn {
  width: auto;
  margin: 0;
  white-space: nowrap;
  padding: 0 25px;
  background: linear-gradient(135deg, var(--neon-blue), #0072ff);
  box-shadow: 0 4px 15px rgba(0, 114, 255, 0.3);
}
.access-btn:hover {
  box-shadow: 0 6px 20px rgba(0, 114, 255, 0.5), 0 0 15px rgba(0, 243, 255, 0.4);
}
.access-close-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.6);
  font-size: 12px;
  padding: 8px 20px;
  margin-top: 10px;
}
.access-close-btn:hover {
  border-color: rgba(255,255,255,0.4);
  color: #fff;
  background: rgba(255,255,255,0.05);
}

@media (max-width: 480px) {
  /* Enforce safe margins via backdrop padding */
  .modal-backdrop {
    padding: 0 25px!important; /* 25px safety margin on both sides */
    box-sizing: border-box!important;
  }

  /* Mobile Modal Base */
  .modal-content { 
    padding: 20px 15px!important; 
    width: 100%!important;
    max-width: 360px!important;
    margin: 0 auto!important;
    box-sizing: border-box!important;
    border-radius: 15px!important;
  }
  .modal-content h2 { font-size: 1.4rem!important; margin-bottom: 10px!important; }
  
  /* Mobile OTP Specifics - Compact & Cool */
  .otp-modal-content { 
      padding: 15px 10px!important; 
      width: 100%!important;
      max-width: 340px!important;
      border: 1px solid rgba(0, 243, 255, 0.3)!important;
      box-shadow: 0 10px 40px rgba(0,0,0,0.8), 0 0 20px rgba(0, 243, 255, 0.1)!important;
      margin: 0 auto!important;
  }
  .otp-inputs { gap: 5px!important; margin: 8px 0!important; }
  .otp-inputs input { 
      width: 34px!important; 
      height: 40px!important; 
      font-size: 16px!important; 
      border-radius: 8px!important;
      border-width: 1px!important;
      background: rgba(0,0,0,0.6)!important;
  }
  .otp-inputs input:focus {
      border-color: #00f3ff!important;
      box-shadow: 0 0 10px rgba(0, 243, 255, 0.4)!important;
  }
  .otp-modal-content h2 { font-size: 1.2rem!important; margin-bottom: 4px!important; color: #fff!important; text-shadow: 0 0 5px rgba(0,243,255,0.5); }
  .otp-modal-content p { font-size: 10px!important; margin-bottom: 6px!important; color: rgba(255,255,255,0.7)!important; }
  .otp-modal-content .modal-close-btn { margin-top: 6px!important; padding: 6px 12px!important; font-size: 10px!important; }
  .otp-modal-content .auth-action-btn { padding: 0!important; display:flex; align-items:center; justify-content:center; font-size: 13px!important; margin-top: 4px!important; height: 32px!important; }

  /* Mobile Access Specifics */
  .access-form-row {
    flex-direction: column;
    gap: 5px;
  }
  .access-btn {
    width: 100%;
    margin-top: 4px;
    display: flex; align-items: center; justify-content: center; padding: 0; height: 34px;
  }
}

/* Legal Document Styles */
.legal-doc {
  font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  font-size: 14px;
  color: #e2e8f0;
}
.legal-title {
  text-align: center;
  margin-bottom: 5px;
  color: var(--neon-blue);
  text-shadow: 0 0 10px rgba(0, 243, 255, 0.3);
}
.legal-meta {
  text-align: center;
  margin-bottom: 25px;
  font-size: 12px;
  color: #94a3b8;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding-bottom: 15px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.legal-section h3 {
  color: #fff;
  font-size: 1.2rem;
  margin-bottom: 12px;
  border-left: 3px solid var(--neon-blue);
  padding-left: 10px;
}
.legal-highlight {
  background: rgba(0, 243, 255, 0.1);
  border: 1px solid rgba(0, 243, 255, 0.3);
  padding: 15px;
  border-radius: 8px;
  margin: 15px 0;
  font-weight: bold;
  color: #fff;
  text-align: center;
}
.legal-warning {
  color: #ff9f43;
  font-weight: bold;
  margin-top: 10px;
  padding: 10px;
  background: rgba(255, 159, 67, 0.1);
  border-radius: 6px;
}