/* BMX triky. Jedna obrazovka přes celou plochu jako Jízda do kopce: park na plátně, nahoře body a úkoly,
   dole pedály, skok a čtyři triky. Jeden svět (slunečný park), tmavý režim hra nemá. */
:root {
  --nebe: #9ED8FF;
  --ink: #1F2A44;
  --karta: #FFFFFF;
  --karta-2: #EEF6FF;
  --hrana: #A9B8CF;
  --zlata: #FFC83D;
  --zlata-tmava: #C98A00;
  --zelena: #36A852;
  --zelena-tmava: #237A3A;
  --cervena: #E8463A;
  --cervena-tmava: #A82C22;
  --oranz: #FF8A2A;
  --oranz-tmava: #C2601A;
  --stin: rgba(31, 42, 68, .22);
  --clona: rgba(31, 42, 68, .38);
  --bila: #FFFFFF;
  --font: "Nunito", ui-rounded, "Segoe UI", system-ui, sans-serif;
  --cisla: "Titillium Web", "Nunito", system-ui, sans-serif;
  color-scheme: light;
}
[hidden] { display: none !important; }
html, body { height: 100%; touch-action: manipulation; }
body {
  margin: 0; background: var(--nebe); color: var(--ink); font-family: var(--font); overflow: hidden; overscroll-behavior: none;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
}
#platno { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
button { font-family: var(--font); color: var(--ink); cursor: pointer; }
button:focus-visible { outline: 4px solid var(--ink); outline-offset: 3px; }

/* ===== Horní lišta: body, trať, úkoly ===== */
.hud {
  position: fixed; inset: 0; pointer-events: none; display: flex; flex-direction: column; justify-content: space-between;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: calc(12px + env(safe-area-inset-top, 0px)) calc(16px + env(safe-area-inset-bottom, 0px));
}
.nahore { display: flex; flex-direction: column; gap: 10px; }
.horni { display: flex; align-items: flex-start; gap: 10px 14px; flex-wrap: wrap; }
.skore { display: grid; gap: 3px; line-height: 1; }
.skore b { font: 900 clamp(30px, 6vmin, 48px)/1 var(--cisla); text-shadow: 0 2px 0 rgba(255, 255, 255, .7); font-variant-numeric: tabular-nums; }
.skore small { font-size: 15px; font-weight: 800; opacity: .75; }
.trat { width: clamp(100px, 20vmin, 160px); height: 10px; border-radius: 999px; background: rgba(255, 255, 255, .85); box-shadow: 0 2px 0 var(--stin); overflow: hidden; margin-top: 4px; }
.trat i { display: block; height: 100%; background: var(--oranz); transform-origin: left; transform: scaleX(var(--p, 0)); }
.ukoly { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; flex: 1 1 18rem; justify-content: center; }
.ukoly li {
  display: flex; align-items: center; gap: 6px; padding: 7px 13px 7px; border-radius: 999px;
  background: rgba(255, 255, 255, .85); font-size: 15px; font-weight: 800; box-shadow: 0 2px 0 var(--stin); font-variant-numeric: tabular-nums;
}
.ukoly li.hotovo { background: var(--zlata); }
.vpravo { display: flex; gap: 8px; align-items: center; }
a.maly { display: grid; place-items: center; text-decoration: none; }
.maly {
  pointer-events: auto; width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .85);
  box-shadow: 0 2px 0 var(--stin); font-size: 22px; font-weight: 900; line-height: 1;
}
/* Kombo ve vzduchu: co už je hotové a co se právě dělá */
.kombo {
  align-self: center; background: rgba(255, 255, 255, .92); border-radius: 999px; padding: 6px 20px 5px; box-shadow: 0 3px 0 var(--stin);
  font: 900 clamp(20px, 4.4vmin, 32px)/1.1 var(--cisla); text-align: center;
}

