/* Regional con Alma — Live Piano Night
   Paleta: noche, sepia cálido, dorado tenue, marfil
*/
:root {
  --bg: #14100c;
  --bg-2: #1c1612;
  --bg-3: #241b15;
  --ink: #f4ece0;
  --ink-2: #e6dbc8;
  --ink-3: #b9a78a;
  --ink-4: #877863;
  --rule: #3a2c22;
  --gold: #d9b88a;
  --gold-2: #e9caa1;
  --rose: #d99a9a;
  --rose-2: #c98080;
  --ok: #8bbf86;
  --warn: #e0b04a;
  --bad: #d96a5a;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, monospace;
  --display: "Rye", "Cormorant Garamond", Georgia, serif;
  --script: "Allura", "Cormorant Garamond", cursive;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
}

a { color: var(--gold-2); text-decoration: none; }
a:hover { color: var(--gold); }
.mono { font-family: var(--mono); letter-spacing: 0.5px; }
em { font-family: var(--serif); font-style: italic; }

.overline {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 500;
}

h1, h2 { font-family: var(--serif); font-weight: 500; letter-spacing: 0.5px; }
h1 { font-size: 40px; margin: 8px 0 4px; line-height: 1.1; }
h2 { font-size: 22px; margin: 0 0 16px; color: var(--ink); }

/* ------------------------------------------------- buttons & badges */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 6px;
  font-family: var(--sans);
  font-size: 13px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  transition: transform .12s ease, background .15s ease, color .15s ease, border-color .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--gold); color: #1a1410; }
.btn-primary:hover { background: var(--gold-2); color: #1a1410; }
.btn-ghost { border-color: var(--rule); color: var(--ink-2); }
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); }
.btn-block { width: 100%; }
.btn-mini { padding: 6px 12px; font-size: 11px; letter-spacing: 1px; }
.btn-danger { color: var(--bad); border-color: var(--rule); }
.btn-danger:hover { border-color: var(--bad); }

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 500;
  border: 1px solid var(--rule);
}
.badge-active { color: var(--ink-2); }
.badge-used { color: var(--ink-4); border-color: var(--ink-4); }
.badge-void { color: var(--bad); border-color: var(--bad); }
.badge-ok { color: var(--ok); border-color: var(--ok); }
.badge-pending { color: var(--ink-4); }
.badge-error { color: var(--bad); border-color: var(--bad); }

.notice {
  padding: 12px 16px;
  border-radius: 6px;
  border-left: 3px solid var(--ink-4);
  background: var(--bg-2);
  font-size: 14px;
  margin: 16px 0;
  color: var(--ink-2);
}
.notice.ok { border-color: var(--ok); }
.notice.warn { border-color: var(--warn); }
.notice.error { border-color: var(--bad); }
.notice code { background: var(--bg-3); padding: 1px 6px; border-radius: 3px; font-size: 12px; }

/* --------------------------------------------------- fields */

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink-4);
}
.field input, .field select, .field textarea {
  background: var(--bg-2);
  border: 1px solid var(--rule);
  color: var(--ink);
  padding: 12px 14px;
  border-radius: 6px;
  font-family: var(--sans);
  font-size: 15px;
  outline: none;
  transition: border-color .15s ease;
}
.field input:focus { border-color: var(--gold); }
.field-small { max-width: 120px; }

/* --------------------------------------------------- landing */

.page-landing {
  background:
    radial-gradient(ellipse 60% 50% at 70% 30%, rgba(217, 184, 138, 0.10), transparent 70%),
    radial-gradient(ellipse 80% 60% at 20% 80%, rgba(217, 154, 154, 0.06), transparent 70%),
    #0a0807;
  position: relative;
  overflow: hidden;
}

