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

:root {
  --paper: #f3eee6;
  --ink: #1d1712;
  --muted: #5e534a;
  --line: #e4dacd;
  --terracotta: #8f3d32;
  --panel: #fffdf9;
  --serif: Palatino, "Palatino Linotype", "Iowan Old Style", Georgia, serif;
  --sans: "Segoe UI", system-ui, sans-serif;
  --desk: #e7e0d4;
}

html, body { margin: 0; padding: 0; }
body {
  --desk: var(--paper);
  min-height: 100vh;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
}

a { color: var(--terracotta); }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--terracotta); outline-offset: 2px; }

.top {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 12px 22px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}
.logo {
  height: 22px;
  width: auto;
  display: block;
}
.top nav { display: flex; gap: 16px; }
.top nav a { color: var(--muted); text-decoration: none; font-weight: 600; }
.top nav a.active { color: var(--ink); }
.who { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.who-name {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 14px;
}
.who form { margin: 0; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 28px 20px 72px; }
.narrow { max-width: 640px; }
.page-head { margin-bottom: 18px; }
.row-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; }
h1, h2 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}
h1 { font-size: 36px; }
h2 { font-size: 28px; }
.lede { margin: 0; color: var(--muted); max-width: 62ch; }
.back { margin: 0 0 10px; }
.caption { color: var(--muted); font-size: 14px; margin: 0 0 10px; }
.note-inline {
  background: #fff6e8;
  border: 1px solid #f0ddb8;
  border-radius: 12px;
  padding: 10px 12px;
  margin: 0 0 16px;
}

/* auth pages share the landing styles */

.stack { display: flex; flex-direction: column; gap: 12px; }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 14px; font-weight: 700; }
.field small { color: var(--muted); font-size: 13px; }
.field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #d9cfc2;
  background: white;
}
.check { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0; }
.check input { width: 18px; height: 18px; margin-top: 3px; flex: none; }

.color-pair {
  display: grid;
  grid-template-columns: 1fr 56px;
  gap: 10px;
  align-items: end;
}
input[type="color"] {
  width: 56px;
  height: 48px;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid #d9cfc2;
  background: white;
}

.templates {
  border: 0;
  margin: 4px 0 2px;
  padding: 0;
  min-inline-size: 0;
}
.templates legend {
  font-size: 14px;
  font-weight: 700;
  padding: 0;
  margin-bottom: 4px;
}
.template-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.template-card {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  text-align: left;
  background: white;
  border: 1px solid #d9cfc2;
  border-radius: 14px;
  padding: 8px;
  cursor: pointer;
  color: var(--ink);
}
.template-card.is-current {
  border-color: var(--terracotta);
  box-shadow: inset 0 0 0 1px var(--terracotta);
}
.swatch {
  width: 64px;
  height: 46px;
  border-radius: 8px;
  background: var(--sw-bg);
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--sw-fg) 28%, transparent);
}
.swatch-bar {
  display: block;
  height: 7px;
  background: var(--sw-accent);
}
.swatch-line,
.swatch-dot {
  display: block;
  height: 5px;
  border-radius: 99px;
  margin-left: 8px;
}
.swatch-line {
  width: 62%;
  margin-top: 8px;
  background: var(--sw-fg);
}
.swatch-dot {
  width: 32%;
  margin-top: 6px;
  background: var(--sw-accent);
}
.template-copy { min-width: 0; }
.template-name {
  display: block;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.25;
}
.template-tag {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}
.template-badge {
  display: none;
  margin-left: 4px;
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--terracotta);
  font-weight: 800;
  white-space: nowrap;
}
.template-card.is-current .template-badge { display: inline; }

