:root {
  --bg: #121214;
  --bg-up: #1b1b1f;
  --line: #34343b;
  --text: #f4f4f5;
  --muted: #9c9ca6;
  --dim: #6b6b75;
  --orange: #ff7300;
  --orange-hi: #ff8f2e;
  --gold: #ffd600;
  --error: #ff8a65;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; overflow-x: hidden; overflow-x: clip; }

body {
  font-family: Montserrat, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* Fine film grain over the whole page: depth without a pattern */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.top, .stage, .foot { z-index: 1; }

::selection { background: var(--orange); color: #111; }

/* ---------- header ---------- */

.top {
  position: relative;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 22px clamp(16px, 4vw, 48px);
}

.brand {
  height: 38px;
  width: auto;
  filter: brightness(0) invert(1);
}

.steps {
  display: flex;
  gap: 28px;
  list-style: none;
  margin: 0 auto;
  padding: 0;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
}
.steps li { display: flex; align-items: center; gap: 8px; transition: color 0.3s; }
.steps span {
  font-variant-numeric: tabular-nums;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.72rem;
}
.steps li.done { color: var(--muted); }
.steps li.done span { border-color: var(--muted); }
.steps li.active { color: var(--text); }
.steps li.active span { background: var(--orange); border-color: var(--orange); color: #111; }

/* ---------- layout ---------- */

.stage {
  position: relative;
  flex: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(20px, 5vh, 64px) clamp(16px, 4vw, 48px) 48px;
}

.view { animation: rise 0.5s var(--ease) both; }

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(32px, 6vw, 96px);
  min-height: 62vh;
}

.copy { max-width: 460px; }

.eyebrow {
  margin: 0 0 18px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--orange);
}

h1 {
  margin: 0 0 16px;
  font-size: clamp(2.5rem, 5.4vw, 4.2rem);
  line-height: 1.02;
  font-weight: 800;
  letter-spacing: -0.03em;
}
h1:focus { outline: none; }

.lead { margin: 0 0 40px; color: var(--muted); font-size: 1.05rem; line-height: 1.6; }

/* ---------- form ---------- */

.field { margin-bottom: 30px; }

label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 10px 0 12px;
  font: inherit;
  font-size: 1.45rem;
  font-weight: 600;
  color: var(--text);
  background: transparent;
  border: 0;
  border-bottom: 2px solid var(--line);
  border-radius: 0;
  caret-color: var(--orange);
  transition: border-color 0.2s;
}
input::placeholder { color: #45454d; }
input:focus { outline: none; border-bottom-color: var(--orange); }
.field:focus-within label { color: var(--orange); }

.with-action { display: flex; align-items: flex-end; gap: 12px; }
.with-action input { flex: 1; }

button, .ghost-btn {
  font: inherit;
  cursor: pointer;
}
button:focus-visible, .ghost-btn:focus-visible, .inline-link:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.go {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 17px 30px;
  border: 0;
  border-radius: 999px;
  background: var(--orange);
  color: #111;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.01em;
  box-shadow: 0 10px 34px rgba(255, 115, 0, 0.28);
  transition: background 0.2s, box-shadow 0.2s, transform 0.08s;
}
.go:hover { background: var(--orange-hi); box-shadow: 0 12px 40px rgba(255, 115, 0, 0.4); }
.go:active { transform: translateY(1px); }
.go:disabled { opacity: 0.6; cursor: progress; }
.go .arrow { transition: transform 0.25s var(--ease); }
.go:hover .arrow { transform: translateX(4px); }

.text-btn {
  padding: 8px 2px;
  border: 0;
  background: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.9rem;
  border-bottom: 1px solid transparent;
}
.text-btn:hover { color: var(--text); border-bottom-color: var(--muted); }

.ghost-btn {
  display: inline-flex;
  align-items: center;
  padding: 15px 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: 0;
  text-transform: none;
  margin: 0;
  transition: border-color 0.2s, background 0.2s;
}
.ghost-btn:hover { border-color: var(--orange); background: rgba(255, 115, 0, 0.08); }

.error {
  margin: -10px 0 26px;
  padding-left: 14px;
  border-left: 2px solid var(--error);
  color: var(--error);
  font-size: 0.95rem;
  line-height: 1.5;
}
.error.center { margin: 18px auto 0; max-width: 520px; }

/* ---------- the bulb ---------- */

.bulb-wrap { display: grid; place-items: center; }

.bulb {
  position: relative;
  width: clamp(150px, 20vw, 230px);
}
/* Light rays, centred on the glass of the bulb; fan out when it switches on */
.bulb::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 40%;
  width: 360%;
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(255, 190, 70, 0.13) 0deg 3deg, transparent 3deg 15deg);
  -webkit-mask-image: radial-gradient(circle, #000 8%, rgba(0, 0, 0, 0.5) 28%, transparent 62%);
  mask-image: radial-gradient(circle, #000 8%, rgba(0, 0, 0, 0.5) 28%, transparent 62%);
  opacity: 0;
  scale: 0.5;
  transition: opacity 0.8s var(--ease), scale 1.1s var(--ease);
  animation: spin 90s linear infinite;
  pointer-events: none;
}
.bulb.on::after { opacity: 1; scale: 1; }
.bulb::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 40%;
  width: 260%;
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 214, 0, 0.5), rgba(255, 115, 0, 0.16) 35%, transparent 65%);
  opacity: 0.18;
  transform: scale(0.6);
  transition: opacity 0.6s var(--ease), transform 0.8s var(--ease);
}
.bulb img {
  position: relative;
  display: block;
  width: 100%;
  height: auto;
  filter: grayscale(1) brightness(0.55);
  opacity: 0.55;
  transition: filter 0.5s var(--ease), opacity 0.5s var(--ease);
}
.bulb.on::before { opacity: 1; transform: scale(1); }
.bulb.on img {
  filter: drop-shadow(0 0 28px rgba(255, 115, 0, 0.9)) brightness(1.08);
  opacity: 1;
}
.bulb.flicker img { animation: flicker 0.6s steps(2) 1; }