/* Animated bokeh particles — pure CSS, GPU-friendly */
.bokeh {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.bokeh__dot {
  position: absolute;
  border-radius: 50%;
  filter: blur(8px);
  opacity: 0;
  will-change: transform, opacity;
}
@keyframes bokehFloat {
  0%   { transform: translate3d(0,0,0) scale(0.8);  opacity: 0; }
  10%  { opacity: var(--bo-opacity, 0.5); }
  90%  { opacity: var(--bo-opacity, 0.5); }
  100% { transform: translate3d(var(--bo-tx, 0px), var(--bo-ty, -120vh), 0) scale(1.2); opacity: 0; }
}
.page-landing main { position: relative; z-index: 1; }
@media (prefers-reduced-motion: reduce) { .bokeh { display: none; } }
.landing { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 56px 24px; }
.landing__inner { max-width: 680px; text-align: center; }
.landing__url { font-size: 11px; letter-spacing: 3px; color: var(--ink-3); text-transform: lowercase; }
.landing__hero { margin: 24px 0 28px; }
.landing__display {
  font-family: var(--display);
  font-size: clamp(56px, 12vw, 116px);
  line-height: 0.95;
  letter-spacing: 0.04em;
  color: var(--ink);
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.5);
  margin: 0;
}
.landing__con {
  display: block;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(20px, 3vw, 28px);
  color: var(--ink-3);
  margin: 6px 0 -4px;
  letter-spacing: 0.06em;
}
.landing__script {
  display: block;
  font-family: var(--script);
  font-weight: 400;
  font-size: clamp(80px, 16vw, 156px);
  line-height: 1;
  color: var(--ink);
  margin: -8px 0 0;
}
.landing__tagline {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(17px, 2.4vw, 22px);
  color: var(--ink-2);
  line-height: 1.5;
  margin: 32px auto 36px;
  max-width: 540px;
}
.landing__tagline::before, .landing__tagline::after {
  content: "—";
  color: var(--rose);
  margin: 0 14px;
  letter-spacing: 0;
}
.landing__date {
  font-family: var(--display);
  font-size: clamp(28px, 5vw, 44px);
  letter-spacing: 0.2em;
  color: var(--gold);
  margin: 0 0 8px;
}
.landing__when {
  font-family: var(--serif);
  font-size: 18px;
  color: var(--ink-2);
  letter-spacing: 0.06em;
}
.landing__strip {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 24px;
  align-items: center;
  margin: 36px 0 28px;
  padding: 20px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.landing__strip > div { padding: 0 8px; }
.landing__strip-key {
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--rose);
  margin-bottom: 4px;
}
.landing__strip-val {
  font-family: var(--serif);
  font-size: 18px;
  color: var(--ink);
}
.landing__strip-mid { border-left: 1px solid var(--rule); border-right: 1px solid var(--rule); }

.countdown {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  max-width: 420px;
  margin: 20px auto 0;
}
.countdown__cell {
  background: rgba(28, 22, 18, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 14px 6px 10px;
  text-align: center;
}
.countdown__num {
  display: block;
  font-family: var(--display);
  font-size: clamp(22px, 5vw, 32px);
  color: var(--gold);
  line-height: 1;
  letter-spacing: 0.05em;
  font-variant-numeric: tabular-nums;
}
.countdown__lbl {
  display: block;
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-top: 6px;
}

.landing__venue { color: var(--ink-3); font-family: var(--serif); font-size: 17px; margin: 0 0 28px; line-height: 1.5; }
.landing__cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.landing__signature { margin-top: 56px; font-size: 11px; letter-spacing: 4px; color: var(--ink-4); text-transform: uppercase; }
@media (max-width: 520px) {
  .landing__strip { grid-template-columns: 1fr; gap: 16px; }
  .landing__strip-mid { border-left: 0; border-right: 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 16px 0; }
}

/* --------------------------------------------------- auth */

.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.auth__card {
  width: 100%; max-width: 380px;
  background: var(--bg-2);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 36px 32px;
  display: flex; flex-direction: column; gap: 16px;
}
.auth__card h1 { font-size: 28px; margin: 6px 0 0; }
.auth__hint { color: var(--ink-3); font-size: 14px; margin: 0 0 8px; }
.auth__back { font-size: 12px; text-align: center; color: var(--ink-4); }

/* --------------------------------------------------- topbar */

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
  position: sticky; top: 0; z-index: 10;
  gap: 12px;
}
.topbar__title { font-family: var(--serif); font-size: 22px; margin-top: 2px; }
.topbar__nav { display: flex; gap: 8px; flex-wrap: wrap; }

/* --------------------------------------------------- admin */

.admin { max-width: 1100px; margin: 0 auto; padding: 28px 24px 64px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat { background: var(--bg-2); border: 1px solid var(--rule); border-radius: 10px; padding: 20px; text-align: left; }
.stat__num { font-family: var(--serif); font-size: 40px; color: var(--gold); line-height: 1; }
.stat__label { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--ink-4); margin-top: 6px; }

