@font-face { font-family: 'Racha Display'; src: url('../fonts/anton.woff') format('woff'); font-display: swap; }

:root {
  --stage-a: #3442d9; --stage-b: #7a3cf0;
  --p-red: #ff4d5e; --p-blue: #4a74ff; --p-yellow: #ffbe1a; --p-green: #17c27b; --p-aqua: #17bdf0; --p-violet: #a874ff;
  --bg: #eef0fd; --card: #fff; --ink: #171a42; --soft: #5a5f88; --line: #dcdff4;
  --display: 'Racha Display', 'Arial Narrow', sans-serif;
  --font: ui-rounded, 'SF Pro Rounded', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #121436; --card: #1f2250; --ink: #f2f3ff; --soft: #b0b5e0; --line: #343970; }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
html.locked, html.locked body { overflow: hidden; }
body { margin: 0; font: 500 16px/1.45 var(--font); color: var(--ink); background: var(--bg); overflow-x: hidden; }
body::before { content: ''; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top); background: var(--stage-a); z-index: 15; }
#app { max-width: 520px; margin: 0 auto; }
#view:not(.full) { padding-bottom: calc(104px + env(safe-area-inset-bottom)); min-height: 100dvh; }
button, input, textarea { font-family: var(--font); }
button, label.btn, summary { cursor: pointer; touch-action: manipulation; }
button { color: inherit; }
button:disabled { opacity: .35; cursor: default; }
:focus-visible { outline: 3px solid var(--p-yellow); outline-offset: 2px; }
h1, h2 { line-height: 1.15; }
h2 { font-size: 20px; font-weight: 800; margin: 0 0 6px; }
p { margin: 6px 0; }
small { display: block; font-size: 12px; font-weight: 600; }
.soft { color: var(--soft); }
.fine { font-size: 12px; color: var(--soft); }
.pre { white-space: pre-wrap; }
details summary { font-size: 13px; font-weight: 700; color: var(--soft); }
details p { font-size: 14px; white-space: pre-wrap; }
.ic { width: 1.3em; height: 1.3em; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.big { width: 30px; height: 30px; color: var(--pc, var(--stage-b)); }
.fatal { padding: 48px 24px; font-weight: 700; text-align: center; }

/* ---------- Chispa y la barra ---------- */
.rig { display: block; width: 100%; max-width: 420px; margin: 4px auto 0; overflow: visible; }
.plate.off rect { fill: rgba(255,255,255,.08); stroke: rgba(255,255,255,.5); stroke-width: 1.4; stroke-dasharray: 4 3; }
.plate.on rect { fill: var(--pc); stroke: #fff; stroke-width: 1.6; }
.plate.on .shine { fill: rgba(255,255,255,.55); stroke: none; }
.plate.pop.pl { animation: plate-l .6s cubic-bezier(.2,1.5,.4,1) both; animation-delay: calc(var(--i) * 90ms + 220ms); }
.plate.pop.pr { animation: plate-r .6s cubic-bezier(.2,1.5,.4,1) both; animation-delay: calc(var(--i) * 90ms + 220ms); }
@keyframes plate-l { from { transform: translateX(-90px); opacity: 0; } }
@keyframes plate-r { from { transform: translateX(90px); opacity: 0; } }
.spark-body { transform-box: fill-box; transform-origin: 50% 100%; animation: breathe 2.6s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.035, .965); } }
.eyes { transform-box: fill-box; transform-origin: center; animation: blink 4.4s infinite; }
@keyframes blink { 0%, 92%, 100% { transform: none; } 95% { transform: scaleY(.08); } }
.band-tail { transform-box: fill-box; transform-origin: left center; animation: flap 1.1s ease-in-out infinite alternate; }
@keyframes flap { from { transform: rotate(-9deg); } to { transform: rotate(11deg); } }
.mouth { fill: none; stroke: #2b1537; stroke-width: 3.6; stroke-linecap: round; }
.m-idle, .m-happy, .m-strong, .m-party { display: none; }
.mood-idle .m-idle, .mood-happy .m-happy, .mood-strong .m-strong, .mood-party .m-party { display: inline; }
.mood-party .spark { animation: hop 1.1s ease-in-out infinite; }
@keyframes hop { 50% { transform: translateY(-7px); } }
.rig.press .lift { animation: press .75s ease-in-out .15s 3; }
.rig.press .spark-body { animation: squash .75s ease-in-out .15s 3; }
@keyframes press { 45% { transform: translateY(-22px); } }
@keyframes squash { 45% { transform: scale(.95, 1.08); } }
.mini { display: block; width: 96px; flex: none; overflow: visible; }

/* ---------- Cabecera ---------- */
.stage { position: relative; overflow: hidden; color: #fff; background: linear-gradient(155deg, var(--stage-a), var(--stage-b)); padding: calc(env(safe-area-inset-top) + 12px) 14px 44px; transition: background .4s; }
.stage > :not(.court) { position: relative; }
.court { position: absolute; inset: 0; width: 100%; height: 100%; fill: none; stroke: #fff; stroke-width: 2; opacity: .13; pointer-events: none; }
.datebar { display: flex; align-items: center; justify-content: space-between; text-align: center; }
.datebar h1, .title { font-family: var(--display); font-weight: 400; letter-spacing: .6px; margin: 0; }
.datebar h1 { font-size: 34px; }
.datebar p { margin: 0; font-size: 13px; font-weight: 700; }
.title { font-size: 40px; }
.round { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border: 0; border-radius: 50%; background: rgba(255,255,255,.18); color: #fff; font-size: 17px; transition: transform .15s; }
.round:active { transform: scale(.88); }
.round.solid { background: linear-gradient(135deg, var(--stage-a), var(--stage-b)); }
.stage-line { display: flex; gap: 10px; align-items: stretch; margin-top: 10px; }
.bubble { flex: 1; display: flex; align-items: center; margin: 0; padding: 10px 14px; min-height: 58px; background: #fff; color: #1b1e48; border-radius: 20px 20px 4px 20px; font-weight: 800; font-size: 15px; line-height: 1.3; }
.enter .bubble { animation: pop .5s cubic-bezier(.2,1.6,.4,1) .15s both; transform-origin: bottom right; }
@keyframes pop { from { transform: scale(.5); opacity: 0; } }
.streak { display: grid; grid-template-columns: auto auto; align-content: center; justify-items: center; align-items: center; column-gap: 4px; min-width: 74px; padding: 4px 10px; border-radius: 18px; background: rgba(0,0,0,.22); }
.streak .ic { width: 24px; height: 24px; color: #ffd23f; fill: #ff8a1f; transform-origin: 50% 100%; animation: flicker 1.3s ease-in-out infinite; }
@keyframes flicker { 30% { transform: scale(1.12, .94) rotate(-4deg); } 65% { transform: scale(.94, 1.1) rotate(4deg); } }
.streak b { font: 400 28px/1 var(--display); }
.streak span { grid-column: 1 / -1; font-size: 11px; font-weight: 700; }
.legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 2px 0 0; padding: 0; list-style: none; }
.legend li { display: flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 99px; background: rgba(0,0,0,.2); font-size: 12px; font-weight: 800; transition: background .3s, color .3s; }
.legend i { width: 10px; height: 10px; border-radius: 50%; background: var(--pc); box-shadow: 0 0 0 1.5px #fff; }
.legend li.on { background: #fff; color: #1b1e48; }

.content { position: relative; display: flex; flex-direction: column; gap: 20px; margin-top: -26px; padding: 22px 14px 8px; border-radius: 28px 28px 0 0; background: var(--bg); }
.enter .content { animation: from-right .45s cubic-bezier(.2,1.1,.3,1) both; }
.enter.back .content { animation-name: from-left; }
@keyframes from-right { from { transform: translate(34px, 18px); opacity: 0; } }
@keyframes from-left { from { transform: translate(-34px, 18px); opacity: 0; } }

/* ---------- Botones y campos ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border: 0; border-radius: 16px; font: 800 16px var(--font); color: #fff; background: linear-gradient(135deg, var(--stage-a), var(--stage-b)); box-shadow: 0 5px 0 rgba(10,10,60,.25); transition: transform .12s, box-shadow .12s; }
.btn:active, .ticket:active, .tile:active, .routine:active, .weigh:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(10,10,60,.2); }
.btn.ghost { background: var(--card); color: var(--ink); box-shadow: 0 4px 0 var(--line); }
.btn.light { background: #fff; color: #1f225c; box-shadow: 0 5px 0 rgba(0,0,0,.25); }
.btn.ghost-light { background: rgba(255,255,255,.16); box-shadow: none; }
.btn.danger { background: #d52c46; }
.btn.wide { width: 100%; margin-top: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.row > .btn { flex: 1; }
.file { position: relative; overflow: hidden; }
.file input { position: absolute; inset: 0; width: 100%; opacity: 0; font-size: 0; cursor: pointer; }
.file:focus-within { outline: 3px solid var(--p-yellow); outline-offset: 2px; }
.link { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0; border: 0; background: none; color: var(--ink); font: 800 15px var(--font); }
.link.danger { color: #e0364f; }
.icon-btn { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border: 0; background: none; color: var(--soft); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.chip { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; min-width: 44px; padding: 0 14px; border: 2px solid var(--line); border-radius: 99px; background: var(--card); color: var(--ink); font: 800 14px var(--font); transition: transform .15s, background .2s; }
.chip:active { transform: scale(.9); }
.chip.on { border-color: transparent; background: var(--ink); color: var(--bg); }
.chip.strong { border-color: var(--p-aqua); }
.field { display: flex; flex-direction: column; gap: 5px; margin: 10px 0; font-size: 14px; font-weight: 800; text-align: left; }
.input, .search { display: flex; align-items: center; gap: 8px; padding: 0 14px; background: var(--card); border: 2px solid var(--line); border-radius: 14px; transition: border-color .2s; }
.input:focus-within, .search:focus-within { border-color: var(--stage-b); }
.input input, .search input { flex: 1; width: 100%; min-width: 0; min-height: 48px; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 17px; font-weight: 600; }
.input em { color: var(--soft); font-style: normal; font-size: 13px; }
textarea { width: 100%; padding: 12px; border: 2px solid var(--line); border-radius: 14px; background: var(--card); color: var(--ink); font-size: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; align-items: end; }

.bar { display: block; height: 10px; overflow: hidden; border-radius: 99px; background: color-mix(in srgb, var(--bc, var(--p-yellow)) 22%, transparent); }
.bar > i { display: block; width: 100%; height: 100%; border-radius: inherit; background: var(--bc, var(--p-yellow)); transform-origin: left; transform: scaleX(var(--v, 0)); transition: transform .9s cubic-bezier(.25,1.3,.4,1); }
.stage .bar { background: rgba(0,0,0,.28); }

/* ---------- Hoy ---------- */
.score { padding: 18px; border-radius: 26px; color: #fff; background: linear-gradient(140deg, #171a42, #2f3279); box-shadow: 0 16px 28px -18px rgba(25,25,110,.9); }
.score-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; margin-bottom: 10px; }
.score-top b { display: block; font: 400 62px/1.05 var(--display); }
.score-top span { font-weight: 800; }
.score-top p { font-size: 13px; color: #c4c8f2; }
.macros { display: grid; gap: 11px; margin-top: 16px; }
.macros > div { display: grid; grid-template-columns: 1fr auto; gap: 5px; font-size: 14px; font-weight: 800; }
.macros em { font-style: normal; }
.macros .bar { grid-column: 1 / -1; }

.tickets { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
.ticket { display: flex; align-items: center; gap: 10px; min-height: 66px; padding: 9px; border: 0; border-radius: 20px; background: var(--card); color: var(--ink); font: 800 15px/1.2 var(--font); text-align: left; box-shadow: 0 5px 0 var(--line); transition: transform .12s, background .25s; }
.ticket i { display: grid; place-items: center; width: 46px; height: 46px; flex: none; border-radius: 50%; background: var(--pc); color: #fff; font-style: normal; font-size: 19px; }
.ticket span { min-width: 0; overflow-wrap: anywhere; }
.ticket.planned { outline: 3px solid var(--pc); outline-offset: -3px; }
.ticket.on { background: var(--pc); color: #fff; box-shadow: 0 5px 0 color-mix(in srgb, var(--pc) 65%, #000); }
.ticket.on i { background: #fff; color: #171a42; }
.ticket.on[style*='yellow'], .ticket.on[style*='aqua'], .ticket.on[style*='green'] { color: #101335; }
.ticket.stamp { animation: stamp .55s cubic-bezier(.2,1.4,.4,1); }
@keyframes stamp { 0% { transform: scale(1.16) rotate(-4deg); } 55% { transform: scale(.94) rotate(2deg); } }

.water { display: flex; align-items: center; gap: 18px; padding: 16px; border-radius: 26px; background: linear-gradient(135deg, color-mix(in srgb, var(--p-aqua) 24%, var(--card)), var(--card)); }
.water-info { flex: 1; min-width: 0; }
.water-info .row { gap: 6px; }
.water-info .chip { padding: 0 11px; }
.water-info b { font: 400 30px var(--display); }
.bottle { position: relative; width: 66px; height: 122px; flex: none; overflow: hidden; border: 4px solid var(--p-aqua); border-radius: 18px 18px 24px 24px; background: var(--card); }
.liquid { position: absolute; inset: 0; background: linear-gradient(var(--p-aqua), #1479e8); transform: translateY(calc((1 - var(--v, 0)) * (100% + 12px))); transition: transform 1s cubic-bezier(.3,1.45,.4,1); }
.wave { position: absolute; left: 0; top: -9px; width: 220%; height: 10px; background: radial-gradient(circle at 50% 100%, var(--p-aqua) 11px, transparent 12px) 0 0 / 22px 10px repeat-x; animation: wave 1.2s linear infinite; }
@keyframes wave { to { transform: translateX(-44px); } }

.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; padding: 14px; border: 0; border-radius: 22px; background: var(--card); color: var(--ink); font: 800 14px var(--font); text-align: left; box-shadow: 0 5px 0 var(--line); transition: transform .12s; }
.tile b { font: 400 30px/1.15 var(--display); }
.tile .bar { width: 100%; }
.tile small { color: var(--soft); }

.habit { display: flex; align-items: flex-start; gap: 12px; margin-top: 8px; padding: 10px 12px; border-radius: 20px; background: var(--card); }
.habit > div { flex: 1; min-width: 0; padding-top: 10px; font-weight: 800; }
.habit details { padding-top: 2px; font-weight: 500; }
.tick { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border: 3px solid var(--line); border-radius: 50%; background: transparent; color: transparent; font-size: 20px; transition: background .25s, border-color .25s; }
.habit.on .tick { border-color: var(--p-green); background: var(--p-green); color: #fff; }
.tick.stamp { animation: stamp .55s cubic-bezier(.2,1.4,.4,1); }
.tick.stamp path { stroke-dasharray: 26; animation: draw .45s .1s both; }
@keyframes draw { from { stroke-dashoffset: 26; } to { stroke-dashoffset: 0; } }

.weigh { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 18px; border: 0; border-radius: 22px; background: var(--card); color: var(--ink); font: 800 16px var(--font); text-align: left; box-shadow: 0 5px 0 var(--line); transition: transform .12s; }
.weigh > span { flex: 1; }
.weigh small { color: var(--soft); }
.weigh b { font: 400 28px var(--display); }
.notice { display: flex; align-items: center; gap: 10px; padding: 14px; border: 0; border-radius: 18px; background: color-mix(in srgb, var(--p-yellow) 30%, var(--card)); color: var(--ink); font: 800 14px var(--font); text-align: left; }

/* ---------- Comida ---------- */
.totals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.totals .big { grid-column: 1 / -1; text-align: center; }
.totals .big b { display: block; font: 400 68px/1.1 var(--display); }
.totals .big span { font-weight: 800; }
.mini-macro { font-size: 12px; font-weight: 800; }
.mini-macro b { display: block; margin-bottom: 4px; font-size: 18px; }
.mini-macro b small { display: inline; }
.meal { padding: 14px 14px 10px; border-radius: 22px; background: var(--card); }
.meal-head { display: flex; align-items: center; gap: 10px; }
.meal-head h2 { flex: 1; margin: 0; }
.meal-head > span { font-weight: 800; color: var(--soft); font-size: 14px; }
.meal ul { margin: 8px 0 0; padding: 0; list-style: none; }
.meal li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); font-weight: 700; }
.meal li > div { flex: 1; min-width: 0; }
.meal li small { color: var(--soft); }
.meal li b { font: 400 22px var(--display); }

/* ---------- Rutinas ---------- */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 12px 0 0; padding: 0; list-style: none; }
.week li { display: flex; flex-direction: column; align-items: center; gap: 5px; min-height: 76px; padding: 8px 0; border-radius: 16px; background: rgba(0,0,0,.2); font-weight: 800; font-size: 13px; }
.week li.today { background: #fff; color: #1b1e48; }
.week i { width: 15px; height: 15px; border-radius: 50%; background: var(--pc); box-shadow: 0 0 0 2px #fff; }
.week i.none { background: transparent; box-shadow: none; border: 2px dashed currentColor; opacity: .45; }
.enter .week i { animation: pop .5s cubic-bezier(.2,1.8,.4,1) .3s both; }
.routine { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px; border: 0; border-radius: 24px; background: var(--card); color: var(--ink); font-family: var(--font); text-align: left; box-shadow: 0 5px 0 var(--line); transition: transform .12s; }
.routine > span:nth-child(2) { flex: 1; min-width: 0; }
.routine b { font-size: 19px; }
.routine small { color: var(--soft); }
.routine-plate { width: 62px; height: 62px; flex: none; border-radius: 50%; background: radial-gradient(circle, var(--line) 0 7px, #c9d0e4 8px 11px, var(--pc) 12px 20px, color-mix(in srgb, var(--pc) 72%, #000) 21px 24px, var(--pc) 25px); }
.enter .routine-plate { animation: roll .7s cubic-bezier(.2,1.2,.4,1) both; }
@keyframes roll { from { transform: translateX(-80px) rotate(-260deg); } }
.empty { text-align: center; font-weight: 700; }
.empty .mini { width: 130px; margin: 0 auto 8px; }

/* ---------- Yo ---------- */
.stage.me { display: flex; align-items: center; gap: 16px; }
.stage.me p { margin: 0; font-weight: 800; }
dl { margin: 0; padding: 2px 16px; border-radius: 20px; background: var(--card); }
dl div { display: flex; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--line); }
dl div:last-child { border: 0; }
dd { margin: 0; font-weight: 800; }
.swatches { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-top: 10px; }
.swatches button { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 4px 0; border: 0; background: none; color: inherit; font: 800 12px var(--font); }
.swatches i { width: 48px; height: 48px; border: 3px solid transparent; border-radius: 50%; background: linear-gradient(135deg, var(--a), var(--b)); transition: transform .3s cubic-bezier(.2,1.8,.4,1); }
.swatches .on i { border-color: #fff; box-shadow: 0 0 0 3px var(--ink); transform: scale(1.1) rotate(12deg); }
ul.plain { margin: 8px 0; padding: 2px 14px; border-radius: 18px; background: var(--card); list-style: none; }
ul.plain li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--line); font-weight: 700; min-height: 52px; }
ul.plain li:last-child { border: 0; }
ul.plain small { color: var(--soft); }

/* ---------- Barra de pestañas ---------- */
#tabs { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; max-width: 520px; margin: 0 auto; display: grid; grid-template-columns: repeat(var(--n, 5), 1fr); padding: 8px 6px calc(env(safe-area-inset-bottom) + 6px); border-radius: 26px 26px 0 0; background: var(--card); box-shadow: 0 -10px 30px -16px rgba(20,20,90,.45); }
#tabs[hidden] { display: none; }
.indicator { position: absolute; top: 8px; left: 6px; width: calc((100% - 12px) / var(--n, 5)); height: 40px; transform: translateX(calc(var(--at, 0) * 100%)); transition: transform .45s cubic-bezier(.3,1.45,.4,1); pointer-events: none; }
.indicator::after { content: ''; position: absolute; inset: 1px 13px; border-radius: 99px; background: color-mix(in srgb, var(--stage-b) 22%, transparent); }
#tabs button { position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px; min-height: 56px; padding: 0; border: 0; background: none; color: var(--soft); font: 800 11px var(--font); }
#tabs b { display: grid; place-items: center; height: 40px; font-size: 18px; }
#tabs button[aria-current='page'] { color: var(--ink); }
#tabs button[aria-current='page'] b { animation: bob .5s cubic-bezier(.2,1.6,.4,1); }
@keyframes bob { 35% { transform: translateY(-7px) scale(1.18); } }
#tabs .fab b { width: 64px; height: 64px; margin-top: -30px; margin-bottom: -2px; border: 5px solid var(--card); border-radius: 50%; color: #fff; font-size: 23px; background: linear-gradient(135deg, var(--stage-a), var(--stage-b)); animation: pulse 2.6s infinite; }
#tabs .fab:active b { transform: scale(.9); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--stage-b) 65%, transparent); } 70%, 100% { box-shadow: 0 0 0 14px transparent; } }

/* ---------- Paneles ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 40; }
.backdrop { position: absolute; inset: 0; background: rgba(12,12,42,.6); animation: fade .25s both; }
@keyframes fade { from { opacity: 0; } }
.sheet { position: absolute; left: 0; right: 0; bottom: var(--kb, 0px); max-width: 520px; margin: 0 auto; max-height: calc(92dvh - var(--kb, 0px)); overflow-y: auto; overscroll-behavior: contain; padding: 10px 16px calc(env(safe-area-inset-bottom) + 22px); border-radius: 28px 28px 0 0; background: var(--bg); color: var(--ink); animation: sheet-in .45s cubic-bezier(.2,1.12,.35,1) both; }
@keyframes sheet-in { from { transform: translateY(100%); } }
.out { pointer-events: none; }
.out .sheet { animation: sheet-out .22s ease-in forwards; }
.out .backdrop { opacity: 0; transition: opacity .22s; }
@keyframes sheet-out { to { transform: translateY(100%); } }
.grab { width: 44px; height: 5px; margin: 0 auto 10px; border-radius: 9px; background: var(--line); }
.sheet-x { position: absolute; top: 10px; right: 8px; width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: none; color: var(--soft); }
.sheet h2 { padding-right: 40px; font-size: 22px; }
.search { margin-top: 6px; }
.results ul { margin: 10px 0 0; padding: 0; list-style: none; }
.results li { animation: row-in .35s cubic-bezier(.2,1.2,.4,1) both; animation-delay: calc(var(--i) * 28ms); }
@keyframes row-in { from { transform: translateY(14px); opacity: 0; } }
.results button { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; margin-bottom: 7px; padding: 11px 14px; border: 0; border-radius: 16px; background: var(--card); color: var(--ink); font: 800 15px var(--font); text-align: left; }
.results small { color: var(--soft); }
.results b { font: 400 22px var(--display); text-align: right; }
.preview { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 8px; }
.preview div { padding: 8px 2px 6px; border-radius: 14px; border-bottom: 6px solid var(--pc, var(--p-yellow)); background: var(--card); text-align: center; }
.preview b { display: block; font: 400 24px var(--display); }
.preview span { font-size: 11px; font-weight: 800; }
.warn { padding: 10px 12px; border-radius: 14px; background: color-mix(in srgb, var(--p-yellow) 30%, var(--card)); font-size: 14px; font-weight: 700; }
.dots { display: flex; flex-wrap: wrap; gap: 14px; margin: 14px 4px; }
.dots button { width: 38px; height: 38px; border: 0; border-radius: 50%; background: var(--pc); transition: transform .3s cubic-bezier(.2,1.8,.4,1); }
.dots .on { box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--ink); transform: scale(1.08); }
.weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 14px 0; }
.weekdays button { min-height: 44px; border: 2px solid var(--line); border-radius: 14px; background: var(--card); color: var(--ink); font-weight: 800; }
.weekdays .on { border-color: transparent; background: var(--ink); color: var(--bg); }
.shots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.shots:empty { display: none; }
.shots figure { position: relative; margin: 0; animation: pop .4s cubic-bezier(.2,1.6,.4,1); }
.shots img { display: block; width: 100%; height: 150px; object-fit: cover; object-position: top; border-radius: 12px; }
.shots button { position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 50%; background: rgba(12,12,42,.8); color: #fff; }
.shot { display: block; width: 100%; margin-top: 12px; border-radius: 16px; }
.notes { padding: 14px; border-radius: 16px; background: var(--card); font-size: 14px; line-height: 1.65; }

.toast { position: fixed; z-index: 60; left: 14px; right: 14px; bottom: calc(env(safe-area-inset-bottom) + 100px); max-width: 480px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-radius: 18px; background: #12143a; color: #fff; font-weight: 800; font-size: 15px; box-shadow: 0 10px 30px -8px rgba(0,0,0,.5); animation: toast-in .45s cubic-bezier(.2,1.5,.4,1); }
.toast button { border: 0; background: none; color: #ffd23f; font: 800 15px var(--font); min-height: 32px; }
@keyframes toast-in { from { transform: translateY(40px) scale(.9); opacity: 0; } }
.float { position: fixed; z-index: 50; transform: translateX(-50%); pointer-events: none; font: 400 22px var(--display); color: var(--p-aqua); animation: float .9s ease-out forwards; }
@keyframes float { to { transform: translate(-50%, -66px) scale(1.2); opacity: 0; } }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 70; }

/* ---------- Escáner ---------- */
.scanner { position: fixed; inset: 0; z-index: 35; display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; background: #0f1033; color: #fff; animation: fade .3s; }
.scanner video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scanner .close { position: absolute; z-index: 2; top: calc(env(safe-area-inset-top) + 12px); right: 14px; }
.frame { position: relative; width: 80%; max-width: 340px; height: 190px; border-radius: 22px; box-shadow: 0 0 0 100vmax rgba(10,10,38,.55); animation: breathe-frame 1.8s ease-in-out infinite; }
@keyframes breathe-frame { 50% { transform: scale(1.035); } }
.frame i { position: absolute; width: 42px; height: 42px; border: 5px solid #fff; }
.frame i:nth-child(1) { top: 0; left: 0; border-width: 5px 0 0 5px; border-radius: 22px 0 0; }
.frame i:nth-child(2) { top: 0; right: 0; border-width: 5px 5px 0 0; border-radius: 0 22px 0 0; }
.frame i:nth-child(3) { bottom: 0; left: 0; border-width: 0 0 5px 5px; border-radius: 0 0 0 22px; }
.frame i:nth-child(4) { bottom: 0; right: 0; border-width: 0 5px 5px 0; border-radius: 0 0 22px; }
.laser { position: absolute; left: 7%; right: 7%; top: 12%; height: 3px; border-radius: 3px; background: var(--p-red); box-shadow: 0 0 16px 4px var(--p-red); animation: laser 1.4s ease-in-out infinite alternate; }
@keyframes laser { to { top: 86%; } }
.scanner.hit .frame { animation: stamp .5s; }
.scanner.hit .frame i { border-color: var(--p-green); }
.scanner.hit .laser { display: none; }
.scanner .status { position: relative; z-index: 2; margin: 26px 28px; text-align: center; font-weight: 800; }
.scan-actions { position: absolute; z-index: 2; left: 14px; right: 14px; bottom: calc(env(safe-area-inset-bottom) + 20px); display: flex; gap: 10px; max-width: 492px; margin: 0 auto; }
.scan-actions .btn { flex: 1; padding: 0 8px; font-size: 14px; }

/* ---------- Instalación y alta ---------- */
#view.full { min-height: 100dvh; color: #fff; background: linear-gradient(160deg, var(--stage-a), var(--stage-b)); }
.intro { display: flex; flex-direction: column; justify-content: center; gap: 14px; min-height: 100dvh; overflow: hidden; padding: calc(env(safe-area-inset-top) + 20px) 22px calc(env(safe-area-inset-bottom) + 28px); text-align: center; }
.intro > * { animation: intro-r .5s cubic-bezier(.2,1.15,.3,1) both; }
.intro.from-left > * { animation-name: intro-l; }
.intro > :nth-child(2) { animation-delay: .05s; }
.intro > :nth-child(3) { animation-delay: .1s; }
.intro > :nth-child(4) { animation-delay: .15s; }
.intro > :nth-child(n+5) { animation-delay: .2s; }
@keyframes intro-r { from { transform: translateX(60px); opacity: 0; } }
@keyframes intro-l { from { transform: translateX(-60px); opacity: 0; } }
.intro h1, .intro h2 { margin: 0; }
.intro h1 { font: 400 38px/1.1 var(--display); letter-spacing: .6px; }
.intro h1.logo { font-size: 84px; letter-spacing: 2px; }
.intro p { margin: 0; font-weight: 700; }
.intro .hint { font-size: 13px; font-weight: 600; }
.intro .btn.wide { margin-top: 4px; }
.intro .input { background: #fff; border-color: #fff; }
.intro .input input { color: #1b1e48; }
.intro .input em { color: #5a5f88; }
.intro .chips { justify-content: center; margin: 4px 0; }
.intro .chip { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.45); color: #fff; }
.intro .chip.on { background: #fff; border-color: #fff; color: #1b1e48; }
.options { display: grid; gap: 8px; }
.option { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 50px; padding: 8px 16px; border: 2px solid rgba(255,255,255,.4); border-radius: 16px; background: rgba(255,255,255,.12); color: #fff; font-family: var(--font); text-align: left; transition: background .2s, transform .15s; }
.option span { font-size: 12px; font-weight: 600; text-align: right; }
.option.on { background: #fff; color: #1b1e48; transform: scale(1.02); }
.intro .mini { width: 140px; align-self: center; }
.intro .swatches { grid-template-columns: repeat(5, 1fr); }
.intro .swatches .on i { box-shadow: 0 0 0 4px rgba(0,0,0,.3); }
.progress { display: flex; align-items: center; gap: 12px; }
.progress .bar { flex: 1; --bc: #fff; background: rgba(255,255,255,.28); }
.result { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.result div { padding: 10px 4px; border-radius: 18px; background: rgba(0,0,0,.2); }
.result .main { grid-column: 1 / -1; }
.result b { display: block; font: 400 30px var(--display); }
.result .main b { font-size: 76px; line-height: 1.1; }
.result span { font-size: 13px; font-weight: 800; }
.steps { margin: 0; padding: 14px 16px 14px 38px; border-radius: 20px; background: rgba(0,0,0,.22); font-weight: 700; text-align: left; line-height: 1.55; }
.steps li { margin: 6px 0; }
.steps .ic { vertical-align: -4px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
