/* ─── Access Gate: Modal Flotante ─── */
.gate-body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--bg, #0b0b0f);
  color: var(--text, #f5f5f7);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  overflow: hidden;
}

.gate-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg, #0b0b0f);
}

.gate-backdrop::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 30%, rgba(var(--accent-rgb, 0,113,227), 0.08), transparent);
}

.gate-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  place-items: center;
  z-index: 10000;
  padding: 24px;
}

.gate-modal {
  width: 100%;
  max-width: 440px;
  background: var(--card, rgba(24,24,30,.6));
  backdrop-filter: blur(40px) saturate(200%);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  border: 1px solid var(--glass-border, rgba(255,255,255,.08));
  border-radius: 24px;
  box-shadow: 0 24px 80px rgba(0,0,0,.4), 0 0 0 1px rgba(255,255,255,.04);
  animation: gate-in .5s cubic-bezier(.16,1,.3,1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

@keyframes gate-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.gate-icon {
  display: flex;
  justify-content: center;
  padding-top: 32px;
}

.gate-lock {
  font-size: 32px;
  filter: grayscale(0.2);
}

.gate-content {
  padding: 24px 32px 16px;
  flex: 1;
}

.gate-view h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.025em;
  text-align: center;
  margin: 0 0 8px;
  color: var(--text, #f5f5f7);
}

.gate-desc {
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
  color: var(--text-secondary, #a1a1a6);
  margin: 0 0 24px;
}

.gate-desc strong {
  color: var(--text, #f5f5f7);
  font-weight: 600;
}

.gate-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.gate-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary, #a1a1a6);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.gate-input-wrap {
  position: relative;
}

.gate-input-wrap input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--border, rgba(255,255,255,.06));
  background: var(--card-solid, #18181e);
  color: var(--text, #f5f5f7);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  box-sizing: border-box;
}

.gate-input-wrap input:focus {
  border-color: var(--accent, #0071e3);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb, 0,113,227),.15);
}

.gate-input-wrap input.invalid {
  border-color: #ff453a;
  box-shadow: 0 0 0 3px rgba(255,69,58,.15);
}

.gate-input-wrap input.valid {
  border-color: #30d158;
  box-shadow: 0 0 0 3px rgba(48,209,88,.15);
}

.gate-input-status {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  opacity: 0;
  transition: opacity .2s;
}

.gate-input-status.visible {
  opacity: 1;
}

.gate-hint {
  font-size: 12px;
  color: var(--text-secondary, #a1a1a6);
  margin-top: 6px;
  display: block;
}

.gate-hint.error {
  color: #ff453a;
}

.gate-hint.success {
  color: #30d158;
}

.gate-optional {
  margin-top: 4px;
  border: none;
}

.gate-optional summary {
  font-size: 13px;
  color: var(--text-secondary, #a1a1a6);
  cursor: pointer;
  padding: 8px 0;
  user-select: none;
  outline: none;
}

.gate-optional summary span {
  color: var(--text-tertiary, #6e6e73);
}

.gate-optional[open] summary {
  margin-bottom: 12px;
}

.gate-optional-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gate-optional-fields input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--border, rgba(255,255,255,.06));
  background: var(--card-solid, #18181e);
  color: var(--text, #f5f5f7);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  box-sizing: border-box;
}

.gate-optional-fields input:focus {
  border-color: var(--accent, #0071e3);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb, 0,113,227),.15);
}

.gate-btn {
  width: 100%;
  padding: 14px 24px;
  border-radius: 980px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all .25s cubic-bezier(.16,1,.3,1);
  min-height: 48px;
  letter-spacing: -0.01em;
}

.gate-btn:active {
  transform: scale(.98);
}

.gate-btn-primary {
  background: var(--accent, #0071e3);
  color: #fff;
}

.gate-btn-primary:hover {
  background: var(--accent-dark, #0077ed);
  box-shadow: 0 6px 20px rgba(var(--accent-rgb, 0,113,227),.3);
}

.gate-btn-primary:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
}

.gate-btn-ghost {
  background: transparent;
  color: var(--accent, #0071e3);
  border: 1.5px solid rgba(var(--accent-rgb, 0,113,227),.3);
}

.gate-btn-ghost:hover {
  background: rgba(var(--accent-rgb, 0,113,227),.06);
  border-color: var(--accent, #0071e3);
}

.gate-btn-text {
  background: transparent;
  color: var(--text-secondary, #a1a1a6);
  padding: 10px;
  min-height: auto;
  font-size: 13px;
  font-weight: 500;
}

.gate-btn-text:hover {
  color: var(--text, #f5f5f7);
}

.gate-error {
  background: rgba(255,69,58,.1);
  color: #ff453a;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.4;
  display: none;
  margin-top: 4px;
}

.gate-error.visible {
  display: block;
  animation: gate-shake .4s cubic-bezier(.36,.07,.19,.97);
}

@keyframes gate-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

.gate-otp {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin: 24px 0 16px;
}

.gate-otp input {
  width: 100%;
  aspect-ratio: 1;
  max-width: 56px;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  font-family: inherit;
  border-radius: 12px;
  border: 1.5px solid var(--border, rgba(255,255,255,.06));
  background: var(--card-solid, #18181e);
  color: var(--text, #f5f5f7);
  outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
  margin: 0 auto;
}

.gate-otp input:focus {
  border-color: var(--accent, #0071e3);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb, 0,113,227),.15);
  background: var(--bg-secondary, #121218);
}

.gate-otp input.filled {
  border-color: var(--accent, #0071e3);
  background: rgba(var(--accent-rgb, 0,113,227),.06);
}

.gate-otp input.error {
  border-color: #ff453a;
  background: rgba(255,69,58,.06);
  animation: gate-shake .4s;
}

.gate-code-error {
  text-align: center;
  font-size: 13px;
  color: #ff453a;
  min-height: 20px;
  margin-bottom: 8px;
}

.gate-timer-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
}

.gate-timer-label {
  font-size: 13px;
  color: var(--text-secondary, #a1a1a6);
}

.gate-timer {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent, #0071e3);
  font-variant-numeric: tabular-nums;
}

.gate-success-icon {
  display: flex;
  justify-content: center;
  margin: 16px 0 24px;
}

.gate-footer {
  padding: 16px 32px 24px;
  text-align: center;
  border-top: 1px solid var(--border, rgba(255,255,255,.06));
}

.gate-footer span {
  font-size: 12px;
  color: var(--text-tertiary, #6e6e73);
}

.gate-footer a {
  color: var(--accent, #0071e3);
  text-decoration: none;
}

.gate-footer a:hover {
  text-decoration: underline;
}

.gate-view {
  animation: gate-fade .3s cubic-bezier(.16,1,.3,1);
}

@keyframes gate-fade {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 480px) {
  .gate-modal {
    max-width: 100%;
    border-radius: 20px;
  }
  
  .gate-content {
    padding: 20px 24px 12px;
  }
  
  .gate-footer {
    padding: 14px 24px 20px;
  }
  
  .gate-otp input {
    max-width: 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gate-modal,
  .gate-view,
  .gate-error {
    animation: none;
  }
}

@media (prefers-color-scheme: light) {
  .gate-backdrop {
    background: #f5f5f7;
  }
  
  .gate-modal {
    background: rgba(255,255,255,.85);
    border-color: rgba(0,0,0,.08);
    box-shadow: 0 24px 80px rgba(0,0,0,.12), 0 0 0 1px rgba(0,0,0,.04);
  }
  
  .gate-view h2 {
    color: #1d1d1f;
  }
  
  .gate-desc {
    color: #6e6e73;
  }
  
  .gate-label {
    color: #6e6e73;
  }
  
  .gate-input-wrap input,
  .gate-optional-fields input,
  .gate-otp input {
    background: #ffffff;
    border-color: rgba(0,0,0,.08);
    color: #1d1d1f;
  }
  
  .gate-hint {
    color: #6e6e73;
  }
  
  .gate-otp input.filled {
    background: rgba(0,113,227,.06);
    border-color: #0071e3;
  }
  
  .gate-footer {
    border-top-color: rgba(0,0,0,.08);
  }
  
  .gate-footer span {
    color: #86868b;
  }
}