.card { background: var(--bg-2); border: 1px solid var(--rule); border-radius: 10px; padding: 24px; margin-bottom: 20px; }
.card__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; }
.card__head h2 { margin: 0; }

.form-grid { display: grid; grid-template-columns: 2fr 2fr 1fr 1fr auto; gap: 12px; align-items: end; }
.form-grid .btn { height: 44px; }
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr 1fr; } .form-grid .btn { grid-column: 1 / -1; } }

.table-wrap { overflow-x: auto; }
.tickets { width: 100%; border-collapse: collapse; }
.tickets th, .tickets td { padding: 12px 10px; text-align: left; border-bottom: 1px solid var(--rule); font-size: 14px; vertical-align: middle; }
.tickets th { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--gold); font-weight: 500; }
.tickets .email { color: var(--ink-3); font-size: 13px; }
.tickets .actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* --------------------------------------------------- ticket public */

.page-ticket {
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, rgba(217, 184, 138, 0.10), transparent 70%),
    radial-gradient(ellipse 90% 60% at 10% 90%, rgba(217, 154, 154, 0.05), transparent 70%),
    #0a0807;
}
.ticket { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 32px 16px calc(48px + env(safe-area-inset-bottom, 0)) 16px; }

/* ----------------------------------------------- Ticket stub (Broadway feel) */
.stub {
  width: 100%;
  max-width: 440px;
  background:
    linear-gradient(180deg, #221913 0%, #1a130e 60%, #14100c 100%);
  color: var(--ink);
  border-radius: 16px;
  overflow: hidden;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.55),
    0 6px 16px rgba(0, 0, 0, 0.35),
    inset 0 0 0 1px rgba(217, 184, 138, 0.20);
  position: relative;
}
.stub::before, .stub::after {
  content: "";
  position: absolute; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0.6;
}
.stub::before { top: 0; }
.stub::after { bottom: 0; }

.stub__top, .stub__bottom { padding: 28px 26px; position: relative; }
.stub__top {
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(217, 184, 138, 0.08), transparent 60%),
    transparent;
}

.stub__row { display: flex; gap: 16px; align-items: flex-start; }
.stub__row--brand { justify-content: space-between; align-items: center; }

.stub__brand { flex: 1; }
.stub__title {
  font-family: var(--display);
  font-size: clamp(28px, 7vw, 36px);
  letter-spacing: 0.04em;
  line-height: 1;
  margin-top: 4px;
}
.stub__con {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  color: var(--ink-3);
  margin: 2px 0 -4px;
  letter-spacing: 0.04em;
}
.stub__script {
  font-family: var(--script);
  font-size: clamp(48px, 12vw, 64px);
  line-height: 1;
  color: var(--ink);
  margin-top: -2px;
}
.stub__seal {
  flex-shrink: 0;
  color: var(--gold);
  opacity: 0.85;
  animation: sealSpin 60s linear infinite;
}
@keyframes sealSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .stub__seal { animation: none; } }

.stub__tagline {
  font-family: var(--serif);
  font-style: italic;
  text-align: center;
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.4;
  margin: 18px 0 22px;
  padding: 0 8px;
}

