:root {
  --papal: #FFFDF6;
  --white: #FFFFFF;
  --celeste: #74ACDF;
  --celeste-soft: #E6F1FA;
  --celeste-deep: #3C7DB8;
  --gold: #C9A227;
  --gold-soft: #F6EDCB;
  --ink: #1E2A3B;
  --muted: #5B6778;
  --error: #B3261E;
  --ok: #1E7B45;
  --radius: 16px;
  --shadow: 0 6px 24px rgba(30, 42, 59, 0.08);
  --title: "Fraunces", Georgia, "Times New Roman", serif;
  --text: "Nunito Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--papal);
  color: var(--ink);
  font-family: var(--text);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

h1, h2, .pack-title { font-family: var(--title); line-height: 1.15; margin: 0 0 .4em; }
h1 { font-size: clamp(2rem, 8vw, 2.8rem); font-weight: 800; }
h2 { font-size: 1.25rem; font-weight: 600; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Cabecera */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
  background: rgba(255, 253, 246, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--gold-soft);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-family: var(--title); font-weight: 600; }
.brand img { border-radius: 8px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.credits-pill { background: var(--gold-soft); color: #6B5410; padding: 4px 10px; border-radius: 999px; font-weight: 800; font-size: .85rem; white-space: nowrap; }
.country select { padding: 6px 8px; font-size: .9rem; border-radius: 10px; }

main { max-width: 560px; margin: 0 auto; padding: 16px 16px 32px; }
.loading { text-align: center; color: var(--muted); padding: 48px 0; }

/* Inicio */
.hero { text-align: center; padding: 16px 0 8px; }
.hero h1 { color: var(--ink); }
.subtitle { font-size: 1.15rem; color: var(--celeste-deep); font-weight: 600; margin: 0 0 16px; }
.weekly {
  display: flex; flex-direction: column; gap: 2px;
  margin: 0 auto 18px; padding: 12px 16px; max-width: 420px;
  background: linear-gradient(135deg, var(--celeste-soft), var(--gold-soft));
  border: 1px solid var(--gold); border-radius: var(--radius);
}
.weekly-label { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 800; }
.weekly strong { font-family: var(--title); font-size: 1.1rem; }
.available { color: var(--muted); margin: 10px 0 0; font-weight: 600; }

.section-title { margin-top: 28px; }
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile {
  position: relative; aspect-ratio: 4 / 5; border-radius: 12px; overflow: hidden;
  display: flex; align-items: flex-end; padding: 6px;
  background: linear-gradient(160deg, var(--celeste) 0%, var(--celeste-soft) 55%, var(--gold-soft) 100%);
  border: 1px solid rgba(201, 162, 39, .4);
}
.tile::before {
  content: ""; position: absolute; left: 50%; top: 22%; width: 34%; aspect-ratio: 3 / 4; transform: translateX(-50%);
  background: var(--white); clip-path: polygon(50% 0, 100% 35%, 100% 100%, 0 100%, 0 35%);
  box-shadow: inset 0 -6px 0 var(--gold);
}
.tile span { position: relative; font-size: .7rem; font-weight: 800; color: var(--ink); background: rgba(255,255,255,.85); padding: 2px 6px; border-radius: 6px; line-height: 1.2; }

/* Tarjetas */
.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin: 16px 0; border: 1px solid #F0EAD6; }
.card summary { cursor: pointer; font-weight: 800; color: var(--celeste-deep); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }

.code-card { border: 2px solid var(--gold); }
.code-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 1.3rem; font-weight: 800; letter-spacing: .08em; background: var(--celeste-soft); padding: 8px 12px; border-radius: 10px; }
.code-form { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.code-form input { flex: 1 1 180px; text-transform: uppercase; font-family: ui-monospace, Consolas, monospace; letter-spacing: .06em; }

/* Formularios */
input, select {
  font: inherit; color: var(--ink); background: var(--white);
  border: 1.5px solid #D5DCE6; border-radius: 12px; padding: 10px 12px; width: 100%; min-height: 44px;
}
select:focus, input:focus { outline: 3px solid rgba(116, 172, 223, .5); border-color: var(--celeste); }
.form-grid { display: grid; gap: 12px; }
.form-grid label { display: grid; gap: 4px; font-weight: 600; font-size: .95rem; }
.consent { display: flex; gap: 10px; align-items: flex-start; font-size: .95rem; }
.consent input { width: 22px; height: 22px; min-height: 0; flex: none; margin-top: 2px; accent-color: var(--celeste-deep); }

.photo-drop { display: grid; gap: 12px; justify-items: center; }
.photo-drop img { max-height: 260px; border-radius: 12px; object-fit: contain; }

/* Botones */
.btn {
  font: inherit; font-weight: 800; border: none; cursor: pointer; border-radius: 999px;
  padding: 12px 20px; min-height: 44px; display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  text-decoration: none; transition: transform .08s ease, filter .15s ease;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn small { font-weight: 600; font-size: .75rem; opacity: .85; }
.btn-big { width: 100%; font-size: 1.1rem; padding: 16px 20px; }
.btn-primary { background: var(--celeste-deep); color: var(--white); }
.btn-secondary { background: var(--celeste-soft); color: var(--celeste-deep); }
.btn-gold { background: var(--gold); color: var(--white); }
.btn-mp { background: #009EE3; color: var(--white); }
.btn-small { padding: 8px 14px; min-height: 40px; background: var(--celeste-soft); color: var(--celeste-deep); }
.btn-link { background: none; color: var(--celeste-deep); text-decoration: underline; padding: 8px; }
.back { padding-left: 0; }

.msg { margin: 8px 0; font-weight: 600; }
.msg:empty { display: none; }
.msg.error { color: var(--error); }
.msg.ok { color: var(--ok); }
.turnstile { margin: 12px 0; display: flex; justify-content: center; }
.turnstile:empty { margin: 0; }

/* Generando */
.generating { text-align: center; padding: 48px 8px; }
.spinner {
  width: 72px; height: 72px; margin: 0 auto 24px; border-radius: 50%;
  border: 6px solid var(--celeste-soft); border-top-color: var(--gold);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.phrase { font-family: var(--title); font-size: 1.25rem; min-height: 3em; color: var(--celeste-deep); }

/* Resultado */
.screen-title { font-size: 1.8rem; }
.result-frame { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px; }
.result-frame canvas { width: 100%; height: auto; display: block; border-radius: 10px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
@media (max-width: 340px) { .actions { grid-template-columns: 1fr; } }

/* Comprar */
.pack { text-align: center; border: 2px solid var(--gold); }
.pack-title { font-size: 1.8rem; font-weight: 800; }

/* Legales */
.legal h1 { font-size: 1.8rem; }
.legal h2 { font-size: 1.1rem; margin-top: 1.2em; }

.footer { text-align: center; padding: 24px 16px calc(24px + env(safe-area-inset-bottom, 0px)); color: var(--muted); font-size: .85rem; border-top: 1px solid var(--gold-soft); }
.footer a { color: var(--celeste-deep); margin: 0 8px; }
