:root {
  --bg: #0a0612;
  --ink: #f2edf8;
  --ink-muted: #a89bb8;
  --ink-faint: #6e5f82;
  --accent: #8b5cf6;
  --accent-hover: #a78bfa;
  --accent-deep: #6d28d9;
  --accent-soft: rgba(139, 92, 246, 0.18);
  --line: rgba(196, 181, 253, 0.14);
  --surface: rgba(28, 18, 48, 0.65);
  --surface-strong: rgba(36, 22, 58, 0.9);
  --radius: 10px;
  --font-display: "Space Grotesk", "DM Sans", system-ui, sans-serif;
  --font-body: "DM Sans", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --shell-max: 1120px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* —— Background —— */
.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.bg__gradient {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 65% 50% at 10% 0%, rgba(109, 40, 217, 0.28), transparent 55%),
    radial-gradient(ellipse 50% 40% at 90% 85%, rgba(139, 92, 246, 0.16), transparent 50%),
    radial-gradient(ellipse 40% 30% at 55% 45%, rgba(76, 29, 149, 0.12), transparent 60%),
    linear-gradient(160deg, #0a0612 0%, #12081f 45%, #0d0716 100%);
}

.bg__grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 75% 70% at 50% 40%, #000 20%, transparent 75%);
  opacity: 0.45;
}

/* —— Shell —— */
.shell {
  position: relative;
  z-index: 1;
  max-width: var(--shell-max);
  margin: 0 auto;
  min-height: 100vh;
  padding: 72px 48px 64px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 36px;
}

/* —— Brand —— */
.brand {
  text-align: left;
}

.brand__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.75rem, 5vw, 3.75rem);
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--ink);
  background: linear-gradient(120deg, #f5f0ff 0%, #c4b5fd 55%, #8b5cf6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand__tagline {
  margin-top: 12px;
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--ink-muted);
  letter-spacing: 0.01em;
}

/* —— Announcement banner —— */
.announce {
  display: flex;
  align-items: center;
  gap: 0;
  min-height: 48px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, rgba(109, 40, 217, 0.35), rgba(28, 18, 48, 0.85) 28%, rgba(28, 18, 48, 0.85));
  border: 1px solid var(--line);
  overflow: hidden;
  position: relative;
}

.announce__badge {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  align-self: stretch;
  display: flex;
  align-items: center;
  padding: 0 16px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-deep), var(--accent));
  box-shadow: 8px 0 20px rgba(10, 6, 18, 0.45);
}

.announce__track {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 2%, #000 94%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 2%, #000 94%, transparent);
}

.announce__scroll {
  display: flex;
  width: max-content;
  will-change: transform;
  animation: announceMarquee 18s linear infinite;
}

.announce__group {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  white-space: nowrap;
}

.announce__group span {
  font-size: 0.9rem;
  color: var(--ink-muted);
  letter-spacing: 0.02em;
  padding: 0 4px;
}

.announce__sep {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin: 0 28px;
  padding: 0 !important;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.85;
  box-shadow: 0 0 8px rgba(167, 139, 250, 0.55);
}

@keyframes announceMarquee {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(-50%, 0, 0);
  }
}

/* —— Panel —— */
.panel {
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  gap: 0 48px;
  align-items: stretch;
  min-height: 280px;
}

.panel__divider {
  width: 1px;
  background: linear-gradient(
    to bottom,
    transparent,
    var(--line) 12%,
    rgba(167, 139, 250, 0.35) 50%,
    var(--line) 88%,
    transparent
  );
  justify-self: center;
}

.panel__left,
.panel__right {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.panel__left {
  gap: 16px;
  padding-right: 8px;
}

.panel__right {
  padding-left: 8px;
  min-height: 220px;
}

/* —— Field —— */
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field__label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.field__input {
  width: 100%;
  height: 56px;
  padding: 0 18px;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out), background 0.2s;
}

.field__input::placeholder {
  color: var(--ink-faint);
  font-weight: 400;
  letter-spacing: 0.02em;
}

.field__input:hover {
  border-color: rgba(196, 181, 253, 0.28);
}