.stub__details {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  padding: 18px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.stub__cell { text-align: center; padding: 0 4px; }
.stub__cell + .stub__cell { border-left: 1px solid var(--rule); }
.stub__label {
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 4px;
}
.stub__value {
  font-family: var(--display);
  font-size: 18px;
  letter-spacing: 0.04em;
  color: var(--ink);
  line-height: 1.1;
}
.stub__value--big { font-size: 22px; }
.stub__sub { font-size: 11px; color: var(--ink-3); margin-top: 3px; letter-spacing: 0.5px; }

.stub__venue { text-align: center; margin-top: 18px; }
.stub__venue-name {
  font-family: var(--serif);
  font-size: 19px;
  color: var(--ink);
}
.stub__venue-addr { font-size: 12px; color: var(--ink-3); margin-top: 4px; letter-spacing: 0.5px; }
.stub__venue-links { margin-top: 10px; font-size: 12px; }
.stub__venue-links a { color: var(--gold-2); text-decoration: none; border-bottom: 1px dotted rgba(217,184,138,0.4); }
.stub__venue-links a:hover { color: var(--gold); border-bottom-color: var(--gold); }
.stub__venue-links .dot { color: var(--ink-4); margin: 0 8px; }

/* Perforation */
.stub__perf {
  position: relative;
  height: 28px;
  background: #0a0807;
}
.stub__notch {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px;
  background: var(--bg);
  border-radius: 50%;
}
.stub__notch--left { left: -14px; }
.stub__notch--right { right: -14px; }
.stub__dashes {
  position: absolute; left: 24px; right: 24px; top: 50%;
  height: 1px;
  background-image: linear-gradient(90deg, var(--rule) 50%, transparent 50%);
  background-size: 10px 1px;
  background-repeat: repeat-x;
}

.stub__bottom { text-align: center; padding-top: 26px; padding-bottom: 32px; }
.stub__qr {
  display: inline-block;
  background: var(--ink);
  padding: 14px;
  border-radius: 12px;
  margin-bottom: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.stub__qr img { display: block; width: 240px; height: 240px; max-width: 60vw; }
.stub__code {
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 3px;
  color: var(--gold);
  margin-bottom: 16px;
}
.stub__owner { margin: 12px 0 8px; }
.stub__owner-name {
  font-family: var(--serif);
  font-size: 18px;
  color: var(--ink);
}
.stub__hint { color: var(--ink-4); font-size: 12px; margin-top: 14px; line-height: 1.5; }
.stub__status { margin-top: 16px; text-align: left; }

.stub--used { opacity: 0.7; }
.stub--used::after { background: linear-gradient(90deg, transparent, var(--ok), transparent); }
.stub--void { opacity: 0.55; }
.stub--void::after { background: linear-gradient(90deg, transparent, var(--bad), transparent); }
.stub--void .stub__qr { filter: grayscale(1) brightness(0.85); }
.stub--void::before { background: linear-gradient(90deg, transparent, var(--bad), transparent); }

.ticket__footer { text-align: center; margin-top: 20px; }

.ticket__actions {
  margin-top: 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  max-width: 440px;
  width: 100%;
}
.ticket__actions .btn { padding: 12px 18px; font-size: 12px; }
.ticket__actions .btn-primary { flex: 1 1 100%; }

.ios-tip {
  max-width: 440px;
  margin-top: 16px;
  padding: 14px 18px;
  background: var(--bg-2);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--gold);
  border-radius: 8px;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.55;
}
.ios-tip em { font-style: italic; color: var(--gold); }

.ticket__siblings {
  display: block;
  max-width: 440px;
  margin-top: 16px;
  padding: 14px 18px;
  background: rgba(217, 184, 138, 0.08);
  border: 1px solid var(--rule);
  border-radius: 8px;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.5;
  text-decoration: none;
  text-align: center;
  transition: border-color .15s ease, background .15s ease;
}
.ticket__siblings:hover { border-color: var(--gold); background: rgba(217, 184, 138, 0.14); color: var(--gold); }
.ticket__siblings strong { color: var(--gold); font-weight: 600; }

.ticket__share-row {
  margin-top: 16px;
  display: flex;
  gap: 8px;
  max-width: 440px;
  width: 100%;
}
.ticket__share-row .share-btn { flex: 1 1 0; }

/* --------------------------------------------------- order distribution page */

.page-order {
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, rgba(217, 184, 138, 0.10), transparent 70%),
    #0a0807;
  min-height: 100vh;
  min-height: 100dvh;
}
.order {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 18px calc(48px + env(safe-area-inset-bottom, 0)) 18px;
}
.order__head { text-align: center; margin-bottom: 28px; }
.order__title {
  font-family: var(--display);
  font-size: clamp(36px, 8vw, 56px);
  margin: 8px 0 2px;
  letter-spacing: 0.04em;
}
.order__title em {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.5em;
  color: var(--ink-3);
}
.order__alma { font-family: var(--script); font-weight: 400; font-size: 1.05em; }
.order__sub { font-family: var(--serif); font-style: italic; color: var(--ink-3); margin: 8px 0 18px; }
.order__intro {
  max-width: 500px;
  margin: 0 auto;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-3);
  padding: 0 8px;
}

.order__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }

