:root {
  color-scheme: dark;
  --black: #000;
  --ink: #030711;
  --cyan: #5eecff;
  --cyan-pale: #ddfdff;
  --purple: #a936f6;
  --purple-dark: #5b2099;
  --red: #ff1424;
  --yellow: #ffc125;
  --input-frame-image: url("/assets/awaken-scifi-input-box.png");
  --input-fill: rgba(36, 0, 18, 0.68);
  --input-border-radius: 0;
  --input-glow: 0 0 24px rgba(94, 236, 255, 0.1);
  font-family: "Noto Sans SC", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background: var(--black);
}

body {
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.gate-page {
  min-height: 100svh;
  overflow: hidden;
}

.gate {
  position: relative;
  isolation: isolate;
  display: grid;
  width: 100%;
  min-height: 100svh;
  place-items: center;
  overflow: hidden;
  background: #000;
}

.gate__backdrop {
  position: absolute;
  z-index: -3;
  inset: 0;
  background:
    radial-gradient(circle at 50% 50%, rgba(35, 4, 57, 0.22) 0 12%, transparent 38%),
    radial-gradient(circle at 50% 56%, rgba(0, 178, 216, 0.08), transparent 47%),
    #000;
}

.gate__ring {
  position: absolute;
  z-index: -2;
  top: 50%;
  left: 50%;
  width: min(150vw, 128svh);
  min-width: 880px;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  pointer-events: none;
  user-select: none;
  -webkit-mask-image: radial-gradient(circle, transparent 0 7%, rgba(0, 0, 0, 0.12) 15%, rgba(0, 0, 0, 0.68) 34%, #000 58%);
  mask-image: radial-gradient(circle, transparent 0 7%, rgba(0, 0, 0, 0.12) 15%, rgba(0, 0, 0, 0.68) 34%, #000 58%);
}

.gate__ring > img,
.gate__ring-rotor,
.gate__ring-rotor img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.gate__ring-geometry {
  opacity: 0.88;
}

.gate__ring-rotor {
  transform-origin: center;
  animation: ring-rotation 48s linear infinite;
  will-change: transform;
}

.gate__ring-rotor img {
  pointer-events: none;
}

.gate__content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(100%, 820px);
  padding: clamp(24px, 5vh, 72px) 20px 20px;
  text-align: center;
}

.gate__identity {
  position: relative;
  display: grid;
  min-width: min(92vw, 330px);
  min-height: 190px;
  align-content: center;
  padding: 30px 32px 34px;
}

.gate__identity::before,
.gate__identity::after {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.gate__identity::before {
  border: 1px solid rgba(221, 253, 255, 0.62);
  box-shadow: inset 0 0 18px rgba(94, 236, 255, 0.07);
}

.gate__identity::after {
  inset: 18px 39px 24px;
  border-top: 3px solid rgba(169, 54, 246, 0.92);
  border-bottom: 3px solid rgba(94, 236, 255, 0.8);
  transform: rotate(-2deg);
}

.gate__identity h1,
.gate__identity p {
  position: relative;
  z-index: 1;
  margin: 0;
  font-weight: 300;
  letter-spacing: 0.08em;
  text-shadow: 0 0 10px rgba(221, 253, 255, 0.18);
}

.gate__identity h1 {
  color: #fff;
  font-size: clamp(36px, 4.25vw, 60px);
  line-height: 1.22;
}

.gate__identity p {
  margin-top: 5px;
  color: var(--purple);
  font-size: clamp(22px, 2.3vw, 34px);
  line-height: 1.25;
  text-shadow: 0 0 13px rgba(169, 54, 246, 0.3);
}

.gate-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  margin-top: clamp(16px, 5.5vh, 66px);
}

.gate-form__frame {
  position: relative;
  width: clamp(420px, 38vw, 650px);
  aspect-ratio: 4 / 1;
  filter: drop-shadow(var(--input-glow));
  transform: translateZ(0);
}

.gate-form__frame > img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  user-select: none;
}

.gate-form__frame input {
  position: absolute;
  z-index: 2;
  top: 29%;
  right: 14%;
  bottom: 29%;
  left: 14%;
  width: 72%;
  min-width: 0;
  padding: 0 20px;
  border: 0;
  border-radius: var(--input-border-radius);
  outline: 0;
  background: transparent;
  color: var(--cyan-pale);
  caret-color: var(--yellow);
  font-family: Consolas, "SFMono-Regular", "Microsoft YaHei", monospace;
  font-size: clamp(17px, 1.35vw, 23px);
  font-weight: 400;
  letter-spacing: 0.12em;
  text-align: center;
  text-shadow: 0 0 8px rgba(94, 236, 255, 0.48);
}

.gate-form__frame input::placeholder {
  color: rgba(221, 253, 255, 0.35);
  letter-spacing: 0.18em;
}

.gate-form__frame input:focus {
  background: linear-gradient(90deg, transparent, rgba(94, 236, 255, 0.035), transparent);
}

.gate-form__frame:focus-within {
  filter:
    drop-shadow(0 0 8px rgba(94, 236, 255, 0.35))
    drop-shadow(0 0 20px rgba(169, 54, 246, 0.18));
}

.gate-form__scan {
  position: absolute;
  z-index: 1;
  top: 31%;
  bottom: 31%;
  left: 15%;
  width: 10%;
  opacity: 0;
  background: linear-gradient(90deg, transparent, rgba(221, 253, 255, 0.13), transparent);
  pointer-events: none;
}

.gate-form[data-state="loading"] .gate-form__scan {
  opacity: 1;
  animation: input-scan 1.15s linear infinite;
}

.gate-form[data-state="loading"] .gate-form__frame {
  filter: drop-shadow(0 0 16px rgba(94, 236, 255, 0.4));
}

.gate-form[data-state="success"] .gate-form__frame {
  filter: drop-shadow(0 0 22px rgba(94, 236, 255, 0.58));
}

.gate-form__frame.is-rejected {
  animation: input-rejected 340ms ease-out;
}

.gate-form__status {
  min-height: 1.5em;
  margin: 8px 0 0;
  color: rgba(221, 253, 255, 0.64);
  font-family: Consolas, "SFMono-Regular", "Microsoft YaHei", monospace;
  font-size: 13px;
  letter-spacing: 0.12em;
}

.gate-form[data-state="error"] .gate-form__status {
  color: #ff5b71;
  text-shadow: 0 0 8px rgba(255, 20, 36, 0.45);
}

.gate-form[data-state="success"] .gate-form__status {
  color: var(--cyan);
}

@keyframes input-scan {
  from { transform: translateX(0); }
  to { transform: translateX(600%); }
}

@keyframes input-rejected {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(3px); }
}

