:root {
  --coral: #E2725B;
  --cream: #FFFDD0;
  --olive: #A6BA45;
  --red: #FF3E3E;
  --navy: #19223F;
  --ink: #000;
  --track: #D9D9D9;
  --white: #fff;

  --app-w: min(100vw, 520px);
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);

  --cross: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpath d='M18 50H82M50 18V82' stroke='%2319223F' stroke-width='1.6' vector-effect='non-scaling-stroke' fill='none'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--coral);
  color: var(--white);
  font-family: 'Arvo', Rockwell, 'Roboto Slab', Georgia, serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

button, a { font: inherit; color: inherit; touch-action: manipulation; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
[hidden] { display: none !important; }

#app {
  position: fixed;
  inset: 0;
  margin: 0 auto;
  width: var(--app-w);
  overflow: hidden;
  background: var(--coral);
}

.screen {
  position: absolute;
  inset: 0;
}

/* ───────────────────────── Start ───────────────────────── */

.screen-start {
  background: var(--coral);
  cursor: pointer;
  overflow: hidden;
}

.start-crosses {
  position: absolute;
  inset: 0;
  background-image: var(--cross);
  background-size: calc(var(--app-w) * .129) calc(var(--app-w) * .099);
  background-position: calc(var(--app-w) * -.02) calc(var(--app-w) * -.03);
  pointer-events: none;
}

.logo-wrap {
  position: absolute;
  left: 1.5%;
  width: 96%;
  top: 40%;
  transform: translateY(-50%);
}

.logo {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 10px 24px rgba(25, 34, 63, .18));
  animation: logoIn .9s var(--ease-out) both;
}

.sparkles {
  position: absolute;
  left: 6.7%;
  top: -46%;
  width: 31%;
  overflow: visible;
}
.spark {
  transform-box: fill-box;
  transform-origin: center;
  animation: twinkle 3.2s ease-in-out infinite both;
}
.spark.s1 { animation-delay: .1s; }
.spark.s2 { animation-delay: .9s; }
.spark.s3 { animation-delay: 1.6s; }
.spark.s4 { animation-delay: 2.3s; }

.start-cta {
  position: absolute;
  left: 50%;
  bottom: calc(5.5% + var(--safe-b) * .5);
  transform: translateX(-50%);
  padding: 12px 26px 13px;
  background: var(--navy);
  color: var(--cream);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .14em;
  text-transform: uppercase;
  animation: ctaIn .7s .5s var(--ease-out) both;
}
.start-cta::after {
  content: '';
  position: absolute;
  inset: -6px;
  border: 1.5px solid var(--navy);
  opacity: 0;
  animation: ctaPulse 2.6s 1.4s ease-out infinite;
}

.pandas {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.panda {
  position: absolute;
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
  font-size: calc(var(--app-w) * .062);
  line-height: 1;
  translate: -50% -50%;
  rotate: var(--r, 0deg);
  animation:
    pandaIn .6s var(--d, .6s) cubic-bezier(.3, 1.5, .5, 1) both,
    pandaBob var(--f, 4s) calc(var(--d, .6s) + .6s) ease-in-out infinite;
}
@keyframes pandaIn {
  from { opacity: 0; transform: scale(.3); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes pandaBob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-3px); }
}

