:root {
  --bg: #0d0d0e;
  --surface: #1c1b1b;
  --surface-2: #262525;
  --border: #353434;
  --text: #f5f5f7;
  --muted: #a1a1a6;
  --gold: #f0c35a;
  --gold-dark: #c99a2e;
  --ok: #4caf7a;
  --danger: #e2584d;
  --radius: 14px;
  --page: 1120px;
  --nav-h: 60px;
  font-family: Inter, system-ui, -apple-system, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
html.is-watching { scroll-behavior: auto !important; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

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

h1, h2 { letter-spacing: -0.03em; }

/* Barra in alto */
.nav {
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
  height: var(--nav-h);
  background: rgba(13, 13, 14, 0.72);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.nav-inner {
  max-width: var(--page);
  height: 100%;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand img { width: 34px; height: 30px; object-fit: contain; }
.brand-title { display: block; font-size: .95rem; letter-spacing: .25em; font-weight: 700; text-transform: uppercase; }
.brand-sub { display: block; color: var(--gold); font-size: .65rem; letter-spacing: .35em; text-transform: uppercase; }

/* Bottoni */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 999px; padding: 12px 22px;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: filter .15s, opacity .15s, transform .15s;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--gold); color: #1c1b1b; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-link { background: transparent; color: var(--gold); padding-left: 8px; padding-right: 8px; }
.btn-link::after { content: "›"; font-size: 1.3em; line-height: 0; margin-left: 2px; }
.btn-sm { padding: 7px 14px; font-size: .85rem; }
.btn-lg { padding: 15px 28px; font-size: 1.05rem; }

/* Sezione animata con la tessera */
.story { position: relative; height: 420vh; }
.story-stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  perspective: 1800px;
}
.stage-glow {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 900px;
  height: 900px;
  margin: -450px 0 0 -450px;
  background: radial-gradient(closest-side, rgba(240, 195, 90, 0.22), rgba(240, 195, 90, 0.06) 55%, transparent);
  pointer-events: none;
  will-change: transform, opacity;
}

.hero-copy {
  position: absolute;
  top: 50%;
  left: max(20px, calc(50% - var(--page) / 2 + 20px));
  width: min(520px, 44vw);
  transform: translateY(-50%);
  will-change: transform, opacity;
}
.eyebrow {
  display: inline-block;
  margin-bottom: 18px;
  padding: 6px 12px;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--gold);
  background: rgba(240, 195, 90, 0.1);
  border: 1px solid rgba(240, 195, 90, 0.25);
  border-radius: 999px;
}
.hero-copy h1 { font-size: clamp(2.4rem, 5vw, 4rem); line-height: 1.04; margin: 0 0 18px; font-weight: 800; }
.hero-copy h1 span, .benefits h2 span, .final-cta h2 span {
  background: linear-gradient(120deg, #ffe3a1, #f0c35a 45%, #c99a2e);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-copy p { color: var(--muted); font-size: 1.2rem; line-height: 1.55; margin: 0 0 28px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* Tessera 3D */
.card-scene {
  --card-w: min(440px, 36vw);
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--card-w);
  aspect-ratio: 1.586;
  margin-left: calc(var(--card-w) / -2);
  margin-top: calc(var(--card-w) / -3.172);
  transform-style: preserve-3d;
  will-change: transform;
}
.card-3d {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  will-change: transform;
}
.card-shadow {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: -14%;
  height: 22%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.75), transparent);
  filter: blur(12px);
  will-change: transform, opacity;
}
.card-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 7% 6.5%;
  border-radius: calc(var(--card-w) * 0.045);
  overflow: hidden;
  color: #F5F5F7;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(212, 164, 58, 0.38), transparent 55%),
    radial-gradient(80% 70% at 0% 100%, rgba(212, 164, 58, 0.12), transparent 60%),
    linear-gradient(150deg, #2c2b2f 0%, #161618 100%);
  box-shadow:
    inset 0 0 0 1px rgba(240, 201, 106, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 30px 60px -20px rgba(0, 0, 0, 0.6);
}
.card-back { transform: rotateY(180deg); }

.card-sheen {
  position: absolute;
  inset: -50%;
  background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, 0.22) 50%, transparent 60%);
  transform: translateX(var(--sheen, -60%));
  pointer-events: none;
  mix-blend-mode: screen;
}

