@font-face {
  font-family: "digital";
  src: url("../assets/datestamp.otf") format("opentype");
  font-display: swap;
}

:root {
  /* Paleta del cliente */
  --cream: #E4D5B7;
  --card: #C9B79C;
  --taupe: #A78A7F;
  --coffee: #6E5B5B;
  --char: #3F3A3A;
  /* Extras */
  --paper: #F4EEE3;
  --field: #EFE5D0;
  --stamp: #F08A3C;
  --vf: #171414;
  --counter: #0f0d0d;
  --plastic: #2a2626;
  --plastic-2: #4b4545;
  --hard: #1f1c1c;
  --film: #231f1f;

  --display: "Young Serif", Georgia, serif;
  --ui: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Space Mono", ui-monospace, Menlo, Consolas, monospace;
  --texture: radial-gradient(rgba(228, 213, 183, .05) 1px, transparent 1.2px);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--ui);
  color: var(--char);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}
body.dark {
  color: var(--cream);
  background-color: var(--char);
  background-image: var(--texture);
  background-size: 5px 5px;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
a { color: var(--coffee); }

.sr-only, .file-input {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; opacity: 0;
}

/* ─── Tipografía base ─── */
.display { font-family: var(--display); font-weight: 400; letter-spacing: -.01em; margin: 0; }
.label {
  font: 700 10px/1.2 var(--mono); letter-spacing: .14em; text-transform: uppercase;
  color: var(--coffee);
}
body.dark .label { color: var(--card); }
.h44 { font-size: 44px; line-height: 1.02; }
.lead { font-size: 17px; line-height: 1.45; margin: 16px 0 0; text-wrap: pretty; }
.digital { font-family: "digital", var(--mono); }

.credit {
  margin: 0; padding: 22px 0 max(9px, var(--safe-bottom));
  text-align: center; font: 400 10px/1.4 var(--mono); letter-spacing: .08em; color: var(--coffee);
}
body.dark .credit { color: var(--card); }
.credit a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 2px; }
/* Disparar: al pie, bajo los controles, sin robarle alto al visor */
.shoot .controls { padding-bottom: 6px; }
.shoot .credit { flex: none; padding: 2px 0 max(9px, var(--safe-bottom)); }
/* Preparando / subiendo: el contenido va centrado; el crédito, fijo al fondo */
.view.loading { position: relative; }
.loading > .credit { position: absolute; left: 0; right: 0; bottom: 0; }

/* ─── Botones ─── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 52px; padding: 0 1.4em;
  border-radius: 16px; border: 0;
  font: 700 17px/1 var(--ui);
  cursor: pointer; text-decoration: none; user-select: none;
  transition: transform 90ms, box-shadow 90ms, opacity .15s;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn.dark { background: var(--char); color: var(--cream); box-shadow: 0 4px 0 var(--hard); }
.btn.dark:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--hard); }
.btn.light { background: var(--cream); color: var(--char); box-shadow: 0 4px 0 var(--coffee); }
.btn.light:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--coffee); }
.btn.ghost { background: transparent; border: 1.5px solid currentColor; }
.btn.block { width: 100%; }
.btn.tall { min-height: 58px; }

/* ─── Pantallas ─── */
.screen {
  width: 100%; max-width: 480px; margin: 0 auto;
  min-height: 100svh; display: flex; flex-direction: column;
}

/* 01 Bienvenida */
.welcome { padding: calc(28px + var(--safe-top)) 28px 0; }
.meta-row { display: flex; justify-content: space-between; gap: 12px; }
.welcome-title { font-size: 48px; line-height: 1; margin-top: 18px; overflow-wrap: anywhere; }