@keyframes logoIn {
  from { opacity: 0; transform: scale(.92) rotate(-2deg); }
  to   { opacity: 1; transform: none; }
}
@keyframes twinkle {
  0%, 100% { transform: scale(1);   opacity: 1; }
  50%      { transform: scale(.72); opacity: .55; }
}
@keyframes ctaIn {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
@keyframes ctaPulse {
  0%   { opacity: .7; transform: scale(1); }
  70%  { opacity: 0;  transform: scale(1.18, 1.5); }
  100% { opacity: 0; }
}

/* ───────────────────────── Kalender ───────────────────────── */

.cal-back {
  position: fixed;
  z-index: 3;
  top: calc(var(--safe-t) + 10px);
  left: calc((100vw - var(--app-w)) / 2 + 12px);
}

.screen-calendar {
  --box: min(44vw, 228px);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
.screen-calendar::-webkit-scrollbar { display: none; }

.doors {
  list-style: none;
  margin: 0;
  padding: calc(var(--box) * .6 + var(--safe-t)) 0 calc(var(--box) * .6 + var(--safe-b));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(var(--box) * .18);
}

.door {
  position: relative;
  display: block;
  width: var(--box);
  aspect-ratio: 1;
  border: max(3px, calc(var(--box) * .016)) solid var(--ink);
  background: var(--cream);
  transition: transform .18s var(--ease-out);
}
.door:active { transform: scale(.97); }
.door:focus-visible { outline: 3px solid var(--cream); outline-offset: 4px; }

.door-cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  visibility: hidden;
}
.door.opening .door-cover,
.door.opened .door-cover { visibility: visible; }
.door.opening .door-cover { animation: coverReveal 1s .45s var(--ease-out) both; }

.wrap {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.wrap-l { clip-path: inset(0 50% 0 0); }
.wrap-r { clip-path: inset(0 0 0 50%); }

.paper {
  position: absolute;
  inset: 0;
  background: var(--cream);
}
.rib-v, .rib-h {
  position: absolute;
  background: var(--olive);
}
.rib-v { left: 34.7%; width: 7.6%; top: 0; bottom: 0; transform-origin: 50% 0; }
.rib-h { top: 35%;  height: 7.3%; left: 0; right: 0; transform-origin: 100% 50%; }

.bow {
  position: absolute;
  left: 38.5%;
  top: 38.6%;
  width: 30%;
  height: 30%;
  transform: translate(-50%, -50%);
  overflow: visible;
  fill: var(--red);
}

.num {
  position: absolute;
  right: 8%;
  bottom: 4%;
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 900;
  font-size: calc(var(--box) * .27);
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: lining-nums;
}

/* Today's unopened door: gentle bow wiggle */
.door.today:not(.opened):not(.opening) .bow {
  animation: bowWiggle 2.8s ease-in-out infinite;
}

/* Opened state */
.door.opened .wrap { display: none; }
.door-chip {
  position: absolute;
  right: -2px;
  bottom: -2px;
  min-width: calc(var(--box) * .2);
  padding: 2px 6px 0;
  background: var(--cream);
  border: max(3px, calc(var(--box) * .016)) solid var(--ink);
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 900;
  font-size: calc(var(--box) * .12);
  line-height: 1.25;
  color: var(--ink);
  text-align: center;
  display: none;
}
.door.opened .door-chip { display: block; animation: chipIn .4s var(--ease-out) both; }

/* Unwrap animation */
.door.opening { z-index: 2; }
.door.opening .bow   { animation: bowOff .42s cubic-bezier(.55, -.35, .75, .4) both; }
.door.opening .rib-v { animation: ribV .38s .22s var(--ease-in-out) both; }
.door.opening .rib-h { animation: ribH .38s .22s var(--ease-in-out) both; }
.door.opening .wrap-l { animation: paperL .7s .55s cubic-bezier(.5, 0, .25, 1) both; }
.door.opening .wrap-r { animation: paperR .7s .55s cubic-bezier(.5, 0, .25, 1) both; }

@keyframes bowOff {
  to { transform: translate(-50%, -50%) rotate(140deg) scale(0); }
}
@keyframes ribV { to { transform: scaleY(0); } }
@keyframes ribH { to { transform: scaleX(0); } }
@keyframes paperL {
  to { transform: translateX(-62%) rotate(-9deg); opacity: 0; }
}
@keyframes paperR {
  to { transform: translateX(62%) rotate(9deg); opacity: 0; }
}
@keyframes coverReveal {
  from { transform: scale(1.12); filter: saturate(.4) brightness(1.15); }
  to   { transform: scale(1);    filter: none; }
}
@keyframes bowWiggle {
  0%, 70%, 100% { transform: translate(-50%, -50%) rotate(0); }
  78% { transform: translate(-50%, -50%) rotate(-14deg) scale(1.06); }
  86% { transform: translate(-50%, -50%) rotate(10deg); }
  93% { transform: translate(-50%, -50%) rotate(-4deg); }
}
@keyframes chipIn {
  from { opacity: 0; transform: scale(.6); }
  to   { opacity: 1; transform: none; }
}
.door.nope { animation: nope .42s var(--ease-out); }
@keyframes nope {
  20% { transform: translateX(-7px) rotate(-1.5deg); }
  40% { transform: translateX(6px)  rotate(1.2deg); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(2px); }
}

/* Staggered entrance */
.doors.enter .door-item {
  animation: rise .7s var(--ease-out) both;
  animation-delay: calc(min(var(--i), 6) * 70ms + 120ms);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: none; }
}

/* ───────────────────────── Song ───────────────────────── */

.screen-song {
  --disc: min(55vw, 31dvh, 290px);
  --gutter: max(10.5%, 20px);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(var(--safe-t) + 6px) 0 calc(var(--safe-b) + 18px);
}

.song-top {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 12px;
  min-height: 52px;
}
.back, .back-spacer { width: 44px; height: 44px; flex: none; }
.back {
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--white);
  transition: background .2s;
}
.back:active { background: rgba(0, 0, 0, .12); }
.back svg { width: 26px; height: 26px; }
.song-day {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  opacity: .9;
}