.order-card {
  background: linear-gradient(180deg, var(--bg-2), #1a130c);
  border: 1px solid var(--rule);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}
.order-card--used { opacity: 0.6; }
.order-card--void { opacity: 0.5; }
.order-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--rule);
  background: rgba(217, 184, 138, 0.04);
}
.order-card__num {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
}
.order-card__body {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 18px;
  align-items: center;
  padding: 18px;
}
.order-card__qr {
  display: block;
  background: var(--ink);
  padding: 8px;
  border-radius: 8px;
  line-height: 0;
}
.order-card__qr img { width: 104px; height: 104px; display: block; }
.order-card__info { min-width: 0; }
.order-card__code {
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 2px;
  color: var(--gold);
  margin-bottom: 8px;
}
.order-card__link {
  display: block;
  color: var(--ink-3);
  font-size: 11px;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.order-card__link:hover { color: var(--gold); }

.order-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 14px 14px;
}
.share-btn {
  flex: 1 1 calc(50% - 6px);
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 8px;
  background: rgba(217, 184, 138, 0.06);
  border: 1px solid var(--rule);
  border-radius: 8px;
  color: var(--ink-2);
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .12s ease;
}
.share-btn:hover { border-color: var(--gold); color: var(--gold); background: rgba(217, 184, 138, 0.12); }
.share-btn:active { transform: scale(0.97); }
.share-btn--ok { border-color: var(--ok); color: var(--ok); background: rgba(123, 184, 122, 0.12); }
.share-btn__icon { font-size: 14px; }
@media (min-width: 520px) {
  .share-btn { flex: 0 1 auto; padding: 10px 14px; }
}

.order__footer { margin-top: 30px; text-align: center; padding: 0 16px; }

/* --------------------------------------------------- scan */

