:root {
  color-scheme: dark;
  --gate-bg: #080010;
  --gate-panel: rgba(10, 0, 20, 0.95);
  --gate-panel-border: rgba(84, 96, 132, 0.28);
  --gate-panel-border-soft: rgba(84, 96, 132, 0.22);
  --gate-text: #d8deef;
  --gate-title: #ffffff;
  --gate-muted: #8d98b7;
  --gate-muted-soft: #59627c;
  --gate-button-bg: rgba(255, 255, 255, 0.08);
  --gate-button-bg-disabled: rgba(255, 255, 255, 0.04);
  --gate-button-text: #eef2ff;
  --gate-error: #ff6b6b;
  --gate-success: #b8c4ff;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--gate-bg);
  color: var(--gate-text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
}

@keyframes hue-rotate-border {
  0%   { border-color: rgba(160, 200, 255, 0.35); box-shadow: 0 0 18px rgba(100, 160, 255, 0.18); }
  25%  { border-color: rgba(130, 100, 255, 0.4);  box-shadow: 0 0 22px rgba(120, 80, 255, 0.22); }
  50%  { border-color: rgba(180, 100, 255, 0.35); box-shadow: 0 0 18px rgba(160, 60, 255, 0.18); }
  75%  { border-color: rgba(80, 160, 255, 0.4);   box-shadow: 0 0 22px rgba(60, 140, 255, 0.22); }
  100% { border-color: rgba(160, 200, 255, 0.35); box-shadow: 0 0 18px rgba(100, 160, 255, 0.18); }
}

.hue-border {
  border: 1px solid rgba(160, 200, 255, 0.35);
  animation: hue-rotate-border 6s ease-in-out infinite;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.gate-screen {
  width: 100%;
  min-height: calc(100vh - 48px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.gate-shell {
  width: min(100%, 336px);
  background: var(--gate-panel);
  border-radius: 12px;
  padding: 34px 34px 26px;
}

.gate-header {
  text-align: center;
  margin-bottom: 24px;
}

.gate-wordmark {
  margin-bottom: 6px;
  color: var(--gate-title);
  font-size: 28px;
  letter-spacing: 4px;
}

.gate-mode {
  margin: 0;
  color: var(--gate-muted-soft);
  font-size: 11px;
  letter-spacing: 2px;
}

.gate-title {
  margin: 0 0 12px;
  color: var(--gate-title);
  font-size: 21px;
  font-weight: 400;
  line-height: 1.35;
}

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

.gate-copy {
  margin: 0;
  font-size: 13px;
  line-height: 1.65;
  color: var(--gate-muted);
}

.gate-section {
  margin-top: 18px;
  display: grid;
  gap: 10px;
}

.gate-section-label {
  margin: 0;
  color: var(--gate-muted-soft);
  font-size: 10px;
  letter-spacing: 1.4px;
}

.gate-divider {
  height: 1px;
  margin: 18px 0 14px;
  background: var(--gate-panel-border-soft);
}

.gate-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.gate-input {
  flex: 1 1 240px;
  width: 100%;
  min-height: 41px;
  padding: 9px 12px;
  border-radius: 6px;
  border: 1px solid var(--gate-panel-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--gate-text);
  font: inherit;
  font-size: 13px;
}

.gate-input::placeholder {
  color: var(--gate-muted-soft);
}

.gate-button,
.gate-link-button {
  min-height: 41px;
  border-radius: 6px;
  font: inherit;
  font-size: 12px;
  letter-spacing: 1px;
  cursor: pointer;
}

.gate-button {
  padding: 0 14px;
  background: var(--gate-button-bg);
  border: 1px solid rgba(110, 124, 166, 0.34);
  color: var(--gate-button-text);
}

.gate-link-button {
  width: 100%;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--gate-panel-border-soft);
  color: var(--gate-muted);
}

.gate-link-button:hover,
.gate-button:hover {
  filter: brightness(1.08);
}

.gate-token-panel {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.gate-token-panel .gate-section-label,
.gate-token-panel .gate-feedback {
  text-align: center;
}

.gate-token-form {
  display: grid;
  gap: 14px;
}

.gate-token-row {
  display: grid;
  gap: 18px;
  justify-items: center;
}

.gate-token-row .gate-input {
  text-align: center;
}

.gate-token-row .gate-input::placeholder {
  text-align: center;
}

.gate-token-row .gate-button {
  min-width: 128px;
  margin-top: 2px;
  justify-self: center;
}

.gate-note {
  margin: 0;
  color: var(--gate-muted-soft);
  font-size: 10px;
  line-height: 1.6;
}

.gate-feedback {
  min-height: 18px;
  font-size: 11px;
  color: var(--gate-muted);
}

.gate-feedback[data-state='error'] {
  color: var(--gate-error);
}

.gate-feedback[data-state='success'] {
  color: var(--gate-success);
}

.gate-token-panel[hidden] {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .hue-border {
    animation: none;
    border-color: rgba(130, 130, 255, 0.3);
    box-shadow: none;
  }
}

@media (max-width: 480px) {
  .gate-shell {
    padding: 26px 18px 22px;
  }

  .gate-row {
    flex-direction: column;
  }

  .gate-button,
  .gate-input {
    width: 100%;
  }
}
