/* Vesmírné hodiny · Vili. Barvy z Colors.swift (DESIGN.md) aplikace. */
:root {
  --cosmos: #1B1F4D;
  --cosmos-mid: #2A3580;
  --star-blue: #7B8FFF;
  --coral: #F18F8F;
  --sun: #FFD972;
  --mint: #A8E6A1;
  --off: #F4F1FF;
  --ink: #20233A;
  --panel: #FFFFFF;
  --panel-soft: #EEF2FF;
  --success: #43B86C;
  --error: #F26D6D;
  --face: #FFF9E8;
  --rim: #4652A3;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  background: radial-gradient(ellipse at 30% 0%, var(--cosmos-mid), var(--cosmos) 70%) fixed var(--cosmos);
  color: var(--off);
  font: 500 18px/1.35 "Fredoka", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
button { font: inherit; color: inherit; }
h1, h2, p { margin: 0; }

/* Hvězdná obloha: pár vrstev teček, pomalé blikání */
.sky {
  position: fixed; inset: 0; pointer-events: none; z-index: -1;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 18%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 28% 72%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 44% 32%, #FFE9A8 50%, transparent 51%),
    radial-gradient(1px 1px at 63% 12%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 78% 58%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 88% 26%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 8% 88%, #C9D2FF 50%, transparent 51%),
    radial-gradient(1px 1px at 52% 92%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 94% 84%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 36% 50%, #fff 50%, transparent 51%);
  animation: twinkle 4s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: .55; } to { opacity: 1; } }

/* ===== Tlačítka a štítky ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 0 22px; border: 0; border-radius: 999px;
  font-weight: 600; font-size: 19px; text-decoration: none; cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .2);
  transition: transform .15s;
}
.btn:active { transform: scale(.95); }
.btn.sun { background: var(--sun); color: var(--ink); }
.btn.blue { background: var(--star-blue); color: var(--ink); }
.btn.ghost { background: var(--cosmos-mid); color: var(--off); padding: 0 16px; }
.btn.big { min-height: 64px; padding: 0 36px; font-size: 26px; }
.pill { border-radius: 999px; padding: 6px 14px; font-weight: 600; white-space: nowrap; }
.pill.sun { background: var(--sun); color: var(--ink); }
.panel { background: var(--panel); color: var(--ink); border-radius: 18px; padding: 16px 20px; }

/* ===== Tik-Tak ===== */
.mascot { width: 96px; height: auto; flex: none; cursor: pointer; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .3)); animation: float 3.2s ease-in-out infinite; }
.mascot.big { width: min(240px, 55vw); }
@keyframes float { 50% { transform: translateY(-8px); } }
body.talking .mascot { animation: talk .36s ease-in-out infinite alternate; }
@keyframes talk { from { transform: rotate(-3deg) scale(1); } to { transform: rotate(3deg) scale(1.04); } }

