:root {
  --green: #5aae2e; --green-d: #3f8f22; --green-l: #9fd47f; --green-bg: #eef5ea;
  --blue: #2e3192; --ink: #14161a; --muted: #5d646c; --line: #eef0ec;
  --bg: #f4f6f3; --dark: #0d1015; --red: #c4342b;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: #dfe3df; font-family: 'Archivo', Arial, sans-serif; -webkit-font-smoothing: antialiased; color: var(--ink); }
button { font-family: inherit; cursor: pointer; }
button:disabled { cursor: default; }
input, select { font-family: inherit; }
@keyframes pop { 0% { transform: scale(.6); opacity: 0 } 100% { transform: scale(1); opacity: 1 } }
@keyframes up { 0% { transform: translateY(100%) } 100% { transform: translateY(0) } }
@keyframes spin { to { transform: rotate(360deg) } }

/* Marco: pantalla completa en móvil, columna centrada en ordenador */
.shell { position: relative; max-width: 430px; height: 100dvh; margin: 0 auto; background: var(--bg); display: flex; flex-direction: column; overflow: hidden; }
@media (min-width: 600px) { .shell { height: min(900px, calc(100dvh - 40px)); margin: 20px auto; border-radius: 28px; box-shadow: 0 30px 80px rgba(0,0,0,.25); } }
.scroll { flex: 1; overflow-y: auto; overflow-x: hidden; }

/* Logo */
.logo { display: flex; align-items: baseline; gap: 8px; }
.logo-mark { display: flex; align-items: center; font-weight: 900; font-size: 30px; letter-spacing: -1px; line-height: 1; }
.logo-o { display: inline-block; width: 30px; height: 30px; margin: 0 1px; background: url(/o.svg) center / contain no-repeat; }
.logo-sub { font-size: 10px; font-weight: 700; font-style: italic; letter-spacing: 2px; }
.logo-sub span { font-weight: 400; }

/* Tipografía */
.kicker { font-size: 11px; font-weight: 700; letter-spacing: 2px; color: var(--green); }
.kicker.muted { color: var(--muted); }
.kicker.light { color: var(--green-l); }
.h1 { font-size: 32px; font-weight: 900; color: var(--blue); letter-spacing: -.8px; line-height: 1.05; margin-top: 6px; }
.lead { font-size: 14px; color: var(--muted); margin-top: 8px; line-height: 1.45; }
.page { padding: 28px 22px 24px; }

/* Cabecera oscura */
.hero { background: var(--dark); color: #fff; padding: 28px 22px 28px; position: relative; overflow: hidden; }
.hero-ring { position: absolute; right: -90px; top: 20px; width: 260px; height: 260px; border-radius: 50%; border: 28px solid rgba(90,174,46,.16); pointer-events: none; }
.hero > :not(.hero-ring):not(.hero-bg) { position: relative; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--green); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; border: 0; }
.big-points { display: flex; align-items: baseline; gap: 10px; margin-top: 6px; }
.big-points b { font-size: 64px; font-weight: 900; letter-spacing: -2px; line-height: 1; }
.big-points span { font-size: 15px; font-weight: 700; letter-spacing: 1px; }

/* Botones */
.btn { width: 100%; height: 54px; border-radius: 6px; border: 0; background: var(--green); color: #fff; font-size: 15px; font-weight: 800; letter-spacing: .5px; display: flex; align-items: center; justify-content: center; gap: 10px; }
.btn:hover { background: #4c9a25; } .btn:active { background: #3f8722; }
.btn.blue { background: var(--blue); } .btn.blue:hover { background: #262985; }
.btn.ghost { background: transparent; border: 2px solid #fff; color: #fff; } .btn.ghost:hover { background: rgba(255,255,255,.08); }
.btn.outline { background: transparent; border: 2px solid #d5dbd2; color: var(--muted); } .btn.outline:hover { background: #f6f8f5; }
.btn.danger { background: transparent; border: 2px solid #f0c9c6; color: var(--red); }
.btn:disabled { opacity: .5; }
.link { border: 0; background: none; color: var(--blue); font-size: 13px; font-weight: 700; padding: 0; }
.chip { height: 38px; padding: 0 14px; border-radius: 6px; font-size: 13px; font-weight: 700; border: 2px solid var(--green); background: var(--green); color: #fff; white-space: nowrap; }
.chip.off { background: transparent; border-color: #d5dbd2; color: #a3aaa0; }

/* Tarjetas y listas */
.stack { display: flex; flex-direction: column; gap: 18px; padding: 22px; }
.card { background: #fff; border-radius: 14px; padding: 20px; }
.list { background: #fff; border-radius: 14px; overflow: hidden; }
.row { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .t { font-size: 15px; font-weight: 700; color: var(--ink); }
.row .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.row .amt { font-size: 15px; font-weight: 800; white-space: nowrap; }
.ico { width: 40px; height: 40px; border-radius: 10px; background: var(--green-bg); color: var(--green-d); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.badge { width: 52px; height: 52px; border-radius: 12px; background: var(--blue); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 16px; flex-shrink: 0; }
.empty { padding: 22px 18px; color: var(--muted); font-size: 14px; text-align: center; }
.bar { height: 8px; border-radius: 4px; background: #e6ebe4; margin-top: 12px; overflow: hidden; }
.bar > div { height: 100%; background: var(--green); border-radius: 4px; transition: width .6s; }
.stamps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-top: 16px; }
.stamp { aspect-ratio: 1; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; border: 2px solid #d5dbd2; background: #fff; color: #a3aaa0; }
.stamp.on { background: var(--green); border-color: var(--green); color: #fff; }
.stamp.goal { background: var(--blue); border-color: var(--blue); color: #fff; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
.stats .card { padding: 16px; } .stats b { font-size: 28px; font-weight: 900; display: block; } .stats span { font-size: 12px; color: var(--muted); }
.pill { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: 1px; padding: 3px 8px; border-radius: 4px; background: var(--green-bg); color: var(--green-d); }
.pill.used { background: #eceef6; color: var(--blue); } .pill.dead { background: #f3f3f3; color: #8a918c; }

/* QR */
.qr-box { background: #fff; border-radius: 16px; padding: 22px; display: flex; flex-direction: column; align-items: center; }
.qr-box svg { width: 220px; height: 220px; display: block; }
.qr-code-text { color: var(--ink); font-weight: 800; font-size: 18px; letter-spacing: 3px; margin-top: 16px; }
.qr-sub { color: var(--muted); font-size: 12px; margin-top: 4px; text-align: center; }
.timer { height: 4px; width: 200px; background: #e6ebe4; border-radius: 2px; margin-top: 14px; overflow: hidden; }
.timer > div { height: 100%; background: var(--green); transition: width 1s linear; }

/* Barra de pestañas */
.tabs { height: 76px; background: #fff; border-top: 1px solid #e3e7e1; display: flex; padding: 0 8px 10px; flex-shrink: 0; }
.tabs button { flex: 1; border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: #8a918c; font-size: 11px; font-weight: 700; }
.tabs button.on { color: var(--green); }

/* Hoja inferior */
.overlay { position: absolute; inset: 0; background: rgba(5,7,10,.55); z-index: 10; display: flex; align-items: flex-end; }
.sheet { width: 100%; max-height: 92%; overflow-y: auto; background: #fff; border-radius: 24px 24px 0 0; padding: 28px 24px 32px; animation: up .3s ease-out; text-align: center; }
.sheet .tick { width: 72px; height: 72px; border-radius: 50%; background: var(--green); color: #fff; margin: 0 auto; display: flex; align-items: center; justify-content: center; animation: pop .4s ease-out; }
.sheet .tick.err { background: var(--red); }
.sheet .title { font-size: 30px; font-weight: 900; color: var(--blue); letter-spacing: -.6px; margin-top: 6px; line-height: 1.05; }
.sheet .body { font-size: 14px; color: var(--muted); margin-top: 10px; line-height: 1.45; }
.sheet .code { margin-top: 16px; border: 2px dashed var(--blue); border-radius: 10px; padding: 14px; font-weight: 900; font-size: 22px; letter-spacing: 3px; color: var(--blue); }
.sheet .actions { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; }

/* Formularios */
.field { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; text-align: left; }
.field label { font-size: 11px; font-weight: 700; letter-spacing: 2px; color: var(--muted); }
.field input, .field select { height: 52px; border-radius: 8px; border: 2px solid #d5dbd2; padding: 0 14px; font-size: 17px; font-weight: 600; background: #fff; color: var(--ink); outline: none; }
.field input:focus, .field select:focus { border-color: var(--green); }
.error { background: #fbeceb; color: var(--red); font-size: 14px; font-weight: 600; padding: 12px 14px; border-radius: 8px; margin-top: 14px; text-align: left; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: #e6ebe4; border-radius: 8px; padding: 4px; margin-top: 22px; }
.seg button { height: 40px; border: 0; border-radius: 6px; background: transparent; font-weight: 700; font-size: 14px; color: var(--muted); }
.seg button.on { background: #fff; color: var(--ink); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid #d5dbd2; border-top-color: var(--green); animation: spin .8s linear infinite; margin: 60px auto; }
.foot { text-align: center; font-size: 12px; color: #8a918c; margin: 26px 0 8px; }
.foot a { color: #8a918c; }

/* ---------- Movimiento ---------- */
:root { --ease-out: cubic-bezier(.22, 1, .36, 1); --spring: cubic-bezier(.34, 1.56, .64, 1); }
@keyframes inRight { from { opacity: 0; transform: translateX(28px) } to { opacity: 1; transform: none } }
@keyframes inLeft { from { opacity: 0; transform: translateX(-28px) } to { opacity: 1; transform: none } }
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.98) } to { opacity: 1; transform: none } }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes fadeOut { to { opacity: 0 } }
@keyframes down { to { transform: translateY(105%) } }
@keyframes sheetUp { from { transform: translateY(100%) } to { transform: none } }
@keyframes stampIn { 0% { transform: scale(0) rotate(-30deg); opacity: 0 } 70% { transform: scale(1.15) rotate(4deg); opacity: 1 } 100% { transform: none } }
@keyframes qrIn { from { opacity: 0; transform: scale(.85); filter: blur(6px) } to { opacity: 1; transform: none; filter: none } }
@keyframes tabBounce { 0% { transform: translateY(0) } 40% { transform: translateY(-5px) scale(1.12) } 100% { transform: none } }
@keyframes ringSpin { to { transform: rotate(360deg) } }
@keyframes shimmer { from { transform: translateX(-100%) } to { transform: translateX(250%) } }
@keyframes glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(90,174,46,.0) } 50% { box-shadow: 0 0 0 8px rgba(90,174,46,.18) } }
@keyframes shake { 20%, 60% { transform: translateX(-6px) } 40%, 80% { transform: translateX(6px) } }

.nav-right { animation: inRight .45s var(--ease-out) both; }
.nav-left { animation: inLeft .45s var(--ease-out) both; }
.nav-fade { animation: fade .4s ease both; }
.enter .card, .enter .list, .enter .qr-box, .enter .stats, .enter .seg, .enter form, .enter .h1, .enter .lead, .enter .kicker {
  animation: rise .55s var(--ease-out) both;
}
.enter .stack > :nth-child(1), .enter .page > :nth-child(1) { animation-delay: .04s; }
.enter .stack > :nth-child(2), .enter .page > :nth-child(2) { animation-delay: .09s; }
.enter .stack > :nth-child(3), .enter .page > :nth-child(3) { animation-delay: .14s; }
.enter .stack > :nth-child(4), .enter .page > :nth-child(4) { animation-delay: .19s; }
.enter .stack > :nth-child(5), .enter .page > :nth-child(5) { animation-delay: .24s; }
.enter .page > :nth-child(n+6) { animation-delay: .28s; }
.enter .stamp.on { animation: stampIn .5s var(--spring) both; animation-delay: calc(.25s + var(--i) * .05s); }
.enter .stamp.goal { animation: stampIn .6s var(--spring) both, glow 2.4s ease-in-out 1.2s infinite; animation-delay: .8s, 1.4s; }
.enter .bar > div { animation: barFill 1s var(--ease-out) .35s both; }
@keyframes barFill { from { width: 0 } }
.enter .row { animation: rise .5s var(--ease-out) both; animation-delay: calc(.2s + var(--i, 0) * .045s); }
.qr-anim svg { animation: qrIn .6s var(--ease-out) both; }
.hero-ring { animation: ringSpin 40s linear infinite; border-right-color: rgba(90,174,46,.32); }
.big-points b { display: inline-block; font-variant-numeric: tabular-nums; }
.bump { animation: tabBounce .5s var(--spring); color: var(--green-l); transition: color 1.2s; }

/* Botones con respuesta táctil */
.btn, .chip, .avatar, .link, .quick button, .seg button, .tabs button, .icon-btn {
  transition: transform .18s var(--ease-out), background-color .2s, color .2s, border-color .2s, box-shadow .2s, opacity .2s;
}
.btn:active, .chip:active, .avatar:active, .quick button:active, .icon-btn:active { transform: scale(.96); }
.btn { position: relative; overflow: hidden; }
.btn:not(.ghost):not(.outline):not(.danger)::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 40%; background: linear-gradient(90deg, transparent, rgba(255,255,255,.22), transparent);
  transform: translateX(-100%); pointer-events: none;
}
.btn:not(.ghost):not(.outline):not(.danger):hover::after { animation: shimmer .9s ease; }
.card { transition: transform .25s var(--ease-out), box-shadow .25s; }
@media (hover: hover) { .card:hover { box-shadow: 0 10px 30px rgba(20,22,26,.07); } }
.tabs button svg { transition: transform .3s var(--spring); }
.tabs button.on svg { animation: tabBounce .5s var(--spring); }
.tabs { position: relative; }
.tab-dot { position: absolute; top: 0; height: 3px; width: 32px; border-radius: 0 0 3px 3px; background: var(--green); transition: left .45s var(--spring); }

/* Hoja inferior: entrada con muelle y salida suave */
.overlay { animation: fade .25s ease both; }
.sheet { animation: sheetUp .5s var(--spring) both; }
.overlay.closing { animation: fadeOut .22s ease both; }
.overlay.closing .sheet { animation: down .25s cubic-bezier(.4, 0, 1, 1) both; }
.sheet .tick { animation: pop .5s var(--spring) .12s both; }
.sheet .kicker, .sheet .title, .sheet .body, .sheet .code, .sheet .actions, .sheet > div > svg { animation: rise .45s var(--ease-out) both; }
.sheet .kicker { animation-delay: .16s; } .sheet .title { animation-delay: .2s; } .sheet .body { animation-delay: .24s; }
.sheet .code { animation-delay: .28s; } .sheet .actions { animation-delay: .32s; }
.error { animation: shake .4s ease, fade .2s ease; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
.view { min-height: 100%; display: flex; flex-direction: column; }
.enter .hero > :not(.hero-ring):not(.hero-bg) { animation: rise .6s var(--ease-out) both; }
.enter .hero > :nth-child(3) { animation-delay: .06s; } .enter .hero > :nth-child(4) { animation-delay: .12s; }
.enter .hero > :nth-child(5) { animation-delay: .16s; } .enter .hero > :nth-child(6) { animation-delay: .22s; }
.enter .card.i { animation-delay: calc(.16s + var(--i) * .06s); }
.overlay.static, .overlay.static .sheet, .overlay.static .sheet * { animation: none !important; }
.stamp.goal { animation: glow 2.4s ease-in-out 1.4s infinite; }
.enter.page > * { animation: rise .5s var(--ease-out) both; }
.enter.page > :nth-child(2) { animation-delay: .05s; } .enter.page > :nth-child(3) { animation-delay: .1s; }
.enter.page > :nth-child(4) { animation-delay: .15s; } .enter.page > :nth-child(n+5) { animation-delay: .2s; }
