/* ==========================================================================
   Il calendario: temi, caselle 3D, apertura, contenuti
   ========================================================================== */

.calendar {
  --gap: clamp(7px, 1.2vw, 12px);
  position: relative; padding: clamp(18px, 3vw, 36px); border-radius: 30px;
  background: var(--cal-bg); color: var(--cal-ink);
  box-shadow: 0 0 0 1px var(--frame-line), 0 0 0 10px var(--frame), 0 0 0 11px var(--frame-line), 0 40px 90px -30px rgba(0, 0, 0, .65);
  margin: 11px;
  transition: background .6s, box-shadow .6s;
  isolation: isolate;
}
.calendar::before { content: ''; position: absolute; inset: 0; border-radius: inherit; background: var(--cal-pattern, none); opacity: .9; pointer-events: none; z-index: -1; }
.cal-header { text-align: center; margin-bottom: clamp(16px, 2.4vw, 28px); }
.cal-header .for { font-family: var(--font-script); font-size: clamp(2rem, 4vw, 3.2rem); line-height: 1; color: var(--accent); text-shadow: var(--accent-glow); }
.cal-header .sub { font-size: .76rem; font-weight: 800; letter-spacing: .26em; text-transform: uppercase; opacity: .75; margin-top: 6px; }

.door-grid {
  display: grid; gap: var(--gap);
  grid-template-columns: repeat(6, 1fr);
  grid-auto-rows: minmax(clamp(64px, 9vw, 108px), auto);
  grid-template-areas:
    "d7 d15 d15 d2 d22 d18"
    "d4 d1 d1 d13 d10 d18"
    "d20 d9 d9 d24 d24 d5"
    "d16 d11 d8 d24 d24 d14"
    "d16 d3 d3 d21 d21 d19"
    "d6 d12 d12 d23 d17 d17";
}
@media (max-width: 640px) {
  .door-grid {
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: minmax(72px, auto);
    grid-template-areas:
      "d7 d15 d15 d2" "d4 d1 d1 d18" "d22 d13 d10 d18" "d24 d24 d20 d5" "d24 d24 d9 d9"
      "d16 d11 d8 d14" "d16 d3 d3 d19" "d21 d21 d6 d23" "d12 d12 d17 d17";
  }
}
.door {
  position: relative; border: 0; padding: 0; background: none; perspective: 900px; border-radius: 14px; min-height: 64px;
  -webkit-tap-highlight-color: transparent; cursor: pointer;
}
.door .back {
  position: absolute; inset: 0; border-radius: inherit; overflow: hidden;
  background: var(--door-back); box-shadow: inset 0 4px 18px rgba(0, 0, 0, .5);
  display: grid; place-items: center; font-size: clamp(1.4rem, 3vw, 2.2rem);
}
.door .back img { width: 100%; height: 100%; object-fit: cover; opacity: .95; }
.door .back .glow { position: absolute; inset: 0; background: radial-gradient(circle at 50% 50%, rgba(255, 230, 160, .55), transparent 70%); }
.door .leaf {
  position: absolute; inset: 0; border-radius: inherit; display: grid; place-items: center;
  background: var(--door-bg); color: var(--door-ink);
  box-shadow: var(--door-shadow), inset 0 0 0 1px var(--door-edge);
  transform-origin: left center; transform-style: preserve-3d; backface-visibility: hidden;
  transition: transform 1.25s var(--ease-out), box-shadow 1.25s, filter .3s;
  overflow: hidden;
}
.door .leaf::before { /* bordo interno decorativo */
  content: ''; position: absolute; inset: 6px; border-radius: 9px; border: 1px dashed var(--door-dash); pointer-events: none;
}
.door .leaf::after { /* pomello */
  content: ''; position: absolute; right: 9px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%;
  background: var(--knob); box-shadow: 0 1px 2px rgba(0, 0, 0, .4);
}
.door .num { position: relative; font-family: var(--font-display); font-size: clamp(1.4rem, 3.2vw, 2.4rem); font-weight: 400; line-height: 1; text-shadow: var(--num-shadow); }
.door:nth-child(3n) .num { font-style: italic; }
.door:nth-child(5n+2) .num { font-family: var(--font-script); font-size: clamp(1.9rem, 4vw, 3rem); }
.door.h2 .num, .door.w2 .num { font-size: clamp(2rem, 4.5vw, 3.4rem); }
.door:hover:not(.opened) .leaf { transform: rotateY(-12deg); filter: brightness(1.08); }
.door.opened .leaf { transform: rotateY(-108deg); box-shadow: -14px 0 24px -6px rgba(0, 0, 0, .55), inset 0 0 0 1px var(--door-edge); }
.door.opened:hover .leaf { transform: rotateY(-100deg); }
.door.locked .leaf { filter: saturate(.85); }
.door.locked .lock-ico { position: absolute; top: 9px; left: 11px; font-size: .62rem; opacity: .5; }
.door.shake { animation: shake .5s; }
@keyframes shake { 20%, 60% { transform: translateX(-5px) rotate(-1deg); } 40%, 80% { transform: translateX(5px) rotate(1deg); } }
.door.today .leaf { animation: todayGlow 2.2s ease-in-out infinite; }
@keyframes todayGlow { 50% { box-shadow: var(--door-shadow), inset 0 0 0 1px var(--door-edge), 0 0 0 3px var(--accent), 0 0 34px 4px var(--accent); } }
.door.today .today-tag {
  position: absolute; top: -9px; left: 50%; transform: translateX(-50%); z-index: 3; white-space: nowrap;
  font-size: .62rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; padding: 3px 9px; border-radius: 99px;
  background: var(--red-500); color: #fff; box-shadow: 0 4px 10px rgba(0, 0, 0, .3);
}
.door .reaction-badge { position: absolute; z-index: 4; bottom: -6px; right: -6px; font-size: 1.1rem; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .4)); }
.door .tip {
  position: absolute; z-index: 10; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); white-space: nowrap;
  background: var(--night-900); color: var(--cream-100); font-size: .78rem; padding: 7px 12px; border-radius: 10px; pointer-events: none;
  animation: pop .3s var(--ease-spring);
}

/* Casella 24 */
.door.d24 .leaf { background: var(--d24-bg); }
.door.d24 .num { font-size: clamp(2.6rem, 6vw, 4.6rem); color: var(--d24-ink); z-index: 2; }
.door.d24.style-fiocco .leaf .ribbon-v, .door.d24.style-fiocco .leaf .ribbon-h { position: absolute; background: var(--gold-foil); z-index: 1; box-shadow: 0 0 8px rgba(0, 0, 0, .3); }
.door.d24 .ribbon-v { top: 0; bottom: 0; left: 50%; width: 16px; transform: translateX(-50%); }
.door.d24 .ribbon-h { left: 0; right: 0; top: 50%; height: 16px; transform: translateY(-50%); }
.door.d24 .bow { position: absolute; top: 50%; left: 50%; width: 76px; transform: translate(-50%, -78%); z-index: 2; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .35)); }
.door.d24.style-fiocco .num { background: var(--red-600); color: var(--gold-200); padding: 4px 14px; border-radius: 14px; box-shadow: 0 0 0 3px var(--gold-300); margin-top: 40px; font-size: clamp(1.8rem, 4vw, 2.6rem); }
.door.d24.style-oro .leaf { background: var(--gold-foil); background-size: 200% 200%; animation: foil 5s ease-in-out infinite; }
.door.d24.style-oro .num { color: var(--red-700); text-shadow: 0 1px 0 rgba(255, 255, 255, .6); }
@keyframes foil { 50% { background-position: 100% 100%; } }
.door.d24.style-doppia .leaf { width: 50%; }
.door.d24.style-doppia .leaf.right { left: 50%; transform-origin: right center; }
.door.d24.style-doppia.opened .leaf.right { transform: rotateY(108deg); }
.door.d24.style-doppia .num { font-size: clamp(1.8rem, 4vw, 3rem); }

