/* Celá obrazovka je kopcovitá krajina na canvasu. Nahoře úkol a hvězdy, dole abeceda a přepínač režimu.
   Jeden pevný slunečný svět (jen světlý vzhled). Písmena jsou v Andice, písmu pro děti, které se učí číst. */
:root {
  --sky: #9AD8FF;
  --sky-low: #E8F6FF;
  --ink: #1F2A4D;
  --paper: #FFFDF6;
  --sun: #FFC93C;
  --red: #F0605D;
  --orange: #F7A531;
  --green: #3CB878;
  --blue: #3D8BFF;
  --violet: #9B6BF2;
  --muted: #5B6886;
  --font-ui: "Nunito", ui-rounded, system-ui, sans-serif;
  --font-letter: "Andika", "Nunito", system-ui, sans-serif;
  color-scheme: light;
}
html, body { height: 100%; }
body {
  margin: 0; overflow: hidden; background: var(--sky-low); color: var(--ink);
  font: 500 18px/1.3 var(--font-ui);
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  user-select: none; -webkit-user-select: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible { outline: 4px solid var(--blue); outline-offset: 3px; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

/* ===== Horní lišta ===== */
.top {
  position: fixed; z-index: 5; left: 0; right: 0; top: 0; pointer-events: none;
  padding: max(12px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
}
/* vlevo domeček zpátky na rozcestník, vedle něj úkol */
.left { display: flex; align-items: flex-start; gap: 10px; }
.home {
  pointer-events: auto; display: grid; place-items: center; width: 48px; height: 48px; flex: none; border-radius: 50%;
  background: var(--paper); box-shadow: 0 3px 0 #1F2A4D2E; font-size: 24px; line-height: 1; text-decoration: none;
}
.home:focus-visible { outline: 4px solid var(--blue); outline-offset: 3px; }
.task {
  pointer-events: auto; display: flex; align-items: center; gap: 12px;
  background: var(--paper); border-radius: 22px; padding: 8px 10px 8px 16px;
  box-shadow: 0 6px 0 #1F2A4D1F, 0 10px 24px #1F2A4D24;
}
.task small { font-size: 17px; font-weight: 600; color: var(--muted); }
.task-letter {
  min-width: 72px; height: 72px; padding: 0 10px; border-radius: 18px; display: grid; place-items: center;
  background: var(--ink); color: #fff; font: 700 52px/1 var(--font-letter);
  text-shadow: 0 2px 0 #0003; transition: transform .3s cubic-bezier(.3, 1.8, .5, 1);
}
.task-letter.bump { transform: scale(1.18) rotate(-6deg); }
/* Skládání: obrázek a slovo, chycená písmena barevně, další podtržené, zbytek tlumeně */
.task-letter.spell { display: flex; gap: 2px; font-size: 40px; padding: 0 14px; }
.task-letter.spell span { color: #FFFFFF59; }
.task-letter.spell span:first-of-type { margin-left: 8px; }
.task-letter.spell span.got { color: var(--c); }
.task-letter.spell span.now { color: #fff; text-decoration: underline 4px; text-underline-offset: 6px; }
.say { width: 48px; height: 48px; border: 0; border-radius: 50%; background: #EAF1FF; display: grid; place-items: center; }
.say svg { width: 24px; height: 24px; }
.stars {
  pointer-events: auto; background: var(--sun); border-radius: 999px; padding: 8px 16px;
  font-weight: 700; font-size: 24px; box-shadow: 0 5px 0 #C9900F; font-variant-numeric: tabular-nums;
  transition: transform .25s cubic-bezier(.3, 1.8, .5, 1);
}
.stars.bump { transform: scale(1.25); }
/* Stopky: jak dlouho trvá projet celou abecedu */
.right { display: flex; gap: 8px; align-items: flex-start; }
.clock {
  pointer-events: auto; background: var(--paper); border-radius: 999px; padding: 8px 14px;
  font-weight: 700; font-size: 24px; box-shadow: 0 5px 0 #1F2A4D1F; font-variant-numeric: tabular-nums;
}
.card .best { color: var(--ink); font-weight: 600; font-size: 18px; }

/* ===== Spodní lišta: režim + abeceda ===== */
.bottom {
  position: fixed; z-index: 2; left: 0; right: 0; bottom: 0;
  padding: 0 max(16px, env(safe-area-inset-right, 0px)) max(14px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  display: flex; flex-wrap: wrap-reverse; align-items: flex-end; justify-content: space-between; gap: 10px;
  pointer-events: none;
}
.modes { pointer-events: auto; display: flex; background: #FFFDF6E6; border-radius: 999px; padding: 4px; box-shadow: 0 4px 12px #1F2A4D26; }
.modes button { border: 0; background: none; border-radius: 999px; padding: 8px 14px; font-weight: 600; font-size: 16px; color: var(--muted); }
.modes button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.abc {
  list-style: none; margin: 0; padding: 6px 8px; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px;
  background: #FFFDF6E6; border-radius: 18px; box-shadow: 0 4px 12px #1F2A4D26; max-width: 100%;
}
.abc li {
  min-width: 26px; height: 30px; padding: 0 4px; border-radius: 8px; display: grid; place-items: center;
  font: 700 18px/1 var(--font-letter); color: #1F2A4D59; background: #1F2A4D0D;
}
.abc li.got { color: #fff; background: var(--c); }
.abc li.now { outline: 3px solid var(--ink); outline-offset: 1px; color: var(--ink); background: var(--paper); animation: now 1s ease-in-out infinite alternate; }
@keyframes now { to { transform: translateY(-3px); } }

/* ===== Odměna: obrázek k písmenu ===== */
.reward {
  position: fixed; z-index: 3; left: 50%; top: 22%; transform: translate(-50%, -50%);
  background: var(--paper); border-radius: 28px; padding: 14px 26px 18px; text-align: center;
  box-shadow: 0 8px 0 #1F2A4D1F, 0 18px 40px #1F2A4D33; animation: pop-in .45s cubic-bezier(.3, 1.7, .5, 1);
  max-width: calc(100vw - 32px);
}
.reward .pic { font-size: 84px; line-height: 1.1; }
.reward .word { font: 600 30px/1.1 var(--font-ui); white-space: nowrap; }
.reward .word b { font: 700 40px/1 var(--font-letter); color: var(--c); }
.reward .word .hl { color: var(--c); font-weight: 700; text-decoration: underline 4px; text-underline-offset: 5px; }
@keyframes pop-in { from { transform: translate(-50%, -50%) scale(.3); opacity: 0; } }

/* ===== Úvod ===== */
.start {
  position: fixed; z-index: 4; inset: 0; display: grid; place-items: center; background: #E8F6FF8C;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
.card {
  width: min(560px, 100%); background: var(--paper); border-radius: 32px; padding: 28px 24px 22px; text-align: center;
  box-shadow: 0 10px 0 #1F2A4D1A, 0 24px 60px #1F2A4D33; display: grid; gap: 14px;
}
.card h1 { margin: 0; font: 700 clamp(38px, 9vw, 60px)/1 var(--font-ui); text-wrap: balance; }
.card h1 span:nth-child(5n+1) { color: var(--red); } .card h1 span:nth-child(5n+2) { color: var(--orange); }
.card h1 span:nth-child(5n+3) { color: var(--green); } .card h1 span:nth-child(5n+4) { color: var(--blue); } .card h1 span:nth-child(5n) { color: var(--violet); }
.card p { margin: 0; font-size: 20px; color: var(--muted); }
/* výběr levelu: 1 Abeceda / 2 Slova */
.levels { display: flex; justify-content: center; gap: 6px; background: #EEF3FA; border-radius: 999px; padding: 5px; justify-self: center; }
.levels button { border: 0; background: none; border-radius: 999px; padding: 8px 18px; font-weight: 600; font-size: 18px; color: var(--muted); }
.levels button b { display: inline-grid; place-items: center; width: 26px; height: 26px; margin-right: 4px; border-radius: 50%; background: #1F2A4D1A; font-size: 16px; }
.levels button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.levels button[aria-pressed="true"] b { background: var(--sun); color: var(--ink); }
/* výsledek po dojetí do cíle */
.card .result { font-size: 24px; font-weight: 700; color: var(--ink); background: #FFF3C4; border-radius: 18px; padding: 10px 14px; }
.pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 4px; }
.pick button {
  border: 0; border-radius: 22px; padding: 16px 12px; display: grid; gap: 4px; text-align: center;
  background: var(--c); color: #fff; box-shadow: 0 6px 0 var(--d); transition: transform .12s;
}
.pick button:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--d); }
.pick b { font-size: 24px; font-weight: 700; }
.pick span { font-size: 15px; opacity: .92; }
.card small { color: var(--muted); font-size: 14px; }
@media (max-width: 420px) { .pick { grid-template-columns: 1fr; } .task small { display: none; } .task-letter { min-width: 60px; height: 60px; font-size: 44px; } .right { flex-direction: column; align-items: flex-end; } }
@media (max-width: 700px) { .abc { gap: 3px; padding: 5px 6px; } .abc li { min-width: 21px; height: 25px; font-size: 15px; padding: 0 2px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
