:root {
  --bg: #0b0b0c;
  --card: #141416;
  --field: #0e0e10;
  --line: #2a2a2f;
  --text: #f4f0e6;
  --muted: #a39e93;
  --gold: #d4af37;
  --gold-light: #f2d784;
  --gold-dark: #a8842a;
  --success: #3fcf8e;
  --warning: #f2a93b;
  --danger: #f0596d;
  --radius: 14px;
  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 16px 32px;
  background:
    radial-gradient(ellipse 80% 45% at 50% -5%, rgba(212, 175, 55, 0.18), transparent 70%),
    var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

a { color: var(--gold-light); }

.brand { padding: 24px 0 18px; }
.brand img { display: block; width: 76px; height: auto; }

.card {
  position: relative;
  width: 100%;
  max-width: 460px;
  padding: 24px 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold-light), var(--gold-dark));
}
.card--success::before { background: var(--success); }
.card--warning::before { background: var(--warning); }

h1 {
  margin: 0 0 6px;
  font-size: 1.55rem;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-align: center;
}
.lead { margin: 0 0 16px; color: var(--muted); text-align: center; font-size: 0.95rem; }
.muted { color: var(--muted); font-size: 0.94rem; }

/* Scratch hint */
.hint { margin: 0 auto 18px; max-width: 200px; }
.hint img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #1c1c1f;
}
.hint figcaption { margin-top: 8px; font-size: 0.86rem; color: var(--muted); text-align: center; }
.hint em { font-style: normal; color: var(--gold-light); font-weight: 600; }

/* Form */
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field > label { font-size: 0.86rem; font-weight: 600; color: var(--muted); }

.input {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  font: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder { color: #5f5b55; }
.input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.22);
}
.input--code {
  height: 58px;
  text-align: center;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 1.3rem;
  letter-spacing: 0.14em;
}
.input--code::placeholder { letter-spacing: 0.06em; font-size: 1rem; }

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

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 54px;
  margin-top: 4px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(180deg, var(--gold-light), var(--gold) 55%, var(--gold-dark));
  color: #1a1407;
  font: inherit;
  font-weight: 700;
  font-size: 1.02rem;
  text-decoration: none;
  cursor: pointer;
  transition: filter 0.15s, transform 0.05s;
}
.button:hover { filter: brightness(1.06); }
.button:active { transform: translateY(1px); }
.button:focus-visible { outline: 3px solid rgba(242, 215, 132, 0.5); outline-offset: 2px; }
.button:disabled { cursor: progress; filter: saturate(0.6) brightness(0.9); }
.button--ghost {
  background: transparent;
  color: var(--gold-light);
  border: 1px solid var(--gold-dark);
}

.fineprint { margin: 2px 0 0; font-size: 0.8rem; color: var(--muted); text-align: center; }

/* Alerts */
.alert {
  display: grid;
  gap: 2px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid;
  font-size: 0.93rem;
}
.alert--error { border-color: rgba(240, 89, 109, 0.45); background: rgba(240, 89, 109, 0.1); }
.alert--error strong { color: var(--danger); }
.alert--notice { border-color: rgba(242, 169, 59, 0.45); background: rgba(242, 169, 59, 0.1); }

/* Result */
.result { text-align: center; }
.result p { margin: 0 0 12px; }
.badge {
  display: inline-grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin: 6px 0 16px;
  border-radius: 50%;
}
.badge svg { width: 38px; height: 38px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.badge--success { color: var(--success); background: rgba(63, 207, 142, 0.12); box-shadow: 0 0 0 6px rgba(63, 207, 142, 0.06); }
.badge--warning { color: var(--warning); background: rgba(242, 169, 59, 0.12); box-shadow: 0 0 0 6px rgba(242, 169, 59, 0.06); }
.badge { animation: pop 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.3) both; }
@keyframes pop { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.code-chip {
  display: inline-block;
  margin: 8px 0 20px !important;
  padding: 8px 16px;
  border: 1px dashed var(--gold-dark);
  border-radius: 10px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 1.1rem;
  letter-spacing: 0.12em;
  color: var(--gold-light);
  word-break: break-all;
}

.footer { margin-top: 24px; font-size: 0.85rem; }
.footer a { color: var(--muted); text-decoration: none; }
.footer a:hover { color: var(--gold-light); }

@media (min-width: 520px) {
  .brand { padding: 48px 0 28px; }
  .brand img { width: 110px; }
  .card { padding: 36px 36px 32px; }
  .lead { font-size: 1rem; margin-bottom: 20px; }
  .hint { max-width: 280px; margin-bottom: 22px; }
}

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