.account-gate {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-blocking, 1000) - 1);
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 100dvh;
  padding:
    max(24px, env(safe-area-inset-top, 0px))
    clamp(16px, 5vw, 96px)
    max(24px, env(safe-area-inset-bottom, 0px));
  overflow: auto;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.04) 0%, rgba(0, 0, 0, 0.78) 72%, #000 100%),
    linear-gradient(112deg, rgba(var(--accent-rgb, 90, 98, 235), 0.34) 0%, rgba(0, 0, 0, 0) 44%),
    linear-gradient(248deg, rgba(255, 255, 255, 0.13) 0%, rgba(0, 0, 0, 0) 38%),
    var(--bg, #000);
  color: var(--text, #fff);
  isolation: isolate;
}

.account-gate::before,
.account-gate::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.account-gate::before {
  z-index: 0;
  background: url("/assets/icons/icon.svg") calc(100% + 12vmin) 50% / min(82vmin, 760px) auto no-repeat;
  filter: invert(1);
  opacity: 0.1;
}

.account-gate::after {
  z-index: 0;
  background:
    linear-gradient(90deg, #000 0%, rgba(0, 0, 0, 0.78) 34%, rgba(0, 0, 0, 0.18) 64%, #000 100%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 0 1px, transparent 1px 100%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 22px),
    linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, #000 100%);
  background-size: auto, 92px 100%, auto, auto;
  opacity: 0.72;
}

.account-gate[hidden] { display: none !important; }

body.account-gated {
  overflow: hidden;
  height: 100%;
}

body.account-gated #showBackdrop,
body.account-gated #featuredHero,
body.account-gated #onboardingOverlay,
body.account-gated .shell,
body.account-gated .bottom-nav {
  visibility: hidden;
  pointer-events: none;
}

.account-gate-panel {
  position: relative;
  z-index: 1;
  width: min(468px, calc(100vw - 32px));
  display: grid;
  gap: 18px;
  box-sizing: border-box;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(22px) saturate(1.55) brightness(0.84);
  backdrop-filter: blur(22px) saturate(1.55) brightness(0.84);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.58);
  overflow: hidden;
  animation: account-gate-enter 420ms cubic-bezier(0.22, 0.78, 0.32, 1) both;
}

.account-gate-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.72), transparent);
  pointer-events: none;
}

.account-gate-brand {
  width: 112px;
  color: #fff;
  filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.55));
}

.account-gate-brand svg {
  width: 100%;
  height: auto;
  display: block;
  fill: currentColor;
}

.account-gate-copy {
  display: grid;
  gap: 10px;
}

.account-gate-copy h1 {
  margin: 0;
  max-width: 9ch;
  color: #fff;
  font-size: 2.65rem;
  line-height: 0.92;
  letter-spacing: 0;
  text-wrap: balance;
}

.account-gate-copy p {
  margin: 0;
  max-width: 31rem;
  color: var(--text-80, rgba(255, 255, 255, 0.78));
  font-size: var(--fs-sm, 0.9rem);
  line-height: 1.5;
  font-weight: var(--fw-semi, 600);
}

.account-mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 7px;
  border: 1.5px solid var(--header-control-border, rgba(255, 255, 255, 0.28));
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  -webkit-backdrop-filter: blur(14px) saturate(1.6) brightness(0.78);
  backdrop-filter: blur(14px) saturate(1.6) brightness(0.78);
}

.account-mode-switch[hidden] { display: none !important; }

.account-mode-btn {
  min-width: 0;
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-80, rgba(255, 255, 255, 0.78));
  font: var(--fw-bold, 700) var(--fs-sm, 0.9rem)/1.1 var(--font, "DM Sans", system-ui, sans-serif);
  letter-spacing: 0;
  cursor: pointer;
  white-space: normal;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.account-mode-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.account-mode-btn:focus,
.account-submit:focus,
.account-icon-btn:focus {
  outline: none;
}

.account-mode-btn:focus-visible,
.account-submit:focus-visible,
.account-icon-btn:focus-visible {
  outline: 2px solid rgba(var(--accent-hover-rgb, 130, 136, 254), 0.95);
  outline-offset: 2px;
}

.account-mode-btn.is-active {
  background: #fff;
  color: #0d131a;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.32);
}

.account-status {
  margin: 0;
  padding: 11px 12px;
  border: 1px solid rgba(255, 210, 138, 0.28);
  border-radius: 8px;
  background: rgba(255, 210, 138, 0.1);
  color: rgba(255, 228, 184, 0.94);
  font-size: var(--fs-xs, 0.78rem);
  font-weight: var(--fw-bold, 700);
  line-height: 1.35;
}

.account-form,
.account-secret-panel {
  display: grid;
  gap: 12px;
}

.account-form[hidden],
.account-secret-panel[hidden],
.account-status[hidden] {
  display: none !important;
}