/* ===== Obrazovky ===== */
.screen { min-height: 100vh; min-height: 100dvh; padding: max(12px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); }
.bar { display: flex; align-items: center; gap: 12px; max-width: 1200px; margin: 0 auto 14px; }
.bar h1 { flex: 1; font-size: 24px; font-weight: 600; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.start { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; text-align: center; }
.start h1 { font-size: clamp(34px, 8vw, 56px); font-weight: 700; color: var(--sun); }
.start p { font-size: 22px; }
.home-link { color: var(--off); opacity: .8; margin-top: 8px; }

/* ===== Mapa ===== */
.map-body { display: grid; grid-template-columns: 260px 1fr; gap: 24px; max-width: 1200px; margin: 0 auto; align-items: start; }
.map-intro { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 14px; }
.map-intro .mascot { width: 150px; }
.map-intro h2 { font-size: 32px; font-weight: 700; color: var(--sun); }
.map-intro p { font-size: 19px; opacity: .9; }
.lessons { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.card {
  width: 100%; display: flex; align-items: center; gap: 14px; text-align: left;
  border: 0; border-radius: 22px; padding: 14px 16px; min-height: 104px;
  background: var(--panel); color: var(--ink); cursor: pointer;
  box-shadow: 0 6px 14px rgba(0, 0, 0, .22);
}
.card.locked { background: var(--panel-soft); cursor: default; box-shadow: none; opacity: .92; }
.card.pulse { animation: pulse 1.5s ease-in-out infinite alternate; }
@keyframes pulse { to { transform: scale(1.025); box-shadow: 0 0 0 4px var(--sun), 0 6px 14px rgba(0, 0, 0, .22); } }
.planet { position: relative; flex: none; width: 64px; height: 64px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff8, transparent 45%), var(--planet); border: 3px solid #F4F1FFd9; }
.card.locked .planet { opacity: .45; }
.planet-star { position: absolute; top: -10px; right: -12px; font-size: 26px; }
.card-text { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.card-text small { color: var(--star-blue); font-weight: 600; font-size: 15px; }
.card.locked .card-text small { color: #20233A94; }
.card-text b { font-size: 22px; font-weight: 600; line-height: 1.15; }
.card-text .sub { font-size: 16px; color: #20233AC7; }
.card-text .score { font-size: 15px; color: #20233AB0; font-weight: 600; }
.go { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: 26px; font-weight: 700; background: var(--star-blue); color: #fff; }
.card.locked .go { background: none; font-size: 22px; opacity: .6; }

/* ===== Lekce ===== */
.lesson-body { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(320px, 1.1fr); gap: 28px; max-width: 1200px; margin: 0 auto; align-items: start; }
.lesson-left, .lesson-right { display: flex; flex-direction: column; gap: 16px; }
.main-clock { width: min(100%, 420px, 62vh); margin: 0 auto; aspect-ratio: 1; display: grid; place-items: center; }
#clock-slot { width: 100%; }
.digital {
  width: 100%; aspect-ratio: 1.6; display: grid; place-items: center;
  background: #0E1130; border: 6px solid var(--rim); border-radius: 28px;
  color: #7CFFB0; font: 700 clamp(56px, 14vw, 104px) "Fredoka", monospace; letter-spacing: 2px;
  text-shadow: 0 0 18px #43B86C99; font-variant-numeric: tabular-nums;
}
.talk { display: flex; align-items: center; gap: 14px; }
.talk .mascot { width: 88px; }
#feedback { flex: 1; font-size: 20px; background: #2A358099; border-radius: 18px; padding: 12px 16px; min-height: 56px; }
.prompt { font-size: 26px; font-weight: 600; min-height: 84px; display: flex; align-items: center; }
.l1-help { display: flex; flex-direction: column; gap: 8px; font-size: 20px; }
.l1-help span { color: #20233AC7; font-size: 17px; }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.option {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px;
  border: 0; border-radius: 16px; padding: 12px; background: var(--panel); color: var(--ink);
  cursor: pointer; box-shadow: 0 4px 10px rgba(0, 0, 0, .16); transition: transform .12s, background .2s;
}
.option:active:not(:disabled) { transform: scale(.96); }
.option .clock { width: min(100%, 150px); }
.option .time-label { font-weight: 600; font-size: 17px; color: #20233AC7; font-variant-numeric: tabular-nums; }
.option.wrong { background: #F26D6De6; box-shadow: 0 0 0 4px var(--error); }
.option.correct { background: var(--success); }
.option.reveal { box-shadow: 0 0 0 5px var(--sun); }
.option.faded { opacity: .5; }
.option:disabled { cursor: default; }
.option.correct:disabled, .option.wrong:disabled { opacity: 1; }
.actions { display: flex; justify-content: space-between; gap: 12px; }

/* ===== Ciferník (souřadnice SVG -100..100) ===== */
.clock { display: block; width: 100%; height: auto; overflow: visible; }
.clock .face { fill: var(--face); filter: drop-shadow(0 5px 7px rgba(0, 0, 0, .25)); }
.clock .rim { fill: none; stroke: var(--rim); stroke-width: 6; }
.clock.mini .rim { stroke-width: 10; }
.clock .tick { fill: var(--rim); opacity: .35; }
.clock .tick.major { opacity: 1; }
.clock .num text { font: 700 19px "Fredoka", system-ui, sans-serif; fill: var(--ink); text-anchor: middle; }
.clock .num rect { fill: none; }
.clock.tappable .num { cursor: pointer; }
.clock.tappable .num rect { fill: #FFFFFFeb; stroke: var(--rim); stroke-width: 3; }
.clock .num.on rect { fill: var(--sun); stroke: var(--ink); stroke-width: 4; }
.clock .num.wrong rect { fill: #F26D6D47; stroke: var(--error); stroke-width: 4; }
.clock .num.disabled:not(.on):not(.wrong) { opacity: .42; }
.clock .num.disabled { cursor: default; }
.clock .num.on { animation: hint 1s ease-in-out infinite alternate; }
@keyframes hint { to { opacity: .75; } }
.clock .hand.hour { fill: var(--ink); }
.clock .hand.minute { fill: var(--rim); }
.clock .hands.animate .hand { transition: transform .45s ease-in-out; }
.clock .cap { fill: var(--sun); }
.clock .cap-dot { fill: var(--ink); }

/* ===== Odměny ===== */
.star-pop { position: fixed; z-index: 10; transform: translate(-50%, -50%); pointer-events: none; font-size: 30px; font-weight: 700; color: var(--sun); text-shadow: 0 2px 6px rgba(0, 0, 0, .4); animation: pop 1.1s ease-out forwards; }
@keyframes pop { to { transform: translate(-50%, -150%) scale(1.3); opacity: 0; } }
.confetti { position: fixed; top: -50px; z-index: 10; pointer-events: none; animation: fall 2.4s ease-in forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }

/* ===== Úzké obrazovky (telefon na výšku): vše pod sebou, otázka nahoře ===== */
@media (max-width: 760px) {
  .map-body { grid-template-columns: 1fr; gap: 16px; }
  .map-intro { position: static; flex-direction: row; align-items: center; }
  .map-intro .mascot { width: 90px; }
  .map-intro h2 { font-size: 26px; }
  .map-intro p { font-size: 17px; }
  .lessons { grid-template-columns: 1fr; }
  .bar h1 { font-size: 20px; }
  .lesson-body { display: flex; flex-direction: column; gap: 14px; }
  .lesson-left, .lesson-right { display: contents; }
  .prompt { order: 1; font-size: 22px; min-height: 0; }
  .main-clock { order: 2; width: min(100%, 300px, 32vh); }
  .options { order: 3; gap: 10px; }
  .l1-help { order: 3; }
  .talk { order: 4; }
  .actions { order: 5; }
  .talk .mascot { width: 64px; }
  #feedback { font-size: 18px; }
  .option { padding: 8px; }
  .option .clock { width: min(100%, 116px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