/* ---------- live preview ---------- */

.preview {
  position: relative;
  margin: 0;
  display: grid;
  justify-items: center;
  gap: 14px;
}
.preview::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 45%;
  width: 150%;
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 115, 0, 0.22), transparent 62%);
  pointer-events: none;
}
.ghost-wrap {
  position: relative;
  width: min(320px, 100%);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.06);
  transform: rotate(-3deg);
  transition: transform 0.6s var(--ease);
}
.ghost-wrap canvas { display: block; width: 100%; height: auto; }
.preview:hover .ghost-wrap { transform: rotate(0); }

/* Searching: a band of light sweeps down the card while it glows */
.ghost-wrap .scan {
  position: absolute;
  left: 0;
  right: 0;
  top: -45%;
  height: 45%;
  background:
    linear-gradient(180deg, transparent 49%, rgba(255, 255, 255, 0.9) 50%, transparent 51%),
    linear-gradient(180deg, transparent, rgba(255, 140, 0, 0.12) 30%, rgba(255, 170, 40, 0.42) 50%, rgba(255, 140, 0, 0.12) 70%, transparent);
  opacity: 0;
  pointer-events: none;
}
.preview.scanning .ghost-wrap { transform: rotate(0); animation: glow-pulse 1.6s ease-in-out infinite; }
.preview.scanning .ghost-wrap .scan { opacity: 1; animation: sweep 1.6s cubic-bezier(0.45, 0, 0.55, 1) infinite; }
.preview.found .ghost-wrap { transform: rotate(0); animation: flash 0.5s ease-out; }