.tessera-top, .tessera-bottom, .back-top { display: flex; justify-content: space-between; }
.tessera-top { align-items: flex-start; }
.tessera-bottom { align-items: flex-end; gap: 12px; }
.tessera-logo { display: block; width: 56px; height: 50px; object-fit: contain; }
.tessera-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #F0C96A;
}
.tessera-name { display: block; font-size: clamp(18px, 1.9vw, 24px); font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.tessera-note { display: block; margin-top: 6px; font-size: 12px; line-height: 1.4; color: rgba(245, 245, 247, 0.6); }
.tessera-price {
  flex-shrink: 0;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 800;
  color: #1a1000;
  background: linear-gradient(135deg, #F0C96A, #D4A43A);
  border-radius: 999px;
}

.back-top { align-items: center; }
.back-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(245, 245, 247, 0.55);
  border: 1px solid rgba(245, 245, 247, 0.25);
  border-radius: 999px;
  padding: 3px 9px;
}
.barcode-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 5% 6% 4%;
  background: #fbfaf6;
  border-radius: 10px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}
.barcode { display: block; width: 100%; height: auto; max-height: calc(var(--card-w) * 0.2); }
.barcode-code { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 13px; font-weight: 600; letter-spacing: .3em; color: #1a1a1c; }
.back-note { font-size: 12px; color: rgba(245, 245, 247, 0.6); text-align: center; }

.flip-caption {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 9vh;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  will-change: transform, opacity;
}
.flip-caption strong { display: block; font-size: clamp(2rem, 4.6vw, 3.6rem); letter-spacing: -0.035em; line-height: 1.05; }
.flip-caption span { display: block; margin-top: 10px; color: var(--muted); font-size: clamp(1rem, 1.6vw, 1.25rem); }

/* Vantaggi accanto alla tessera */
.benefits {
  position: absolute;
  top: 50%;
  right: max(20px, calc(50% - var(--page) / 2 + 20px));
  width: min(480px, 42vw);
  transform: translateY(-50%);
  pointer-events: none;
}
.benefits h2 { font-size: clamp(1.9rem, 3.4vw, 2.8rem); line-height: 1.08; margin: 0 0 26px; }
.benefits ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.benefits li {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 18px;
}
.benefits li strong { display: block; font-size: 1.05rem; margin-bottom: 3px; }
.benefits li span span { color: var(--muted); line-height: 1.45; font-size: .95rem; }
.benefit-icon {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(240, 195, 90, 0.22), rgba(240, 195, 90, 0.06));
  color: var(--gold);
}
.benefit-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.benefits h2, .benefits li {
  opacity: 0;
  transform: translateY(24px);
  filter: blur(6px);
  will-change: opacity, transform, filter;
}

.scroll-hint {
  position: absolute;
  left: 50%;
  bottom: 28px;
  width: 26px;
  height: 42px;
  margin-left: -13px;
  border: 2px solid rgba(245, 245, 247, 0.3);
  border-radius: 999px;
}
.scroll-hint span {
  position: absolute;
  left: 50%;
  top: 8px;
  width: 4px;
  height: 8px;
  margin-left: -2px;
  border-radius: 2px;
  background: rgba(245, 245, 247, 0.6);
  animation: scroll-hint 1.8s ease-in-out infinite;
}
@keyframes scroll-hint {
  0% { transform: translateY(0); opacity: 1; }
  70% { transform: translateY(14px); opacity: 0; }
  100% { transform: translateY(0); opacity: 0; }
}

/* Sezioni sotto */
.section { max-width: var(--page); margin: 0 auto; padding: 120px 20px; }
.section-title { font-size: clamp(2rem, 4vw, 3rem); text-align: center; margin: 0 0 48px; }