.page-scan { background: #000; overscroll-behavior: none; }
.topbar--scan {
  background: rgba(14, 11, 8, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
}
.scan { padding: 0; max-width: 700px; margin: 0 auto; }

/* Start screen */
.scan__start {
  text-align: center;
  padding: 56px 28px calc(48px + env(safe-area-inset-bottom, 0px));
  min-height: calc(100vh - 80px);
  min-height: calc(100dvh - 80px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 20px;
}
.scan__start-icon {
  width: 96px; height: 96px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--bg-2);
  border: 1px solid var(--rule);
  color: var(--gold);
  margin-bottom: 4px;
}
.scan__start h2 { font-family: var(--serif); font-size: 32px; margin: 0; }
.scan__start-hint { color: var(--ink-3); font-size: 15px; line-height: 1.5; margin: 0 0 16px; max-width: 320px; }
.scan__start .btn { max-width: 320px; }

/* Camera view */
.scan__camera {
  position: relative;
  background: #000;
  height: calc(100vh - 64px);
  height: calc(100dvh - 64px);
  max-height: 92vh;
  overflow: hidden;
}
#reader { width: 100%; height: 100%; }
#reader video { width: 100% !important; height: 100% !important; object-fit: cover; }
/* Hide html5-qrcode's default UI; we provide our own */
#reader div[style*="text-align: center"],
#reader > div > div:first-child,
#reader > div > img,
#reader__dashboard,
#reader__scan_region img,
#reader__filescan_input { display: none !important; }
#reader__scan_region { background: transparent !important; padding: 0 !important; }

.scan__overlay { position: absolute; inset: 0; pointer-events: none; display: grid; place-items: center; }
.scan__frame {
  position: relative;
  width: min(70vw, 320px); aspect-ratio: 1;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
  border-radius: 24px;
}
.scan__corner {
  position: absolute; width: 28px; height: 28px;
  border: 3px solid var(--gold);
}
.scan__corner--tl { top: -2px; left: -2px; border-right: none; border-bottom: none; border-top-left-radius: 16px; }
.scan__corner--tr { top: -2px; right: -2px; border-left: none; border-bottom: none; border-top-right-radius: 16px; }
.scan__corner--bl { bottom: -2px; left: -2px; border-right: none; border-top: none; border-bottom-left-radius: 16px; }
.scan__corner--br { bottom: -2px; right: -2px; border-left: none; border-top: none; border-bottom-right-radius: 16px; }
@keyframes scanPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.scan__frame::after {
  content: "";
  position: absolute; left: 8%; right: 8%; top: 50%; height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  animation: scanLine 2.4s ease-in-out infinite;
}
@keyframes scanLine {
  0%, 100% { transform: translateY(-100%); opacity: 0; }
  10% { opacity: 1; }
  50% { transform: translateY(100%); opacity: 1; }
  60% { opacity: 0; }
}

.scan__hint {
  position: absolute; left: 0; right: 0;
  top: calc(50% + min(36vw, 165px) + 16px);
  text-align: center;
  color: var(--ink-2);
  font-family: var(--serif); font-style: italic;
  font-size: 17px;
  text-shadow: 0 1px 6px rgba(0,0,0,0.7);
  pointer-events: none;
}
.scan__chips {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 8px;
}
.scan__chip {
  background: rgba(14, 11, 8, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--ink);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  border: 1px solid var(--rule);
}
.scan__chip[data-kind="ok"] { color: var(--ok); border-color: var(--ok); }
.scan__chip[data-kind="loading"] { color: var(--gold); border-color: var(--gold); }
.scan__chip[data-kind="warn"] { color: var(--warn); border-color: var(--warn); }
.scan__chip[data-kind="error"] { color: var(--bad); border-color: var(--bad); }

.scan__controls {
  position: absolute;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  left: 0; right: 0;
  display: flex; justify-content: center; gap: 18px;
  pointer-events: none;
}
.scan__controls .btn-circle { pointer-events: auto; }
.btn-circle {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: rgba(14, 11, 8, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--rule);
  color: var(--ink);
  display: grid; place-items: center;
  cursor: pointer;
  transition: transform .12s ease, background .15s ease, color .15s ease, border-color .15s ease;
}
.btn-circle:active { transform: scale(0.92); }
.btn-circle.on { background: var(--gold); color: #14100c; border-color: var(--gold); }
.btn-circle--danger:hover { border-color: var(--bad); color: var(--bad); }

.scan__manual { padding: 20px 16px; }
.scan__result {
  padding: 16px;
  position: sticky;
  bottom: 0;
  background: linear-gradient(180deg, transparent 0%, rgba(14, 11, 8, 0.9) 30%, var(--bg) 100%);
  z-index: 5;
}
.scan__result:empty { display: none; }

.scan__diag { margin: 20px 16px; color: var(--ink-4); font-size: 12px; }
.scan__diag pre { background: var(--bg-2); padding: 12px; border-radius: 6px; max-height: 200px; overflow: auto; font-size: 11px; }

.result {
  display: flex; align-items: center; gap: 16px;
  padding: 22px 24px;
  border-radius: 12px;
  background: var(--bg-2);
  border: 1px solid var(--rule);
}
.result__icon {
  width: 56px; height: 56px;
  display: grid; place-items: center;
  border-radius: 50%;
  font-size: 30px; font-weight: 600;
  flex-shrink: 0;
}
.result__title { font-family: var(--serif); font-size: 26px; line-height: 1.1; }
.result__name { font-size: 18px; color: var(--ink-2); margin-top: 2px; }
.result__sub { font-size: 13px; color: var(--ink-4); margin-top: 4px; }

.result-ok { border-color: var(--ok); background: linear-gradient(180deg, rgba(123,184,122,0.12), var(--bg-2)); }
.result-ok .result__icon { background: var(--ok); color: #0a1209; }
.result-warn { border-color: var(--warn); background: linear-gradient(180deg, rgba(224,176,74,0.12), var(--bg-2)); }
.result-warn .result__icon { background: var(--warn); color: #1a1410; }
.result-error { border-color: var(--bad); background: linear-gradient(180deg, rgba(217,106,90,0.12), var(--bg-2)); }
.result-error .result__icon { background: var(--bad); color: #1a1410; }
.result__hint { color: var(--ink-3); font-size: 13px; margin-top: 6px; }

/* ----------------------------------------------- valid-scan welcome */

.result-welcome {
  position: relative;
  overflow: hidden;
  padding: 32px 28px 36px;
  text-align: center;
  border-color: var(--gold);
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(217, 184, 138, 0.18), transparent 70%),
    linear-gradient(180deg, #1a130c, #14100c);
  box-shadow: 0 20px 60px rgba(0,0,0,0.4), inset 0 0 0 1px rgba(217, 184, 138, 0.25);
}
.welcome { position: relative; z-index: 2; }
.welcome__check {
  width: 88px; height: 88px;
  border-radius: 50%;
  margin: 0 auto 18px;
  display: grid; place-items: center;
  background: radial-gradient(circle, rgba(123, 184, 122, 0.2), transparent 70%);
  color: var(--ok);
  animation: pop .5s cubic-bezier(.34,1.56,.64,1);
}
.welcome__check-path {
  stroke-dasharray: 60;
  stroke-dashoffset: 60;
  animation: drawCheck .55s ease-out .2s forwards;
}
@keyframes drawCheck { to { stroke-dashoffset: 0; } }
@keyframes pop {
  0% { transform: scale(0.4); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.welcome__greeting {
  font-family: var(--serif); font-style: italic;
  font-size: 22px;
  color: var(--gold);
  margin: 4px 0 2px;
  animation: fadeUp .5s ease-out .35s both;
}
.welcome__name {
  font-family: var(--script);
  font-size: clamp(40px, 9vw, 56px);
  line-height: 1.05;
  color: var(--ink);
  margin: 4px 0 10px;
  animation: fadeUp .5s ease-out .45s both;
}
.welcome__sub {
  font-size: 13px;
  color: var(--ink-3);
  letter-spacing: 1px;
  animation: fadeUp .5s ease-out .55s both;
}
.welcome__sub .welcome__dot { margin: 0 8px; color: var(--gold); }
.welcome__bar {
  width: 60px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  margin: 18px auto 12px;
  animation: fadeUp .5s ease-out .7s both;
}
.welcome__tag {
  font-family: var(--sans);
  font-size: 11px; letter-spacing: 4px; text-transform: uppercase;
  color: var(--gold-2);
  animation: fadeUp .5s ease-out .8s both;
}
@keyframes fadeUp {
  0% { opacity: 0; transform: translateY(6px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* Confetti */
.welcome__confetti {
  position: absolute; inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.welcome__confetti span {
  position: absolute;
  top: -10px;
  width: 8px; height: 8px;
  background: var(--gold);
  opacity: 0;
  border-radius: 1px;
  animation: confettiFall 1.6s ease-in forwards;
}
.welcome__confetti span:nth-child(1) { left: 6%;  background: var(--gold);  animation-delay: 0.10s; transform: rotate(15deg); }
.welcome__confetti span:nth-child(2) { left: 18%; background: var(--rose);  animation-delay: 0.18s; transform: rotate(-22deg); width: 6px; height: 12px; }
.welcome__confetti span:nth-child(3) { left: 30%; background: var(--gold-2); animation-delay: 0.05s; transform: rotate(40deg); }
.welcome__confetti span:nth-child(4) { left: 42%; background: var(--ink);   animation-delay: 0.22s; transform: rotate(-10deg); width: 5px; height: 10px; }
.welcome__confetti span:nth-child(5) { left: 54%; background: var(--gold);  animation-delay: 0.12s; transform: rotate(28deg); }
.welcome__confetti span:nth-child(6) { left: 66%; background: var(--rose-2);animation-delay: 0.30s; transform: rotate(-35deg); width: 7px; height: 10px; }
.welcome__confetti span:nth-child(7) { left: 76%; background: var(--gold-2); animation-delay: 0.08s; transform: rotate(20deg); }
.welcome__confetti span:nth-child(8) { left: 86%; background: var(--ink-2); animation-delay: 0.26s; transform: rotate(-50deg); }
.welcome__confetti span:nth-child(9) { left: 94%; background: var(--gold);  animation-delay: 0.16s; transform: rotate(12deg); width: 5px; height: 9px; }
.welcome__confetti span:nth-child(10){ left: 50%; background: var(--rose);  animation-delay: 0.34s; transform: rotate(0deg); }
@keyframes confettiFall {
  0%   { opacity: 0; transform: translateY(0) rotate(0deg); }
  10%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(360px) rotate(540deg); }
}
@media (prefers-reduced-motion: reduce) {
  .welcome__confetti, .welcome__check-path, .welcome__check { animation: none; }
}

@keyframes flashOk { 0% { background-color: rgba(123,184,122,0.4); } 100% { background-color: transparent; } }
@keyframes flashBad { 0% { background-color: rgba(217,106,90,0.4); } 100% { background-color: transparent; } }
.flash-ok { animation: flashOk .6s ease-out; }
.flash-bad { animation: flashBad .6s ease-out; }

.lookup-empty { color: var(--ink-4); padding: 12px 4px; font-size: 13px; }
.lookup-list { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 8px; }
.lookup-item {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-2);
  border: 1px solid var(--rule);
  border-radius: 8px;
}
.lookup-item__name { font-family: var(--serif); font-size: 18px; color: var(--ink); }
.lookup-item__meta { font-size: 12px; color: var(--ink-4); margin-top: 2px; }
