@font-face {
  font-family: "Inter";
  src: url("fonts/inter-latin-variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Space Grotesk";
  src: url("fonts/space-grotesk-latin-variable.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #070b09;
  --bg-secondary: #0b110e;
  --surface: #101814;
  --accent: #00d68f;
  --accent-soft: rgba(0, 214, 143, 0.12);
  --accent-line: rgba(0, 214, 143, 0.42);
  --text: #f4f7f5;
  --text-secondary: #a0ada5;
  --text-muted: #68766d;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --danger: #ff6b5e;
  --danger-soft: rgba(255, 107, 94, 0.09);
  --font-body: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Space Grotesk", "Inter", ui-sans-serif, system-ui, sans-serif;
  --radius-panel: 18px;
  --radius-control: 10px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  min-width: 280px;
  color-scheme: dark;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  display: grid;
  place-items: center;
  padding: clamp(1rem, 4vw, 2rem);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  background:
    radial-gradient(ellipse 62% 46% at 50% -14%, rgba(0, 214, 143, 0.1), transparent 68%),
    radial-gradient(ellipse 44% 38% at 104% 108%, rgba(139, 124, 255, 0.06), transparent 70%),
    repeating-linear-gradient(0deg, transparent 0 47px, rgba(244, 247, 245, 0.022) 47px 48px),
    repeating-linear-gradient(90deg, transparent 0 47px, rgba(244, 247, 245, 0.022) 47px 48px),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 92% 72% at 50% 42%, transparent 52%, rgba(0, 0, 0, 0.5));
}

::selection {
  background: rgba(0, 214, 143, 0.28);
  color: var(--text);
}

h1,
p {
  margin: 0;
}

a {
  color: inherit;
}

svg {
  display: block;
}

:where(a, button, input):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

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

/* ---- Panel ------------------------------------------------------------ */

.gate {
  position: relative;
  z-index: 1;
  width: min(100%, 25.5rem);
  padding: clamp(1.4rem, 5vw, 2.15rem);
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 32%),
    var(--surface);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 2px 12px rgba(0, 0, 0, 0.35),
    0 26px 80px rgba(0, 0, 0, 0.55);
  animation: rise 0.5s var(--ease-out) both;
}

.gate::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 18%;
  right: 18%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 214, 143, 0.55), transparent);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

/* ---- Brand ------------------------------------------------------------ */

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.brand-mark {
  width: 30px;
  height: 30px;
  flex: none;
}

.brand-copy {
  display: grid;
  gap: 0.05rem;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  line-height: 1.2;
}

.brand-label {
  color: var(--text-muted);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1.3;
}

/* ---- Heading ---------------------------------------------------------- */

.gate-head {
  margin-top: 1.5rem;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-secondary);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  animation: pulse 2.6s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    box-shadow: 0 0 0 6px rgba(0, 214, 143, 0.05);
    opacity: 0.6;
  }
}

h1 {
  margin-top: 0.55rem;
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 5.5vw, 1.75rem);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.12;
}

.intro {
  margin-top: 0.4rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.55;
}

/* ---- Error / expired state -------------------------------------------- */

.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin-top: 1.1rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid rgba(255, 107, 94, 0.32);
  border-left: 3px solid var(--danger);
  border-radius: 10px;
  background: var(--danger-soft);
}

.alert-icon {
  width: 18px;
  height: 18px;
  flex: none;
  margin-top: 0.1rem;
  color: var(--danger);
}

.alert-title {
  color: #ffd9d4;
  font-size: 0.83rem;
  font-weight: 500;
  line-height: 1.45;
}

.alert-hint {
  margin-top: 0.15rem;
  color: rgba(255, 217, 212, 0.62);
  font-size: 0.75rem;
  line-height: 1.45;
}

/* ---- Challenge --------------------------------------------------------- */

form {
  margin-top: 1.25rem;
}

.challenge {
  position: relative;
  padding: 1.15rem 1rem 1.05rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background:
    radial-gradient(ellipse 82% 92% at 50% -18%, rgba(0, 214, 143, 0.08), transparent 72%),
    var(--bg-secondary);
  text-align: center;
}

.challenge-kicker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  color: var(--accent);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.kicker-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}

.equation {
  margin-top: 0.45rem;
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 8vw, 2.25rem);
  font-weight: 600;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.unknown {
  color: var(--accent);
  animation: breathe 3.2s ease-in-out infinite;
}

@keyframes breathe {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

/* ---- Field ------------------------------------------------------------- */

.field {
  display: grid;
  gap: 0.4rem;
  margin-top: 1.1rem;
}

.field label {
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

#answer {
  width: 100%;
  padding: 0.78rem 0.9rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  color: var(--text);
  background: rgba(7, 11, 9, 0.6);
  font: inherit;
  font-size: 1rem;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

#answer::placeholder {
  color: var(--text-muted);
}

#answer:hover {
  border-color: rgba(255, 255, 255, 0.24);
}

#answer:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(7, 11, 9, 0.85);
  box-shadow: 0 0 0 3px rgba(0, 214, 143, 0.16);
}

#answer:user-invalid {
  border-color: rgba(255, 107, 94, 0.55);
}

.hint {
  color: var(--text-muted);
  font-size: 0.74rem;
  line-height: 1.45;
}

.trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---- Submit ------------------------------------------------------------ */

button[type="submit"] {
  position: relative;
  width: 100%;
  margin-top: 1.05rem;
  padding: 0.82rem 1rem;
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-control);
  color: var(--accent);
  background: var(--accent-soft);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.12s ease, opacity 0.18s ease;
}

form:invalid button[type="submit"] {
  opacity: 0.55;
}

.btn-progress {
  display: none;
}

button[type="submit"]:active {
  transform: translateY(1px);
}

button[type="submit"]:active .btn-label {
  display: none;
}

button[type="submit"]:active .btn-progress {
  display: inline;
}

@media (hover: hover) {
  button[type="submit"]:hover {
    border-color: var(--accent);
    color: #04120c;
    background: var(--accent);
  }
}

/* ---- Fine print + footer ------------------------------------------------ */

.fine-block {
  margin-top: 1.3rem;
  padding-top: 0.95rem;
  border-top: 1px solid var(--border);
}

.fine {
  color: var(--text-muted);
  font-size: 0.72rem;
  line-height: 1.55;
}

.fine + .fine {
  margin-top: 0.45rem;
}

.gate-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1rem;
  color: var(--text-muted);
  font-size: 0.68rem;
}

.gate-footer nav {
  display: flex;
  gap: 0.9rem;
}

.gate-footer a {
  text-decoration: none;
  text-underline-offset: 3px;
}

.gate-footer a:hover {
  color: var(--text-secondary);
  text-decoration: underline;
}

/* ---- Responsive --------------------------------------------------------- */

@media (max-width: 380px) {
  .gate {
    padding: 1.15rem;
    border-radius: 14px;
  }

  .gate-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