@keyframes ring-rotation {
  to { transform: rotate(360deg); }
}

.result-page,
.system-page {
  min-height: 100svh;
  background: #000;
  color: var(--cyan-pale);
}

.result,
.system-message {
  position: relative;
  display: grid;
  min-height: 100svh;
  place-items: center;
  padding: 32px 20px;
  overflow: hidden;
  text-align: center;
}

.result::before {
  position: absolute;
  width: min(70vw, 760px);
  aspect-ratio: 1;
  border: 1px solid rgba(94, 236, 255, 0.12);
  border-radius: 50%;
  box-shadow: 0 0 70px rgba(94, 236, 255, 0.06);
  content: "";
}

.result__reticle {
  position: absolute;
  width: min(82vw, 900px);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--purple), transparent);
  opacity: 0.35;
}

.result__panel {
  position: relative;
  width: min(100%, 720px);
  padding: clamp(38px, 7vw, 80px);
  border-block: 1px solid rgba(94, 236, 255, 0.28);
  background: linear-gradient(90deg, transparent, rgba(6, 27, 37, 0.38), transparent);
}

.result__eyebrow,
.system-message__code {
  margin: 0 0 18px;
  color: var(--purple);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
  letter-spacing: 0.25em;
}

.result h1,
.system-message h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(38px, 7vw, 72px);
  font-weight: 300;
  letter-spacing: 0.12em;
}

.result__copy,
.system-message > p:last-child {
  margin-top: 24px;
  color: rgba(221, 253, 255, 0.72);
  font-size: clamp(17px, 2vw, 22px);
  letter-spacing: 0.14em;
  line-height: 1.9;
}

.system-message {
  background:
    linear-gradient(rgba(94, 236, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(94, 236, 255, 0.03) 1px, transparent 1px),
    #000;
  background-size: 64px 64px;
}

@media (max-width: 680px) {
  .gate__ring {
    width: 128svh;
    min-width: 800px;
  }

  .gate__content {
    justify-content: center;
    min-height: 100svh;
    padding: 20px 14px max(20px, env(safe-area-inset-bottom));
  }

  .gate__identity {
    min-width: min(86vw, 300px);
    min-height: 170px;
    padding-inline: 20px;
  }

  .gate__identity h1 {
    font-size: clamp(32px, 11vw, 46px);
  }

  .gate__identity p {
    font-size: clamp(20px, 7vw, 28px);
  }

  .gate-form {
    margin-top: clamp(16px, 4vh, 36px);
  }

  .gate-form__frame {
    width: min(104vw, 500px);
    transform: scale(0.94);
  }

  .gate-form__frame input {
    padding-inline: 8px;
    font-size: 16px;
  }

  .gate-form__status {
    margin-top: 2px;
  }
}

@media (max-height: 680px) and (orientation: landscape) {
  .gate__content {
    transform: scale(0.84);
  }

  .gate-form {
    margin-top: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  .gate__ring-rotor {
    transform: none;
  }
}