.btn {
  appearance: none;
  border: 0;
  background: var(--terracotta);
  color: #fffdf9;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn.secondary { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px #cfc3b4; }
.btn.ghost { background: transparent; color: var(--muted); padding: 8px 10px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }

.alert {
  background: #fde8e4;
  color: #6d241c;
  border: 1px solid #f0c2ba;
  border-radius: 12px;
  padding: 12px 14px;
  margin: 0 0 14px;
}
.alert ul { margin: 0; padding-left: 18px; }
.alert.ok { background: #e7f4ea; color: #1d5c32; border-color: #b7dfc4; }
.warn { color: #8a4b12; margin: 0; font-size: 14px; }

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 28px;
  align-items: start;
}
.preview-col { position: sticky; top: 78px; }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
}
table.grid { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
tr:last-child td { border-bottom: 0; }
.empty {
  background: var(--panel);
  border: 1px dashed #d3c6b6;
  border-radius: 16px;
  padding: 28px;
}

.facts { margin: 0; display: grid; gap: 10px; }
.facts div { display: grid; grid-template-columns: 140px 1fr; gap: 8px; }
.facts dt { color: var(--muted); margin: 0; }
.facts dd { margin: 0; }

.pass {
  --bg: #1c1410;
  --fg: #f6f1e8;
  --accent: #e39b3a;
  position: relative;
  overflow: hidden;
  width: min(100%, 380px);
  min-height: 540px;
  border-radius: 28px;
  background: var(--bg);
  color: var(--fg);
  display: flex;
  flex-direction: column;
  border: 1px solid color-mix(in srgb, var(--fg) 28%, transparent);
  box-shadow:
    0 1px 0 color-mix(in srgb, var(--fg) 25%, transparent) inset,
    0 24px 50px rgba(40, 24, 12, 0.28);
}
.pass-strip { height: 12px; background: var(--accent); position: relative; z-index: 1; }
.pass-orb {
  position: absolute;
  width: 210px;
  height: 210px;
  border-radius: 50%;
  background: var(--accent);
  right: -70px;
  top: -78px;
  z-index: 0;
}
.pass-orb-sm {
  width: 96px;
  height: 96px;
  left: -28px;
  right: auto;
  top: auto;
  bottom: 148px;
  background: color-mix(in srgb, var(--accent) 78%, var(--fg));
}
.pass-head, .pass-main, .pass-foot { position: relative; z-index: 1; }
.pass-head {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 12px;
  padding: 16px 22px 0;
}
.mark {
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 700;
}
.chip {
  width: 48px;
  height: 36px;
  border-radius: 8px;
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--accent) 55%, white),
      var(--accent) 42%,
      color-mix(in srgb, var(--accent) 45%, black));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fg) 30%, transparent);
}
.pass-main { padding: 18px 22px 12px; flex: 1; }
.eyebrow {
  margin: 0 0 4px;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.75;
}
.venue, .guest {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.03em;
  margin: 0;
  overflow-wrap: anywhere;
}
.venue { font-size: 40px; line-height: 0.98; max-width: 12ch; }
.tagline { margin: 12px 0 0; font-size: 16px; max-width: 28ch; }
.tagline.is-empty { display: none; }
.pass-rule {
  position: relative;
  z-index: 1;
  height: 22px;
  margin: 0;
  background:
    radial-gradient(circle at 0 50%, var(--desk) 11px, transparent 12px),
    radial-gradient(circle at 100% 50%, var(--desk) 11px, transparent 12px);
}
.pass-rule::before {
  content: "";
  position: absolute;
  left: 22px;
  right: 22px;
  top: 10px;
  border-top: 2px dashed color-mix(in srgb, var(--accent) 80%, var(--fg));
}
.pass-foot {
  padding: 6px 22px 20px;
  background: color-mix(in srgb, var(--fg) 10%, transparent);
}
.guest { font-size: 34px; line-height: 1; }
.code-label { margin-top: 14px; }
.code-pill {
  display: inline-block;
  margin: 0;
  background: var(--accent);
  color: var(--bg);
  font-family: ui-monospace, "Cascadia Mono", "Segoe UI Mono", monospace;
  font-weight: 700;
  letter-spacing: 0.16em;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 16px;
}
.bars { display: flex; align-items: flex-end; height: 48px; margin-top: 16px; }
.bars i {
  display: block;
  background: var(--fg);
  border-radius: 1px;
  flex: none;
}

body.guest {
  --desk: #e7e0d4;
  background:
    radial-gradient(900px 420px at 50% -10%, #fff, transparent 60%),
    var(--desk);
}
.guest-wrap {
  max-width: 440px;
  margin: 0 auto;
  padding: 28px 18px 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.guest-kicker {
  margin: 0 0 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--muted);
}
.wallet-box { width: min(100%, 380px); margin-top: 16px; }
.wallet-box summary {
  list-style: none;
  cursor: pointer;
  background: var(--accent);
  color: var(--on-accent);
  text-align: center;
  padding: 16px 18px;
  border-radius: 16px;
  font-weight: 800;
  font-size: 17px;
}
.wallet-box summary::-webkit-details-marker { display: none; }
.note-body {
  margin-top: 10px;
  background: var(--panel);
  color: var(--ink);
  border-radius: 16px;
  padding: 16px;
  border: 1px solid var(--line);
}
.note-body h2 { font-size: 24px; }
.note-body p { margin-top: 0; }
.note-body .btn { width: 100%; margin-bottom: 8px; }

@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-hero, .auth-panel { padding: 32px 20px; }
  .auth-hero h1 { font-size: 38px; }
  .split { grid-template-columns: 1fr; }
  .preview-col { position: static; }
  .top { flex-wrap: wrap; gap: 8px 14px; }
  .who { width: 100%; margin-left: 0; justify-content: space-between; }
  .row-head { flex-direction: column; align-items: flex-start; }
  .facts div { grid-template-columns: 1fr; gap: 2px; }
  h1 { font-size: 32px; }
  .template-grid { grid-template-columns: 1fr; }
}