.disc {
  position: relative;
  flex: none;
  width: var(--disc);
  aspect-ratio: 1;
  margin-top: 4px;
  border-radius: 50%;
  border: max(4px, calc(var(--disc) * .02)) solid var(--ink);
  overflow: hidden;
  background: #222;
  view-transition-name: cover;
  animation: spin 9s linear infinite;
  animation-play-state: paused;
}
.is-playing .disc { animation-play-state: running; }
.disc-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.disc-hole {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 19%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--coral);
  border: max(4px, calc(var(--disc) * .02)) solid var(--ink);
}
@keyframes spin { to { transform: rotate(360deg); } }

.song-meta {
  text-align: center;
  padding: 0 var(--gutter);
  margin-top: clamp(12px, 2.4dvh, 22px);
}
.song-title {
  margin: 0;
  font-size: clamp(22px, 6.4vw, 30px);
  font-weight: 700;
  line-height: 1.15;
}
.song-artist {
  margin: 4px 0 0;
  font-size: clamp(15px, 4.2vw, 19px);
  font-weight: 400;
  opacity: .95;
}

.progress-wrap {
  width: calc(100% - 2 * var(--gutter));
  margin-top: clamp(12px, 2.4dvh, 24px);
}
.progress {
  position: relative;
  height: 9px;
  background: var(--track);
  cursor: pointer;
  touch-action: none;
}
.progress::before { /* larger hit area */
  content: '';
  position: absolute;
  inset: -14px 0;
}
.progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: var(--ink);
}
.progress:focus-visible { outline: 2px solid var(--cream); outline-offset: 4px; }
.times {
  display: flex;
  justify-content: space-between;
  margin-top: 7px;
  font-size: 11px;
  letter-spacing: .04em;
  opacity: .85;
  font-variant-numeric: tabular-nums;
}

