:root {
  --peach: #ffd9c7;
  --lav: #e6d5ff;
  --mint: #c9f5e4;
  --pink: #ff8fb1;
  --pink-d: #ff6b98;
  --coral: #ff9a76;
  --grape: #8b5fc7;
  --ink: #4a3b64;
  --ink-soft: #7d6b98;
  --green: #7eb831;
  --green-d: #5f9022;
  --card: #ffffff;
  --gold: #f4c430;
  --shadow: 0 12px 30px rgba(139, 95, 199, 0.18);
  --shadow-sm: 0 6px 16px rgba(139, 95, 199, 0.14);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

body {
  font-family: 'Fredoka', system-ui, sans-serif;
  color: var(--ink);
  min-height: 100vh;
  background: linear-gradient(135deg, #ffe9dd 0%, #f3e6ff 45%, #d9f8ec 100%);
  background-attachment: fixed;
  overflow-x: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
}

/* ---------- background decor ---------- */
.bg-decor { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.blob { position: absolute; border-radius: 50%; filter: blur(8px); opacity: 0.5; }
.b1 { width: 320px; height: 320px; background: var(--peach); top: -80px; left: -60px; animation: float 9s ease-in-out infinite; }
.b2 { width: 260px; height: 260px; background: var(--mint); bottom: -70px; right: -50px; animation: float 11s ease-in-out infinite reverse; }
.b3 { width: 200px; height: 200px; background: var(--lav); top: 40%; right: 12%; animation: float 8s ease-in-out infinite; }
.sparkle { position: absolute; color: #fff; font-size: 26px; opacity: 0.8; animation: twinkle 3s ease-in-out infinite; text-shadow: 0 0 12px rgba(255,255,255,.7); }
.s1 { top: 14%; left: 18%; } .s2 { top: 22%; right: 20%; animation-delay: .6s; }
.s3 { bottom: 20%; left: 24%; animation-delay: 1.2s; } .s4 { bottom: 28%; right: 28%; animation-delay: 1.8s; }

@keyframes float { 0%,100% { transform: translateY(0) translateX(0); } 50% { transform: translateY(-24px) translateX(12px); } }
@keyframes twinkle { 0%,100% { transform: scale(1); opacity: .35; } 50% { transform: scale(1.4); opacity: 1; } }

/* ---------- stage / screens ---------- */
#stage {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 620px;
}
.screen {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 26px;
  animation: pop 0.5s cubic-bezier(.18,.89,.32,1.28);
}
.screen.is-active { display: flex; }
.screen.wide { max-width: none; }
#stage:has(.wide.is-active) { max-width: 920px; }

@keyframes pop { from { opacity: 0; transform: scale(.9) translateY(20px); } to { opacity: 1; transform: scale(1) translateY(0); } }

/* ---------- elephant + speech bubble ---------- */
.scene {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  width: 100%;
  justify-content: center;
}
.scene.compact { gap: 12px; }
.elephant-wrap { flex-shrink: 0; width: 190px; }
.elephant-wrap.sm { width: 130px; }
.elephant-wrap.xs { width: 90px; }
.elephant {
  width: 100%;
  display: block;
  filter: drop-shadow(0 10px 16px rgba(95, 144, 34, .28));
  animation: sway 4s ease-in-out infinite;
  transform-origin: bottom center;
}
@keyframes sway { 0%,100% { transform: rotate(-2deg) translateY(0); } 50% { transform: rotate(2deg) translateY(-6px); } }
.elephant.shake { animation: shake .5s ease; }
@keyframes shake { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-8px) rotate(-4deg)} 40%{transform:translateX(8px) rotate(4deg)} 60%{transform:translateX(-6px)} 80%{transform:translateX(6px)} }
.elephant.celebrate { animation: celebrate .8s ease-in-out infinite; }
@keyframes celebrate { 0%,100%{transform:translateY(0) rotate(-3deg) scale(1)} 50%{transform:translateY(-14px) rotate(3deg) scale(1.05)} }

.bubble {
  position: relative;
  background: var(--card);
  border-radius: 22px;
  padding: 20px 24px;
  box-shadow: var(--shadow);
  max-width: 360px;
  min-height: 60px;
  font-size: 1.15rem;
  line-height: 1.5;
  font-weight: 500;
  border: 3px solid #fff;
}
.bubble.small { font-size: 1rem; padding: 14px 18px; max-width: 320px; }
.bubble-tail {
  position: absolute;
  left: -14px;
  bottom: 26px;
  width: 0; height: 0;
  border: 12px solid transparent;
  border-right-color: var(--card);
  filter: drop-shadow(-3px 0 0 #fff);
}
.caret { display: inline-block; width: 2px; margin-left: 1px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- buttons ---------- */
.actions { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.btn {
  font-family: inherit;
  font-weight: 600;
  font-size: 1.15rem;
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 16px 34px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
  position: relative;
}
.btn:hover { transform: translateY(-3px) scale(1.03); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0) scale(.98); }
.btn-primary { background: linear-gradient(135deg, var(--pink) 0%, var(--pink-d) 100%); }
.btn-bribe { background: linear-gradient(135deg, var(--gold) 0%, var(--coral) 100%); color: #6b4a10; }
.btn-answer { background: linear-gradient(135deg, var(--grape) 0%, #a77ae0 100%); }
.btn.full { width: 100%; justify-content: center; display: flex; align-items: center; gap: 8px; }
.btn:disabled { filter: grayscale(.5) opacity(.6); cursor: not-allowed; transform: none; }
.link-btn {
  background: none; border: none; font-family: inherit; font-size: 1rem;
  color: var(--grape); font-weight: 600; cursor: pointer; text-decoration: underline;
  text-underline-offset: 4px; padding: 8px;
}
.link-btn:hover { color: var(--pink-d); }

.badge {
  background: #fff;
  color: var(--pink-d);
  border-radius: 999px;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  font-size: .9rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
}
.badge.bump { animation: bump .35s ease; }
@keyframes bump { 0%,100%{transform:scale(1)} 40%{transform:scale(1.5)} }

/* ---------- level cards ---------- */
.level-cards { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.level-card {
  font-family: inherit;
  background: var(--card);
  border: 3px solid #fff;
  border-radius: 22px;
  padding: 22px 26px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  min-width: 150px;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s;
}
.level-card:hover { transform: translateY(-6px) rotate(-1deg); box-shadow: var(--shadow); }
.level-card.selected { border-color: var(--pink); background: #fff0f5; }
.level-emoji { font-size: 2.4rem; }
.level-name { font-size: 1.35rem; font-weight: 700; color: var(--ink); }
.level-sub { font-size: .9rem; color: var(--ink-soft); }

.level-reaction { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.mini-bubble {
  background: #fff; border: 3px solid #fff; border-radius: 18px;
  padding: 14px 20px; box-shadow: var(--shadow-sm); font-size: 1.05rem;
  font-weight: 500; max-width: 440px; text-align: center;
}
.mini-bubble.center { align-self: center; }

/* ---------- puzzle ---------- */
.puzzle-layout {
  display: flex; gap: 24px; align-items: flex-start; width: 100%;
  justify-content: center; flex-wrap: wrap;
}
.crossword-card {
  background: rgba(255,255,255,.7);
  backdrop-filter: blur(4px);
  border-radius: 24px;
  padding: 28px 24px 24px;
  box-shadow: var(--shadow);
  border: 3px solid #fff;
}
.tajenka-label {
  text-align: center; font-weight: 700; letter-spacing: 4px;
  color: var(--grape); margin-bottom: 14px; font-size: .95rem;
}
.grid {
  display: grid;
  gap: 4px;
  justify-content: center;
}
.cell-slot { width: 36px; height: 36px; }
.cell {
  width: 36px; height: 36px;
  border: none;
  border-radius: 9px;
  background: #fff;
  text-align: center;
  font-family: inherit;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink);
  text-transform: uppercase;
  box-shadow: inset 0 0 0 2px #ece3f7;
  transition: box-shadow .15s, background .2s, transform .15s;
  caret-color: var(--pink-d);
}
.cell:focus { outline: none; box-shadow: inset 0 0 0 3px var(--pink); transform: scale(1.06); }
.cell.key {
  background: linear-gradient(135deg, #fff6d6, #ffe9a8);
  box-shadow: inset 0 0 0 2px var(--gold);
}
.cell.key:focus { box-shadow: inset 0 0 0 3px var(--coral); }
.cell.correct { background: #e4f9ec; box-shadow: inset 0 0 0 2px #86e0ab; }
.cell.revealed { background: #f0e7ff; box-shadow: inset 0 0 0 2px var(--grape); }
.cell.wrong { animation: cellwrong .4s ease; }
@keyframes cellwrong { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-5px)} 75%{transform:translateX(5px)} }

.clues-card {
  background: rgba(255,255,255,.7);
  backdrop-filter: blur(4px);
  border-radius: 24px;
  padding: 22px 24px;
  box-shadow: var(--shadow);
  border: 3px solid #fff;
  width: 300px;
  max-width: 100%;
}
.clues-card h3 { color: var(--grape); margin-bottom: 12px; font-size: 1.2rem; }
.clues { list-style: none; counter-reset: c; display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.clues li {
  counter-increment: c;
  font-size: .92rem; color: var(--ink-soft); line-height: 1.35;
  padding-left: 30px; position: relative;
}
.clues li::before {
  content: counter(c);
  position: absolute; left: 0; top: -1px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--lav); color: var(--grape);
  font-weight: 700; font-size: .8rem;
  display: flex; align-items: center; justify-content: center;
}
.clues li .q { display: block; }
.clues li .hint {
  display: block; margin-top: 4px; font-size: .86rem; font-style: italic;
  color: var(--coral); font-weight: 500;
  animation: hintpop .35s cubic-bezier(.18,.89,.32,1.28);
}
@keyframes hintpop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.clues li.active {
  background: #fff4de; border-radius: 10px;
  box-shadow: inset 3px 0 0 var(--coral);
  margin: 0 -8px; padding-left: 38px; padding-right: 8px;
}
.clues li.active::before { background: var(--coral); color: #fff; }
.clues li.solved { color: var(--green-d); opacity: .7; }
.clues li.solved .q { text-decoration: line-through; }
.clues li.solved::before { background: #d6f5c9; color: var(--green-d); }
.bribe-note { font-size: .8rem; color: var(--ink-soft); margin-top: 10px; text-align: center; font-style: italic; }

/* ---------- win overlay (vystředěné okno, viditelné i na mobilu) ---------- */
.win-overlay { z-index: 55; }
.win-card {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  background: #fff0f5;
  padding: 30px 34px; border-radius: 26px; box-shadow: var(--shadow);
  border: 4px solid var(--pink);
  max-width: 90vw;
  animation: pop .5s cubic-bezier(.18,.89,.32,1.28);
}
.win-emoji { font-size: 3rem; animation: celebrate .9s ease-in-out infinite; }
.win-title { font-size: 1.3rem; font-weight: 700; color: var(--pink-d); }
.win-tajenka {
  font-family: 'Caveat', cursive; font-size: 2.6rem; font-weight: 700;
  color: var(--pink-d); letter-spacing: 1px; text-align: center;
}
.answer-no { background: linear-gradient(135deg, #b9adc9 0%, #9d8bb8 100%); }

/* ---------- answer / time ---------- */
.answer-cards { display: flex; flex-direction: column; gap: 14px; width: 100%; max-width: 340px; }
.time-picker {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  background: rgba(255,255,255,.85); padding: 28px 32px; border-radius: 24px;
  box-shadow: var(--shadow); border: 3px solid #fff;
}
.time-picker label { font-size: 1.15rem; font-weight: 600; }
#time-select {
  font-family: inherit; font-size: 1.2rem; font-weight: 600; color: var(--ink);
  padding: 12px 20px; border-radius: 999px; border: 3px solid var(--lav);
  background: #fff; cursor: pointer; min-width: 200px; text-align: center;
}
#time-select:focus { outline: none; border-color: var(--pink); }
.final-message {
  font-family: 'Caveat', cursive; font-size: 2rem; font-weight: 700;
  color: var(--green-d); text-align: center; max-width: 420px; line-height: 1.3;
  background: rgba(255,255,255,.85); padding: 24px 30px; border-radius: 24px;
  box-shadow: var(--shadow); border: 3px solid var(--mint);
  animation: pop .5s cubic-bezier(.18,.89,.32,1.28);
}

/* ---------- modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(74, 59, 100, .45);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fade .3s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--card); border-radius: 26px; padding: 34px 36px;
  max-width: 460px; box-shadow: var(--shadow); border: 3px solid #fff;
  position: relative; animation: pop .4s cubic-bezier(.18,.89,.32,1.28);
}
.modal h2 { color: var(--grape); margin-bottom: 18px; }
.modal ul { list-style: none; display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.modal li { font-size: 1.02rem; line-height: 1.45; }
.modal-close {
  position: absolute; top: 16px; right: 18px; background: var(--lav);
  border: none; width: 34px; height: 34px; border-radius: 50%; cursor: pointer;
  font-size: 1rem; color: var(--grape); font-weight: 700;
}
.modal-close:hover { background: var(--pink); color: #fff; }

/* ---------- kartářka Mirka ---------- */
.modal.mirka { text-align: center; max-width: 420px; }
.modal.mirka h2 { color: var(--grape); }
.mirka-state { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.mirka-orb { font-size: 3.4rem; animation: sway 4s ease-in-out infinite; }
.mirka-intro { color: var(--ink-soft); font-size: 1.05rem; font-style: italic; }
.mirka-choices { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.tarot-card {
  width: 190px; height: auto; border-radius: 14px;
  box-shadow: 0 14px 30px rgba(44, 29, 74, .4);
  animation: pop .5s cubic-bezier(.18,.89,.32,1.28);
}
.tarot-meaning { font-size: 1.1rem; line-height: 1.45; color: var(--ink); font-weight: 600; }
.tarot-meaning strong { color: var(--green-d); }
.tarot-list {
  list-style: none; text-align: left; display: flex; flex-direction: column; gap: 8px;
  font-size: 1.05rem; color: var(--ink); margin-top: -4px;
}
.tarot-list li { line-height: 1.3; }
#mirka-q {
  width: 100%; font-family: inherit; font-size: 1rem; color: var(--ink);
  border: 3px solid var(--lav); border-radius: 16px; padding: 12px 14px; resize: vertical;
}
#mirka-q:focus { outline: none; border-color: var(--pink); }
.mirka-sent-text { font-size: 1.08rem; line-height: 1.5; color: var(--ink); }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 32px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 14px 24px; border-radius: 999px;
  font-weight: 600; font-size: 1rem; box-shadow: var(--shadow); z-index: 60;
  opacity: 0; transition: opacity .3s, transform .3s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- confetti ---------- */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 40; overflow: hidden; }
.confetti i {
  position: absolute; top: -14px; width: 11px; height: 11px; border-radius: 3px;
  animation: fall linear forwards;
}
@keyframes fall {
  to { transform: translateY(110vh) rotate(720deg); opacity: .9; }
}

@media (max-width: 680px) {
  .clues-card { width: 100%; }
  .bubble { font-size: 1rem; }
}