/* ---------- TEMI ---------- */
.theme-notte {
  --cal-bg: radial-gradient(130% 100% at 50% 0%, #1d3557 0%, #0d1b2f 55%, #060d18 100%);
  --cal-pattern: radial-gradient(1.2px 1.2px at 12% 18%, #fff 50%, transparent), radial-gradient(1px 1px at 72% 12%, #fff 50%, transparent), radial-gradient(1.5px 1.5px at 40% 6%, #f6dfa0 50%, transparent), radial-gradient(1px 1px at 88% 40%, #fff 50%, transparent), radial-gradient(1px 1px at 22% 60%, #fff 50%, transparent);
  --cal-ink: #eaf2ff; --accent: #f1cd75; --accent-glow: 0 0 24px rgba(241, 205, 117, .55);
  --frame: #0a1424; --frame-line: rgba(241, 205, 117, .45);
  --door-bg: linear-gradient(155deg, #23426b, #142844); --door-ink: #f6dfa0; --door-edge: rgba(241, 205, 117, .35); --door-dash: rgba(241, 205, 117, .25);
  --door-shadow: 0 6px 14px -4px rgba(0, 0, 0, .6); --door-back: radial-gradient(circle, #f9e3a6, #b5852c); --knob: #f1cd75; --num-shadow: 0 0 14px rgba(241, 205, 117, .45);
  --d24-bg: radial-gradient(circle at 50% 30%, #2c5282, #142844); --d24-ink: #f6dfa0;
}
.theme-velluto {
  --cal-bg: radial-gradient(120% 100% at 50% 0%, #a3172e 0%, #6e0e1d 50%, #320510 100%);
  --cal-ink: #fff3d1; --accent: #f6dfa0; --accent-glow: 0 0 24px rgba(246, 223, 160, .5);
  --frame: #2b040d; --frame-line: rgba(246, 223, 160, .5);
  --door-bg: linear-gradient(155deg, #b01a33, #7a0f1f); --door-ink: #f6dfa0; --door-edge: rgba(246, 223, 160, .5); --door-dash: rgba(246, 223, 160, .3);
  --door-shadow: 0 6px 14px -4px rgba(0, 0, 0, .55); --door-back: radial-gradient(circle, #fff3d1, #d6a646); --knob: var(--gold-foil); --num-shadow: 0 2px 0 rgba(0, 0, 0, .25);
  --d24-bg: radial-gradient(circle at 50% 30%, #1f5a3c, #0b2519); --d24-ink: #f6dfa0;
}
.theme-velluto .door:nth-child(4n+2) { --door-bg: linear-gradient(155deg, #fbf5e9, #ead9b5); --door-ink: #8f1426; --door-dash: rgba(143, 20, 38, .25); }
.theme-velluto .door:nth-child(5n) { --door-bg: linear-gradient(155deg, #276946, #123524); }
.theme-bosco {
  --cal-bg: radial-gradient(120% 100% at 50% 0%, #2b6345 0%, #123524 55%, #06180f 100%);
  --cal-pattern: repeating-linear-gradient(45deg, rgba(255, 255, 255, .025) 0 12px, transparent 12px 24px);
  --cal-ink: #f3ead5; --accent: #ecc56c; --accent-glow: 0 0 20px rgba(236, 197, 108, .45);
  --frame: #0a2015; --frame-line: rgba(236, 197, 108, .4);
  --door-bg: linear-gradient(155deg, #f8f1e1, #e6d6b2); --door-ink: #1d4a33; --door-edge: rgba(29, 74, 51, .25); --door-dash: rgba(29, 74, 51, .25);
  --door-shadow: 0 6px 14px -4px rgba(0, 0, 0, .5); --door-back: radial-gradient(circle, #fff3d1, #c99a3c); --knob: #c8102e; --num-shadow: none;
  --d24-bg: var(--red-velvet); --d24-ink: #f6dfa0;
}
.theme-bosco .door:nth-child(3n+1) { --door-bg: linear-gradient(155deg, #c8102e, #8f1426); --door-ink: #fff3d1; --door-dash: rgba(255, 243, 209, .35); --knob: #ecc56c; }
.theme-bosco .door:nth-child(7n+3) { --door-bg: linear-gradient(155deg, #3a7d58, #1d4a33); --door-ink: #fff3d1; --door-dash: rgba(255, 243, 209, .3); }
.theme-kraft {
  --cal-bg: linear-gradient(160deg, #c9a273, #a77d50);
  --cal-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.9' numOctaves='3'/%3E%3CfeColorMatrix values='0 0 0 0 .3 0 0 0 0 .2 0 0 0 0 .1 0 0 0 .18 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  --cal-ink: #3b2414; --accent: #8f1426; --accent-glow: none;
  --frame: #7d5934; --frame-line: rgba(59, 36, 20, .4);
  --door-bg: linear-gradient(155deg, #e2c49b, #c9a273); --door-ink: #8f1426; --door-edge: rgba(59, 36, 20, .3); --door-dash: rgba(59, 36, 20, .35);
  --door-shadow: 0 5px 10px -4px rgba(59, 36, 20, .6); --door-back: radial-gradient(circle, #fffaf0, #e7d6b5); --knob: #8f1426; --num-shadow: none;
  --d24-bg: linear-gradient(155deg, #8f1426, #5e0b18); --d24-ink: #fff3d1;
}
.theme-kraft .door .leaf { background-image: linear-gradient(90deg, transparent calc(50% - 1px), rgba(143, 20, 38, .55) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)), var(--door-bg); }
.theme-kraft .door:nth-child(4n) { --door-bg: linear-gradient(155deg, #fbf5e9, #ecdcbc); }
.theme-kraft .door:nth-child(6n+1) { --door-bg: linear-gradient(155deg, #2f5d43, #1d4a33); --door-ink: #fff3d1; }
.theme-neve {
  --cal-bg: radial-gradient(120% 100% at 50% 0%, #ffffff 0%, #e6f0f8 55%, #c6d9ea 100%);
  --cal-pattern: radial-gradient(2px 2px at 20% 30%, #fff 50%, transparent), radial-gradient(2px 2px at 70% 70%, #fff 50%, transparent);
  --cal-ink: #24425f; --accent: #c8102e; --accent-glow: none;
  --frame: #f7fbff; --frame-line: rgba(36, 66, 95, .25);
  --door-bg: linear-gradient(155deg, #ffffff, #e8f1f9); --door-ink: #24425f; --door-edge: rgba(36, 66, 95, .18); --door-dash: rgba(36, 66, 95, .2);
  --door-shadow: 0 8px 16px -8px rgba(36, 66, 95, .5); --door-back: radial-gradient(circle, #fff, #cfe1f0); --knob: #b9cde0; --num-shadow: none;
  --d24-bg: linear-gradient(155deg, #c8102e, #8f1426); --d24-ink: #fff;
}
.theme-neve .door:nth-child(5n+1) { --door-bg: linear-gradient(155deg, #c8102e, #a00e26); --door-ink: #fff; --door-dash: rgba(255, 255, 255, .35); }
.theme-neve .door:nth-child(7n+4) { --door-bg: linear-gradient(155deg, #dbe8f4, #bcd2e6); }

/* ---------- Intro: busta / scatola / casella ---------- */
.intro {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(900px 700px at 50% 40%, #1c4a35, #04100b 75%);
  transition: opacity 1s var(--ease-out), visibility 1s;
}
.intro.gone { opacity: 0; visibility: hidden; }
.intro-stage { position: relative; text-align: center; color: var(--cream-100); }
.intro-hint { margin-top: 34px; font-size: .9rem; letter-spacing: .14em; text-transform: uppercase; opacity: .7; animation: breathe 2.4s infinite; }
@keyframes breathe { 50% { opacity: .3; } }

/* Busta */
.envelope { position: relative; width: min(420px, 86vw); aspect-ratio: 1.5; cursor: pointer; perspective: 1200px; margin: 0 auto; }
.envelope .env-back { position: absolute; inset: 0; border-radius: 10px; background: linear-gradient(160deg, #a3172e, #6e0e1d); box-shadow: var(--shadow-deep); }
.envelope .letter {
  position: absolute; left: 6%; right: 6%; top: 8%; height: 84%; border-radius: 8px; padding: 9% 8%;
  background: linear-gradient(#fffcf5, #f3e8d2); color: var(--ink); text-align: center;
  transition: transform 1.2s var(--ease-out) .5s; z-index: 1;
  box-shadow: 0 4px 20px rgba(0, 0, 0, .2);
}
.envelope .letter .for { font-family: var(--font-script); font-size: clamp(2rem, 7vw, 3rem); color: var(--red-600); line-height: 1; }
.envelope .letter small { display: block; font-size: .7rem; letter-spacing: .24em; text-transform: uppercase; color: var(--ink-mute); margin-bottom: 8px; }
.envelope .env-front { position: absolute; inset: 0; z-index: 2; border-radius: 10px; pointer-events: none; overflow: hidden; }
.envelope .env-front::before { /* tasca: copre tutto tranne la "V" superiore */
  content: ''; position: absolute; inset: 0; border-radius: 10px;
  background: linear-gradient(170deg, #a3172e, #7a0f1f);
  clip-path: polygon(0 0, 50% 56%, 100% 0, 100% 100%, 0 100%);
}
.envelope .env-front::after { /* pieghe diagonali */
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to top right, transparent calc(50% - 1px), rgba(0, 0, 0, .18) 50%, transparent calc(50% + 1px)) left bottom / 50% 100% no-repeat,
              linear-gradient(to top left, transparent calc(50% - 1px), rgba(0, 0, 0, .18) 50%, transparent calc(50% + 1px)) right bottom / 50% 100% no-repeat;
  clip-path: polygon(0 0, 50% 56%, 100% 0, 100% 100%, 0 100%);
}
.envelope .env-name { position: absolute; z-index: 3; left: 0; right: 0; bottom: 9%; text-align: center; font-family: var(--font-script); font-size: clamp(1.6rem, 6vw, 2.4rem); color: var(--gold-200); text-shadow: 0 1px 2px rgba(0, 0, 0, .35); transition: opacity .4s; }
.envelope.open .env-name { opacity: 0; }
.envelope .flap {
  position: absolute; left: 0; right: 0; top: 0; height: 58%; z-index: 3; transform-origin: top center;
  background: linear-gradient(180deg, #b01a33, #8f1426); clip-path: polygon(0 0, 100% 0, 50% 100%);
  transition: transform .9s var(--ease-out), z-index 0s .45s;
  filter: drop-shadow(0 6px 6px rgba(0, 0, 0, .3));
}
.envelope .seal {
  position: absolute; z-index: 4; left: 50%; top: 58%; width: 74px; height: 74px; transform: translate(-50%, -50%);
  border-radius: 50%; display: grid; place-items: center; transition: opacity .4s, transform .6s var(--ease-spring);
  background: radial-gradient(circle at 35% 30%, #f9e3a6, #d6a646 45%, #8a6420 100%);
  box-shadow: 0 4px 10px rgba(0, 0, 0, .4), inset 0 0 0 5px rgba(138, 100, 32, .45), inset 0 0 0 7px rgba(255, 243, 209, .35);
  font-family: var(--font-script); font-size: 2.1rem; color: #6b4b14;
}
.envelope:hover .seal { transform: translate(-50%, -50%) scale(1.07) rotate(-6deg); }
.envelope.open .seal { opacity: 0; transform: translate(-50%, -50%) scale(1.6); }
.envelope.open .flap { transform: rotateX(180deg); z-index: 0; }
.envelope.open .letter { transform: translateY(-62%); }

/* Scatola regalo */
.giftbox { position: relative; width: min(280px, 70vw); aspect-ratio: 1; margin: 60px auto 0; cursor: pointer; }
.giftbox .box { position: absolute; left: 6%; right: 6%; bottom: 0; height: 72%; border-radius: 6px; background: var(--red-velvet); box-shadow: var(--shadow-deep); }
.giftbox .lid { position: absolute; left: 0; right: 0; top: 18%; height: 18%; border-radius: 6px; background: linear-gradient(180deg, #b01a33, #7a0f1f); z-index: 2; transition: transform 1s var(--ease-out); box-shadow: 0 6px 10px rgba(0, 0, 0, .3); }
.giftbox .rib-v { position: absolute; left: 50%; width: 14%; top: 18%; bottom: 0; transform: translateX(-50%); background: var(--gold-foil); z-index: 3; transition: transform 1s var(--ease-out); }
.giftbox .bow { position: absolute; left: 50%; top: 0; width: 60%; transform: translateX(-50%); z-index: 4; transition: transform 1s var(--ease-out), opacity .8s; }
.giftbox .tag { position: absolute; right: -14%; top: 44%; z-index: 5; background: var(--cream-50); color: var(--red-600); padding: 10px 16px; border-radius: 6px; font-family: var(--font-script); font-size: 1.8rem; transform: rotate(8deg); box-shadow: var(--shadow-soft); }
.giftbox:hover .lid, .giftbox:hover .bow { transform: translateX(-50%) translateY(-6px); }
.giftbox:hover .lid { transform: translateY(-6px); }
.giftbox.open .lid { transform: translateY(-140%) rotate(-18deg); }
.giftbox.open .bow { transform: translateX(-50%) translateY(-180%) rotate(-24deg); opacity: 0; }
.giftbox.open .rib-v { transform: translateX(-50%) scaleY(0); transform-origin: bottom; }

/* Portone */
.bigdoor { position: relative; width: min(300px, 74vw); aspect-ratio: .62; margin: 0 auto; perspective: 1400px; cursor: pointer; }
.bigdoor .frame { position: absolute; inset: -12px; border-radius: 150px 150px 10px 10px; background: var(--gold-foil); box-shadow: var(--shadow-deep); }
.bigdoor .inside { position: absolute; inset: 0; border-radius: 140px 140px 6px 6px; background: radial-gradient(circle at 50% 40%, #fff3d1, #ecc56c 40%, #8a6420); overflow: hidden; display: grid; place-items: center; }
.bigdoor .panel { position: absolute; top: 0; bottom: 0; width: 50%; background: linear-gradient(160deg, #1f5a3c, #0b2519); transition: transform 1.4s var(--ease-out); box-shadow: inset 0 0 0 8px rgba(0, 0, 0, .12), inset 0 0 0 9px rgba(246, 223, 160, .3); }
.bigdoor .panel.l { left: 0; border-radius: 140px 0 0 6px; transform-origin: left; }
.bigdoor .panel.r { right: 0; border-radius: 0 140px 6px 0; transform-origin: right; }
.bigdoor .panel::after { content: ''; position: absolute; top: 55%; width: 10px; height: 10px; border-radius: 50%; background: var(--gold-300); }
.bigdoor .panel.l::after { right: 14px; } .bigdoor .panel.r::after { left: 14px; }
.bigdoor .wreath { position: absolute; z-index: 3; left: 50%; top: 18%; width: 46%; transform: translateX(-50%); transition: opacity .5s; }
.bigdoor .name { position: absolute; z-index: 3; left: 0; right: 0; bottom: 18%; text-align: center; font-family: var(--font-script); font-size: 2.4rem; color: var(--gold-200); text-shadow: 0 2px 8px rgba(0, 0, 0, .6); transition: opacity .5s; }
.bigdoor.open .panel.l { transform: rotateY(-100deg); }
.bigdoor.open .panel.r { transform: rotateY(100deg); }
.bigdoor.open .wreath, .bigdoor.open .name { opacity: 0; }

/* PIN */
.pin-box { width: min(380px, 100%); margin: 0 auto; text-align: center; color: var(--cream-100); }
.pin-inputs { display: flex; justify-content: center; gap: 10px; margin: 26px 0; }
.pin-inputs input { width: 52px; height: 64px; text-align: center; font-family: var(--font-display); font-size: 1.8rem; border-radius: 14px; border: 0; background: rgba(255, 255, 255, .08); color: #fff; box-shadow: inset 0 0 0 1.5px rgba(246, 223, 160, .3); }
.pin-inputs input:focus { outline: 0; box-shadow: inset 0 0 0 2px var(--gold-300), 0 0 0 5px rgba(236, 197, 108, .2); }
.pin-box.error .pin-inputs { animation: shake .5s; }

/* ---------- Pagina destinatario ---------- */
.recipient-page { min-height: 100svh; padding: 30px 0 80px; position: relative; overflow-x: hidden; }
.recipient-page.bg-notte { background: radial-gradient(1200px 800px at 50% 0%, #142a47, #050b14); }
.recipient-page.bg-velluto { background: radial-gradient(1200px 800px at 50% 0%, #4a0a14, #160206); }
.recipient-page.bg-bosco { background: radial-gradient(1200px 800px at 50% 0%, #1c5139, #04100b); }
.recipient-page.bg-kraft { background: radial-gradient(1200px 800px at 50% 0%, #6b4a2c, #2a1a0e); }
.recipient-page.bg-neve { background: radial-gradient(1200px 800px at 50% 0%, #4a6f94, #142a40); }
.recipient-top { text-align: center; color: var(--cream-100); margin-bottom: 26px; position: relative; z-index: 2; }
.recipient-top .dedication { font-family: var(--font-display); font-style: italic; font-size: 1.15rem; max-width: 560px; margin: 10px auto 0; opacity: .85; }
.countdown { display: flex; justify-content: center; gap: 12px; margin: 24px 0 10px; }
.countdown div { min-width: 76px; padding: 12px 8px; border-radius: 16px; background: rgba(255, 255, 255, .06); box-shadow: inset 0 0 0 1px rgba(246, 223, 160, .2); }
.countdown b { display: block; font-family: var(--font-display); font-size: 2rem; font-weight: 400; color: var(--gold-200); line-height: 1.1; font-variant-numeric: tabular-nums; }
.countdown span { font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; opacity: .7; }
.cal-wrap { width: min(980px, 100% - 24px); margin: 0 auto; position: relative; z-index: 2; }
.recipient-foot { text-align: center; margin-top: 40px; color: rgba(251, 245, 233, .6); font-size: .85rem; position: relative; z-index: 2; }
.recipient-foot a { color: var(--gold-300); }
.install-tip { width: min(560px, 100% - 32px); margin: 26px auto 0; padding: 14px 18px; border-radius: 16px; background: rgba(255, 255, 255, .07); color: var(--cream-100); font-size: .86rem; display: flex; gap: 12px; align-items: center; position: relative; z-index: 2; }
.install-tip button { margin-left: auto; background: none; border: 0; color: inherit; opacity: .6; font-size: 1.2rem; }

/* ---------- Contenuto della casella (modal) ---------- */
.door-modal-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(3, 8, 6, .8); backdrop-filter: blur(8px); display: grid; place-items: center; padding: 16px; overflow-y: auto; animation: fade .4s; }
.door-modal { position: relative; width: min(620px, 100%); animation: unfold .8s var(--ease-out); margin: auto; }
@keyframes unfold { from { opacity: 0; transform: perspective(1200px) rotateX(-25deg) translateY(40px) scale(.94); } }
.door-modal .close-x { position: absolute; z-index: 5; top: -14px; right: -6px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--cream-50); color: var(--ink); font-size: 1.4rem; box-shadow: var(--shadow-soft); }
.paper {
  position: relative; border-radius: 6px; padding: clamp(30px, 6vw, 56px) clamp(24px, 6vw, 56px) clamp(28px, 5vw, 44px);
  background:
    linear-gradient(transparent 0, transparent calc(2.05em - 1px), rgba(143, 20, 38, .07) calc(2.05em - 1px), rgba(143, 20, 38, .07) 2.05em) 0 1.2em / 100% 2.05em,
    radial-gradient(circle at 100% 0%, #f3e8d2, transparent 40%),
    #fffcf5;
  color: var(--ink); box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .7), 0 0 0 1px rgba(181, 133, 44, .2);
}
.paper::before { content: ''; position: absolute; inset: 10px; border: 1px solid rgba(181, 133, 44, .3); border-radius: 3px; pointer-events: none; }
.paper .door-label { display: flex; align-items: center; gap: 10px; justify-content: center; font-size: .72rem; font-weight: 800; letter-spacing: .26em; text-transform: uppercase; color: var(--gold-500); margin-bottom: 14px; }
.paper .door-label::before, .paper .door-label::after { content: ''; width: 30px; height: 1px; background: currentColor; }
.paper h2 { text-align: center; font-size: clamp(1.7rem, 4vw, 2.4rem); color: var(--red-600); margin-bottom: .6em; }
.paper .letter-text { font-family: var(--font-display); font-size: clamp(1.08rem, 2.2vw, 1.22rem); line-height: 2.05em; white-space: pre-wrap; }
.paper .sign { text-align: right; font-family: var(--font-script); font-size: 2.2rem; color: var(--red-600); margin-top: 16px; line-height: 1; }
.polaroids { display: grid; gap: 18px; margin: 10px 0 20px; }
.polaroids.n2 { grid-template-columns: 1fr 1fr; }
.polaroids.n4, .polaroids.many { grid-template-columns: 1fr 1fr; }
.polaroids.n3 { grid-template-columns: repeat(3, 1fr); gap: 12px; }
.polaroids.n3 .polaroid { padding: 8px 8px 26px; }
.polaroid { background: #fff; padding: 12px 12px 44px; box-shadow: 0 12px 24px -10px rgba(0, 0, 0, .45); position: relative; transform: rotate(var(--r, -1.5deg)); transition: transform .4s var(--ease-out); }
.polaroid:nth-child(2n) { --r: 1.8deg; }
.polaroid:hover { transform: rotate(0) scale(1.02); z-index: 2; }
.polaroid img { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--cream-200); }
.polaroid.single img { aspect-ratio: auto; max-height: 58vh; object-fit: cover; object-position: 50% 60%; }
.polaroid::before { content: ''; position: absolute; top: -12px; left: 50%; width: 90px; height: 26px; transform: translateX(-50%) rotate(-3deg); background: rgba(246, 223, 160, .75); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.caption { text-align: center; font-family: var(--font-script); font-size: 1.9rem; color: var(--ink-soft); line-height: 1.2; margin-top: 8px; }
.voice-player { display: flex; align-items: center; gap: 16px; padding: 18px 20px; border-radius: 20px; background: var(--night-700); color: var(--cream-100); margin: 10px 0 20px; }
.voice-player .play { width: 58px; height: 58px; border-radius: 50%; border: 0; background: var(--gold-foil); color: var(--night-900); display: grid; place-items: center; flex: none; box-shadow: 0 8px 18px -6px rgba(214, 166, 70, .8); }
.voice-player .play svg { width: 22px; height: 22px; }
.voice-player .wave { flex: 1; display: flex; align-items: center; gap: 3px; height: 46px; cursor: pointer; }
.voice-player .wave i { flex: 1; border-radius: 3px; background: rgba(246, 223, 160, .3); transition: background .2s; }
.voice-player .wave i.on { background: var(--gold-300); }
.voice-player .time { font-variant-numeric: tabular-nums; font-size: .85rem; opacity: .8; min-width: 42px; text-align: right; }
.video-frame { border-radius: 14px; overflow: hidden; background: #000; margin: 10px 0 20px; box-shadow: 0 16px 34px -14px rgba(0, 0, 0, .6); }
.video-frame video { width: 100%; max-height: 70vh; }
.voucher {
  position: relative; margin: 10px 0 20px; display: grid; grid-template-columns: 1fr 110px; border-radius: 18px; overflow: hidden;
  background: var(--red-velvet); color: var(--cream-100); box-shadow: 0 18px 40px -16px rgba(143, 20, 38, .8);
}
.voucher .v-main { padding: 26px 26px 24px; border-right: 2px dashed rgba(246, 223, 160, .5); position: relative; }
.voucher .v-main::before, .voucher .v-main::after { content: ''; position: absolute; right: -13px; width: 24px; height: 24px; border-radius: 50%; background: #fffcf5; }
.voucher .v-main::before { top: -12px; } .voucher .v-main::after { bottom: -12px; }
.voucher small { font-size: .68rem; font-weight: 800; letter-spacing: .24em; text-transform: uppercase; color: var(--gold-300); }
.voucher .v-what { font-family: var(--font-display); font-size: clamp(1.4rem, 3.4vw, 1.9rem); line-height: 1.15; margin: 6px 0 10px; }
.voucher .v-when { font-size: .9rem; opacity: .85; }
.voucher .v-stub { display: grid; place-items: center; writing-mode: vertical-rl; transform: rotate(180deg); font-family: var(--font-display); letter-spacing: .3em; text-transform: uppercase; color: var(--gold-200); font-size: .9rem; background: rgba(0, 0, 0, .15); }
.reactions { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; margin-top: 18px; padding-top: 18px; border-top: 1px dashed rgba(181, 133, 44, .4); }
.reactions p { width: 100%; text-align: center; font-size: .78rem; color: var(--ink-mute); margin: 0 0 4px; }
.reactions button { width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--cream-100); font-size: 1.35rem; transition: transform .3s var(--ease-spring); }
.reactions button:hover { transform: scale(1.18); }
.reactions button[aria-pressed='true'] { background: var(--gold-200); box-shadow: 0 0 0 2px var(--gold-400); transform: scale(1.1); }
.door-modal.is24 .paper { background: radial-gradient(circle at 50% 0%, #fff3d1, #fffcf5 50%); box-shadow: 0 0 0 1px var(--gold-300), 0 0 0 8px rgba(236, 197, 108, .2), 0 0 80px rgba(236, 197, 108, .4), 0 30px 70px -20px rgba(0, 0, 0, .7); }
.door-nav { display: flex; justify-content: space-between; margin-top: 16px; }
.door-nav button { background: rgba(255, 255, 255, .1); border: 0; color: var(--cream-100); padding: 10px 18px; border-radius: 99px; font-size: .88rem; font-weight: 600; }
.door-nav button:disabled { opacity: .3; }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 95; }
.preview-note { position: sticky; top: 0; z-index: 60; background: var(--gold-foil); color: var(--night-900); text-align: center; padding: 10px 16px; font-weight: 700; font-size: .9rem; }
.preview-note a { color: inherit; }
.paper .empty-door { text-align: center; font-family: var(--font-display); font-style: italic; font-size: 1.3rem; color: var(--ink-soft); margin: 10px 0; }

/* ==========================================================================
   ✨ Animazioni del calendario
   ========================================================================== */
/* Entrata: le caselle si "ribaltano" in posizione una dopo l'altra */
.door-grid.doors-enter .door { animation: doorIn 1s var(--ease-spring) both; animation-delay: calc(var(--i, 0) * 42ms); }
@keyframes doorIn { from { opacity: 0; transform: perspective(700px) rotateX(-80deg) translateY(26px) scale(.9); } }
/* Riflesso che scorre sull'anta */
.door .sheen { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; overflow: hidden; }
.door .sheen::before { content: ''; position: absolute; top: -50%; bottom: -50%; width: 40%; left: -60%; transform: rotate(18deg); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .35), transparent); transition: left 0s; }
.door:hover:not(.opened) .sheen::before { left: 130%; transition: left .9s var(--ease-out); }
.door.today .sheen::before { animation: sheen 3.2s ease-in-out infinite; }
@keyframes sheen { 0%, 55% { left: -60%; } 100% { left: 130%; } }
/* Apertura: la luce esce da dietro l'anta */
.door.opening .back .glow { animation: glowFlash 1.4s var(--ease-out); }
@keyframes glowFlash { 0% { opacity: 0; } 25% { opacity: 1; background: radial-gradient(circle, rgba(255, 250, 225, 1), rgba(255, 220, 140, .7) 45%, transparent 75%); } 100% { opacity: 1; } }
.door.opening .leaf { transition-duration: 1.4s; }
.door.opened .back img { animation: backIn 1.2s var(--ease-out) both; }
@keyframes backIn { from { transform: scale(1.25); filter: brightness(1.8) blur(3px); } }

/* Modal: raggi di luce dietro la carta e contenuti che emergono uno dopo l'altro */
.door-modal::before {
  content: ''; position: absolute; z-index: -1; left: 50%; top: 40%; width: 180vmax; aspect-ratio: 1; transform: translate(-50%, -50%);
  background: repeating-conic-gradient(rgba(255, 230, 170, .14) 0deg 6deg, transparent 6deg 22deg);
  -webkit-mask: radial-gradient(circle, #000 0%, transparent 45%); mask: radial-gradient(circle, #000 0%, transparent 45%);
  animation: raysIn 1.4s var(--ease-out) both, spin 60s linear infinite; pointer-events: none;
}
@keyframes raysIn { from { opacity: 0; } }
.door-modal .paper > * { animation: rise .9s var(--ease-out) both; }
.door-modal .paper > *:nth-child(1) { animation-delay: .25s; } .door-modal .paper > *:nth-child(2) { animation-delay: .4s; }
.door-modal .paper > *:nth-child(3) { animation-delay: .55s; } .door-modal .paper > *:nth-child(4) { animation-delay: .7s; }
.door-modal .paper > *:nth-child(5) { animation-delay: .85s; } .door-modal .paper > *:nth-child(6) { animation-delay: 1s; }
.door-modal .paper > *:nth-child(n+7) { animation-delay: 1.15s; }
/* Lettera: le righe compaiono come scritte a mano */
.letter-text .ln { display: block; min-height: 2.05em; animation: inkIn 1.1s var(--ease-out) both; }
.letter-text .ln:first-child::first-letter { font-size: 3.2em; float: left; line-height: .9; margin: .08em .1em 0 0; color: var(--red-600); font-style: italic; }
@keyframes inkIn { from { opacity: 0; filter: blur(6px); clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
/* Polaroid che "si sviluppa" e poi respira lentamente */
.polaroid .ph { overflow: hidden; background: #ddd; }
.polaroid .ph img { animation: develop 3.2s ease-out both, kenburns 18s ease-in-out 3.2s infinite alternate; }
@keyframes develop { 0% { filter: brightness(2.6) saturate(0) sepia(.5) blur(8px); opacity: .4; } 45% { filter: brightness(1.4) saturate(.4) sepia(.3) blur(2px); opacity: 1; } 100% { filter: none; } }
.polaroid { animation: dropIn 1s var(--ease-spring) both; }
.polaroid:nth-child(2) { animation-delay: .15s; } .polaroid:nth-child(3) { animation-delay: .3s; } .polaroid:nth-child(4) { animation-delay: .45s; }
@keyframes dropIn { from { opacity: 0; transform: translateY(-40px) rotate(-12deg) scale(1.1); } }
/* Buono: entra come un biglietto, con un riflesso */
.voucher { animation: ticketIn 1.1s var(--ease-spring) .5s both; }
.voucher::after { content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 35%, rgba(255, 240, 200, .35) 50%, transparent 65%); background-size: 250% 100%; animation: shine 3.5s ease-in-out 1.4s infinite; pointer-events: none; }
@keyframes ticketIn { from { opacity: 0; transform: translateX(-60px) rotate(-10deg) scale(.9); } }
@keyframes shine { 0% { background-position: 150% 0; } 60%, 100% { background-position: -100% 0; } }
/* Casella 24: alone dorato pulsante */
.door-modal.is24 .paper { animation: glow24 3s ease-in-out 1s infinite; }
@keyframes glow24 { 50% { box-shadow: 0 0 0 1px var(--gold-300), 0 0 0 10px rgba(236, 197, 108, .3), 0 0 120px rgba(236, 197, 108, .65), 0 30px 70px -20px rgba(0, 0, 0, .7); } }
.door-modal.is24 h2 { background: var(--gold-text); background-size: 200% auto; -webkit-background-clip: text; background-clip: text; color: transparent; animation: rise .9s var(--ease-out) .4s both, shimmer 5s linear infinite; filter: drop-shadow(0 1px 0 rgba(143, 20, 38, .4)); }
/* Uscita della busta: lettera luminosa */
.envelope.open .letter { box-shadow: 0 0 60px rgba(255, 230, 160, .7), 0 4px 20px rgba(0, 0, 0, .2); }
.bigdoor.open .inside { animation: pour 1.4s var(--ease-out) both; }
@keyframes pour { to { box-shadow: 0 0 120px 40px rgba(255, 225, 150, .8); } }

/* ---------- Canzone (vinile) ---------- */
.song { margin: 10px 0 22px; padding: 18px; border-radius: 20px; background: radial-gradient(120% 120% at 0% 0%, #1b3a2a, #0b1d14 70%); color: var(--cream-100); box-shadow: 0 20px 40px -18px rgba(0, 0, 0, .7), inset 0 0 0 1px rgba(246, 223, 160, .18); animation: rise .9s var(--ease-out) .5s both; }
.song-top { display: flex; gap: 18px; align-items: center; }
.vinyl { position: relative; flex: none; width: 112px; height: 112px; border-radius: 50%; display: grid; place-items: center;
  background: repeating-radial-gradient(circle, var(--disc-b, #111) 0 2px, var(--disc-a, #1c1c1c) 2px 4px), var(--disc-b, #111); box-shadow: 0 10px 24px rgba(0, 0, 0, .6), inset 0 0 0 2px rgba(0, 0, 0, .55);
  animation: vinylIn 1.2s var(--ease-spring) .6s both; }
.vinyl::before { content: ''; position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(from 30deg, transparent 0 40deg, rgba(255, 255, 255, .14) 55deg, transparent 75deg 220deg, rgba(255, 255, 255, .1) 235deg, transparent 255deg); }
.vinyl-label { position: relative; width: 44%; height: 44%; border-radius: 50%; background: radial-gradient(circle, #f6dfa0, #c8102e 60%) center / cover; box-shadow: 0 0 0 3px #0a0a0a; }
.vinyl-label::after { content: ''; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px; border-radius: 50%; background: #0b1d14; }
.song:hover .vinyl, .song.playing .vinyl { animation: vinylIn 1.2s var(--ease-spring) .6s both, spin 3.2s linear infinite; }
.song.playing .vinyl { animation: spin 2.4s linear infinite; }
@keyframes vinylIn { from { opacity: 0; transform: translateX(-30px) rotate(-200deg) scale(.6); } }
.song-info { min-width: 0; }
.song-info small { font-size: .66rem; font-weight: 800; letter-spacing: .22em; text-transform: uppercase; color: var(--gold-300); }
.song-info b { display: block; font-family: var(--font-display); font-weight: 500; font-size: 1.35rem; line-height: 1.2; margin: 4px 0 6px; }
.song-info p { margin: 0 0 10px; font-size: .9rem; opacity: .8; font-style: italic; }
.song-actions { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.song-open { color: #1ed760; font-size: .85rem; font-weight: 700; text-decoration: none; }
.song-embed iframe { display: block; margin-top: 16px; border-radius: 12px; animation: rise .6s var(--ease-out) both; }
.song-note { font-size: .7rem; opacity: .55; margin: 12px 0 0; }
.song-note a { color: inherit; }
@media (max-width: 480px) { .vinyl { width: 84px; height: 84px; } .song-info b { font-size: 1.1rem; } }

/* ---------- Pulsante musica ---------- */
.music-fab {
  position: fixed; left: 18px; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 85; display: inline-flex; align-items: center; gap: 10px;
  padding: 11px 16px 11px 13px; border-radius: 999px; border: 0; color: var(--cream-100); font-size: .82rem; font-weight: 700;
  background: rgba(5, 18, 12, .72); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: inset 0 0 0 1px rgba(246, 223, 160, .3), 0 12px 30px -10px rgba(0, 0, 0, .6);
  transition: transform .3s var(--ease-spring), box-shadow .3s; animation: rise .8s var(--ease-out) 1s both;
}
.music-fab:hover { transform: translateY(-2px); }
.music-fab .eq { display: inline-flex; align-items: flex-end; gap: 2.5px; height: 16px; }
.music-fab .eq i { width: 3px; height: 4px; border-radius: 2px; background: var(--gold-300); transition: height .3s; }
.music-fab.on .eq i { animation: eqb 1s ease-in-out infinite; }
.music-fab.on .eq i:nth-child(2) { animation-delay: -.3s; } .music-fab.on .eq i:nth-child(3) { animation-delay: -.6s; } .music-fab.on .eq i:nth-child(4) { animation-delay: -.15s; }
@keyframes eqb { 0%, 100% { height: 4px; } 50% { height: 16px; } }
.music-fab:not(.on) .mf-label::after { content: ' · off'; opacity: .6; }
.music-fab.hinting:not(.on) { box-shadow: inset 0 0 0 1px var(--gold-300), 0 0 0 0 rgba(236, 197, 108, .6); animation: rise .8s var(--ease-out) 1s both, fabPulse 2s ease-out 2s infinite; }
.music-fab.hinting:not(.on) .mf-label::after { content: ' · tocca per ascoltare'; }
@keyframes fabPulse { to { box-shadow: inset 0 0 0 1px var(--gold-300), 0 0 0 16px rgba(236, 197, 108, 0); } }
.music-choices { display: grid; gap: 8px; margin: 10px 0 14px; }
.music-opt { display: flex; align-items: center; gap: 12px; text-align: left; border: 0; border-radius: 14px; padding: 10px 12px; background: rgba(255, 255, 255, .06); color: rgba(251, 245, 233, .85); box-shadow: inset 0 0 0 1.5px transparent; transition: all .25s; }
.music-opt b { display: block; font-size: .92rem; }
.music-opt small { display: block; font-size: .74rem; opacity: .65; }
.music-opt .m-ico { font-size: 1.3rem; width: 28px; text-align: center; }
.music-opt .m-play { margin-left: auto; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: rgba(246, 223, 160, .14); color: var(--gold-200); font-size: .8rem; flex: none; }
.music-opt[aria-pressed='true'] { background: rgba(236, 197, 108, .14); box-shadow: inset 0 0 0 2px var(--gold-300); color: var(--gold-100); }
.music-opt.previewing .m-play { background: var(--gold-foil); color: var(--night-900); }


/* ==========================================================================
   Interno delle caselle aperte: un mosaico curato
   ========================================================================== */
.door .back { container-type: size; background: var(--door-back); }
.door .back .glow { z-index: 3; pointer-events: none; opacity: 0; }
.door.opening .back .glow { opacity: 1; }
.door .back::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 2;
  box-shadow: inset 0 0 0 1px rgba(255, 240, 200, .28), inset 0 0 22px rgba(0, 0, 0, .35); }
.bk-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.door.opened .bk-photo { animation: backIn 1.2s var(--ease-out) both; }
.bk-num { position: absolute; z-index: 3; top: 7px; left: 8px; min-width: 22px; padding: 1px 7px; border-radius: 99px; font-family: var(--font-display); font-style: italic; font-size: .72rem; line-height: 1.5; text-align: center;
  background: rgba(10, 16, 24, .45); color: #fff8e6; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.bk { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; padding: 12px 10px; text-align: center; overflow: hidden; }
.bk-txt { position: relative; z-index: 1; display: grid; gap: 3px; max-width: 100%; }
.bk-txt small { font-size: .56rem; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; opacity: .8; }
.bk-txt b { font-family: var(--font-display); font-weight: 500; font-size: clamp(.78rem, 11cqi, 1.35rem); line-height: 1.18; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.door.opened .bk > * { animation: rise .9s var(--ease-out) .25s both; }

/* Lettera: carta, righe, sigillo di ceralacca e titolo in corsivo */
.bk-letter { background: linear-gradient(transparent 0 calc(100% - 1px), rgba(143, 20, 38, .08) 0) 0 0 / 100% 18px, radial-gradient(circle at 70% 0%, #fff, transparent 60%), linear-gradient(160deg, #fffaf0, #f1e4c8); color: var(--red-600); }
.bk-letter .seal { width: clamp(22px, 24cqi, 38px); aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-script); font-size: clamp(.8rem, 14cqi, 1.3rem); color: #f6dfa0;
  background: radial-gradient(circle at 35% 30%, #e0384f, #8f1426 70%); box-shadow: 0 3px 6px rgba(80, 0, 10, .35), inset 0 0 0 3px rgba(0, 0, 0, .12); }
.bk-letter .bk-txt b { font-family: var(--font-script); font-weight: 400; font-size: clamp(1rem, 16cqi, 2rem); line-height: 1.05; }
/* Buono: biglietto rosso con perforazione */
.bk-ticket { color: #fff3d1; background: radial-gradient(circle at 0 50%, transparent 9px, transparent 0) , var(--red-velvet); }
.bk-ticket::before { content: ''; position: absolute; inset: 7px; border: 1.5px dashed rgba(246, 223, 160, .55); border-radius: 8px; }
.bk-ticket::after { content: ''; position: absolute; top: 50%; left: -9px; right: -9px; height: 18px; margin-top: -9px; background: radial-gradient(circle at 9px 9px, var(--cal-bg-solid, #0d1b2f) 8px, transparent 9px) left / 18px 18px no-repeat, radial-gradient(circle at 9px 9px, var(--cal-bg-solid, #0d1b2f) 8px, transparent 9px) right / 18px 18px no-repeat; }
.bk-ticket .bk-txt small { color: var(--gold-300); }
/* Canzone: copertina del disco con il vinile che esce dalla busta */
.bk-song { background: radial-gradient(120% 120% at 0 0, #1d3b2b, #0a1a12); color: #fff; justify-content: flex-end; align-items: stretch; text-align: left; padding: 0; }
.bk-song .cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.bk-song .cover-blank { display: grid; place-items: center; font-size: 2rem; color: var(--gold-300); }
.bk-song::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 35%, rgba(0, 0, 0, .78)); }
.bk-song .disc { display: none; }
.bk-song .bk-txt { padding: 10px 11px; }
.bk-song .bk-txt small { color: #1ed760; opacity: 1; }
.bk-song .bk-txt b { font-size: clamp(.74rem, 9cqi, 1.15rem); -webkit-line-clamp: 2; }
.back.wide .bk-song { flex-direction: row; align-items: center; justify-content: flex-start; gap: 0; padding: 0 14px 0 12px; }
.back.wide .bk-song::after { display: none; }
.back.wide .bk-song .cover { position: relative; inset: auto; width: auto; height: 74%; aspect-ratio: 1; border-radius: 6px; z-index: 2; box-shadow: 6px 6px 16px rgba(0, 0, 0, .55); flex: none; }
.back.wide .bk-song .disc { display: block; position: relative; flex: none; height: 68%; aspect-ratio: 1; margin-left: -34%; margin-right: 12px; border-radius: 50%; z-index: 1;
  background: radial-gradient(circle, #c8102e 0 17%, #111 18% 20%, transparent 21%), repeating-radial-gradient(circle, #121212 0 2px, #1f1f1f 2px 4px); box-shadow: 0 4px 12px rgba(0, 0, 0, .6); }
.back.wide .bk-song .disc { margin-left: calc(-1 * 68cqh * .55); transform: translateX(55%); animation: spin 6s linear infinite; }
.back.wide .bk-song .bk-txt { padding: 0 0 0 4px; }
.back.wide .bk-song .bk-txt b { font-size: clamp(.8rem, 5.5cqi, 1.2rem); }

/* Vocale: onda sonora dorata */
.bk-voice { background: radial-gradient(120% 120% at 20% 0%, #24603f, #0b2519 75%); color: var(--cream-100); }
.bk-voice .bars { display: flex; align-items: center; gap: 3px; height: clamp(18px, 34cqh, 46px); }
.bk-voice .bars i { width: 3px; border-radius: 2px; background: linear-gradient(var(--gold-200), var(--gold-500)); height: 30%; animation: eqb 1.6s ease-in-out infinite; }
.bk-voice .bars i:nth-child(odd) { animation-duration: 1.2s; } .bk-voice .bars i:nth-child(3n) { animation-delay: -.5s; } .bk-voice .bars i:nth-child(4n+1) { animation-delay: -.9s; }
.bk-voice .bk-txt small { color: var(--gold-300); }
/* Video */
.bk-video { background: radial-gradient(circle, #2a2a2a, #0b0b0b); color: #fff; }
.bk-video .play { width: clamp(26px, 30cqi, 48px); aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; background: var(--gold-foil); color: var(--night-900); font-size: .8rem; padding-left: 2px; }
/* Caselle piccole: solo l'essenziale, niente testo affollato */
.back.small .bk { gap: 4px; padding: 8px 7px; }
.back.small .bk-txt small { display: none; }
.back.small .bk-txt b { font-size: clamp(.62rem, 12cqi, .82rem); -webkit-line-clamp: 2; }
.back.small .bk-letter .bk-txt b { font-size: clamp(.82rem, 17cqi, 1.15rem); }
.back.small .bk-letter .seal { width: 26%; }
.back.small .bk-voice .bk-txt { display: none; }
.back.small .bk-voice .bars { height: 44%; gap: 2.5px; }
.back.small .bk-voice .bars i { width: 2.5px; }
.back.small .bk-ticket .bk-txt small { display: block; font-size: .48rem; letter-spacing: .24em; }
.back.small .bk-ticket .bk-txt b { font-size: clamp(.6rem, 11cqi, .8rem); -webkit-line-clamp: 3; }
.back.small .bk-ticket::before { inset: 5px; }
.back.small .bk-song .bk-txt { padding: 6px 7px; }
.back.small .bk-song .bk-txt b { font-size: clamp(.58rem, 10cqi, .74rem); -webkit-line-clamp: 1; }
.back.small .bk-song::after { background: linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, .8)); }
.back.small .bk-video .bk-txt { display: none; }
.back.small .bk-num, .back.tall .bk-num { font-size: .62rem; top: 5px; left: 5px; padding: 0 6px; }
.back.big .bk-txt b { font-size: clamp(1rem, 7cqi, 1.6rem); }
.theme-notte { --cal-bg-solid: #0f1e33; } .theme-velluto { --cal-bg-solid: #5a0c19; } .theme-bosco { --cal-bg-solid: #10301f; } .theme-kraft { --cal-bg-solid: #b48c5e; } .theme-neve { --cal-bg-solid: #e1ecf6; }

.bk-voice .mic { width: clamp(16px, 18cqi, 30px); height: auto; fill: none; stroke: var(--gold-300); stroke-width: 1.7; stroke-linecap: round; filter: drop-shadow(0 0 6px rgba(236, 197, 108, .5)); }
.back.small .bk-voice .mic { width: 30%; }
.back.small .bk-voice .bars { height: 22%; }

/* Player di YouTube nella casella: compatto, centrato, angoli arrotondati (come la scheda di Spotify) */
.song-embed.yt { width: 100%; max-width: 380px; height: 214px; margin: 12px auto 0; border-radius: 14px; overflow: hidden; background: #000; box-shadow: 0 6px 18px -8px rgba(0, 0, 0, .5); }
.song-embed.yt iframe { width: 100%; height: 100%; margin: 0; border: 0; display: block; pointer-events: none; }   /* si comanda solo dal nostro pulsante: niente bottoni di YouTube che compaiono al passaggio */
.song[data-provider='youtube'] .song-open { color: #ff7a8a; }

/* Comando minimale sotto il video di YouTube */
.yt-bar { display: flex; align-items: center; gap: 12px; width: 100%; max-width: 380px; margin: 10px auto 0; padding: 6px 14px 6px 6px; border-radius: 999px; background: #243b45; color: #fff; box-shadow: 0 5px 12px -6px rgba(10, 30, 40, .6); }
.yt-pp { flex: none; width: 38px; height: 38px; border-radius: 50%; border: 0; display: grid; place-items: center; background: #fff; color: #243b45; cursor: pointer; box-shadow: 0 3px 0 rgba(0, 0, 0, .25); }
.yt-pp svg { fill: currentColor; }
.yt-bar:not(.on) .i-pause, .yt-bar.on .i-play { display: none; }
.yt-track { position: relative; flex: 1; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .25); cursor: pointer; }
.yt-track::before { content: ''; position: absolute; inset: -12px 0; }        /* area di tocco più grande */
.yt-track i { display: block; height: 100%; width: 0; border-radius: 3px; background: #ff4d63; transition: width .25s linear; }
.yt-time { flex: none; font: 600 .78rem var(--font-body, sans-serif); font-variant-numeric: tabular-nums; opacity: .85; min-width: 2.4em; text-align: right; }
.yt-track:focus-visible, .yt-pp:focus-visible { outline: 3px solid rgba(255, 255, 255, .7); outline-offset: 3px; }

/* Il disco prende i colori della copertina: solchi, riflessi e luce (e restano quando gira) */
.song.tinted .vinyl { box-shadow: 0 10px 26px -4px var(--disc-b), 0 4px 12px rgba(0, 0, 0, .45), inset 0 0 0 2px rgba(0, 0, 0, .45), inset 0 0 14px 2px var(--disc-hi); }
.song.tinted .vinyl::before { background: conic-gradient(from 30deg, transparent 0 40deg, rgba(255, 255, 255, .3) 55deg, transparent 80deg 220deg, rgba(255, 255, 255, .22) 235deg, transparent 262deg); }
.song .vinyl-label { width: 46%; height: 46%; box-shadow: 0 0 0 3px rgba(0, 0, 0, .5), 0 0 0 5px var(--disc-hi, transparent); }

/* ---------- Ordine delle voci (elenco "Già nella casella" dell'editor) ---------- */
.door-body, .blk { display: contents; }
.rb-list { position: relative; display: grid; gap: 7px; text-align: left; }
.rb-card { position: relative; display: flex; align-items: center; gap: 11px; padding: 7px 8px 7px 8px; border-radius: 13px; background: #fff; border: 1.5px solid #d6e3e8; box-shadow: 0 3px 0 rgba(36, 59, 69, .1); cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: pan-y; color: var(--teal, #334e5a); }
.rb-card:focus-visible { outline: 3px solid rgba(232, 53, 47, .5); outline-offset: 2px; }
.rb-ico { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 1.1rem; background: #eef9fb; overflow: hidden; }
.rb-thumb, .rb-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.rb-txt { flex: 1; min-width: 0; display: grid; gap: 1px; }
.rb-txt b { font-size: .86rem; line-height: 1.2; }
.rb-txt small { color: #6a838d; font-size: .73rem; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rb-grip { flex: none; width: 34px; height: 34px; display: grid; place-items: center; color: #8da3ac; touch-action: none; cursor: grab; }
.rb-grip svg { width: 18px; height: 18px; }
.rb-list.is-locked .rb-card { cursor: default; opacity: .75; box-shadow: none; }
.rb-card.drag-origin { opacity: .35; filter: grayscale(.5); border-style: dashed; border-color: var(--red, #e8352f); box-shadow: none; }
.rb-ghost { z-index: 60; pointer-events: none; cursor: grabbing; will-change: transform; box-shadow: 0 18px 22px -10px rgba(10, 25, 32, .5), 0 5px 7px rgba(10, 25, 32, .22); border-color: var(--red, #e8352f); }
.rb-list.is-dragging { cursor: grabbing; }
.rb-note { margin: -2px 0 8px; font-size: .76rem; line-height: 1.4; color: #6a838d; }
.rb-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (prefers-reduced-motion: reduce) { .rb-card { transition: none; } }
/* tocchi comodi su telefono: l'area toccabile è almeno ~40px anche se il testo è piccolo */
.preview-note a { display: inline-block; padding: 10px 8px; margin: -10px -4px; }
