:root {
  --bg: #070a09;
  --ink: #dde8e2;
  --accent: #2ef2a0;
  --accent-2: #f5c542;
  --terminal: #0e1512;
  --muted: #6e8078;
  --danger: #ff6b6b;
  --edge: rgba(221, 232, 226, 0.1);
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --font-display: var(--font-mono);
}

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

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.45;
}

a {
  color: var(--muted);
  text-decoration: none;
}

a:hover {
  color: var(--accent);
}

.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;
}

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: var(--bg);
  padding: 0.5rem 0.75rem;
  z-index: 50;
}

.skip:focus {
  left: 0.75rem;
  top: 0.75rem;
}

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    ellipse 60% 40% at 50% 0%,
    rgba(46, 242, 160, 0.06),
    transparent 60%
  );
  z-index: 0;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background-image: radial-gradient(
    circle at 30% 40%,
    rgba(221, 232, 226, 0.1) 0 1px,
    transparent 1px
  );
  background-size: 24px 24px;
  z-index: 0;
}

.shell {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2rem;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--ink);
}

.brand:hover {
  color: var(--ink);
}

.mark {
  display: block;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.03em;
}

.topnav a {
  font-size: 0.82rem;
  color: var(--muted);
}

.topnav a:hover {
  color: var(--accent);
}

.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  justify-content: center;
}

.slogan {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.1rem, 6vw, 3.15rem);
  line-height: 1.02;
  letter-spacing: -0.045em;
  text-align: center;
}

.slogan .word {
  display: inline-block;
  margin-right: 0.22em;
}

.slogan .accent {
  color: var(--accent);
}

.workspace {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.panel {
  background: var(--terminal);
  border: 1px solid var(--edge);
  overflow: hidden;
}

.chrome {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--edge);
  background: rgba(0, 0, 0, 0.28);
}

.dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #3a4742;
}

.dot:nth-child(1) {
  background: #ff5f57;
}
.dot:nth-child(2) {
  background: #febc2e;
}
.dot:nth-child(3) {
  background: #28c840;
}

.chrome-title {
  margin-left: 0.5rem;
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
}

.screen {
  position: relative;
  margin: 0;
  padding: 1.1rem 1.1rem 1.25rem;
  min-height: 16rem;
  font-size: 0.78rem;
  line-height: 1.5;
}

.noise {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  color: var(--muted);
  font-family: var(--font-mono);
}

.noise .hl {
  opacity: 0.55;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.noise .hl.is-fading {
  opacity: 0.15;
  text-decoration: line-through;
  text-decoration-color: rgba(245, 197, 66, 0.45);
}

.merge-line {
  height: 1px;
  margin: 0.85rem 0;
  background: var(--edge);
  position: relative;
  overflow: hidden;
}

.merge-line span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
}

.event-out {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font-mono);
  color: var(--ink);
  min-height: 5.5rem;
}

.event-out .k {
  color: var(--accent-2);
}

.event-out .s {
  color: var(--accent);
}

.event-out .n {
  color: var(--accent);
}

.cursor {
  display: inline-block;
  width: 0.55ch;
  height: 1em;
  background: var(--accent-2);
  vertical-align: text-bottom;
  animation: blink 1s steps(1) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.keyform {
  border: 1px solid var(--edge);
  background: var(--terminal);
  padding: 0.75rem;
}

#magic-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
}

.field {
  display: block;
  min-width: 0;
}

.field input {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--edge);
  padding: 0.75rem 0.8rem;
  outline: none;
}

.field input:focus {
  border-color: var(--accent);
}

.field input::placeholder {
  color: #54665e;
}

.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 0;
  cursor: pointer;
  background: var(--accent);
  color: var(--bg);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: -0.02em;
  padding: 0 1.1rem;
  white-space: nowrap;
}

.cta:hover:not(:disabled) {
  filter: brightness(1.06);
}

.cta:disabled {
  opacity: 0.65;
  cursor: wait;
}

.cta-loader {
  display: none;
  width: 0.8rem;
  height: 0.8rem;
  border: 2px solid rgba(7, 10, 9, 0.25);
  border-top-color: var(--bg);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.cta.is-loading .cta-loader {
  display: inline-block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.form-status {
  min-height: 1.2rem;
  margin: 0.55rem 0 0;
  font-size: 0.78rem;
  color: var(--accent);
}

.form-status.is-error {
  color: var(--danger);
}

.foot {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.72rem;
  padding-top: 0.5rem;
}

.foot p {
  margin: 0;
}

@media (max-width: 520px) {
  #magic-form {
    grid-template-columns: 1fr;
  }

  .cta {
    padding: 0.75rem 1rem;
  }

  .screen {
    min-height: 14rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cursor,
  .cta-loader {
    animation: none;
  }
}