.play {
  position: relative;
  flex: none;
  width: clamp(58px, 17vw, 76px);
  aspect-ratio: 1;
  margin-top: clamp(2px, 1dvh, 10px);
  transition: transform .15s var(--ease-out);
}
.play:active { transform: scale(.92); }
.play svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  transition: opacity .25s, transform .35s var(--ease-out);
}
.play path {
  fill: none;
  stroke: var(--white);
  stroke-width: 9.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-pause { opacity: 0; transform: scale(.6) rotate(-20deg); }
.is-playing .icon-play  { opacity: 0; transform: scale(.6) rotate(20deg); }
.is-playing .icon-pause { opacity: 1; transform: none; }

.lyrics {
  position: relative; /* offsetTop of lines is measured from here */
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  margin-top: clamp(4px, 1.4dvh, 14px);
  padding: 18px 10% 45% 12.5%;
  overflow-y: auto;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(transparent 0, #000 22px, #000 calc(100% - 48px), transparent 100%);
          mask-image: linear-gradient(transparent 0, #000 22px, #000 calc(100% - 48px), transparent 100%);
}
.lyrics::-webkit-scrollbar { display: none; }
.line {
  margin: 0 0 .42em;
  font-size: clamp(20px, 5.5vw, 26px);
  font-weight: 700;
  line-height: 1.2;
  opacity: .4;
  transform-origin: 0 50%;
  transition: opacity .35s ease, transform .45s var(--ease-out);
  cursor: pointer;
}
.lyrics.static .line { opacity: 1; cursor: default; }
.line.active { opacity: 1; transform: scale(1.02); }
.line.gap { letter-spacing: .3em; }
.lyrics-note {
  margin: 0;
  font-size: 15px;
  opacity: .8;
}

.spotify {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: calc(100% - 2 * var(--gutter));
  margin-top: 10px;
  padding: 14px 18px;
  background: var(--ink);
  color: var(--cream);
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .02em;
  transition: transform .15s var(--ease-out);
}
.spotify:active { transform: scale(.97); }
.spotify svg { width: 22px; height: 22px; flex: none; }
.spotify.nudge { animation: nudge 1.4s var(--ease-out) 2; }
@keyframes nudge {
  0%, 100% { transform: none; }
  15% { transform: translateY(-6px) scale(1.03); }
  30% { transform: none; }
  42% { transform: translateY(-3px); }
  55% { transform: none; }
}

.screen-song.enter > :not(.disc) { animation: rise .6s var(--ease-out) both; }
.screen-song.enter > .song-top     { animation-delay: .15s; }
.screen-song.enter > .song-meta    { animation-delay: .22s; }
.screen-song.enter > .progress-wrap{ animation-delay: .28s; }
.screen-song.enter > .play         { animation-delay: .34s; }
.screen-song.enter > .lyrics       { animation-delay: .4s; }
.screen-song.enter > .spotify      { animation-delay: .46s; }

/* ───────────────────────── Toast ───────────────────────── */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-b) + 28px);
  z-index: 10;
  max-width: min(88vw, 420px);
  padding: 13px 20px;
  background: var(--navy);
  color: var(--cream);
  font-size: 15px;
  line-height: 1.35;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 16px);
  pointer-events: none;
  transition: opacity .3s, transform .4s var(--ease-out);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ───────────────────────── Screen transitions ───────────────────────── */

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: .5s;
  animation-timing-function: var(--ease-in-out);
}
html[data-vt="to-calendar"]::view-transition-old(root) { animation-name: vtZoomOut; }
html[data-vt="to-calendar"]::view-transition-new(root) { animation-name: vtFadeIn; animation-delay: .1s; }
html[data-vt="to-song"]::view-transition-old(root)     { animation-name: vtFadeOut; animation-duration: .35s; }
html[data-vt="to-song"]::view-transition-new(root)     { animation-name: vtFadeIn; }
html[data-vt="back"]::view-transition-old(root)        { animation-name: vtDrop; animation-duration: .4s; }
html[data-vt="back"]::view-transition-new(root)        { animation-name: vtFadeIn; }
html[data-vt="to-start"]::view-transition-old(root)    { animation-name: vtFadeOut; }
html[data-vt="to-start"]::view-transition-new(root)    { animation-name: vtFadeIn; }

::view-transition-group(cover) {
  animation-duration: .65s;
  animation-timing-function: cubic-bezier(.6, 0, .2, 1);
}
::view-transition-old(cover),
::view-transition-new(cover) {
  animation-duration: .65s;
  height: 100%;
  object-fit: cover;
}

@keyframes vtFadeIn  { from { opacity: 0; } }
@keyframes vtFadeOut { to   { opacity: 0; } }
@keyframes vtZoomOut { to   { opacity: 0; transform: scale(1.12); } }
@keyframes vtDrop    { to   { opacity: 0; transform: translateY(40px); } }

/* Fallback for browsers without View Transitions */
.screen.fallback-in { animation: vtFadeIn .45s var(--ease-out) both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after, ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