.free { text-align: center; padding-top: 80px; }
.free-amount {
  font-size: clamp(7rem, 22vw, 15rem);
  font-weight: 800;
  line-height: .9;
  letter-spacing: -0.06em;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #ffe7ad 0%, #f0c35a 45%, #8a6416 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.free-amount span:last-child { font-size: .45em; letter-spacing: 0; margin-left: .05em; vertical-align: .9em; }
.free-amount.is-landed { animation: price-land .55s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes price-land {
  0% { transform: scale(1.08); }
  100% { transform: scale(1); }
}
.free h2 { font-size: clamp(2rem, 4.5vw, 3.4rem); margin: 18px 0 10px; }
.free p { color: var(--muted); font-size: 1.25rem; margin: 0; }

.notice-section { padding-top: 0; }
.notice {
  display: flex;
  gap: 20px;
  align-items: center;
  max-width: 820px;
  margin: 0 auto;
  padding: 28px 32px;
  border-radius: 24px;
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(240, 195, 90, 0.16), transparent 60%),
    rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(240, 195, 90, 0.3);
}
.notice-icon {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--gold);
  color: #1c1b1b;
  font-weight: 800;
  font-size: 1.5rem;
}
.notice-label { font-size: .78rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
.notice p { margin: 6px 0 0; font-size: clamp(1.15rem, 2.2vw, 1.5rem); line-height: 1.4; }
.notice strong { color: var(--gold); }

.steps-section { padding-top: 40px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.steps li {
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 28px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.07);
}
.steps li:nth-child(2) { transition-delay: .08s; }
.steps li:nth-child(3) { transition-delay: .16s; }
.step-num {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin-bottom: 8px;
  border-radius: 50%;
  border: 1px solid rgba(240, 195, 90, 0.5);
  color: var(--gold);
  font-weight: 700;
}
.steps strong { font-size: 1.15rem; }
.steps li > span:last-child { color: var(--muted); line-height: 1.5; }

.final-cta { text-align: center; padding-bottom: 140px; }
.final-cta h2 { font-size: clamp(2.2rem, 5vw, 3.8rem); margin: 0 0 12px; line-height: 1.05; }
.final-cta p { color: var(--muted); font-size: 1.2rem; margin: 0 0 30px; }

.footer {
  max-width: var(--page);
  margin: 0 auto;
  padding: 28px 20px 40px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  color: var(--muted);
  font-size: .85rem;
}

.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity .9s cubic-bezier(0.16, 1, 0.3, 1), transform .9s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.is-visible { opacity: 1; transform: none; }

@media (max-width: 899px) {
  .hero-copy {
    top: auto;
    bottom: max(36px, env(safe-area-inset-bottom));
    left: 20px;
    right: 20px;
    width: auto;
    transform: none;
    text-align: center;
  }
  .eyebrow { margin-bottom: 12px; }
  .hero-copy h1 { font-size: clamp(2rem, 9vw, 2.8rem); margin-bottom: 12px; }
  .hero-copy p { font-size: 1rem; margin-bottom: 20px; }
  .hero-actions { justify-content: center; }
  .card-scene { --card-w: min(360px, 80vw); }
  .tessera-name { font-size: 18px; }
  .tessera-logo { width: 42px; height: 38px; }
  .tessera-note, .back-note { font-size: 11px; }
  .barcode-code { font-size: 11px; }
  .benefits {
    top: auto;
    bottom: max(24px, env(safe-area-inset-bottom));
    left: 20px;
    right: 20px;
    width: auto;
    transform: none;
  }
  .benefits h2 { font-size: 1.6rem; margin-bottom: 14px; text-align: center; }
  .benefits ul { gap: 10px; }
  .benefits li { padding: 12px 14px; gap: 12px; border-radius: 16px; }
  .benefits li strong { font-size: .98rem; }
  .benefits li span span { font-size: .86rem; }
  .benefit-icon { width: 36px; height: 36px; border-radius: 10px; }
  .scroll-hint { display: none; }
  .section { padding: 80px 20px; }
  .steps { grid-template-columns: 1fr; }
  .notice { flex-direction: column; text-align: center; padding: 26px 22px; }
}

@media (max-width: 899px) and (max-height: 700px) {
  .benefits li span span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal, .benefits h2, .benefits li { transition: none; filter: none; }
  .scroll-hint span { animation: none; }
}

/* Modulo di richiesta */
dialog {
  width: min(480px, calc(100vw - 24px));
  max-height: calc(100svh - 32px);
  padding: 0;
  border: 0;
  border-radius: 28px;
  overflow: auto;
  overscroll-behavior: contain;
  color: var(--text);
  background: linear-gradient(180deg, #201f1d 0%, #141414 100%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 40px 90px -20px rgba(0, 0, 0, 0.85);
}
dialog[open] { animation: sheet-in .55s cubic-bezier(0.16, 1, 0.3, 1); }
dialog::backdrop { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
dialog[open]::backdrop { animation: fade-in .35s ease; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(28px) scale(0.96); } }
@keyframes fade-in { from { opacity: 0; } }

.sheet { position: relative; padding: 26px 28px 26px; }
.sheet::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 260px;
  background: radial-gradient(60% 100% at 50% 0%, rgba(240, 195, 90, 0.18), transparent 70%);
  pointer-events: none;
}
.sheet > * { position: relative; }
.sheet-grabber { display: none; }
.sheet-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.sheet-close:hover { background: rgba(255, 255, 255, 0.14); color: var(--text); }
.sheet-close svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }

