*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background-color: #05070a;
  color: #f8fafc;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.gate-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-color: #05070a;
  background-image: url('/invite-space-bg.jpg');
  background-position: center bottom;
  background-size: cover;
  background-repeat: no-repeat;
  transform: scale(1.015);
  pointer-events: none;
}

.gate-vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(circle at 50% 42%, rgba(5, 7, 10, 0.44) 0%, rgba(5, 7, 10, 0.72) 72%, rgba(5, 7, 10, 0.88) 100%),
    linear-gradient(180deg, rgba(5, 7, 10, 0.56) 0%, rgba(5, 7, 10, 0.28) 52%, rgba(5, 7, 10, 0.68) 100%);
  pointer-events: none;
}

.gate-viewport {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  height: 100dvh;
  padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
}

.gate-topbar {
  width: 100%;
  max-width: 1120px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 4px;
  user-select: none;
  -webkit-user-select: none;
}

.gate-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.gate-brand-icon {
  width: 26px;
  height: 26px;
  object-fit: contain;
  flex-shrink: 0;
}

.gate-brand-name {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #ffffff;
  line-height: 1;
}

.gate-brand-pill {
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(151, 251, 227, 0.12);
  color: #97fbe3;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.1;
}

.gate-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(12, 15, 22, 0.68);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 11px;
  font-weight: 600;
  color: #cbd5e1;
}

.gate-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #97fbe3;
  box-shadow: 0 0 10px rgba(151, 251, 227, 0.8);
}

.gate-center {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.gate-card {
  width: 100%;
  padding: clamp(24px, 4vw, 34px);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(14, 18, 26, 0.78) 0%, rgba(9, 12, 18, 0.84) 100%);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-top-color: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow:
    0 28px 80px -16px rgba(0, 0, 0, 0.85),
    0 0 0 1px rgba(151, 251, 227, 0.06);
}

.gate-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #97fbe3;
  margin: 0 0 10px;
}

.gate-title {
  margin: 0 0 8px;
  font-size: clamp(24px, 4.5vw, 30px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.12;
  color: #ffffff;
}

.gate-subtitle {
  margin: 0 0 22px;
  font-size: 13px;
  line-height: 1.5;
  color: #94a3b8;
}

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

.gate-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.gate-input {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 50px;
  padding: 0 16px;
  border-radius: 14px;
  background: rgba(6, 8, 13, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.11);
  color: #ffffff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: center;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
  cursor: text;
  touch-action: manipulation;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.gate-input::placeholder {
  color: #475569;
  letter-spacing: 0.1em;
  font-weight: 600;
}

.gate-input:focus {
  border-color: rgba(151, 251, 227, 0.65);
  box-shadow: 0 0 0 3px rgba(151, 251, 227, 0.14);
}

.gate-input:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  background: rgba(6, 8, 13, 0.45);
}

.gate-input.shake {
  animation: gateShake 0.34s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
  border-color: rgba(251, 113, 133, 0.7);
}

@keyframes gateShake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-6px); }
  40%, 60% { transform: translateX(6px); }
}

.gate-btn {
  width: 100%;
  height: 48px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #97fbe3 0%, #44e6c4 100%);
  color: #05070a;
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 0.12s ease, opacity 0.16s ease, box-shadow 0.18s ease;
  box-shadow: 0 10px 28px -8px rgba(151, 251, 227, 0.45);
}

.gate-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 14px 34px -8px rgba(151, 251, 227, 0.6);
}

.gate-btn:active:not(:disabled) {
  transform: translateY(0);
}

.gate-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.gate-error {
  min-height: 20px;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 600;
  color: #fb7185;
  text-align: center;
  line-height: 1.4;
}

.gate-error.success {
  color: #97fbe3;
}

.gate-footer {
  width: 100%;
  max-width: 1120px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 11px;
  color: rgba(148, 163, 184, 0.72);
  padding-bottom: 4px;
  text-align: center;
  user-select: none;
  -webkit-user-select: none;
}

@media (max-height: 600px) {
  .gate-card {
    padding: 20px;
  }
  .gate-subtitle {
    margin-bottom: 14px;
  }
}
