/* unwrapday · app (editor + vista del calendario). Se carga después de site.css. */

/* ================= temas ================= */
.theme-paper  { --t-bg: #FCEBDD; --t-ink: #2A1A2C; --t-soft: #6B5560; --t-card: #fff;
  --t-0: #fff; --t-0i: #2A1A2C; --t-1: #E0344F; --t-1i: #fff; --t-2: #3B1F4A; --t-2i: #fff;
  --t-3: #F4B740; --t-3i: #2A1A2C; --t-4: #BFE3D0; --t-4i: #2A1A2C; --t-ribbon: #F4B740; --t-ribbon2: #E0344F;
  --t-accent: #E0344F; --t-deco: none; }
.theme-berry  { --t-bg: #9E1B33; --t-ink: #FFF4F0; --t-soft: #FFD6DE; --t-card: #FFF8F6;
  --t-0: #FFF4F0; --t-0i: #9E1B33; --t-1: #E0344F; --t-1i: #fff; --t-2: #6B0F22; --t-2i: #fff;
  --t-3: #FF8FA3; --t-3i: #4A0D1A; --t-4: #FFD6DE; --t-4i: #7A1A2E; --t-ribbon: #F4B740; --t-ribbon2: #F4B740;
  --t-accent: #F4B740; --t-deco: radial-gradient(circle at 12% 18%, rgba(255,255,255,.12) 0 2px, transparent 3px) 0 0 / 46px 46px; }
.theme-plum   { --t-bg: #2B1638; --t-ink: #FBEFFF; --t-soft: #D9C2E6; --t-card: #FFFBFF;
  --t-0: #FBEFFF; --t-0i: #4A2560; --t-1: #4A2560; --t-1i: #fff; --t-2: #7B3F99; --t-2i: #fff;
  --t-3: #F4B740; --t-3i: #2B1638; --t-4: #E9D5F5; --t-4i: #2B1638; --t-ribbon: #F4B740; --t-ribbon2: #7B3F99;
  --t-accent: #F4B740; --t-deco: radial-gradient(circle at 70% 30%, rgba(244,183,64,.18) 0 1.5px, transparent 2.5px) 0 0 / 38px 38px; }
.theme-forest { --t-bg: #1F4636; --t-ink: #F4FBF6; --t-soft: #BFE3D0; --t-card: #FFFDF7;
  --t-0: #F3E9D2; --t-0i: #1F4636; --t-1: #2E6B50; --t-1i: #fff; --t-2: #E0344F; --t-2i: #fff;
  --t-3: #8CC7A1; --t-3i: #12301F; --t-4: #16352A; --t-4i: #F3E9D2; --t-ribbon: #F3E9D2; --t-ribbon2: #E0344F;
  --t-accent: #F3E9D2; --t-deco: linear-gradient(135deg, rgba(255,255,255,.05) 25%, transparent 25%) 0 0 / 30px 30px; }
.theme-night  { --t-bg: #141B3D; --t-ink: #EEF1FF; --t-soft: #C9D3FF; --t-card: #FBFCFF;
  --t-0: #EEF1FF; --t-0i: #141B3D; --t-1: #26306B; --t-1i: #fff; --t-2: #3B4BA8; --t-2i: #fff;
  --t-3: #F4B740; --t-3i: #141B3D; --t-4: #0B1030; --t-4i: #EEF1FF; --t-ribbon: #F4B740; --t-ribbon2: #3B4BA8;
  --t-accent: #F4B740;
  --t-deco: radial-gradient(circle at 20% 30%, #fff 0 1px, transparent 1.5px) 0 0 / 53px 53px,
            radial-gradient(circle at 60% 70%, rgba(255,255,255,.7) 0 1px, transparent 1.5px) 0 0 / 71px 71px; }

/* ================= calendario ================= */
.cal-frame { position: relative; padding: clamp(16px, 3vw, 28px); border-radius: 30px;
  background: var(--t-deco), var(--t-bg); color: var(--t-ink); box-shadow: var(--shadow); }
.cal-cover { text-align: center; padding: 6px 4px 18px; }
.cal-kicker { font-size: 14px; font-weight: 700; color: var(--t-soft); letter-spacing: .02em; }
.cal-title { margin-top: 6px; font: 800 clamp(28px, 5vw, 44px)/1.05 var(--display); letter-spacing: -.03em; }
.cal-dedication { max-width: 32em; margin: 10px auto 0; color: var(--t-soft); white-space: pre-wrap; }
.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(6, 1fr); } .grid.grid-25 { grid-template-columns: repeat(5, 1fr); } }
.tile { position: relative; width: 100%; aspect-ratio: 1 / 1.08; border: 0; border-radius: 16px; cursor: pointer; overflow: hidden;
  font: 800 clamp(20px, 3.2vw, 28px)/1 var(--display); letter-spacing: -.03em;
  box-shadow: 0 2px 0 rgba(0,0,0,.14), 0 8px 18px -10px rgba(0,0,0,.45);
  transition: transform .18s cubic-bezier(.3, 1.6, .5, 1), opacity .2s; }
.tile:hover { transform: translateY(-3px) rotate(-1.5deg); }
.tile:active { transform: scale(.96); }
.tile-0 { background: var(--t-0); color: var(--t-0i); }
.tile-1 { background: var(--t-1); color: var(--t-1i); }
.tile-2 { background: var(--t-2); color: var(--t-2i); }
.tile-3 { background: var(--t-3); color: var(--t-3i); }
.tile-4 { background: var(--t-4); color: var(--t-4i); }
.tile-ribbon::before, .tile-ribbon::after { content: ""; position: absolute; background: var(--t-ribbon); }
.tile-ribbon::before { left: 50%; top: 0; bottom: 0; width: 12%; transform: translateX(-50%); }
.tile-ribbon::after { top: 50%; left: 0; right: 0; height: 11%; transform: translateY(-50%); }
.tile-3 .tile-ribbon::before, .tile-3 .tile-ribbon::after,
.tile-0 .tile-ribbon::before, .tile-0 .tile-ribbon::after { background: var(--t-ribbon2); }
.tile-num { position: absolute; left: 11%; top: 9%; z-index: 1; }
.tile-dot { position: absolute; right: 9%; bottom: 9%; width: 12px; height: 12px; border-radius: 50%;
  background: #2BB673; box-shadow: 0 0 0 2px rgba(255,255,255,.9); z-index: 1; }
.tile.is-selected { outline: 3px solid var(--t-accent); outline-offset: 3px; }
.tile.is-opened { background: var(--t-card); color: var(--t-0i); box-shadow: inset 0 0 0 2px rgba(0,0,0,.08); }
.tile.is-opened .tile-ribbon { display: none; }
.tile.is-locked { cursor: default; }
.tile.is-locked:hover { transform: none; }
.cal-mark { margin-top: 16px; text-align: center; font-size: 13px; font-weight: 700; color: var(--t-soft); }
.cal-mark a { color: inherit; }

/* ================= revelado ================= */
.reveal { width: min(460px, calc(100vw - 20px)); max-height: calc(100dvh - 20px); padding: 0; border: 0; border-radius: 30px;
  background: var(--t-deco), var(--t-bg); color: var(--t-ink); box-shadow: 0 30px 80px -20px rgba(0,0,0,.6); overflow: auto; margin: max(10px, 6dvh) auto auto; }
.reveal::backdrop { background: rgba(20, 12, 24, .6); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.reveal-stage { position: relative; display: grid; justify-items: center; align-content: start; gap: 16px; padding: 22px 18px 18px; min-height: 440px; }
.reveal-stage.is-open { min-height: 0; }
.reveal-stage > .reveal-day { grid-row: 1; }
.reveal-stage > .art, .reveal-stage > .reveal-card { grid-row: 2; grid-column: 1; align-self: start; }
.reveal-stage > .reveal-close { grid-row: 3; }
.reveal-day { padding: 6px 14px; border-radius: 999px; background: rgba(255,255,255,.16); color: var(--t-ink);
  font: 800 14px var(--body); letter-spacing: .02em; }
.theme-paper .reveal-day { background: #fff; color: var(--berry-deep); }
.reveal-card { width: 100%; padding: 22px; border-radius: 22px; background: var(--t-card); color: var(--ink); box-shadow: var(--shadow); display: none; }
.reveal-close { width: 100%; color: var(--t-ink); box-shadow: inset 0 0 0 2px currentColor; }
.reveal-close:hover { background: var(--t-ink); color: var(--t-bg); }
.reveal-stage.is-opening .reveal-close { visibility: hidden; }
.reveal-stage.is-open .art { display: none; }
.reveal-stage.is-open .reveal-card { display: block; }
.op-direct.is-open .reveal-card { animation: pop-in .35s cubic-bezier(.2, 1.4, .4, 1) both; } /* sin animación previa */
.reveal-stage.is-opening .reveal-card { display: block; position: relative; z-index: 5;
  animation: card-in .55s var(--card-delay, 1s) cubic-bezier(.2, 1.4, .4, 1) both; }
.reveal-stage .spark { position: absolute; left: 50%; top: 190px; width: 10px; height: 10px; border-radius: 3px; opacity: 0; pointer-events: none; }
.spark.s1, .spark.s5 { background: var(--gold); } .spark.s2, .spark.s6 { background: var(--berry); }
.spark.s3 { background: var(--mint); } .spark.s4 { background: #fff; }
.reveal-stage.is-opening .spark { animation: burst .7s var(--spark-delay, .5s) ease-out forwards; }
.reveal-stage .s1 { --x: -95px; --y: -80px; } .reveal-stage .s2 { --x: 95px; --y: -70px; }
.reveal-stage .s3 { --x: -115px; --y: 15px; } .reveal-stage .s4 { --x: 110px; --y: 20px; }
.reveal-stage .s5 { --x: -40px; --y: -125px; } .reveal-stage .s6 { --x: 50px; --y: -130px; }
.op-direct .spark { display: none; }

.art { position: relative; margin-top: 26px; }
/* caja de regalo */
.art-gift { width: 190px; height: 190px; }
.op-ribbon.is-opening .art-gift { animation: shake .45s ease both; }
.gift-box { position: absolute; left: 15px; bottom: 0; width: 160px; height: 112px; border-radius: 14px;
  background: linear-gradient(90deg, transparent 43%, var(--t-ribbon) 43% 57%, transparent 57%), var(--t-1);
  box-shadow: inset 0 -10px 0 rgba(0,0,0,.1); }
.gift-lid { position: absolute; left: 4px; top: 50px; width: 182px; height: 40px; border-radius: 12px; z-index: 2;
  background: linear-gradient(90deg, transparent 43%, var(--t-ribbon) 43% 57%, transparent 57%), var(--t-2);
  transform-origin: 15% 100%; }
.gift-bow { position: absolute; left: 50%; top: -30px; }
.gift-bow::before, .gift-bow::after { content: ""; position: absolute; top: 0; width: 46px; height: 32px;
  border: 9px solid var(--t-ribbon); border-radius: 50% 50% 46% 46%; }
.gift-bow::before { right: 2px; transform: rotate(-18deg); }
.gift-bow::after { left: 2px; transform: rotate(18deg); }
.op-ribbon.is-opening .gift-lid { animation: lid-off .55s .42s cubic-bezier(.3, .7, .3, 1) both; }
.op-ribbon.is-opening .gift-box { animation: fade-down .4s .85s ease-in both; }

/* sobre */
.op-envelope { --card-delay: 1.1s; --spark-delay: .8s; }
.art-envelope { width: 230px; height: 160px; margin-top: 60px; perspective: 600px; }
.env-back, .env-front, .env-flap { position: absolute; left: 0; width: 100%; }
.env-back { top: 0; height: 100%; z-index: 0; border-radius: 10px; background: color-mix(in srgb, var(--t-1) 82%, #000); }
.env-letter { position: absolute; left: 14px; right: 14px; top: 12px; height: 120px; border-radius: 6px; background: #fff; z-index: 1;
  background-image: repeating-linear-gradient(transparent 0 18px, #EEE3D6 18px 19px); }
.env-front { bottom: 0; height: 100%; border-radius: 10px; background: var(--t-1); z-index: 2;
  clip-path: polygon(0 34%, 50% 70%, 100% 34%, 100% 100%, 0 100%); }
.env-flap { top: 0; height: 62%; background: color-mix(in srgb, var(--t-1) 90%, #fff); transform-origin: top;
  clip-path: polygon(0 0, 100% 0, 50% 100%); border-radius: 10px 10px 0 0; z-index: 3; }
.env-seal { position: absolute; left: 50%; top: 56%; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%;
  background: var(--t-ribbon); box-shadow: inset 0 0 0 4px rgba(0,0,0,.12); z-index: 4; }
.op-envelope.is-opening .env-seal { animation: seal-pop .35s ease-in both; }
.op-envelope.is-opening .env-flap { animation: flap-open .5s .3s ease-in-out both; }
.op-envelope.is-opening .env-letter { animation: letter-up .45s .8s ease-out both; }
.op-envelope.is-opening .art-envelope { animation: fade-down .35s 1.15s ease-in both; }

/* ventanita */
.op-window { --card-delay: 1.05s; --spark-delay: .55s; }
.art-window { width: 190px; height: 210px; }
.win-roof { position: absolute; left: 0; top: 0; width: 190px; height: 70px; background: var(--t-2); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.win-frame { position: absolute; left: 25px; top: 66px; width: 140px; height: 140px; border-radius: 8px; padding: 14px;
  background: var(--t-0); box-shadow: inset 0 0 0 6px var(--t-3); perspective: 500px; }
.win-glow { position: absolute; inset: 14px; border-radius: 4px; background: radial-gradient(circle, #FFF3C4, var(--t-3) 70%); }
.win-shutter { position: absolute; top: 14px; bottom: 14px; width: calc(50% - 14px); background: var(--t-1);
  box-shadow: inset 0 0 0 4px rgba(0,0,0,.12); }
.win-left { left: 14px; transform-origin: left; border-radius: 4px 0 0 4px; }
.win-right { right: 14px; transform-origin: right; border-radius: 0 4px 4px 0; }
.op-window.is-opening .win-left { animation: shutter-l .6s .25s cubic-bezier(.4, 0, .2, 1) both; }
.op-window.is-opening .win-right { animation: shutter-r .6s .25s cubic-bezier(.4, 0, .2, 1) both; }
.op-window.is-opening .art-window { animation: fade-down .35s .95s ease-in both; }

@keyframes shake { 0%, 100% { transform: none; } 20% { transform: rotate(-6deg) scale(1.03); } 45% { transform: rotate(5deg) scale(1.04); } 70% { transform: rotate(-3deg); } }
@keyframes lid-off { to { transform: translate(-40px, -170px) rotate(-38deg); opacity: 0; } }
@keyframes fade-down { to { transform: translateY(30px) scale(.85); opacity: 0; } }
@keyframes burst { 0% { opacity: 1; transform: translate(-50%, -50%) scale(.4); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) rotate(220deg) scale(1); } }
@keyframes card-in { from { opacity: 0; transform: translateY(70px) scale(.7) rotate(-3deg); } to { opacity: 1; transform: none; } }
@keyframes pop-in { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: none; } }
@keyframes seal-pop { 50% { transform: scale(1.3); } to { transform: scale(0); opacity: 0; } }
@keyframes flap-open { to { transform: rotateX(180deg); z-index: 0; } }
@keyframes letter-up { to { transform: translateY(-70px); } }
@keyframes shutter-l { to { transform: rotateY(-115deg); } }
@keyframes shutter-r { to { transform: rotateY(115deg); } }

/* ================= bloques ================= */
.door-title { font: 800 26px/1.1 var(--display); letter-spacing: -.025em; margin-bottom: 14px; }
.door-empty { color: var(--ink-soft); }
.door-content { display: grid; gap: 14px; }
.b p { white-space: pre-wrap; overflow-wrap: anywhere; }
.b-text p { font-size: 17px; color: #3E2E40; }
.b-letter { padding: 18px; border-radius: 12px; background: #FFFBF3;
  background-image: repeating-linear-gradient(transparent 0 27px, #F1E6D6 27px 28px); }
.b-letter h4 { margin: 0 0 8px; font: 700 18px var(--display); }
.b-letter p { line-height: 28px; }
.b-voucher { position: relative; display: grid; gap: 4px; padding: 18px 22px; border-radius: 14px; background: #FFE9B8; color: #5A3A00;
  border: 2px dashed rgba(106, 67, 0, .35); }
.b-voucher::before, .b-voucher::after { content: ""; position: absolute; top: 50%; width: 22px; height: 22px; margin-top: -11px;
  border-radius: 50%; background: var(--t-card, #fff); }
.b-voucher::before { left: -12px; } .b-voucher::after { right: -12px; }
.b-voucher-kicker { font: 800 12px var(--body); letter-spacing: .1em; text-transform: uppercase; opacity: .75; }
.b-voucher strong { font: 800 22px/1.15 var(--display); }
.b-link { display: grid; gap: 2px; padding: 14px 16px; border-radius: 14px; background: var(--paper-2); text-decoration: none; }
.b-link span { font-size: 13px; color: var(--ink-soft); }
.b-embed iframe { width: 100%; height: 152px; border: 0; border-radius: 14px; background: #000; }
.b-embed-youtube iframe { height: auto; aspect-ratio: 16 / 9; }
.b-embed.is-tall iframe { height: 380px; }
.b-embed-tiktok iframe { height: 575px; }
.b-embed-apple_music iframe { height: 175px; background: #fff; }
.b-embed-apple_music.is-tall iframe { height: 450px; }
.b-photo img, .b-video video { width: 100%; max-height: 70dvh; object-fit: contain; border-radius: 14px; background: #000; }
.b-photo img { background: none; }
figure.b { margin: 0; }
figcaption, .b-caption { margin-top: 8px; font-size: 14px; color: var(--ink-soft); text-align: center; }
.b-gallery-track { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; border-radius: 14px; }
.b-gallery-track img { flex: 0 0 88%; min-width: 0; width: 88%; height: auto; max-height: 60dvh; object-fit: cover; scroll-snap-align: center; border-radius: 14px; }
/* Sin min-width: 0 Safari deja cada foto a su ancho real y la tira ensancha toda la tarjeta. */
.b, .b-gallery, .b-gallery-track { min-width: 0; max-width: 100%; }
.b-voice audio { width: 100%; }

/* ================= app (editor) ================= */
.app-body { background: var(--paper); }
.app-top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; min-height: 60px;
  padding: 8px var(--gutter); background: rgba(255, 247, 238, .9); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1.5px solid var(--line); }
.app-top .brand span { font-size: 19px; }
.app-top-title { flex: 1; min-width: 0; font: 700 16px var(--display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-actions { display: flex; gap: 8px; align-items: center; }
.save-state { font-size: 13px; font-weight: 600; color: var(--ink-soft); white-space: nowrap; }
.save-state.is-error { color: var(--berry-deep); }
.app-main { max-width: 1180px; margin: 0 auto; padding: clamp(16px, 3vw, 32px) var(--gutter) 120px; }
.icon-btn { display: inline-grid; place-items: center; width: 42px; height: 42px; border: 0; border-radius: 12px; cursor: pointer;
  background: transparent; color: var(--ink); }
.icon-btn:hover { background: var(--paper-2); }
.btn-danger { background: var(--berry-deep); box-shadow: none; }
.btn-soft { color: var(--ink); background: var(--paper-2); box-shadow: none; }
.btn-soft:hover { background: var(--paper-3); }
.btn[disabled] { opacity: .55; pointer-events: none; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row-end { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.muted { color: var(--ink-soft); }
.small { font-size: 14px; }

/* formularios */
.field { display: grid; gap: 6px; }
.field > span, .label { font-size: 14px; font-weight: 700; color: var(--ink-soft); }
.field small { font-size: 13px; color: var(--ink-soft); }
.input, .field input, .field select, .field textarea {
  width: 100%; min-height: 48px; padding: 12px 14px; border-radius: 14px; border: 2px solid var(--line);
  background: #fff; color: var(--ink); font: 500 16px/1.4 var(--body); }
.field textarea, textarea.input { min-height: 96px; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--berry); }
.form-grid { display: grid; gap: 16px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .two { grid-template-columns: 1fr; } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 2px solid var(--line); background: #fff; cursor: pointer;
  font: 700 14px var(--body); color: var(--ink); }
.chip[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.swatch { position: relative; display: grid; gap: 6px; padding: 8px; border-radius: 16px; border: 2px solid var(--line); background: #fff;
  cursor: pointer; font: 700 13px var(--body); color: var(--ink); text-align: left; }
.swatch[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink); }
.swatch-art { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; padding: 6px; border-radius: 10px; background: var(--t-bg); }
.swatch-art i { aspect-ratio: 1; border-radius: 4px; }
.swatch-art i:nth-child(1) { background: var(--t-1); } .swatch-art i:nth-child(2) { background: var(--t-2); }
.swatch-art i:nth-child(3) { background: var(--t-3); }
.badge { display: inline-block; padding: 2px 7px; border-radius: 999px; background: var(--gold); color: var(--ink);
  font: 800 10.5px/1.5 var(--body); letter-spacing: .04em; text-transform: uppercase; vertical-align: 1px; }
.swatch .badge { position: absolute; top: 4px; right: 4px; }

/* lista y alta */
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.list-head h1 { font-size: clamp(28px, 4vw, 38px); font-weight: 800; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.card-cal { display: grid; gap: 8px; padding: 18px; border-radius: 20px; background: #fff; box-shadow: var(--shadow); text-decoration: none; }
.card-cal strong { font: 800 20px var(--display); letter-spacing: -.02em; }
.pill { justify-self: start; padding: 4px 10px; border-radius: 999px; background: var(--paper-2); font: 700 12px var(--body); }
.pill-published { background: #D7F2E3; color: #135B37; }
.create-box { max-width: 560px; margin: 0 auto; padding: clamp(20px, 4vw, 34px); border-radius: 28px; background: #fff; box-shadow: var(--shadow); }
.create-box h1 { font-size: clamp(30px, 5vw, 42px); font-weight: 800; }
.create-box > p { margin: 8px 0 22px; color: var(--ink-soft); }
.empty-state { padding: 40px 20px; text-align: center; color: var(--ink-soft); }
.empty-state .btn { margin-top: 18px; }

/* editor */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 440px); gap: 24px; align-items: start; }
.progress { display: grid; gap: 6px; margin-bottom: 16px; font-size: 14px; font-weight: 700; color: var(--ink-soft); }
.progress-bar { height: 8px; border-radius: 99px; background: var(--paper-3); overflow: hidden; }
.progress-bar span { display: block; height: 100%; border-radius: 99px; background: var(--berry); transition: width .3s; }
.panel { position: sticky; top: 76px; max-height: calc(100dvh - 92px); overflow: auto; border-radius: 24px; background: #fff; box-shadow: var(--shadow); }
.panel-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 6px; padding: 12px 12px 12px 18px;
  background: #fff; border-bottom: 1.5px solid var(--line); }
.panel-head h2 { flex: 1; font-size: 22px; }
.panel-body { display: grid; gap: 16px; padding: 18px; }
.panel-foot { position: sticky; bottom: 0; display: flex; gap: 8px; padding: 12px 18px; background: #fff; border-top: 1.5px solid var(--line); }
.panel-foot .btn { flex: 1; }
.notice { padding: 12px 14px; border-radius: 14px; background: var(--paper-2); font-size: 14px; }
.notice-warn { background: #FFE3E7; color: var(--berry-deep); }
@media (max-width: 900px) {
  .editor { grid-template-columns: 1fr; }
  .panel { display: flex; flex-direction: column; }
  .panel-body { flex: 1; align-content: start; }
  .panel { position: fixed; inset: 0; top: auto; z-index: 40; height: 100dvh; max-height: none; border-radius: 0;
    transform: translateY(100%); transition: transform .28s cubic-bezier(.3, .8, .3, 1); visibility: hidden; }
  .panel.is-open { transform: none; visibility: visible; }
}

/* bloques en edición */
.eblocks { display: grid; gap: 12px; }
.eb { display: grid; gap: 10px; padding: 14px; border-radius: 18px; border: 2px solid var(--line); background: var(--paper); }
.eb.is-incomplete { border-style: dashed; }
.eb-head { display: flex; align-items: center; gap: 6px; }
.eb-head strong { flex: 1; display: flex; align-items: center; gap: 8px; font: 700 15px var(--display); }
.eb-head .icon-btn { width: 34px; height: 34px; }
.eb-hint { font-size: 13px; color: var(--ink-soft); }
.ai-btn { justify-self: start; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px;
  border-radius: 999px; border: 2px dashed var(--line); background: transparent; color: var(--ink); font: inherit;
  font-size: 14px; font-weight: 600; cursor: pointer; }
.ai-btn:hover { border-color: var(--ink); }
.ai-btn .ic { color: var(--berry); }
.eb-media { display: grid; gap: 8px; }
.eb-thumb { width: 100%; max-height: 220px; object-fit: cover; border-radius: 12px; background: var(--paper-2); }
.eb-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 6px; }
.eb-thumbs img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; }
.uploading { display: grid; gap: 6px; font-size: 14px; font-weight: 600; }
.addbar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.addbtn { position: relative; display: grid; justify-items: center; gap: 6px; padding: 12px 6px; border-radius: 16px; border: 2px solid var(--line);
  background: #fff; cursor: pointer; font: 700 13px var(--body); color: var(--ink); }
.addbtn:hover { border-color: var(--ink); }
.addbtn .ic { color: var(--berry); }
.addbtn .badge { position: absolute; top: -8px; right: -4px; }
.rec { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--berry); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }

/* hojas modales */
.sheet { width: min(560px, 100vw); max-width: 100vw; max-height: 92dvh; margin: auto auto 0; padding: 0; border: 0; border-radius: 26px 26px 0 0;
  background: #fff; color: var(--ink); box-shadow: 0 -10px 60px -20px rgba(0,0,0,.4); }
.sheet::backdrop { background: rgba(20, 12, 24, .5); }
.sheet-box { display: grid; gap: 16px; padding: 22px clamp(18px, 4vw, 28px) 26px; }
/* Un botón largo (nowrap) no puede ensanchar la hoja más que la pantalla: la columna se queda en el ancho disponible y el texto baja de línea. */
.sheet-box, .sheet .form-grid { grid-template-columns: minmax(0, 1fr); }
.sheet .btn { white-space: normal; text-align: center; line-height: 1.2; }
.sheet h2 { font-size: 26px; }
@media (min-width: 700px) { .sheet { margin: auto; border-radius: 26px; } }
.sheet-wide { width: min(980px, 100vw); }
.confirm p { font-size: 17px; }
.ideas-list { display: grid; gap: 10px; max-height: 56dvh; overflow: auto; }
.idea { display: grid; gap: 4px; padding: 14px; border-radius: 16px; border: 2px solid var(--line); background: var(--paper); cursor: pointer; text-align: left;
  font: inherit; color: var(--ink); }
.idea:hover { border-color: var(--ink); }
.idea small { font-weight: 700; color: var(--berry-deep); }
.share-link { display: flex; gap: 8px; }
.share-link input { flex: 1; min-width: 0; }
.reasons { display: grid; gap: 6px; padding: 0; list-style: none; }
.reasons li::before { content: "✦ "; color: var(--gold-deep); }

/* vista previa a pantalla completa */
.preview-wrap { width: min(980px, 100vw); max-height: 100dvh; }
.preview-banner { margin: 0 0 12px; text-align: center; font-size: 13px; font-weight: 700; color: var(--ink-soft); }

.toast { position: fixed; left: 50%; bottom: 24px; z-index: 100; padding: 12px 18px; border-radius: 14px; background: var(--ink); color: var(--paper);
  font-weight: 600; transform: translate(-50%, 140%); transition: transform .25s; pointer-events: none; max-width: calc(100vw - 32px); }
.toast.is-on { transform: translate(-50%, 0); }
.toast[popover] { inset: auto auto 24px 50%; margin: 0; border: 0; overflow: visible; width: max-content; }

/* ================= página de quien recibe ================= */
.gift-body { min-height: 100dvh; background: var(--t-deco), var(--t-bg); color: var(--t-ink); background-attachment: fixed; }
.gift-main { max-width: 760px; margin: 0 auto; padding: clamp(14px, 4vw, 36px) clamp(12px, 3vw, 24px) 60px; display: grid; gap: 16px; }
.gift-loading { padding: 40vh 0 0; text-align: center; font: 700 18px var(--display); color: var(--t-soft); }
.gift-frame { box-shadow: none; background: transparent; padding: 0; }
.gift-status { margin: 0 0 16px; text-align: center; font-weight: 700; color: var(--t-soft); }
.gift-status > p { margin: 0; }
/* cuenta regresiva tipo reloj */
.gift-countdown { display: flex; justify-content: center; gap: clamp(6px, 2vw, 12px); margin-top: 10px; }
.cd-unit { display: grid; justify-items: center; gap: 4px; min-width: clamp(60px, 18vw, 80px); padding: 10px 6px 8px; border-radius: 16px;
  background: rgba(255,255,255,.14); box-shadow: inset 0 0 0 1px rgba(255,255,255,.2); perspective: 300px; }
.theme-paper .cd-unit { background: #fff; box-shadow: 0 2px 0 rgba(0,0,0,.06), 0 10px 22px -14px rgba(0,0,0,.4); }
.cd-num { display: block; font: 800 clamp(30px, 8.5vw, 42px)/1 var(--display); letter-spacing: -.02em; color: var(--t-ink);
  font-variant-numeric: tabular-nums; transform-origin: 50% 60%; }
.cd-lab { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--t-soft); }
.cd-num.is-flip { animation: cd-flip .45s cubic-bezier(.3, 1.4, .5, 1); }
@keyframes cd-flip { from { transform: rotateX(-90deg); opacity: .15; } to { transform: none; opacity: 1; } }

/* la próxima puerta cerrada brilla: algo espera adentro */
.tile.is-next { animation: next-glow 1.8s ease-in-out infinite; z-index: 1; }
@keyframes next-glow { 0%, 100% { box-shadow: 0 2px 0 rgba(0,0,0,.14), 0 0 0 0 transparent; }
  50% { box-shadow: 0 2px 0 rgba(0,0,0,.14), 0 0 22px 5px color-mix(in srgb, var(--t-accent) 75%, transparent); } }
.next-glow { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.next-glow i { position: absolute; bottom: 16%; width: 6px; height: 6px; border-radius: 50%; background: #FFF6D6;
  box-shadow: 0 0 8px 2px rgba(255, 214, 110, .95); opacity: 0; animation: rise 2.1s ease-in infinite; }
.next-glow i:nth-child(1) { left: 26%; }
.next-glow i:nth-child(2) { left: 52%; animation-delay: .7s; }
.next-glow i:nth-child(3) { left: 74%; animation-delay: 1.4s; }
@keyframes rise { 0% { opacity: 0; transform: translateY(0) scale(.5); } 25% { opacity: 1; } 100% { opacity: 0; transform: translateY(-58px) scale(1); } }

/* puerta cerrada: candado + globo junto a la puerta */
.lock-pop { position: absolute; left: 50%; top: 50%; z-index: 2; font-size: 30px; line-height: 1; pointer-events: none;
  animation: lock-pop .9s ease both; }
@keyframes lock-pop { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.3); } 25% { opacity: 1; transform: translate(-50%, -50%) scale(1.3); }
  60% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -75%) scale(1); } }
.lock-bubble { position: fixed; z-index: 90; display: grid; gap: 2px; max-width: min(260px, calc(100vw - 20px)); padding: 10px 16px;
  border-radius: 16px; background: var(--t-card, #fff); color: var(--ink); text-align: center; font-size: 15px; line-height: 1.3;
  box-shadow: 0 16px 36px -12px rgba(0,0,0,.55); transform-origin: var(--ax, 50%) 100%; animation: bubble-in .34s cubic-bezier(.2, 1.5, .4, 1) both; }
.lock-bubble strong { font: 800 18px/1.2 var(--display); }
.lock-bubble::after { content: ""; position: absolute; left: var(--ax, 50%); bottom: -6px; width: 14px; height: 14px; margin-left: -7px;
  background: inherit; border-radius: 3px; transform: rotate(45deg); }
.lock-bubble.is-below { transform-origin: var(--ax, 50%) 0; }
.lock-bubble.is-below::after { bottom: auto; top: -6px; }
.lock-bubble.is-out { animation: bubble-out .25s ease both; }
@keyframes bubble-in { from { opacity: 0; transform: scale(.55) translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes bubble-out { to { opacity: 0; transform: scale(.9); } }

/* entrada: las puertas llegan en cascada */
.gift-frame.is-entering .cal-cover, .gift-frame.is-entering .gift-status { animation: pop-in .5s ease both; }
.gift-frame.is-entering .tile { animation: tile-in .5s cubic-bezier(.2, 1.4, .4, 1) both; animation-delay: calc(.25s + var(--i, 0) * 45ms); }
@keyframes tile-in { from { opacity: 0; transform: translateY(26px) scale(.55) rotate(-8deg); } to { opacity: 1; transform: none; } }

/* entrada: el regalo envuelto */
.intro { min-height: 86dvh; display: grid; place-content: center; justify-items: center; gap: 12px; padding: 16px 8px; text-align: center; }
.intro-from { font-weight: 800; color: var(--t-soft); letter-spacing: .02em; }
.intro-stage { position: relative; width: 240px; height: 230px; display: grid; place-items: center; }
.intro-gift { display: block; padding: 0; border: 0; background: none; cursor: pointer; animation: gift-bob 2.6s ease-in-out infinite; }
.intro-gift .art { display: block; margin: 20px 0 0; }
.intro-gift .gift-bow { animation: bow-wiggle 2.6s ease-in-out infinite; }
.intro-title { max-width: 11em; font: 800 clamp(32px, 9vw, 48px)/1.04 var(--display); letter-spacing: -.035em; }
.intro-sub { color: var(--t-soft); font-weight: 700; }
.intro-btn { margin-top: 8px; padding: 0 30px; background: var(--t-ink); color: var(--t-bg);
  box-shadow: 0 12px 26px -12px rgba(0,0,0,.6); animation: btn-breathe 2.6s ease-in-out infinite; }
.intro-btn:hover { background: var(--t-ink); filter: brightness(1.05); }
@keyframes gift-bob { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-8px) rotate(-2deg); } }
@keyframes bow-wiggle { 0%, 70%, 100% { transform: none; } 80% { transform: rotate(-8deg); } 90% { transform: rotate(6deg); } }
@keyframes btn-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }
.intro-spark { position: absolute; left: 50%; top: 46%; width: 13px; height: 13px; border-radius: 3px; opacity: 0; pointer-events: none;
  box-shadow: 0 0 10px 2px rgba(255, 236, 170, .7); }
.intro-spark.k0 { background: #F4B740; } .intro-spark.k1 { background: #fff; }
.intro-spark.k2 { background: #FFD6DE; border-radius: 50%; } .intro-spark.k3 { background: #BFE3D0; }
.intro.is-unwrapping .intro-gift { animation: shake .45s ease both; }
.intro.is-unwrapping .gift-bow { animation: none; }
.intro.is-unwrapping .gift-lid { animation: lid-off .55s .35s cubic-bezier(.3, .7, .3, 1) both; }
.intro.is-unwrapping .gift-box { animation: box-burst .4s .75s ease-in both; }
.intro.is-unwrapping .intro-spark { animation: confetti 1.1s .5s cubic-bezier(.15, .8, .3, 1) forwards; }
@keyframes confetti { 0% { opacity: 1; transform: translate(-50%, -50%) scale(.4); }
  65% { opacity: 1; } 100% { opacity: 0; transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y) + 40px)) rotate(260deg) scale(1); } }
.intro.is-unwrapping .intro-from, .intro.is-unwrapping .intro-title,
.intro.is-unwrapping .intro-sub, .intro.is-unwrapping .intro-btn { animation: intro-out .35s .6s ease both; }
@keyframes box-burst { to { transform: scale(1.3); opacity: 0; } }
@keyframes intro-out { to { opacity: 0; transform: translateY(10px); } }
.tile.is-locked { opacity: .9; }
.tile.is-locked::after { content: ""; position: absolute; right: 9%; bottom: 9%; width: 11px; height: 11px; border-radius: 3px;
  background: currentColor; opacity: .35; z-index: 1; }
.tile.is-ready { animation: ready 1.6s ease-in-out infinite; z-index: 1; }
.tile.wiggle { animation: wiggle .45s ease; }
@keyframes ready { 0%, 100% { transform: none; box-shadow: 0 2px 0 rgba(0,0,0,.14), 0 0 0 0 rgba(244, 183, 64, .0); }
  50% { transform: translateY(-3px) scale(1.04); box-shadow: 0 2px 0 rgba(0,0,0,.14), 0 0 0 6px rgba(244, 183, 64, .45); } }
@keyframes wiggle { 0%, 100% { transform: none; } 25% { transform: rotate(-6deg); } 75% { transform: rotate(5deg); } }
.gift-msg { display: grid; justify-items: center; gap: 12px; padding: 18vh 12px 0; text-align: center; }
.gift-msg h1 { font-size: clamp(28px, 6vw, 40px); font-weight: 800; }
.gift-msg p { max-width: 30em; color: var(--t-soft); }
.gift-pin-form { width: min(320px, 100%); }
.gift-pin { text-align: center; font: 800 28px var(--display) !important; letter-spacing: .3em; }
.gift-card { display: grid; gap: 10px; padding: 18px; border-radius: 22px; background: var(--t-card); color: var(--ink); }
.gift-card h2 { font-size: 20px; }
.gift-make { text-align: center; font-weight: 700; }
.gift-make a, .cal-mark a { color: var(--t-soft); }
.react-row button.is-picked { outline: 3px solid var(--berry); transform: scale(1.1); }
.activity-emoji { font-size: 28px; line-height: 1; }
/* que nada dentro de la tarjeta (fila de reacciones, formularios) ensanche la grilla del revelado */
.reveal-stage { grid-template-columns: minmax(0, 1fr); }
.reveal-stage > .reveal-day, .reveal-stage > .art { justify-self: center; }
.react-row { flex-wrap: wrap; }
.react-row button { width: 44px; height: 44px; font-size: 20px; }
.reveal .share-link { margin-top: 10px; }
.reveal .share-link .btn { flex: none; }
/* botones de compra */
.buy { display: grid; gap: 4px; padding: 16px 18px; border-radius: 18px; border: 2px solid var(--line); background: #fff;
  color: var(--ink); text-align: left; cursor: pointer; font: inherit; }
.buy strong { font: 800 20px var(--display); letter-spacing: -.02em; }
.buy span { font-size: 14px; color: var(--ink-soft); }
.buy:hover { border-color: var(--ink); }
.buy.is-primary { background: var(--plum); border-color: var(--plum); color: var(--paper); }
.buy.is-primary span { color: rgba(255, 247, 238, .75); }
.buy[disabled] { opacity: .55; cursor: default; }

/* ================= scroll ================= */
/* Un solo scroll a la vez: con una ventana o el panel (móvil) abiertos, la página de atrás no se mueve
   y el scroll de la ventana no "se pasa" a la página al llegar al final. */
.panel, .sheet, .reveal { overscroll-behavior: contain; }
html:has(dialog[open]), body:has(dialog[open]) { overflow: hidden; }
@media (max-width: 900px) { html:has(.panel.is-open), body:has(.panel.is-open) { overflow: hidden; } }
/* Los textos de las puertas crecen con lo que escribes (sin una barra de scroll adentro del panel). */
.eb textarea.input { resize: none; overflow: hidden; min-height: 96px; field-sizing: content; }

/* «¿Ya hiciste un calendario? Entra» */
.signin-hint { margin: -6px 0 14px; font-size: 15px; color: var(--ink-soft); }
.link-btn { padding: 0; border: 0; background: none; color: var(--berry); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
.save-nudge { margin: 4px 0 0; font-size: 14px; color: var(--ink-soft); }
.list-account { margin: -6px 0 14px; text-align: right; }