.dispo { position: relative; flex: none; width: 300px; height: 172px; margin: 30px auto 0; transform: rotate(-3deg); }
.dispo > * { position: absolute; }
.dispo-wind { left: 30px; top: -10px; width: 48px; height: 16px; border-radius: 6px 6px 0 0; background: #2e2a2a; }
.dispo-body {
  inset: 0; border-radius: 16px; background: var(--char);
  box-shadow: 0 18px 30px rgba(63, 58, 58, .35), inset 0 2px 0 rgba(255, 255, 255, .08);
}
.dispo-sleeve {
  left: 0; right: 0; top: 38px; bottom: 22px; background: var(--card);
  display: flex; flex-direction: column; justify-content: flex-end; padding: 0 16px 10px;
}
.dispo-sleeve::before, .dispo-sleeve::after { content: ""; position: absolute; left: 0; right: 0; }
.dispo-sleeve::before { top: 8px; height: 4px; background: var(--coffee); }
.dispo-sleeve::after { top: 15px; height: 2px; background: var(--taupe); }
.dispo-brand {
  max-width: 104px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font: 400 24px/1.1 var(--display); color: var(--char);
}
.dispo-roll { max-width: 100px; font: 700 8px/1.4 var(--mono); letter-spacing: .12em; color: var(--char); }
.dispo-window { left: 18px; top: 12px; width: 34px; height: 22px; border-radius: 5px; background: #1b1818; box-shadow: inset 0 0 0 2px #574f4f; }
.dispo-flash {
  right: 18px; top: 10px; width: 74px; height: 36px; border-radius: 6px;
  background: repeating-linear-gradient(90deg, #efe7d6 0 3px, #d9ccb2 3px 6px);
  box-shadow: inset 0 0 0 3px #574f4f;
}
.dispo-lens {
  left: 128px; top: 46px; width: 96px; height: 96px; border-radius: 50%; background: var(--plastic);
  box-shadow: 0 0 0 6px var(--char), 0 0 0 9px var(--coffee), 0 6px 14px rgba(0, 0, 0, .4);
}
.dispo-lens::after {
  content: ""; position: absolute; inset: 18px; border-radius: 50%;
  background: radial-gradient(circle at 38% 34%, #8d7c7c 0 8%, #2b2528 18%, #0e0c0d 70%);
  box-shadow: 0 0 0 4px #1a1717;
}
@media (max-width: 359px) {
  .dispo { transform: rotate(-3deg) scale(.86); margin: 20px auto -12px; }
}

.pitch { font-size: 16px; line-height: 1.45; margin: 34px 0 0; text-wrap: pretty; }

.join-form { display: flex; flex-direction: column; gap: 10px; margin-top: auto; padding-top: 28px; }
.text-input {
  width: 100%; height: 54px; padding: 0 16px;
  border-radius: 14px; border: 1.5px solid var(--card); background: var(--field);
  font: 500 18px/1 var(--ui); color: var(--char); outline: none;
}
.text-input::placeholder { color: var(--taupe); }
.text-input:focus, .text-input[aria-invalid="true"] { border-color: var(--coffee); }
.form-error { font: 500 13px/1.35 var(--ui); color: var(--coffee); }
.form-error .btn { margin-top: 10px; min-height: 44px; font-size: 15px; }
.form-note { margin: 0; font-size: 12px; line-height: 1.4; color: var(--coffee); text-align: center; }

/* 05 Cámara cerrada / esperando revelado (crema) */
.closed-screen { padding: calc(40px + var(--safe-top)) 28px 0; background: var(--cream); color: var(--char); }
.closed-screen .label, .closed-screen .credit { color: var(--coffee); }
.closed-screen .h44 { margin-top: 18px; }
.seal {
  align-self: flex-start; margin-top: 28px; transform: rotate(-4deg);
  border: 2px solid var(--coffee); border-radius: 8px; padding: 10px 14px;
  display: flex; flex-direction: column; gap: 4px;
}
.seal-who { font: 500 15px/1.2 var(--ui); color: var(--char); }
.closed-bottom { margin-top: auto; padding-top: 36px; display: flex; flex-direction: column; gap: 14px; }
.closed-bottom p { margin: 0; font-size: 14px; line-height: 1.4; }

/* Cuenta regresiva */
.cd { display: flex; gap: 8px; }
.cd-cell { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; }
.cd-card .cd-cell { background: var(--char); border-radius: 8px; padding: 8px 0 7px; gap: 4px; }
.cd-card b { font: 700 20px/1 var(--mono); color: var(--cream); }
.cd-card span { font: 700 8px/1 var(--mono); letter-spacing: .12em; color: var(--card); }
.cd-flip .cd-cell { gap: 8px; }
.cd-flip b {
  position: relative; width: 100%; height: 78px; border-radius: 12px; background: var(--char);
  display: flex; align-items: center; justify-content: center;
  font: 700 34px/1 var(--mono); color: var(--cream); box-shadow: 0 4px 0 var(--hard);
}
.cd-flip b::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: rgba(0, 0, 0, .55); }
.cd-flip span { font: 700 9px/1 var(--mono); letter-spacing: .14em; color: var(--char); }

/* ─── Cámara ─── */
.view { width: 100%; max-width: 480px; margin: 0 auto; min-height: 100svh; display: flex; flex-direction: column; }

/* 02 Preparando / subiendo */
.loading { justify-content: center; gap: 30px; padding: calc(20px + var(--safe-top)) 32px 20px; overflow: hidden; }
.loading h1 { font-size: 36px; line-height: 1.08; color: var(--cream); margin-top: 10px; }
.loading p { margin: 0; font-size: 15px; line-height: 1.45; color: var(--card); }
.film { position: relative; flex: none; height: 76px; margin: 0 -32px; background: var(--film); overflow: hidden; }
.film::before, .film::after {
  content: ""; position: absolute; left: 0; right: 0; height: 8px; opacity: .55;
  background: repeating-linear-gradient(90deg, var(--card) 0 8px, transparent 8px 20px);
}
.film::before { top: 6px; }
.film::after { bottom: 6px; }
.film.moving::before, .film.moving::after { animation: sprockets .5s linear infinite; }
@keyframes sprockets { to { background-position-x: 20px; } }
.film-fill {
  position: absolute; left: 0; top: 20px; bottom: 20px; width: 0;
  background: repeating-linear-gradient(90deg, var(--taupe) 0 72px, var(--film) 72px 78px);
  transition: width 650ms cubic-bezier(.3, .7, .3, 1);
}
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.checklist li { display: flex; align-items: center; gap: 12px; font: 500 15px/1.2 var(--ui); color: var(--taupe); transition: color 300ms; }
.checklist li.ok { color: var(--cream); }
.checklist .mark { flex: none; width: 28px; font: 700 12px/1 var(--mono); }
.load-error { color: var(--cream) !important; }

/* 03 Disparar */
.shoot { height: 100svh; min-height: 0; padding-top: calc(18px + var(--safe-top)); }
.cam-head { display: flex; justify-content: space-between; gap: 12px; padding: 0 22px 14px; }
.cam-head > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.vf {
  position: relative; flex: 1; min-height: 180px; margin: 0 16px; isolation: isolate;
  border-radius: 24px; background: var(--vf); overflow: hidden;
  box-shadow: 0 0 0 6px var(--plastic-2), 0 0 0 7px var(--plastic);
}
.vf video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.vf-stripes { position: absolute; inset: 0; background: repeating-linear-gradient(135deg, rgba(228, 213, 183, .07) 0 1px, transparent 1px 10px); }
.vf-empty {
  position: absolute; inset: 0; padding: 0 40px;
  display: flex; align-items: center; justify-content: center; text-align: center;
  font: 400 11px/1.5 var(--mono); color: var(--taupe);
}
.vf.live .vf-stripes, .vf.live .vf-empty { display: none; }
.vf-vignette { position: absolute; inset: 0; box-shadow: inset 0 0 70px rgba(0, 0, 0, .85); pointer-events: none; }
.vf-corner { position: absolute; width: 26px; height: 26px; border: 0 solid var(--cream); opacity: .7; }
.vf-corner.tl { left: 18px; top: 18px; border-left-width: 2px; border-top-width: 2px; }
.vf-corner.bl { left: 18px; bottom: 18px; border-left-width: 2px; border-bottom-width: 2px; }
.vf-corner.br { right: 18px; bottom: 18px; border-right-width: 2px; border-bottom-width: 2px; }
.vf-iso { position: absolute; left: 56px; top: 24px; font: 700 10px/1 var(--mono); letter-spacing: .12em; color: var(--cream); }

.counter { position: absolute; right: 14px; top: 14px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.counter-win {
  position: relative; width: 66px; height: 50px; border-radius: 10px; overflow: hidden;
  background: var(--counter); box-shadow: inset 0 3px 8px rgba(0, 0, 0, .95), 0 0 0 4px var(--plastic-2);
}
.counter-col { position: absolute; left: 0; right: 0; top: 0; transition: transform 700ms cubic-bezier(.5, -.35, .3, 1.4); }
.counter-col div { height: 50px; display: flex; align-items: center; justify-content: center; font: 700 30px/1 var(--mono); color: var(--cream); }
.counter-win::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, .75), transparent 30%, transparent 70%, rgba(0, 0, 0, .75));
}
.counter-lbl { font: 700 9px/1 var(--mono); letter-spacing: .14em; color: var(--cream); }

.roll-toast {
  position: absolute; left: 50%; bottom: 28px; width: min(250px, calc(100% - 32px));
  transform: translateX(-50%) translateY(12px); opacity: 0;
  transition: opacity 260ms, transform 260ms; pointer-events: none;
  background: var(--cream); color: var(--char); border-radius: 14px; padding: 12px 18px; text-align: center;
  box-shadow: 0 12px 24px rgba(0, 0, 0, .4);
}
.roll-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.roll-toast .display { font-size: 22px; line-height: 1.1; }
.roll-toast p { margin: 4px 0 0; font-size: 13px; line-height: 1.35; }

.band {
  flex: none; margin-top: 18px; padding: 9px 22px; background: var(--card);
  display: flex; justify-content: space-between; gap: 10px;
  font: 700 9px/1 var(--mono); letter-spacing: .14em; color: var(--char); white-space: nowrap;
  box-shadow: 0 -2px 0 rgba(0, 0, 0, .25), 0 2px 0 rgba(0, 0, 0, .25);
}
.band > span { overflow: hidden; text-overflow: ellipsis; }

.controls {
  flex: none; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center; gap: 12px; padding: 22px 22px max(22px, calc(10px + var(--safe-bottom)));
}
.gallery-link {
  justify-self: start; padding: 6px 0; cursor: pointer;
  font: 400 12px/1.35 var(--ui); color: var(--taupe); text-decoration: underline; text-underline-offset: 3px;
}
.shutter-col { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.shutter-well {
  width: 128px; height: 128px; border-radius: 50%; background: var(--plastic);
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 4px 10px rgba(0, 0, 0, .7), 0 1px 0 rgba(228, 213, 183, .12);
}
.shutter {
  width: 100px; height: 100px; border-radius: 50%; border: 0; cursor: pointer;
  background: radial-gradient(circle at 36% 30%, #F2E9D6, var(--cream) 45%, var(--card) 100%);
  box-shadow: 0 6px 0 var(--coffee), 0 14px 20px rgba(0, 0, 0, .5), inset 0 -5px 10px rgba(110, 91, 91, .35);
  transition: transform 90ms, box-shadow 90ms, opacity 200ms;
}
.shutter:active:not(:disabled) {
  transform: translateY(5px);
  box-shadow: 0 1px 0 var(--coffee), 0 4px 8px rgba(0, 0, 0, .5), inset 0 -3px 8px rgba(110, 91, 91, .35);
}
.shutter:disabled { cursor: default; }
.shutter-lbl { font: 700 11px/1 var(--mono); letter-spacing: .2em; color: var(--cream); }
.wheel-col { justify-self: end; }
.wheel {
  position: relative; width: 44px; height: 116px; border-radius: 12px; overflow: hidden;
  cursor: ns-resize; touch-action: none;
  box-shadow: 0 0 0 3px var(--plastic), 0 6px 14px rgba(0, 0, 0, .4);
}
.wheel-strip {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(180deg, #221e1e 0 4px, #5c5252 4px 7px, #2e2929 7px 9px);
  transition: background-position 650ms cubic-bezier(.3, .7, .3, 1);
}
.wheel.dragging .wheel-strip { transition: none; }
.wheel::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, .8), transparent 35%, transparent 65%, rgba(0, 0, 0, .8)),
              linear-gradient(90deg, rgba(255, 255, 255, .14), transparent 40%);
}
@media (max-height: 680px) {
  .shoot { padding-top: calc(12px + var(--safe-top)); }
  .band { margin-top: 14px; }
  .controls { padding-top: 14px; }
  .shutter-well { width: 104px; height: 104px; }
  .shutter { width: 82px; height: 82px; }
  .wheel { height: 96px; }
}

/* Elegir filtro */
.edit { height: 100svh; min-height: 0; gap: 14px; padding: calc(18px + var(--safe-top)) 16px max(18px, calc(10px + var(--safe-bottom))); }
.edit-head { display: flex; justify-content: space-between; gap: 12px; padding: 0 6px; }
.preview-wrap { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.print-frame {
  position: relative; background: var(--paper); padding: 10px 10px 34px;
  transform: rotate(-1.2deg); box-shadow: 0 20px 40px rgba(0, 0, 0, .5);
}
.print-frame canvas {
  display: block; width: auto; height: auto; min-width: 120px; min-height: 90px; background: var(--plastic);
  max-width: calc(min(100vw, 480px) - 64px); max-height: max(160px, calc(100svh - 340px));
}
.print-filter {
  position: absolute; left: 12px; bottom: 12px;
  font: 400 10px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--taupe);
}
.busy {
  position: absolute; right: 8px; bottom: 8px;
  font: 700 10px/1 var(--mono); letter-spacing: .1em; color: var(--cream);
  background: rgba(0, 0, 0, .6); padding: 6px 8px; border-radius: 6px;
}
.filter-strip {
  flex: none; display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 6px;
  scroll-snap-type: x proximity; scrollbar-width: none;
}
.filter-strip::-webkit-scrollbar { display: none; }
.filter-chip {
  flex: 0 0 auto; width: 78px; scroll-snap-align: start;
  background: none; border: 0; padding: 0; color: var(--card); cursor: pointer; text-align: center;
}
.filter-chip canvas {
  display: block; width: 78px; height: 58px; object-fit: cover; border-radius: 6px;
  background: var(--plastic); box-shadow: 0 0 0 2px transparent; margin: 2px;
  max-width: calc(100% - 4px);
}
.filter-chip[aria-selected="true"] canvas { box-shadow: 0 0 0 2px var(--cream); }
.filter-chip .name { display: block; margin-top: 6px; font: 700 9px/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.filter-chip[aria-selected="true"] .name { color: var(--cream); }
.filter-chip .badge {
  display: inline-block; margin-top: 4px; padding: 2px 5px; border-radius: 4px;
  font: 700 8px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase;
  color: var(--char); background: var(--stamp);
}
.edit-actions { flex: none; display: grid; grid-template-columns: 1fr 1.4fr; gap: 12px; }
.edit-actions .btn.ghost { color: var(--cream); border-color: var(--plastic-2); }

/* 04 Rollo agotado */
.empty { padding: calc(40px + var(--safe-top)) 28px 0; }
.big-counter {
  position: relative; flex: none; width: 132px; height: 100px; margin-left: 7px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font: 700 64px/1 var(--mono); color: var(--cream); background: var(--counter);
  box-shadow: inset 0 3px 8px rgba(0, 0, 0, .95), 0 0 0 6px var(--plastic-2), 0 0 0 7px var(--plastic);
}
.big-counter::after {
  content: ""; position: absolute; inset: 0; border-radius: 16px;
  background: linear-gradient(180deg, rgba(0, 0, 0, .7), transparent 30%, transparent 70%, rgba(0, 0, 0, .7));
}
.empty h1 { font-size: 44px; line-height: 1.02; color: var(--cream); margin-top: 40px; }
.empty .lead { color: var(--card); margin-bottom: 32px; }
.reveal-card {
  margin-top: auto; padding: 20px; border-radius: 18px;
  display: flex; flex-direction: column; gap: 14px;
  background: var(--cream); color: var(--char);
  transform: rotate(-1.2deg); box-shadow: 0 14px 26px rgba(0, 0, 0, .35);
}
body.dark .reveal-card .label { color: var(--coffee); }
.reveal-card .display { font-size: 22px; line-height: 1.15; }
.reveal-card p { margin: 0; font-size: 13px; line-height: 1.4; }

/* Avisos y flash */
.toast {
  position: fixed; left: 50%; bottom: max(24px, var(--safe-bottom)); z-index: 30;
  transform: translateX(-50%) translateY(30px); opacity: 0;
  width: max-content; max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 14px;
  background: var(--cream); color: var(--char); font: 500 14px/1.35 var(--ui); text-align: center;
  box-shadow: 0 12px 24px rgba(0, 0, 0, .4);
  transition: opacity .25s, transform .25s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.flash-overlay { position: fixed; inset: 0; z-index: 40; background: #fff; opacity: 0; pointer-events: none; }
.flash-overlay.go { animation: flash 750ms ease-out; }
@keyframes flash { 0% { opacity: 0; } 7% { opacity: 1; } 100% { opacity: 0; } }

/* ─── 06 Galería ─── */
.album-page { width: 100%; max-width: 1100px; margin: 0 auto; min-height: 100svh; display: flex; flex-direction: column; }
.album-head {
  position: sticky; top: 0; z-index: 5; background: var(--cream);
  display: flex; flex-direction: column; gap: 10px;
  padding: calc(24px + var(--safe-top)) 20px 14px; border-bottom: 1px solid rgba(63, 58, 58, .18);
}
.album-head h1 { font-size: 32px; line-height: 1.05; }
.album-head .count { color: var(--char); letter-spacing: .1em; }
.pills { display: flex; gap: 6px; }
.pill {
  height: 34px; padding: 0 14px; border-radius: 17px; border: 1.5px solid var(--char); cursor: pointer;
  background: transparent; color: var(--char); font: 500 13px/1 var(--ui);
}
.pill[aria-pressed="true"] { background: var(--char); color: var(--cream); }
.album { padding: 0 14px; }
.hour { display: flex; flex-direction: column; gap: 10px; padding-top: 20px; }
.hour-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 0 2px; }
.hour-head .display { font-size: 19px; line-height: 1.1; }
.hour-head .label { font-size: 9px; letter-spacing: .1em; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 700px) { .grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; } }
.print {
  display: block; width: 100%; border: 0; padding: 4px 4px 12px; border-radius: 2px; cursor: zoom-in;
  background: var(--paper); box-shadow: 0 1px 2px rgba(63, 58, 58, .28);
  transition: transform .15s, box-shadow .15s;
}
@media (hover: hover) { .print:hover { transform: translateY(-2px); box-shadow: 0 6px 12px rgba(63, 58, 58, .25); } }
.print .ph { aspect-ratio: 4 / 5; background: var(--card); overflow: hidden; }
.print img { width: 100%; height: 100%; object-fit: cover; display: block; }
.album-empty { margin: 0; text-align: center; padding: 48px 16px; color: var(--coffee); }
.more { display: flex; justify-content: center; padding: 24px 16px 0; }

body.lb-open { overflow: hidden; }
.lightbox {
  position: fixed; inset: 0; z-index: 50; touch-action: pan-y;
  display: flex; flex-direction: column;
  padding: calc(18px + var(--safe-top)) 22px max(22px, calc(12px + var(--safe-bottom)));
  background: rgba(38, 34, 34, .96); color: var(--cream);
}
.lb-top, .lb-bottom { width: 100%; max-width: 720px; margin: 0 auto; }
.lb-top { display: flex; justify-content: space-between; align-items: center; }
.lb-top .label { font-size: 11px; letter-spacing: .12em; color: var(--card); }
.lb-round {
  width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--coffee); cursor: pointer;
  background: transparent; color: var(--cream); font: 400 20px/1 var(--ui);
}
.lb-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 16px 0; }
.lb-print {
  position: relative; margin: 0; padding: 12px 12px 40px; background: var(--paper);
  transform: rotate(-1.2deg); box-shadow: 0 20px 40px rgba(0, 0, 0, .5);
}
.lb-print img {
  display: block; width: auto; height: auto; min-width: 140px; min-height: 100px; background: var(--card);
  max-width: min(calc(100vw - 68px), 900px); max-height: max(200px, calc(100svh - 280px));
}
.lb-print figcaption {
  position: absolute; left: 14px; bottom: 14px;
  font: 400 10px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--taupe);
}
.lb-bottom { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.lb-meta { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.lb-meta .display { font-size: 24px; line-height: 1.1; color: var(--cream); overflow-wrap: anywhere; }
.lb-meta .label { color: var(--card); letter-spacing: .12em; }
.lb-meta a { font: 400 10px/1 var(--mono); letter-spacing: .08em; color: var(--taupe); }
.lb-nav { display: flex; gap: 8px; flex: none; }
.lb-nav button {
  width: 44px; height: 44px; border-radius: 50%; cursor: pointer;
  border: 1.5px solid var(--cream); background: transparent; color: var(--cream); font: 500 18px/1 var(--ui);
}
.lb-nav .next { border: 0; background: var(--cream); color: var(--char); }

/* ─── Hoja de avisos ─── */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 45;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(15, 13, 13, .6);
}
.sheet {
  width: 100%; max-width: 480px; max-height: 92svh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 12px;
  padding: 24px 24px max(22px, calc(12px + var(--safe-bottom)));
  border-radius: 22px 22px 0 0; background: var(--cream); color: var(--char);
  box-shadow: 0 -14px 30px rgba(0, 0, 0, .35);
  animation: sheet-up 280ms cubic-bezier(.3, .7, .3, 1);
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
body.dark .sheet .label, .sheet .label { color: var(--coffee); }
.sheet h2 { font-size: 30px; line-height: 1.05; }
.sheet p { margin: 0; font-size: 15px; line-height: 1.45; }
.sheet #notify-ask, .sheet #notify-ios { display: flex; flex-direction: column; gap: 14px; }
.sheet [hidden] { display: none !important; }
.sheet-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.sheet .btn.ghost { color: var(--char); }
.sheet-skip {
  align-self: center; padding: 8px 12px; border: 0; background: none; cursor: pointer;
  font: 500 14px/1 var(--ui); color: var(--coffee); text-decoration: underline; text-underline-offset: 3px;
}
.sheet-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.sheet-steps li { display: flex; gap: 10px; align-items: baseline; font: 500 16px/1.3 var(--ui); }
.sheet-steps b { flex: none; font: 700 11px/1 var(--mono); color: var(--coffee); }
.share-icon {
  width: 18px; height: 18px; vertical-align: -3px; margin: 0 2px;
  fill: none; stroke: var(--char); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.sheet-note { font-size: 13px !important; color: var(--coffee); }
.reveal-card .btn { margin-top: 2px; }

/* ─── Portada: cómo funciona ─── */
.how { margin-top: 40px; display: flex; flex-direction: column; gap: 14px; }
.how-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.how-steps li {
  display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: baseline;
  padding: 16px 16px 16px 14px; border-radius: 16px; background: var(--field); border: 1.5px solid var(--card);
}
.how-steps b { font: 700 11px/1 var(--mono); letter-spacing: .1em; color: var(--coffee); }
.how-steps strong { display: block; font: 400 20px/1.15 var(--display); }
.how-steps p { margin: 4px 0 0; font-size: 14px; line-height: 1.4; color: var(--coffee); text-wrap: pretty; }
.how-note { margin: 4px 0 0; font-size: 13px; line-height: 1.45; color: var(--coffee); text-align: center; text-wrap: pretty; }

/* ─── Panel /admin ─── */
.btn.sm { min-height: 40px; padding: 0 14px; border-radius: 12px; font-size: 14px; }
.btn.light.sm { box-shadow: 0 3px 0 var(--coffee); background: var(--field); }
.btn.dark.sm { box-shadow: 0 3px 0 var(--hard); }
.btn.ghost.sm { color: var(--char); }

.admin { width: 100%; max-width: 980px; margin: 0 auto; min-height: 100svh; display: flex; flex-direction: column; padding: calc(24px + var(--safe-top)) 16px 0; }
.admin-head { display: flex; flex-direction: column; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid rgba(63, 58, 58, .18); }
.admin-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.admin-title { font-size: 40px; line-height: 1; }
.admin > .credit { margin-top: auto; padding-top: 40px; }
.admin-status { margin: 20px 0 0; color: var(--coffee); font-size: 15px; }
.admin-status:empty { display: none; }

.admin-login { width: 100%; max-width: 380px; margin: 40px auto 0; display: flex; flex-direction: column; gap: 10px; }

.admin-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 0 16px; }
.admin-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }

.admin-filters {
  display: grid; gap: 12px; align-items: end; padding-bottom: 18px;
  grid-template-columns: minmax(200px, 1fr) auto 160px 160px auto;
}
.admin-filters .pills { height: 48px; }
.admin-filters .pill { height: 48px; border-radius: 14px; padding: 0 12px; white-space: nowrap; }
.pill-count { margin-left: 4px; font: 700 11px/1 var(--mono); opacity: .7; }
.pill-count:empty { display: none; }
.f-clear { height: 48px; }
@media (max-width: 900px) {
  .admin-filters { grid-template-columns: 1fr 1fr; }
  .f-search, .f-status, .f-clear { grid-column: 1 / -1; }
  .admin-filters .pills { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .admin-filters .pill { min-width: 0; padding: 0 6px; }
}

.admin-pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 18px; }
.admin-pager .label { text-align: center; }

.admin-card {
  min-width: 0; display: flex; flex-direction: column; gap: 12px; padding: 18px;
  border-radius: 18px; background: var(--paper); box-shadow: 0 1px 2px rgba(63, 58, 58, .22), 0 8px 18px rgba(63, 58, 58, .08);
}
.admin-card.off { opacity: .72; background: var(--field); }
.admin-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.admin-card-head h2 { font-size: 24px; line-height: 1.1; overflow-wrap: anywhere; }
.badge {
  flex: none; padding: 5px 9px; border-radius: 999px; white-space: nowrap;
  font: 700 9px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase;
  background: var(--card); color: var(--char);
}
.badge.open { background: var(--char); color: var(--cream); }
.badge.revealed { background: var(--stamp); color: var(--char); }
.badge.off { background: transparent; border: 1.5px solid var(--coffee); color: var(--coffee); }
.admin-url { font: 400 12px/1.35 var(--mono); color: var(--coffee); overflow-wrap: anywhere; }
.admin-facts { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px 24px; }
.fact { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fact dt { font-size: 9px; }
.fact dd { margin: 0; font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; }

.admin-dialog {
  width: min(560px, calc(100vw - 24px)); max-height: calc(100svh - 24px); padding: 0; border: 0;
  border-radius: 22px; background: var(--cream); color: var(--char); box-shadow: 0 20px 50px rgba(0, 0, 0, .4);
}
.admin-dialog::backdrop { background: rgba(15, 13, 13, .55); }
.admin-form { display: flex; flex-direction: column; gap: 14px; padding: 22px; }
.admin-form-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.admin-form-head h2 { font-size: 28px; line-height: 1.05; }
.admin-close { flex: none; color: var(--char); border-color: var(--card); }
.admin-id { text-align: left; overflow-wrap: anywhere; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field .text-input { height: 48px; font-size: 16px; }
.field select.text-input { padding-right: 8px; }
.field-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.field-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; }
.field.narrow { max-width: 180px; }
.text-input:disabled { opacity: .5; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; line-height: 1.3; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--char); flex: none; }
.admin-preview { margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--field); font-size: 13px; line-height: 1.45; color: var(--coffee); }
.admin-preview:empty { display: none; }
.admin-preview.warn { color: var(--char); background: rgba(240, 138, 60, .22); }
.admin-form .form-error {
  margin: 0; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--stamp);
  background: rgba(240, 138, 60, .18); color: var(--char); font-size: 14px;
}
.admin-form .text-input[aria-invalid="true"] { border-color: var(--stamp); box-shadow: 0 0 0 3px rgba(240, 138, 60, .3); }
.admin-form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 4px; }
.admin-form-actions .btn { min-height: 48px; }
.admin-form-actions .btn.ghost { color: var(--char); }
/* ─── Tarjeta del QR (qr.html) ─── */
.qr-back { color: inherit; text-decoration: none; }
.qr-back:hover { text-decoration: underline; }
.qr-layout { display: grid; grid-template-columns: 1fr; gap: 24px; padding-top: 24px; align-items: start; }
@media (min-width: 820px) { .qr-layout { grid-template-columns: minmax(0, 1fr) 300px; } }
.qr-card { margin: 0; width: 100%; max-width: 560px; justify-self: center; box-shadow: 0 18px 40px rgba(63, 58, 58, .28); line-height: 0; }
.qr-card svg { display: block; width: 100%; height: auto; }
.qr-side { display: flex; flex-direction: column; gap: 22px; }
.qr-group { display: flex; flex-direction: column; gap: 10px; }
.qr-group .btn { width: 100%; }
.qr-note { text-align: left; }
@media print {
  body:has(.qr-page) { background: none; }
  .qr-page { padding: 0; max-width: none; min-height: 0; display: block; }
  .qr-page > :not(.qr-layout), .qr-side, .toast { display: none !important; }
  .qr-layout { display: block; padding: 0; }
  .qr-card { max-width: none; box-shadow: none; }
}

@media (max-width: 520px) {
  .field-row { grid-template-columns: 1fr; }
  .field-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .field-row.three .label { font-size: 8px; letter-spacing: .08em; }
  .admin-form-actions { flex-direction: column-reverse; }
  .admin-form-actions .btn { width: 100%; }
}