.mini-scene { display: flex; justify-content: center; margin: 6px 0 22px; perspective: 1000px; }
.mini-card {
  position: relative;
  width: 220px;
  aspect-ratio: 1.586;
  transform-style: preserve-3d;
  transform: rotateX(10deg) rotateZ(-4deg);
  transition: transform 1s cubic-bezier(0.2, 0.8, 0.2, 1);
  animation: mini-float 5s ease-in-out infinite;
}
.mini-card.is-flipped { transform: rotateX(0deg) rotateY(180deg) rotateZ(0deg) scale(1.08); animation: none; }
@keyframes mini-float {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -6px; }
}
.mini-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 14px 16px;
  border-radius: 12px;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(212, 164, 58, 0.38), transparent 55%),
    linear-gradient(150deg, #2c2b2f 0%, #161618 100%);
  box-shadow:
    inset 0 0 0 1px rgba(240, 201, 106, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 20px 40px -14px rgba(0, 0, 0, 0.8);
}
.mini-back { transform: rotateY(180deg); align-items: center; justify-content: center; gap: 10px; text-align: center; }
.mini-top { display: flex; justify-content: space-between; align-items: flex-start; }
.mini-top img { width: 36px; height: 32px; object-fit: contain; }
.mini-top .tessera-label, .mini-back .tessera-label { font-size: 9px; }
.mini-name {
  display: block;
  overflow: hidden;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
  white-space: nowrap;
  text-overflow: ellipsis;
  transition: color .2s;
}
.mini-name.is-placeholder { color: rgba(245, 245, 247, 0.35); }
.mini-note { display: block; margin-top: 3px; font-size: 10.5px; color: rgba(245, 245, 247, 0.55); }
.mini-code {
  padding: 8px 12px;
  border-radius: 8px;
  background: #fbfaf6;
  color: #1a1a1c;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .18em;
}

.sheet-head { text-align: center; }
.sheet-head h2 { margin: 0 0 6px; font-size: 1.75rem; }
.sheet-head p { margin: 0; color: var(--muted); }

#register-form { margin-top: 24px; }
.group-label {
  display: block;
  margin: 20px 4px 10px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}
.group-label:first-child { margin-top: 0; }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field { position: relative; margin-bottom: 10px; }
.field input {
  width: 100%;
  height: 58px;
  padding: 22px 16px 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.field input:hover { border-color: rgba(255, 255, 255, 0.18); }
.field input:focus {
  outline: none;
  border-color: var(--gold);
  background: rgba(240, 195, 90, 0.06);
  box-shadow: 0 0 0 4px rgba(240, 195, 90, 0.14);
}
.field input:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 100px #2a2721 inset;
  caret-color: var(--text);
}
.field label {
  position: absolute;
  left: 17px;
  top: 19px;
  color: var(--muted);
  font-size: 1rem;
  pointer-events: none;
  transform-origin: left top;
  transition: transform .2s cubic-bezier(0.16, 1, 0.3, 1), color .2s;
}
.field input:focus + label,
.field input:not(:placeholder-shown) + label,
.field input:-webkit-autofill + label { transform: translateY(-11px) scale(0.75); }
.field input:focus + label { color: var(--gold); }
#taxCode { text-transform: uppercase; letter-spacing: .06em; }

.field.has-icon input { padding-left: 48px; }
.field.has-icon.has-scan input { padding-right: 118px; }
.field.has-icon label { left: 49px; }
.field-icon {
  position: absolute;
  left: 15px;
  top: 18px;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
  transition: stroke .2s;
}
.field:focus-within .field-icon { stroke: var(--gold); }

.scan-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  height: 42px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: 10px;
  background: rgba(240, 195, 90, 0.14);
  color: var(--gold);
  font: inherit;
  font-size: .8rem;
  font-weight: 700;
  cursor: pointer;
}
.scan-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.scan-btn:hover { filter: brightness(1.1); }
.scan-hint { margin: -2px 4px 14px; color: var(--muted); font-size: .82rem; line-height: 1.45; }
.scan-hint strong { color: var(--text); font-weight: 600; }

