/* Celoplošná scéna v canvasu. Nahoře nadpis a počítadla, vlevo úkoly, vlevo dole šatník s čepicemi. */
:root {
  --ice-0: #D6ECF5; --ice-1: #EEF7FB; --ice-2: #FAFDFE;
  --deep: #0F3B5C; --ink: #2B5574; --frost: #3A6F94; --warm: #C8463D; --paper: #FFFFFF; --gold: #FFC93C;
  --font: "Fredoka", ui-rounded, system-ui, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: linear-gradient(170deg, var(--ice-0) 0%, var(--ice-1) 55%, var(--ice-2) 100%) fixed;
  color: var(--deep); font-family: var(--font); overflow: hidden;
  -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none;
}
#scene { position: fixed; inset: 0; width: 100%; height: 100%; touch-action: manipulation; }
button { font: inherit; color: inherit; cursor: pointer; }

/* Hlavička: domeček, nadpis a počítadla. Kliky mimo tlačítka jdou do canvasu. */
.top {
  position: fixed; top: 0; left: 0; right: 0; pointer-events: none;
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px 16px;
  padding: max(22px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
}
.home {
  pointer-events: auto; text-decoration: none; font-size: 26px; line-height: 1;
  display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%;
  background: var(--paper); box-shadow: 0 4px 14px rgba(15, 59, 92, .15);
}
h1 { font: 600 clamp(30px, 6vw, 52px)/1 var(--font); margin: 0; letter-spacing: .01em; }
h1 span { display: inline-block; transform-origin: 50% 100%; transition: transform .4s cubic-bezier(.3, 1.6, .5, 1), filter .4s; }
body.melting h1 span { transform: translateY(var(--sag, 20px)) scale(1.06, .8); filter: blur(.6px); transition-duration: 2.8s; transition-timing-function: cubic-bezier(.55, 0, .9, .45); }
body.crack h1 { animation: crack .45s; }
@keyframes crack { 20% { transform: translateX(-5px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }
.stats { margin: 0; display: flex; gap: 14px; font-size: 20px; font-weight: 600; color: var(--frost); font-variant-numeric: tabular-nums; }
.stats .warm { color: var(--warm); }

/* Úkoly: na mobilu jen tlačítko, po klepnutí se rozbalí seznam */
.quests {
  position: fixed; left: max(16px, env(safe-area-inset-left, 0px)); top: 96px; z-index: 2;
  width: min(330px, calc(100vw - 32px)); background: rgba(255, 255, 255, .92);
  border-radius: 22px; box-shadow: 0 6px 24px rgba(15, 59, 92, .14);
}
.quest-toggle {
  width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 10px;
  border: 0; background: none; padding: 12px 18px; font-size: 21px; font-weight: 600; min-height: 56px;
}
.quest-toggle b { background: var(--gold); border-radius: 999px; padding: 2px 12px; font-size: 18px; }
.quest-body { display: none; padding: 0 12px 14px; }
.quests.open .quest-body { display: block; }
#quest-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: calc(100vh - 290px); overflow-y: auto; }
#quest-list li { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 12px; font-size: 17px; font-weight: 500; line-height: 1.25; cursor: pointer; }
#quest-list li:hover { background: #EEF7FB; }
#quest-list li small { color: var(--frost); font-weight: 600; margin-left: 4px; }
#quest-list li.done { color: #3E8E5A; }
#quest-list li.done > span:last-child { text-decoration: line-through; text-decoration-thickness: 2px; }
.qi { font-size: 22px; width: 30px; text-align: center; flex: none; }
.quest-tip { margin: 8px 8px 0; font-size: 14px; color: var(--frost); }
.quest-reset { display: none; margin: 10px 8px 0; border: 0; border-radius: 999px; padding: 10px 16px; background: var(--gold); font-weight: 600; font-size: 17px; }
.quests.all-done .quest-reset { display: inline-block; }
.quests.all-done .quest-toggle b { background: #7BD389; }

/* Šatník: velká kulatá tlačítka s čepicemi */
.wardrobe {
  position: fixed; left: max(16px, env(safe-area-inset-left, 0px)); bottom: max(16px, env(safe-area-inset-bottom, 0px)); z-index: 2;
  display: flex; gap: 10px; padding: 8px; background: rgba(255, 255, 255, .85); border-radius: 999px; box-shadow: 0 4px 18px rgba(15, 59, 92, .12);
}
.wardrobe button { width: 56px; height: 56px; border-radius: 50%; border: 3px solid transparent; background: #EEF7FB; font-size: 28px; line-height: 1; padding: 0; transition: transform .15s; }
.wardrobe button:active { transform: scale(.9); }
.wardrobe button.on { border-color: var(--gold); background: #FFF6D8; }

/* Bublina, ve které mluví sněhulák */
.bubble {
  position: fixed; pointer-events: none; z-index: 3; background: var(--paper); color: var(--deep);
  font: 500 19px var(--font); padding: 10px 16px; border-radius: 18px; white-space: nowrap;
  box-shadow: 0 4px 18px rgba(15, 59, 92, .14); transform-origin: 0 100%;
  animation: pop .25s cubic-bezier(.3, 1.6, .5, 1);
}
.bubble::after { content: ""; position: absolute; left: 16px; bottom: -6px; width: 12px; height: 12px; background: var(--paper); transform: rotate(45deg); }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }

/* Oznámení o splněném úkolu */
.toasts { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 4; display: grid; gap: 8px; pointer-events: none; }
.toast {
  background: var(--gold); color: var(--deep); font-weight: 600; font-size: 20px; padding: 12px 22px; border-radius: 999px;
  box-shadow: 0 6px 22px rgba(209, 142, 0, .35); white-space: nowrap; animation: pop .3s cubic-bezier(.3, 1.6, .5, 1), fade .4s 2.8s forwards;
}
@keyframes fade { to { opacity: 0; transform: translateY(-10px); } }

@media (max-width: 899px) {
  .quests { top: 88px; }
  .quests:not(.open) { width: auto; }
  #quest-list { max-height: 52vh; }
}
@media (max-width: 520px) {
  .top { gap: 4px 12px; }
  .stats { font-size: 17px; }
  .toast { font-size: 17px; white-space: normal; text-align: center; }
}
@media (prefers-reduced-motion: reduce) { h1 span, .bubble, .toast, body.crack h1 { transition: none; animation: none; } }