.field__input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--surface-strong);
}

.field__input.is-invalid {
  border-color: #f07178;
  box-shadow: 0 0 0 3px rgba(240, 113, 120, 0.15);
}

.field__error {
  font-size: 0.85rem;
  color: #f07178;
  margin-top: -4px;
}

/* —— Buttons —— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 52px;
  padding: 0 28px;
  margin-top: 8px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-deep) 0%, var(--accent) 100%);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: filter 0.2s, transform 0.15s var(--ease-out), opacity 0.2s;
  width: 100%;
  max-width: 280px;
}

.btn:hover:not(:disabled) {
  filter: brightness(1.12);
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn--ghost {
  margin-top: 20px;
  max-width: 160px;
  height: 42px;
  font-size: 0.875rem;
  color: var(--ink);
  background: transparent;
  filter: none;
  border: 1.5px solid var(--line);
}

.btn--ghost:hover:not(:disabled) {
  filter: none;
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-hover);
}

.btn--ghost.is-copied {
  border-color: var(--accent);
  color: var(--accent-hover);
  background: var(--accent-soft);
}

/* —— Result states —— */
.result {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-height: 200px;
}

.result[hidden] {
  display: none;
}

.result__icon {
  color: var(--ink-faint);
  margin-bottom: 16px;
  opacity: 0.75;
}

.result__hint {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.result__sub {
  margin-top: 8px;
  font-size: 0.9rem;
  color: var(--ink-muted);
}

.result__label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 12px;
}

.cred {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cred__row {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 12px;
  align-items: baseline;
}

.cred__key {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
}

.cred__val {
  font-family: var(--font-mono);
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent-hover);
  word-break: break-all;
  opacity: 0;
  transform: translateY(8px);
  animation: charIn 0.4s var(--ease-out) forwards;
}

.cred__row:nth-child(2) .cred__val {
  animation-delay: 0.08s;
}

.result__expire,
.result__hint {
  margin-top: 14px;
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.result__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.result__actions .btn--ghost {
  margin-top: 12px;
}

.mail-links {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.mail-links__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mail-links__label {
  font-size: 0.84rem;
  color: var(--ink-muted);
}

.mail-links__btn {
  text-decoration: none;
  min-width: 72px;
  text-align: center;
}

@keyframes charIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* —— Scanner loading —— */
.scanner {
  position: relative;
  width: 100%;
  max-width: 280px;
  height: 72px;
  margin-bottom: 20px;
}

.scanner__frame {
  position: absolute;
  inset: 0;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.scanner__frame::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 11px,
    rgba(196, 181, 253, 0.06) 11px,
    rgba(196, 181, 253, 0.06) 12px
  );
}

.scanner__line {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  width: 2px;
  background: var(--accent-hover);
  border-radius: 1px;
  box-shadow: 0 0 14px rgba(167, 139, 250, 0.55);
  animation: scan 1.6s var(--ease-out) infinite;
}

@keyframes scan {
  0% {
    left: 8%;
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    left: 90%;
    opacity: 0;
  }
}

/* —— Entrance reveals —— */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  animation: revealUp 0.55s var(--ease-out) forwards;
}

.reveal--brand {
  animation-delay: 0.05s;
}

.reveal--announce {
  animation-name: revealFade;
  animation-delay: 0.12s;
}

@keyframes revealFade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.reveal--left {
  animation-delay: 0.22s;
}

.reveal--right {
  animation-delay: 0.34s;
}

@keyframes revealUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* —— Narrow screens (basic) —— */
@media (max-width: 860px) {
  .shell {
    padding: 48px 24px 40px;
    gap: 28px;
  }

  .panel {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .panel__divider {
    width: 100%;
    height: 1px;
    background: linear-gradient(
      to right,
      transparent,
      var(--line) 12%,
      rgba(167, 139, 250, 0.35) 50%,
      var(--line) 88%,
      transparent
    );
  }

  .panel__left,
  .panel__right {
    padding: 0;
  }

  .btn {
    max-width: none;
  }

  .announce__scroll {
    animation-duration: 14s;
  }
}