/* Status line under the button while searching */
.status {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 0;
  min-height: 1.6em;
  color: var(--muted);
  font-size: 0.98rem;
}
.status .pulse {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--orange);
  animation: ping 1.2s ease-out infinite;
}
.status .msg { transition: opacity 0.25s; }
.status .msg.fading { opacity: 0; }

.go.loading,
.go.loading:disabled { cursor: progress; opacity: 1; color: #111; }
.go.loading .arrow { display: none; }
.go.loading::after {
  content: "...";
  display: inline-block;
  width: 0;
  overflow: hidden;
  vertical-align: bottom;
  animation: dots 1.2s steps(4) infinite;
}
.preview figcaption,
.cards figcaption {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
}

/* ---------- card result ---------- */

.card-head { max-width: 640px; margin-bottom: 26px; }
.card-head .lead { margin-bottom: 0; }

.notice {
  max-width: 640px;
  margin: 0 0 28px;
  padding: 14px 18px;
  border-radius: 14px;
  background: rgba(255, 214, 0, 0.08);
  color: #f1e3a6;
  line-height: 1.55;
}
.inline-link {
  display: inline;
  margin: 0;
  font-size: inherit;
  letter-spacing: 0;
  text-transform: none;
  color: var(--gold);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.cards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(24px, 4vw, 56px);
  margin: 10px 0 40px;
}
.cards figure { margin: 0; display: grid; justify-items: center; gap: 14px; }
.cards canvas {
  width: min(340px, 82vw);
  height: auto;
  border-radius: 22px;
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.06);
  animation: reveal 0.7s var(--ease) both;
}
.cards figure:nth-child(2) canvas { animation-delay: 0.12s; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.toolbar .text-btn { margin-left: 10px; }

.hint { text-align: center; color: var(--dim); font-size: 0.85rem; margin-top: 22px; }
.loading { text-align: center; color: var(--muted); }

.foot {
  position: relative;
  padding: 22px clamp(16px, 4vw, 48px);
  color: var(--dim);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- motion ---------- */

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
@keyframes reveal {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to { opacity: 1; transform: none; }
}
@keyframes sweep {
  from { transform: translateY(0); }
  to { transform: translateY(330%); }
}
@keyframes glow-pulse {
  0%, 100% { box-shadow: 0 40px 90px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.06); }
  50% { box-shadow: 0 40px 90px rgba(0, 0, 0, 0.55), 0 0 70px rgba(255, 115, 0, 0.5), 0 0 0 1px rgba(255, 150, 50, 0.45); }
}
@keyframes flash {
  0% { filter: brightness(1); }
  35% { filter: brightness(1.7) saturate(1.2); }
  100% { filter: brightness(1); }
}
@keyframes ping {
  0% { box-shadow: 0 0 0 0 rgba(255, 115, 0, 0.6); }
  100% { box-shadow: 0 0 0 12px rgba(255, 115, 0, 0); }
}
@keyframes dots {
  to { width: 1.25em; }
}
@keyframes spin {
  to { rotate: 360deg; }
}
@keyframes flicker {
  0%, 100% { opacity: 0.55; }
  25% { opacity: 0.9; }
  50% { opacity: 0.3; }
  75% { opacity: 0.8; }
}

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

/* ---------- small screens ---------- */

@media (max-width: 820px) {
  .steps { display: none; }
  .top { justify-content: space-between; }
  .split { grid-template-columns: 1fr; min-height: 0; gap: 40px; }
  .bulb-wrap { order: -1; }
  .bulb { width: 120px; }
  .ghost-wrap { width: min(240px, 70vw); }
}

@media (max-width: 520px) {
  .brand { height: 30px; }
  h1 { font-size: 2.4rem; }
  .lead { margin-bottom: 30px; }
  .go { width: 100%; justify-content: center; }
  .toolbar > * { flex: 1 1 calc(50% - 12px); justify-content: center; text-align: center; }
  .toolbar .go { flex-basis: 100%; }
  .toolbar .text-btn { flex-basis: 100%; margin: 6px 0 0; }
}
