/* Písma jsou hostovaná lokálně (Baloo 2 a Nunito, licence SIL OFL), obě mají kompletní češtinu */
@font-face { font-family: "Baloo 2"; font-weight: 600 700; font-display: swap;
  src: url("../fonts/baloo-2-latin-ext-700-normal.woff2") format("woff2");
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Baloo 2"; font-weight: 600 700; font-display: swap;
  src: url("../fonts/baloo-2-latin-700-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Nunito"; font-weight: 600; font-display: swap;
  src: url("../fonts/nunito-latin-ext-600-normal.woff2") format("woff2");
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Nunito"; font-weight: 600; font-display: swap;
  src: url("../fonts/nunito-latin-600-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Nunito"; font-weight: 800; font-display: swap;
  src: url("../fonts/nunito-latin-ext-800-normal.woff2") format("woff2");
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Nunito"; font-weight: 800; font-display: swap;
  src: url("../fonts/nunito-latin-800-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --pink: #fadadd;
  --pink-deep: #f3b9c2;
  --cocoa: #5b3a2e;
  --cocoa-soft: #8a6455;
  --coral: #e4586f;
  --coral-dark: #a8324a;
  --cream: #fff6e6;
  --orange: #f2a55e;
  --brown: #b98a6b;
  --display: "Baloo 2","Arial Rounded MT Bold", ui-rounded, system-ui, sans-serif;
  --body: "Nunito", ui-rounded, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: radial-gradient(ellipse at 50% 12%, #fdebed 0%, transparent 60%), var(--pink);
  background-attachment: fixed;
  color: var(--cocoa);
  font-family: var(--body);
  font-weight: 600;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}
body.lock { overflow: hidden; }
button { font: inherit; color: inherit; }

.page {
  max-width: 520px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 16px max(40px, env(safe-area-inset-bottom));
}

/* ---------- hlavička ---------- */
.hero { text-align: center; padding: 6px 0 20px; }
.hero-img { display: block; width: min(78%, 330px); height: auto; margin: 0 auto 6px; }
.hero h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.8rem, 8vw, 2.4rem);
  line-height: 1.1;
  text-wrap: balance;
}
.status { margin: 8px 0 0; min-height: 1.5em; color: var(--cocoa-soft); font-size: 1.05rem; text-wrap: balance; }

/* ---------- mřížka okének ---------- */
.grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.grid li { display: block; }
.grid li.wide { grid-column: 1 / -1; }

.door {
  --c: var(--coral);
  --c-dark: var(--coral-dark);
  --c-text: var(--cream);
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  perspective: 700px;
  touch-action: manipulation;
}
.wide .door { aspect-ratio: auto; height: 116px; }

.door .back {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background: #fff3ee;
  box-shadow: inset 0 4px 10px rgba(143, 45, 69, .22);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.door .back img { position: absolute; left: 8%; top: 8%; width: 84%; height: 84%; object-fit: contain; opacity: 0; transition: opacity .3s .25s; }
.door.is-open .back img { opacity: 1; }
.wide .door .back img { left: 5%; top: 6%; width: 90%; height: 88%; }

.door .front {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background: var(--c);
  border: 3px solid var(--c-dark);
  box-shadow: 0 4px 0 var(--c-dark);
  color: var(--c-text);
  display: grid;
  place-items: center;
  transform-origin: 0 50%;
  transition: transform .7s cubic-bezier(.3, .8, .3, 1), box-shadow .7s;
  backface-visibility: hidden;
}
.door .front::before {            /* vnitřní panel dveří */
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 9px;
  border: 2px solid currentColor;
  opacity: .28;
}
.door .front::after {             /* klika */
  content: "";
  position: absolute;
  right: 11px;
  top: 50%;
  width: 9px;
  height: 9px;
  margin-top: -4px;
  border-radius: 50%;
  background: currentColor;
  opacity: .5;
}
.door .num {
  font-family: var(--display);
  font-size: clamp(2rem, 11vw, 2.7rem);
  line-height: 1;
}
.door.is-open .front { transform: rotateY(-112deg); box-shadow: none; }

li:nth-child(5n+1) .door { --c: #e4586f; --c-dark: #a8324a; --c-text: #fff6e6; }
li:nth-child(5n+2) .door { --c: #b98a6b; --c-dark: #7a5240; --c-text: #fff6e6; }
li:nth-child(5n+3) .door { --c: #f4a6b0; --c-dark: #c9707f; --c-text: #5b3a2e; }
li:nth-child(5n+4) .door { --c: #a8324a; --c-dark: #6e1f31; --c-text: #fff6e6; }
li:nth-child(5n)   .door { --c: #f2a55e; --c-dark: #c47a35; --c-text: #5b3a2e; }

/* zamčená okénka */
.door.is-locked .front { filter: saturate(.55) brightness(1.04); }
.door.is-locked .lock {
  position: absolute;
  left: 8px;
  bottom: 8px;
  width: 20px;
  height: 20px;
  color: currentColor;
  opacity: .6;
}
.door .lock { display: none; }
.door.is-locked .lock { display: block; }
.door.shake { animation: shake .45s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px) rotate(-1.5deg); }
  40% { transform: translateX(6px) rotate(1.5deg); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}

/* dnešní okénko */
.door.is-today:not(.is-open) .front { animation: today 2.4s ease-in-out infinite; }
@keyframes today {
  0%, 100% { box-shadow: 0 4px 0 var(--c-dark), 0 0 0 0 rgba(255, 255, 255, .0); transform: scale(1); }
  50% { box-shadow: 0 4px 0 var(--c-dark), 0 0 0 7px rgba(255, 255, 255, .75); transform: scale(1.03); }
}

.door:focus-visible { outline: 3px solid var(--cocoa); outline-offset: 3px; border-radius: 18px; }

/* 24. prosince */
.wide .door .num { font-size: 2.6rem; }
.wide .door .label { display: block; font-family: var(--body); font-weight: 800; font-size: .95rem; margin-top: 2px; text-align: center; }
.wide .door .front { grid-template-columns: 1fr; align-content: center; }
.wide .door .front::before { inset: 9px; }
.door .ribbon { display: none; }
.wide .door .front {
  overflow: hidden;
  background: repeating-linear-gradient(135deg, var(--c) 0 16px, #8f2740 16px 32px);
}
.wide .door .num, .wide .door .label { position: relative; z-index: 1; }

/* ---------- ostatní ---------- */
.foot { margin-top: 28px; text-align: center; color: var(--cocoa-soft); font-family: var(--display); font-size: 1.1rem; }

.toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translate(-50%, 30px);
  max-width: calc(100% - 32px);
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--cocoa);
  color: var(--cream);
  font-weight: 800;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- okno s obsahem ---------- */
.overlay { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.overlay[hidden] { display: none; }
.backdrop { position: absolute; inset: 0; background: rgba(91, 58, 46, .45); animation: fade .25s both; }
@keyframes fade { from { opacity: 0; } }

.sheet {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 94vh;
  max-height: 94dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 28px 22px max(26px, env(safe-area-inset-bottom));
  background: #fff3ee;
  border-radius: 28px 28px 0 0;
  text-align: center;
  outline: none;
  animation: sheet-up .45s cubic-bezier(.2, 1, .3, 1) both;
}
@keyframes sheet-up { from { transform: translateY(100%); } }

.close {
  position: absolute;
  top: 12px; right: 12px;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: var(--pink);
  color: var(--cocoa);
  cursor: pointer;
  z-index: 2;
}
.close:focus-visible, .btn:focus-visible { outline: 3px solid var(--cocoa); outline-offset: 3px; }

.day-img { display: block; width: auto; max-width: 78%; max-height: 32vh; max-height: 32dvh; margin: 6px auto 8px; object-fit: contain; }
.when { margin: 0; color: var(--cocoa-soft); font-weight: 800; }
.day-text {
  margin: 6px 0 22px;
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.5rem, 7vw, 1.9rem);
  line-height: 1.25;
  text-wrap: balance;
}

.btn {
  padding: 15px 32px;
  border: 0;
  border-radius: 999px;
  background: var(--coral);
  color: var(--cream);
  font: 800 1.15rem/1 var(--body);
  box-shadow: 0 6px 0 var(--coral-dark);
  cursor: pointer;
  transition: transform .12s, box-shadow .12s, opacity .3s;
  touch-action: manipulation;
}
.btn:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--coral-dark); }
.btn-quiet { background: var(--pink); color: var(--cocoa); box-shadow: 0 5px 0 var(--pink-deep); }
.btn-quiet:active { box-shadow: 0 1px 0 var(--pink-deep); }

/* ---------- dárek 24. prosince ---------- */
.gift-title {
  margin: 0;
  padding: 0 28px;
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.7rem, 8vw, 2.1rem);
  line-height: 1.12;
  text-wrap: balance;
}
.gift-sub { margin: 8px 0 0; color: var(--cocoa-soft); font-size: 1.05rem; }

.gift-scene { margin: 10px auto 12px; width: min(70%, 260px); }
.gift-svg { display: block; width: 100%; height: auto; overflow: visible; cursor: pointer; outline: none; }
.gift-svg:focus-visible .gift-wobble { filter: drop-shadow(0 0 6px #fff) drop-shadow(0 0 2px var(--coral-dark)); }
.gift-wobble { transform-box: fill-box; transform-origin: 50% 100%; animation: wobble 4.2s ease-in-out infinite; }
@keyframes wobble {
  0%, 78%, 100% { transform: rotate(0) scale(1); }
  82% { transform: rotate(-5deg) scale(1.03); }
  86% { transform: rotate(5deg) scale(1.03); }
  90% { transform: rotate(-3deg); }
  94% { transform: rotate(2deg); }
}
.lid { transform-box: fill-box; transform-origin: 50% 100%; }
.mini-ticket { transition: transform .9s cubic-bezier(.2, 1.2, .4, 1); }

.gift-view:not([data-state="closed"]) .gift-svg { pointer-events: none; }
.gift-view:not([data-state="closed"]) .gift-wobble { animation: none; }
.gift-view:not([data-state="closed"]) .lid { animation: lid-off .9s cubic-bezier(.3, .8, .4, 1) forwards; }
@keyframes lid-off {
  0% { transform: translateY(0) rotate(0); opacity: 1; }
  45% { transform: translateY(-46px) rotate(-14deg); opacity: 1; }
  100% { transform: translateY(-30px) rotate(-38deg) translateX(-70px); opacity: 0; }
}
.gift-view:not([data-state="closed"]) .mini-ticket { transform: translateY(-82px); transition-delay: .35s; }
.gift-view:not([data-state="closed"]) .btn#claim { opacity: 0; pointer-events: none; }
.gift-view[data-state="open"] .btn#claim,
.gift-view[data-state="open"] .gift-scene { display: none; }

.reveal { margin-top: 6px; outline: none; }
.reveal-img { display: block; width: min(86%, 340px); height: auto; margin: 0 auto 4px; }
.reveal:not([hidden]) .ticket { animation: ticket-in 1s cubic-bezier(.2, 1.25, .35, 1) both; }
.reveal:not([hidden]) .reveal-img { animation: pop .6s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes ticket-in { 0% { opacity: 0; transform: translateY(-60px) scale(.7) rotate(-5deg); } 100% { opacity: 1; transform: none; } }
@keyframes pop { 0% { opacity: 0; transform: scale(.6); } 100% { opacity: 1; transform: none; } }

.gift-view .reveal { filter: drop-shadow(0 10px 14px rgba(143, 45, 69, .2)); }
.ticket {
  --notch: 15px;
  --stub-h: 108px;
  --cut: calc(100% - var(--stub-h) - 1.5px);
  width: 100%;
  background: var(--cream);
  border-radius: 20px;
  text-align: left;
  -webkit-mask:
    radial-gradient(circle var(--notch) at 0 var(--cut), #0000 98%, #000) left / 51% 100% no-repeat,
    radial-gradient(circle var(--notch) at 100% var(--cut), #0000 98%, #000) right / 51% 100% no-repeat;
          mask:
    radial-gradient(circle var(--notch) at 0 var(--cut), #0000 98%, #000) left / 51% 100% no-repeat,
    radial-gradient(circle var(--notch) at 100% var(--cut), #0000 98%, #000) right / 51% 100% no-repeat;
}
.ticket-top {
  padding: 12px 22px;
  border-radius: 20px 20px 0 0;
  background: var(--coral-dark);
  color: var(--cream);
  font-family: var(--display);
  font-size: 1.05rem;
  letter-spacing: .03em;
}
.ticket-main { padding: 20px 22px 24px; }
.ticket-main h3 { margin: 0 0 16px; font-family: var(--display); font-weight: 600; font-size: clamp(1.9rem, 9vw, 2.4rem); line-height: 1.05; color: var(--coral-dark); }
.facts { margin: 0; display: grid; gap: 12px; }
.facts div { display: grid; grid-template-columns: 82px 1fr; align-items: baseline; gap: 8px; }
.facts dt { font-size: .95rem; color: var(--cocoa-soft); }
.facts dd { margin: 0; font-family: var(--display); font-size: 1.25rem; line-height: 1.2; }
.perforation { height: 0; border-top: 3px dashed #e3b9a5; margin: 0 22px; }
.ticket-stub { height: var(--stub-h); padding: 0 22px; display: flex; flex-direction: column; justify-content: center; }
.ticket-stub .from { margin: 0; font-family: var(--display); font-size: 1.2rem; color: var(--coral-dark); }
.ticket-stub .msg { margin: 4px 0 0; color: var(--cocoa-soft); }

/* ---------- konfety ---------- */
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; }

/* větší displeje */
@media (min-width: 560px) {
  .page { padding-top: 40px; }
  .overlay { align-items: center; }
  .sheet { border-radius: 28px; max-height: 90dvh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
  #confetti { display: none; }
}