/* ===== Dole: brzda, triky a skok, šlapání ===== */
.dolni { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; }
.pedal {
  pointer-events: auto; touch-action: none; width: clamp(96px, 18vmin, 160px); aspect-ratio: 3 / 4; max-width: 100%; flex: none;
  border: 0; border-radius: 24px; display: grid; place-items: end center; padding-bottom: 16px;
  font: 900 clamp(15px, 2.8vmin, 21px) var(--font); color: var(--bila); letter-spacing: .06em;
  background: repeating-linear-gradient(0deg, transparent 0 15px, rgba(0, 0, 0, .14) 15px 21px), var(--barva);
  box-shadow: 0 8px 0 var(--barva-tmava), 0 12px 20px var(--stin); transition: transform .06s, box-shadow .06s;
}
.pedal.drzim { transform: translateY(6px) scale(.97); box-shadow: 0 2px 0 var(--barva-tmava), 0 4px 8px var(--stin); }
.brzda { --barva: var(--cervena); --barva-tmava: var(--cervena-tmava); }
.slapat { --barva: var(--zelena); --barva-tmava: var(--zelena-tmava); }
.stred { display: flex; flex-direction: column; align-items: center; gap: 12px; min-width: 0; }
.triky { display: grid; grid-template-columns: repeat(4, auto); gap: 8px; }
@media (max-width: 540px) { .triky { grid-template-columns: repeat(2, auto); } }
/* Triky jdou jen ve vzduchu: na zemi jsou tlačítka bledá, ve vzduchu svítí, právě dělaný trik je zlatý */
.trik {
  pointer-events: auto; touch-action: none; position: relative; width: clamp(54px, 10vmin, 76px); aspect-ratio: 1; border: 0; border-radius: 50%;
  font-size: clamp(24px, 4.6vmin, 36px); line-height: 1; background: var(--karta); box-shadow: 0 5px 0 var(--hrana), 0 8px 14px var(--stin);
  opacity: .5; transition: opacity .12s, transform .06s;
}
.trik small { position: absolute; right: 6px; bottom: 3px; font: 700 12px var(--cisla); opacity: .6; }
body.vzduch .trik { opacity: 1; }
.trik.bezi { background: var(--zlata); transform: translateY(4px); box-shadow: 0 1px 0 var(--zlata-tmava); }
.skok {
  pointer-events: auto; touch-action: none; border: 0; border-radius: 999px; padding: 12px 30px; min-height: 56px;
  background: var(--oranz); color: var(--bila); font: 900 clamp(18px, 3.4vmin, 26px) var(--font); letter-spacing: .06em;
  box-shadow: 0 6px 0 var(--oranz-tmava), 0 10px 18px var(--stin); transition: transform .06s, box-shadow .06s;
}
.skok.drzim { transform: translateY(5px); box-shadow: 0 1px 0 var(--oranz-tmava), 0 4px 8px var(--stin); }

/* ===== Oznámení: velké uprostřed (přistání, pád), menší nahoře (úkoly, nový trik) ===== */
.banner {
  position: fixed; left: 50%; top: 36%; z-index: 4; width: max-content; max-width: calc(100% - 32px); transform: translate(-50%, -50%);
  font: 900 clamp(26px, 6vmin, 50px)/1.15 var(--cisla); color: var(--bila); text-align: center; text-wrap: balance; white-space: pre-line; pointer-events: none;
  text-shadow: 0 3px 0 var(--zlata-tmava), 0 6px 16px var(--stin); opacity: 0;
}
.banner.pad { text-shadow: 0 3px 0 var(--cervena-tmava), 0 6px 16px var(--stin); }
.banner.ukaz { animation: banner 1.9s ease-out; }
@keyframes banner {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.6); }
  14% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
  24%, 78% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -62%); }
}
.toast {
  position: fixed; left: 50%; top: 22%; z-index: 4; transform: translateX(-50%);
  width: max-content; max-width: calc(100% - 32px); padding: 8px 18px; border-radius: 999px; background: var(--zlata);
  box-shadow: 0 3px 0 var(--zlata-tmava); font-size: clamp(16px, 3vmin, 22px); font-weight: 900; text-align: center; pointer-events: none; opacity: 0;
}
.toast.ukaz { animation: toast 1.8s ease-out; }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, -12px); } 12%, 82% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }

/* ===== Okna: mapa úrovní a konec jízdy ===== */
.okno {
  position: fixed; inset: 0; z-index: 5; display: grid; place-items: center; background: var(--clona);
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: calc(16px + env(safe-area-inset-top, 0px)) calc(16px + env(safe-area-inset-bottom, 0px));
}
.okno > div {
  background: var(--karta); border-radius: 28px; padding: clamp(18px, 4vmin, 30px); width: min(100%, 40rem); max-height: 100%; overflow: auto;
  box-shadow: 0 10px 0 var(--stin); display: grid; gap: 16px;
}
.okno h1, .okno h2 { margin: 0; font: 900 clamp(30px, 7vmin, 50px)/1.05 var(--cisla); text-wrap: balance; text-align: center; }
.okno h2 { font-size: clamp(20px, 4vmin, 26px); text-align: left; }
.okno p { margin: 0; font-size: 17px; line-height: 1.4; font-weight: 600; text-wrap: pretty; }
.okno .drobne { font-size: 14px; opacity: .7; }
.uvod { text-align: center; }
.domu { justify-self: center; padding: 6px 14px; color: var(--ink); font-size: 18px; font-weight: 800; text-decoration: none; opacity: .75; }
/* úrovně: číslo, název s nejlepším skóre, tři hvězdy; zamčená je bledá */
.urovne { display: grid; gap: 8px; }
.uroven {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 10px 14px; border: 0; border-radius: 18px;
  background: var(--karta-2); box-shadow: 0 4px 0 var(--hrana); text-align: left;
}
.uroven:disabled { opacity: .5; cursor: default; box-shadow: none; }
.uroven .cislo { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--oranz); color: var(--bila); font: 900 24px var(--cisla); }
.uroven:disabled .cislo { background: var(--hrana); font-size: 20px; }
.uroven b { display: block; font-size: 19px; }
.uroven small { font-size: 14px; font-weight: 700; opacity: .7; }
.hvezdicky { font-size: 24px; letter-spacing: 2px; white-space: nowrap; }
.hvezdicky .nic { filter: grayscale(1); opacity: .3; }
/* jezdec: účes a barva kola, vybrané je zlaté */
.volby { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.volby span { font-weight: 900; min-width: 4.2em; }
.volby button { border: 0; border-radius: 999px; padding: 9px 16px; background: var(--karta-2); box-shadow: 0 3px 0 var(--hrana); font-size: 16px; font-weight: 800; }
.volby button[aria-pressed="true"] { background: var(--zlata); box-shadow: 0 3px 0 var(--zlata-tmava); }
.volby .barva { width: 40px; height: 40px; padding: 0; background: var(--b); box-shadow: 0 3px 0 rgba(0, 0, 0, .25); }
.volby .barva[aria-pressed="true"] { outline: 4px solid var(--ink); outline-offset: 2px; background: var(--b); }
/* sbírka triků: samolepky, které se vybarví po prvním přistání triku */
.sbirka { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(6.4rem, 1fr)); gap: 8px; }
.sbirka li { display: grid; gap: 2px; justify-items: center; text-align: center; padding: 8px 6px; border-radius: 16px; background: var(--karta-2); font-size: 14px; font-weight: 900; filter: grayscale(1); opacity: .5; }
.sbirka li.ma { filter: none; opacity: 1; background: #FFF3CC; }
.sbirka b { font-size: 30px; line-height: 1.1; }
.sbirka small { font-size: 12px; font-weight: 700; opacity: .75; }
.velke {
  justify-self: center; border: 0; border-radius: 999px; padding: 14px 32px; background: var(--zelena); color: var(--bila);
  font: 900 clamp(20px, 4vmin, 26px) var(--font); box-shadow: 0 5px 0 var(--zelena-tmava);
}
.velke:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--zelena-tmava); }
.tlacitka { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.druhe { border: 0; border-radius: 999px; padding: 12px 22px; background: var(--karta-2); font-size: 18px; font-weight: 900; box-shadow: 0 4px 0 var(--hrana); }
.odemknout { justify-self: center; border: 0; background: none; font-size: 14px; font-weight: 700; opacity: .55; text-decoration: underline; }
.vysledek { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 22px; font: 900 clamp(28px, 6vmin, 42px)/1 var(--cisla); }
.seznam { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; justify-self: center; font-size: 17px; font-weight: 800; }
/* po všech hvězdách: zlatá cedulka „běž to zkoušet ven“ */
.okno .ven { padding: 12px 16px; border-radius: 18px; background: #FFF3CC; box-shadow: 0 4px 0 var(--zlata); text-align: center; font-size: 19px; font-weight: 800; }
.ven b { display: block; font-size: 22px; }

/* Ukázka: tmavá cedulka nad ovládáním s textem a klávesami, tlačítka, která hra mačká, blikají bílo-zlatě */
.napoveda {
  position: fixed; left: 50%; bottom: 240px; z-index: 3; transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px);
  display: grid; gap: 6px; justify-items: center; padding: 10px 18px 12px; border-radius: 20px;
  background: rgba(31, 42, 68, .88); color: var(--bila); text-align: center; box-shadow: 0 6px 16px var(--stin);
}
.napoveda .stitek { font-size: 12px; font-weight: 900; letter-spacing: .14em; opacity: .75; }
.napoveda b { font-size: clamp(17px, 3.2vmin, 22px); font-weight: 900; text-wrap: balance; }
.napoveda .klavesy { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 12px; min-height: 36px; font-size: 15px; font-weight: 800; }
.napoveda kbd {
  display: inline-block; min-width: 1.7em; padding: 3px 9px; margin-right: 2px; border-radius: 8px; background: var(--bila); color: var(--ink);
  font: 900 17px var(--cisla); box-shadow: 0 3px 0 var(--hrana); animation: klavesa .5s ease-in-out infinite alternate;
}
@keyframes klavesa { to { transform: translateY(2px); box-shadow: 0 1px 0 var(--hrana); background: var(--zlata); } }
.napoveda button { border: 0; border-radius: 999px; padding: 6px 14px; background: rgba(255, 255, 255, .18); color: var(--bila); font-size: 14px; font-weight: 800; }
body.ukazka .drzim, body.ukazka .trik.bezi { outline: 5px solid var(--bila); outline-offset: 3px; animation: svit .45s ease-in-out infinite alternate; }
@keyframes svit { to { outline-color: var(--zlata); } }

/* Ladění fyziky: posuvníky, ať jde chování kola vyzkoušet hned za jízdy */
.ladeni {
  position: fixed; z-index: 6; right: max(16px, env(safe-area-inset-right, 0px)); top: calc(68px + env(safe-area-inset-top, 0px));
  width: min(330px, calc(100% - 32px)); max-height: calc(100% - 90px); overflow: auto; background: var(--karta); border-radius: 18px;
  padding: 14px 16px; box-shadow: 0 8px 0 var(--stin); display: grid; gap: 10px; font-size: 14px;
}
.ladeni h2 { margin: 0; font: 900 20px var(--cisla); }
.ladeni label { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; font-weight: 800; }
.ladeni output { font-variant-numeric: tabular-nums; }
.ladeni input { grid-column: 1 / -1; width: 100%; accent-color: var(--zelena); }
.ladeni button { justify-self: start; border: 0; border-radius: 999px; padding: 8px 16px; background: var(--karta-2); font-weight: 800; box-shadow: 0 3px 0 var(--hrana); }

@media (prefers-reduced-motion: reduce) {
  .banner.ukaz, .toast.ukaz { animation-duration: .01s; animation-delay: 0s; opacity: 1; }
}