.account-form label,
.account-secret-panel label {
  color: var(--text-80, rgba(255, 255, 255, 0.78));
  font-size: var(--fs-xs, 0.78rem);
  font-weight: var(--fw-bold, 700);
  letter-spacing: 0;
}

.account-form input,
.account-secret-panel input {
  width: 100%;
  min-width: 0;
  min-height: 52px;
  box-sizing: border-box;
  padding: 0 15px;
  border: 1.5px solid var(--header-control-border, rgba(255, 255, 255, 0.28));
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.24);
  color: #fff;
  font: var(--fw-bold, 700) var(--fs-sm, 0.9rem)/1.2 ui-monospace, Menlo, Consolas, monospace;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.account-form input::placeholder,
.account-secret-panel input::placeholder {
  color: rgba(255, 255, 255, 0.38);
}

.account-form input:focus,
.account-secret-panel input:focus {
  border-color: rgba(var(--accent-hover-rgb, 130, 136, 254), 0.92);
  background: rgba(255, 255, 255, 0.1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 0 0 4px rgba(var(--accent-rgb, 90, 98, 235), 0.2);
}

.account-submit {
  min-height: 52px;
  border: 1.5px solid rgba(var(--accent-hover-rgb, 130, 136, 254), 0.42);
  border-radius: 999px;
  background: rgba(var(--accent-rgb, 90, 98, 235), 0.86);
  color: #fff;
  font: var(--fw-bold, 700) var(--fs-sm, 0.9rem)/1 var(--font, "DM Sans", system-ui, sans-serif);
  letter-spacing: 0;
  cursor: pointer;
  box-shadow: 0 18px 42px rgba(var(--accent-rgb, 90, 98, 235), 0.34);
  transition: background 180ms ease, border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.account-submit:hover {
  background: rgba(var(--accent-hover-rgb, 130, 136, 254), 0.94);
  border-color: rgba(var(--accent-hover-rgb, 130, 136, 254), 0.74);
  transform: translateY(-1px);
  box-shadow: 0 22px 48px rgba(var(--accent-rgb, 90, 98, 235), 0.42);
}

.account-submit:disabled,
.account-form input:disabled {
  opacity: 0.58;
  cursor: progress;
  transform: none;
}

.account-secret-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 52px 52px;
  gap: 8px;
  align-items: center;
}

.account-icon-btn {
  width: 52px;
  height: 52px;
  display: inline-grid;
  place-items: center;
  border: 1.5px solid var(--header-control-border, rgba(255, 255, 255, 0.28));
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  -webkit-backdrop-filter: blur(14px) saturate(1.6) brightness(0.78);
  backdrop-filter: blur(14px) saturate(1.6) brightness(0.78);
  color: #fff;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.account-icon-btn:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: var(--header-control-border-hover, rgba(255, 255, 255, 0.52));
  transform: translateY(-1px);
}

.account-icon-btn svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.account-secret-note {
  margin: 0;
  color: var(--text-60, rgba(255, 255, 255, 0.6));
  font-size: var(--fs-xs, 0.78rem);
  line-height: 1.45;
  font-weight: var(--fw-bold, 700);
}

.account-confirm-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal, 500);
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(3, 6, 10, 0.76);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.account-confirm-modal-content {
  width: min(420px, calc(100vw - 32px));
  display: grid;
  gap: 16px;
  box-sizing: border-box;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(22px) saturate(1.55) brightness(0.84);
  backdrop-filter: blur(22px) saturate(1.55) brightness(0.84);
  color: #fff;
  text-align: center;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.52);
}

.account-confirm-modal-content h4 {
  margin: 0;
  font-size: var(--fs-lg, 1.1rem);
  line-height: 1.2;
  letter-spacing: 0;
}

.account-confirm-modal-content p {
  margin: 0;
  color: rgba(255, 255, 255, 0.68);
  font-size: var(--fs-sm, 0.9rem);
  font-weight: var(--fw-semi, 600);
  line-height: 1.45;
}

.account-confirm-modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

@keyframes account-gate-enter {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (min-width: 900px) {
  .account-gate {
    justify-content: flex-start;
  }

  .account-gate-panel {
    margin-left: clamp(12px, 4vw, 54px);
  }
}

@media (max-width: 520px) {
  .account-gate {
    align-items: flex-start;
  }

  .account-gate-panel {
    width: calc(100vw - 32px);
    padding: 20px;
  }

  .account-gate-brand {
    width: 96px;
  }

  .account-gate-copy h1 {
    font-size: 2.15rem;
  }
}

@media (max-width: 460px) {
  .account-mode-switch {
    grid-template-columns: 1fr;
    border-radius: 8px;
  }

  .account-mode-btn {
    border-radius: 6px;
  }

  .account-secret-row {
    grid-template-columns: minmax(0, 1fr) 48px 48px;
  }

  .account-icon-btn {
    width: 48px;
    height: 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .account-gate-panel,
  .account-mode-btn,
  .account-submit,
  .account-icon-btn,
  .account-form input,
  .account-secret-panel input {
    animation: none;
    transition: none;
  }
}