.sheet.is-scanning .mini-scene { display: none; }
.scan-panel { text-align: center; }
.scan-panel h2 { margin: 8px 0 16px; font-size: 1.45rem; }
.scan-steps {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  display: grid;
  gap: 8px;
  text-align: left;
}
.scan-steps li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.4;
}
.scan-steps li::before {
  content: counter(scan-step);
  counter-increment: scan-step;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-top: 1px;
  border-radius: 50%;
  background: rgba(240, 195, 90, 0.16);
  color: var(--gold);
  font-size: .75rem;
  font-weight: 700;
}
.scan-steps { counter-reset: scan-step; }
.scan-steps strong { color: var(--text); }
.scan-view {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border-radius: 18px;
  background: #000;
}
.scan-view video,
#scan-reader,
#scan-reader video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
#scan-reader { position: absolute; inset: 0; }
#scan-reader img, #scan-reader canvas { display: none; }
.scan-frame {
  position: absolute;
  left: 4%;
  right: 4%;
  top: 36%;
  height: 28%;
  border: 2px solid rgba(240, 195, 90, 0.9);
  border-radius: 10px;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}
.scan-frame::after {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  height: 2px;
  top: 50%;
  background: rgba(240, 195, 90, 0.85);
  animation: scan-line 1.6s ease-in-out infinite;
}
@keyframes scan-line {
  0%, 100% { transform: translateY(-18px); opacity: .4; }
  50% { transform: translateY(18px); opacity: 1; }
}
.scan-status { margin: 14px 8px 0; color: var(--muted); font-size: .9rem; min-height: 2.6em; }
.scan-status.is-ok { color: var(--ok); font-weight: 600; }
.scan-status.is-error { color: var(--danger); }
.field.has-scan.is-just-scanned input { border-color: var(--ok); box-shadow: 0 0 0 4px rgba(76, 175, 122, 0.16); }

.field .error { display: block; margin: 6px 4px 0; color: var(--danger); font-size: .8rem; }
.field .error:empty { display: none; }
.field.invalid input { border-color: var(--danger); box-shadow: 0 0 0 4px rgba(226, 88, 77, 0.14); animation: shake .4s; }
.field.invalid label, .field.invalid .field-icon { color: var(--danger); stroke: var(--danger); }
@keyframes shake {
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}

.alert { border-radius: 12px; padding: 12px 14px; margin: 6px 0 0; line-height: 1.45; font-size: .9rem; }
.alert-error { background: rgba(226, 88, 77, 0.12); border: 1px solid rgba(226, 88, 77, 0.5); }

.btn-submit { position: relative; width: 100%; height: 54px; margin-top: 16px; font-size: 1.05rem; }
.spinner {
  display: none;
  position: absolute;
  width: 22px;
  height: 22px;
  border: 2.5px solid rgba(28, 27, 27, 0.25);
  border-top-color: #1c1b1b;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.btn-submit.is-loading .btn-label { visibility: hidden; }
.btn-submit.is-loading .spinner { display: block; }
.btn-submit.is-loading:disabled { opacity: 1; }
@keyframes spin { to { transform: rotate(360deg); } }
.sheet-foot { margin: 14px 8px 0; text-align: center; color: var(--muted); font-size: .82rem; line-height: 1.45; }

.success { text-align: center; animation: fade-up .6s cubic-bezier(0.16, 1, 0.3, 1) .35s both; }
.success-check { width: 60px; height: 60px; fill: none; stroke: var(--ok); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.success-check circle { stroke-dasharray: 151; stroke-dashoffset: 151; animation: draw .7s ease-out .5s forwards; opacity: .9; }
.success-check path { stroke-dasharray: 36; stroke-dashoffset: 36; animation: draw .4s ease-out 1.1s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(16px); } }
.success h2 { margin: 12px 0 8px; font-size: 1.6rem; }
.success p { margin: 0 auto; max-width: 340px; color: var(--muted); line-height: 1.5; }
.success .btn-submit { margin-top: 22px; }

.hidden { display: none !important; }

@media (max-width: 600px) {
  dialog {
    width: 100%;
    max-width: 100%;
    max-height: 94svh;
    margin: auto 0 0;
    border-radius: 28px 28px 0 0;
  }
  dialog[open] { animation: sheet-up .5s cubic-bezier(0.16, 1, 0.3, 1); }
  @keyframes sheet-up { from { transform: translateY(100%); } }
  .sheet { padding: 12px 20px calc(22px + env(safe-area-inset-bottom)); }
  .sheet-grabber { display: block; width: 38px; height: 5px; margin: 0 auto 10px; border-radius: 3px; background: rgba(255, 255, 255, 0.22); }
  .sheet-close { top: 14px; right: 14px; }
  .mini-card { width: 190px; }
  .mini-scene { margin: 10px 0 18px; }
  .sheet-head h2 { font-size: 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  dialog[open], dialog[open]::backdrop, .mini-card, .success, .field.invalid input { animation: none; }
  .success-check circle, .success-check path { animation: none; stroke-dashoffset: 0; }
}