.progress { margin-top: 14px; }
.progress-phrase { margin: 0; font-size: 16px; }
.progress-count {
  margin: 4px 0 8px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.progress-track {
  height: 8px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--fg) 28%, transparent);
  overflow: hidden;
}
.progress-track > span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
}
.progress-done { margin: 8px 0 0; font-size: 14px; font-weight: 700; }

.barcode {
  margin: 14px 0 0;
  background: #ffffff;
  color: #161616;
  border-radius: 12px;
  padding: 10px 10px 8px;
}
.barcode-svg svg {
  display: block;
  width: 100%;
  height: auto;
}
.barcode-digits {
  margin: 6px 0 0;
  text-align: center;
  font-family: ui-monospace, "Cascadia Mono", "Segoe UI Mono", monospace;
  font-weight: 700;
  letter-spacing: 0.16em;
  font-size: 15px;
  color: #161616;
}

#reader {
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  background: #1c1410;
}
#reader:not(.is-live) { display: none; }
#reader video { width: 100%; height: auto; border-radius: 12px; background: #111; }
.balance-big {
  font-family: var(--serif);
  font-size: 42px;
  line-height: 1;
  margin: 0;
}
.scan-result { margin-top: 16px; }
.scan-result .eyebrow { color: var(--muted); }

.home-btn {
  width: min(100%, 380px);
  margin-top: 16px;
  border: 0;
  cursor: pointer;
  background: var(--accent);
  color: var(--on-accent);
  text-align: center;
  padding: 16px 18px;
  border-radius: 16px;
  font-weight: 800;
  font-size: 17px;
  font-family: inherit;
}
.home-note { width: min(100%, 380px); }
.home-note p { margin: 0 0 8px; }
.cert-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.cert-line h2 { font-size: 22px; margin: 0; }
.cert-gap { margin-top: 14px; }
.badge {
  flex: none;
  font-size: 13px;
  font-weight: 700;
  border-radius: 999px;
  padding: 4px 10px;
}
.badge.ok { background: #e7f4ea; color: #1d5c32; }
.badge.miss { background: #fff6e8; color: #8a4b12; }
input[type="file"] { font-size: 14px; }

/* landing */
body.landing {
  background: #F7F4EF;
  color: #1C1916;
  font-family: var(--sans);
}
body.landing h1,
body.landing h2,
body.landing h3 {
  font-family: inherit;
  font-weight: 600;
  letter-spacing: 0;
  color: inherit;
}
body.landing a {
  color: #1C1916;
}
body.landing :focus-visible {
  outline: 2px solid #1C1916;
  outline-offset: 3px;
}
.land-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 28px;
}
.land-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
}
.land-nav a.land-brand { text-decoration: none; }
.land-nav a {
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: opacity 200ms ease-out;
}
.land-nav a:hover { opacity: 0.7; }
.land-section {
  max-width: 560px;
  margin: 0 auto;
  padding: 96px 20px;
  text-align: center;
}
.land-eyebrow {
  margin: 0 0 12px;
  font-size: 13px;
}
body.landing h1 {
  font-size: 44px;
  line-height: 1.1;
  margin: 0;
}
body.landing h2 {
  font-size: 28px;
  line-height: 1.2;
  margin: 0;
}
.land-lead {
  margin: 12px auto 0;
  max-width: 560px;
  line-height: 1.5;
}
.land-card {
  --c1: #3E5349;
  --c2: #C4654A;
  --c3: #B8924A;
  width: 320px;
  height: 200px;
  margin: 28px auto 0;
  padding: 16px 16px 12px;
  border: 1px solid #1C1916;
  border-radius: 12px;
  background: #F7F4EF;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.land-dots { display: flex; gap: 8px; }
.land-dots span {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: block;
}
.land-dots span:nth-child(1) { background: var(--c1); }
.land-dots span:nth-child(2) { background: var(--c2); }
.land-dots span:nth-child(3) { background: var(--c3); }
.land-phrase {
  width: 42%;
  margin-top: 14px;
  border-top: 1px solid rgba(28, 25, 22, 0.45);
  height: 0;
}
.land-barcode {
  width: 100%;
  height: 36px;
  margin-top: auto;
  color: #1C1916;
}
.land-barcode svg { display: block; width: 100%; height: 100%; }
.land-barcode svg rect { fill: currentColor; }
.land-readout {
  display: grid;
  width: 100%;
  margin-top: 12px;
}
.land-state { grid-area: 1 / 1; }
.land-word,
.land-count { margin: 0; }
.land-word { font-size: 16px; font-weight: 600; }
.land-count { margin-top: 6px; font-size: 20px; }
.land-bar {
  height: 6px;
  width: 72%;
  margin: 8px auto 0;
  border-radius: 99px;
  background: color-mix(in srgb, var(--c2) 28%, transparent);
}
.land-bar span {
  display: block;
  height: 100%;
  width: 64%;
  border-radius: 99px;
  background: var(--c2);
}
.land-state-acquisti { opacity: 0; }
.land-program.is-switched .land-state-punti { opacity: 0; }
.land-program.is-switched .land-state-acquisti { opacity: 1; }
.land-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-top: 28px;
}
body.landing a.land-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 180px;
  padding: 12px 22px;
  border-radius: 999px;
  background: #1C1916;
  color: #F7F4EF;
  text-decoration: none;
  font-weight: 600;
  transition: opacity 200ms ease-out;
}
body.landing a.land-btn:hover { opacity: 0.82; }
a.land-quiet {
  color: #1C1916;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: opacity 200ms ease-out;
}
a.land-quiet:hover { opacity: 0.7; }
.land-step-list {
  list-style: none;
  margin: 36px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.land-step { margin: 0; }
.land-step-num { margin: 0 0 6px; font-size: 13px; }
.land-step h3 { margin: 0 0 6px; font-size: 20px; }
.land-step p { margin: 0; line-height: 1.5; }
.land-already { margin: 14px 0 0; }
.land-already a {
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: opacity 200ms ease-out;
}
.land-already a:hover { opacity: 0.7; }

.land-open .land-card {
  opacity: 0;
  transform: translateY(16px);
}
.land-open.is-in .land-card {
  opacity: 1;
  transform: none;
  transition: opacity 500ms ease-out, transform 500ms ease-out;
}
.land-open .land-barcode { clip-path: inset(0 100% 0 0); }
.land-open.is-in .land-barcode {
  clip-path: inset(0 0 0 0);
  transition: clip-path 700ms ease-out;
}
.land-steps .land-step { opacity: 0; }
.land-steps.is-in .land-step {
  opacity: 1;
  transition: opacity 400ms ease-out;
}
.land-steps.is-in .land-step:nth-child(1) { transition-delay: 0ms; }
.land-steps.is-in .land-step:nth-child(2) { transition-delay: 450ms; }
.land-steps.is-in .land-step:nth-child(3) { transition-delay: 900ms; }
.land-close .land-close-block {
  opacity: 0;
  transform: translateY(12px);
}
.land-close.is-in .land-close-block {
  opacity: 1;
  transform: none;
  transition: opacity 400ms ease-out, transform 400ms ease-out;
}


body.auth-page .auth-form { padding-top: 48px; }
body.auth-page .auth-form .stack { margin-top: 28px; text-align: left; }
body.auth-page .field span { font-weight: 600; color: #1C1916; }
body.auth-page .field small { color: #1C1916; opacity: 0.7; }
body.auth-page .field input {
  border: 1px solid #1C1916;
  border-radius: 12px;
  background: #F7F4EF;
  color: #1C1916;
}
body.auth-page .stack .btn {
  align-self: center;
  min-width: 180px;
  margin-top: 8px;
  background: #1C1916;
  color: #F7F4EF;
  font-weight: 600;
  transition: opacity 200ms ease-out;
}
body.auth-page .stack .btn:hover { opacity: 0.82; }
body.auth-page .switch { text-align: center; color: #1C1916; }
body.auth-page .switch a {
  color: #1C1916;
  text-decoration: underline;
  text-underline-offset: 3px;
}
body.auth-page .alert {
  background: #F7F4EF;
  color: #1C1916;
  border: 1px solid #C4654A;
  text-align: left;
}

@media (max-width: 720px) {
  .land-section { padding: 64px 16px; }
  body.landing h1 { font-size: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  .land-open .land-card,
  .land-steps .land-step,
  .land-close .land-close-block {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .land-open .land-barcode,
  .land-open.is-in .land-barcode {
    clip-path: none;
    transition: none;
  }
  .land-steps.is-in .land-step { transition: none; }
  .land-program .land-state { transition: none; }
  .land-program .land-state-punti { display: none; }
  .land-program .land-state-acquisti { opacity: 1; }
  a.land-btn,
  a.land-quiet,
  .land-nav a,
  .land-already a { transition: none; }
}

.land-legal-nav {
  display: flex;
  justify-content: center;
  gap: 22px;
  padding: 28px 20px 40px;
  font-size: 14px;
}
.land-legal {
  max-width: 640px;
  margin: 0 auto;
  padding: 48px 20px 24px;
  text-align: left;
}
.land-legal h1 { font-size: 36px; margin: 0 0 28px; }
.land-legal h2 { font-size: 20px; margin: 28px 0 8px; }
.land-legal p { margin: 0; line-height: 1.55; }
