/* Stáj – laděno na Samsung Galaxy Tab S9 FE (Chrome ~1280×800 CSS px na šířku, 800×1280 na výšku), dotyk a S Pen. */
:root {
  --trava: #7cc46b; --trava-tm: #4f9a43; --nebe: #cdeeff; --drevo: #a0703c; --krem: #fff8ec; --text: #3b2a1a;
  --oranz: #f28c28; --zluta: #ffd36e; --cervena: #e26a5a; --modra: #5aa6e2; --fialova: #a77be0;
  --stin: 0 4px 0 rgba(60, 35, 10, .25);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: ui-rounded, "SF Pro Rounded", "Segoe UI", Roboto, system-ui, sans-serif;
  color: var(--text); background: var(--krem);
  touch-action: manipulation; user-select: none; -webkit-user-select: none; overscroll-behavior: none;
  font-size: 20px;
}
#app { min-height: 100%; display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom); }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
input { font: inherit; user-select: text; -webkit-user-select: text; }
h1, h2, h3 { margin: 0 0 .4em; }
h2 { font-size: 30px; }

/* hlavička */
.hl { display: flex; align-items: center; gap: 14px; padding: 10px 18px; background: var(--trava-tm); color: #fff; padding-top: max(10px, env(safe-area-inset-top)); }
.hl h1 { font-size: 30px; flex: 1; margin: 0; }
.zpet, .rodic { border: 0; background: rgba(255, 255, 255, .2); color: #fff; width: 58px; height: 58px; border-radius: 16px; font-size: 30px; }
.rodic { font-size: 24px; opacity: .7; }
.penize { display: flex; align-items: center; gap: 6px; background: rgba(0, 0, 0, .18); padding: 6px 16px 6px 10px; border-radius: 30px; font-size: 28px; }
.penize.bum { animation: bum .5s; }
.ikona-podkova { width: 1.1em; height: 1.1em; vertical-align: -.15em; }
@keyframes bum { 40% { transform: scale(1.25); } }

/* tlačítka */
.tl { border: 0; background: #fff; border-radius: 16px; padding: 14px 22px; font-size: 22px; font-weight: 700; box-shadow: var(--stin); min-height: 60px; }
.tl:active, .tl.stisk { transform: translateY(3px); box-shadow: 0 1px 0 rgba(60, 35, 10, .25); }
.tl.hlavni { background: var(--oranz); color: #fff; }
.tl:disabled { opacity: .45; }
.tl.maly { font-size: 18px; min-height: 48px; padding: 8px 16px; }
.velke-tl { font-size: 28px; padding: 18px 34px; }
.radek { display: flex; flex-wrap: wrap; gap: 14px; margin: 16px 0; align-items: center; }
.pozn { color: #7a6650; font-size: 18px; }
.velky-text { font-size: 24px; line-height: 1.45; }

/* domov */
.domov { flex: 1; display: grid; grid-template-rows: 1fr auto auto; padding: 14px; gap: 10px; }
.scena {
  position: relative; border-radius: 26px; overflow: hidden; min-height: 330px;
  background:
    repeating-linear-gradient(90deg, transparent 0 70px, var(--drevo) 70px 78px) 0 38% / 100% 46px no-repeat,
    linear-gradient(transparent 0 calc(38% + 10px), var(--drevo) calc(38% + 10px) calc(38% + 17px), transparent calc(38% + 17px)),
    linear-gradient(transparent 0 calc(38% + 30px), var(--drevo) calc(38% + 30px) calc(38% + 37px), transparent calc(38% + 37px)),
    linear-gradient(var(--nebe) 0 40%, var(--trava) 40%);
}
.dekorace { position: absolute; font-size: 54px; transform: translate(-50%, 0); pointer-events: none; }
.kun-scena { position: absolute; width: 19%; max-width: 210px; min-width: 120px; border: 0; background: none; padding: 0; transform: translate(-50%, 0); }
.kun-scena .kun-svg { width: 100%; filter: drop-shadow(0 6px 3px rgba(0, 0, 0, .18)); animation: pase 4s ease-in-out infinite; }
.kun-scena:nth-child(odd) .kun-svg { animation-delay: -2s; }
.kun-scena.zrcadlo .kun-svg { transform: scaleX(-1); animation-name: pase-z; }
.kun-scena .jm { display: inline-block; background: rgba(255, 255, 255, .85); border-radius: 12px; padding: 2px 10px; font-weight: 700; font-size: 18px; }
.bublina { position: absolute; top: -8px; right: -6px; background: #fff; border-radius: 16px; padding: 2px 8px; font-size: 22px; box-shadow: var(--stin); animation: houpe 1.2s infinite; }
@keyframes pase { 50% { transform: translateY(-3px) rotate(-1deg); } }
@keyframes pase-z { 0%, 100% { transform: scaleX(-1); } 50% { transform: scaleX(-1) translateY(-3px) rotate(-1deg); } }
@keyframes houpe { 50% { transform: translateY(-5px); } }
.info { text-align: center; font-size: 24px; margin: 4px 0; font-weight: 600; }
.menu { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.velke { border: 0; border-radius: 22px; padding: 12px 8px 14px; color: #fff; box-shadow: var(--stin); display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 150px; justify-content: center; }
.velke:active { transform: translateY(3px); }
.velke .em { font-size: 54px; line-height: 1; height: 62px; display: flex; align-items: center; }
.velke .em .kun-svg { height: 62px; width: auto; }
.velke b { font-size: 26px; }
.velke small { font-size: 16px; opacity: .92; }
.b-krm { background: var(--oranz); } .b-zak { background: var(--modra); } .b-hri { background: var(--fialova); }
.b-obc { background: #3fa58a; } .b-pok { background: #d9a520; }

/* hra: levý panel s koněm, pravý s příkladem */
.hra { flex: 1; display: grid; grid-template-columns: 1fr 1.15fr; gap: 20px; padding: 18px; align-items: start; }
.levy { background: linear-gradient(var(--nebe) 0 45%, var(--trava) 45%); border-radius: 26px; padding: 16px; text-align: center; min-height: 100%; }
.levy h2 { background: rgba(255, 255, 255, .85); display: inline-block; padding: 2px 16px; border-radius: 14px; }
.kun-velky .kun-svg { width: 100%; max-width: 380px; filter: drop-shadow(0 8px 4px rgba(0, 0, 0, .18)); }
.kun-velky.maly-kun .kun-svg { max-width: 260px; }
.kun-velky.hop .kun-svg { animation: hop .5s; }
@keyframes hop { 40% { transform: translateY(-22px) rotate(-4deg); } }
.bricho, .rust { display: flex; align-items: center; gap: 10px; background: rgba(255, 255, 255, .85); border-radius: 16px; padding: 8px 14px; margin-top: 8px; font-weight: 700; }
.pruh { flex: 1; height: 22px; background: #eadfcd; border-radius: 12px; overflow: hidden; }
.pruh i { display: block; height: 100%; background: linear-gradient(90deg, var(--oranz), var(--zluta)); border-radius: 12px; transition: width .5s; }
.tecky { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }
.tecky i { width: 22px; height: 22px; border-radius: 50%; background: rgba(255, 255, 255, .8); border: 2px solid rgba(0, 0, 0, .1); }
.tecky i.ok { background: var(--oranz); } .tecky i.vedle { background: #c9b9a3; }
.otazka { font-size: 64px; font-weight: 800; text-align: center; margin: 6px 0; letter-spacing: 1px; }
.hlaska { min-height: 40px; font-size: 24px; text-align: center; margin: 4px 0 8px; font-weight: 600; }
.hlaska.dobre { color: #2f8a3a; } .hlaska.vedle { color: #a0522d; }

/* číselná klávesnice */
.displej { font-size: 54px; font-weight: 800; text-align: center; background: #fff; border-radius: 18px; padding: 6px; margin: 0 auto 12px; max-width: 360px; box-shadow: inset 0 2px 6px rgba(0, 0, 0, .1); min-height: 82px; }
.displej.prazdny { color: #cbbda8; }
.klavesy { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 420px; margin: 0 auto; }
.klavesy button { border: 0; background: #fff; border-radius: 18px; font-size: 40px; font-weight: 800; height: 84px; box-shadow: var(--stin); }
.klavesy button.stisk { transform: translateY(3px); box-shadow: 0 1px 0 rgba(60, 35, 10, .25); background: #fff3dc; }
.klavesy .k-ok { background: var(--trava-tm); color: #fff; font-size: 32px; }
.klavesy .k-del { background: #f1e6d4; }
.leti { position: fixed; font-size: 48px; z-index: 1150; pointer-events: none; animation: leti .75s ease-in forwards; }
@keyframes leti { to { transform: translate(var(--dx), var(--dy)) scale(.6) rotate(-40deg); opacity: .4; } }

/* vyjížďka */
.vyjizdka { grid-template-columns: 1fr; }
.trasa { position: relative; height: 300px; border-radius: 26px; overflow: hidden; background: linear-gradient(var(--nebe) 0 55%, var(--trava) 55%); }
.krajina { position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 140px, rgba(79, 154, 67, .5) 140px 150px, transparent 150px 330px) 0 62% / 200% 30px repeat-x; animation: krajina 3s linear infinite; }
.krajina::before { content: '🌲    🌳        🌲  🌲       🌳     🌲    🌳        🌲'; position: absolute; top: 18%; white-space: pre; font-size: 70px; animation: krajina 9s linear infinite; }
@keyframes krajina { to { transform: translateX(-330px); } }
.jezdec { position: absolute; left: 12%; bottom: 8%; width: 230px; }
.jezdec .kun-svg { width: 100%; animation: klus .4s ease-in-out infinite; }
@keyframes klus { 50% { transform: translateY(-5px); } }
.jezdec.skok { animation: skok 1s ease-in-out; }
@keyframes skok { 45% { transform: translateY(-120px) rotate(-8deg); } }
.prekazka { position: absolute; right: 18%; bottom: 10%; font-size: 90px; transition: none; }
.prekazka.ujede { transition: right 1s linear; right: 105%; }
.vyj-dole { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; margin-top: 12px; }

/* zakázky */
.zakazky-uvod { padding: 24px; max-width: 900px; margin: 0 auto; }
.jak { background: #fff; border-radius: 22px; padding: 16px 24px; font-size: 22px; box-shadow: var(--stin); }
.zakazka { grid-template-columns: 1fr 1fr; }
.text-ulohy { background: #fffdf6; border-radius: 22px; padding: 20px; box-shadow: var(--stin); border: 3px solid #eadfcd; }
.uloha-text { font-size: 28px; line-height: 1.6; }
.uloha-text.mala { font-size: 20px; background: #fff; border-radius: 16px; padding: 10px; margin-top: 10px; text-align: left; }
.veta.tuk { border-bottom: 3px dashed #d5c3a5; cursor: pointer; }
.veta.otazka-vybrana { background: #fff0b8; border-radius: 8px; box-shadow: 0 0 0 4px #fff0b8; }
.veta.trhni { animation: trhni .4s; background: #ffe1d9; }
@keyframes trhni { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.cis { display: inline-block; font-weight: 800; padding: 0 6px; border-radius: 10px; }
.cis.tuk { background: #e9f3ff; border: 2px solid var(--modra); cursor: pointer; min-width: 44px; text-align: center; }
.cis.vybrane { background: var(--modra); color: #fff; }
.zapis-hotovo { margin-top: 14px; font-size: 26px; background: #f3f9ef; border-radius: 14px; padding: 8px 14px; }
.krok-ulohy h2 { font-size: 28px; }
.moznosti { display: flex; flex-direction: column; gap: 12px; }
.moznost { text-align: left; font-size: 22px; }
.stavba { display: flex; gap: 10px; align-items: center; justify-content: center; font-size: 44px; font-weight: 800; margin: 10px 0 16px; flex-wrap: wrap; }
.slot { display: inline-block; min-width: 86px; padding: 4px 12px; background: #fff; border-radius: 14px; text-align: center; box-shadow: inset 0 2px 6px rgba(0, 0, 0, .1); }
.slot.prazdny { color: #cbbda8; }
.slot.op { min-width: 64px; color: var(--oranz); }
.cipy { display: flex; flex-wrap: wrap; gap: 12px; margin: 10px 0; justify-content: center; }
.cip { font-size: 32px; min-width: 92px; min-height: 72px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.cip small { font-size: 13px; font-weight: 600; color: #7a6650; }
.cip.op { color: var(--oranz); font-size: 40px; }
.cip.mezi { background: #f3f9ef; }
.odpoved .slot { font-size: 30px; min-width: 90px; margin: 0 6px; }

/* hříbě */
.bublina-rec { background: #fff; border-radius: 20px; padding: 14px 18px; font-size: 26px; margin-top: 14px; position: relative; box-shadow: var(--stin); }
.bublina-rec::before { content: ''; position: absolute; top: -14px; left: 40%; border: 8px solid transparent; border-bottom: 8px solid #fff; border-width: 0 12px 14px; }
.rust small { min-width: 54px; }

/* obchod */
.obchod { padding: 18px; }
.zalozky { display: flex; gap: 12px; margin-bottom: 14px; }
.zbozi { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.polozka { border: 0; background: #fff; border-radius: 22px; padding: 12px; box-shadow: var(--stin); display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 22px; }
.polozka .kun-svg { width: 150px; }
.polozka .em-velke { font-size: 74px; line-height: 1.2; }
.polozka[data-malo] { opacity: .6; }
.polozka:disabled { background: #eef7ea; }
.cena { font-weight: 800; color: #7a6650; }

/* pokroky */
.pokroky { padding: 18px 24px; }
.dva-sloupce { display: grid; grid-template-columns: 1.2fr 1fr; gap: 30px; }
.tabulka { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; max-width: 470px; }
.tabulka .b { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; border-radius: 8px; font-size: 17px; font-weight: 700; }
.tabulka .b.hl { background: none; color: var(--trava-tm); font-size: 20px; }
.b.nevid { background: #eee6d8; color: #b3a38a; } .b.zacina { background: #ffe9a8; } .b.skoro { background: #c9ebb9; } .b.umi { background: #6cc35a; color: #fff; }
.rada { display: flex; align-items: center; gap: 10px; margin: 6px 0; font-size: 22px; }
.rada b { width: 32px; text-align: right; }
.rada.hotova .pruh i { background: #6cc35a; }

/* rodiče */
.rodice { padding: 18px 24px; max-width: 1000px; }
.prehled { white-space: pre-wrap; background: #fff; padding: 16px; border-radius: 14px; font-size: 18px; user-select: text; -webkit-user-select: text; }
.chk { display: inline-flex; gap: 8px; align-items: center; margin: 6px 16px 6px 0; font-size: 22px; }
.chk input { width: 28px; height: 28px; }
.rodice input:not([type]) { font-size: 22px; padding: 8px 12px; border-radius: 10px; border: 2px solid #d5c3a5; }

/* modální okno, toast, konfety */
.modal { position: fixed; inset: 0; background: rgba(40, 25, 10, .45); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px; animation: objev .2s; }
.modal-okno { background: var(--krem); border-radius: 28px; padding: 26px 30px; max-width: 640px; width: 100%; text-align: center; box-shadow: 0 10px 40px rgba(0, 0, 0, .3); max-height: 94vh; overflow: auto; }
.modal-okno .radek { justify-content: center; }
.modal-okno .kun-velky .kun-svg { max-width: 260px; }
.detail .kun-svg { width: 260px; }
.jmeno-input { font-size: 34px; padding: 12px 18px; border-radius: 16px; border: 3px solid #d5c3a5; width: 100%; text-align: center; }
@keyframes objev { from { opacity: 0; } }
.toast { position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%); background: var(--text); color: #fff; padding: 14px 24px; border-radius: 20px; font-size: 22px; z-index: 1100; transition: opacity .4s; }
.toast.pryc { opacity: 0; }
.konfety { position: fixed; inset: 0; pointer-events: none; z-index: 1200; overflow: hidden; }
.konfety span { position: absolute; top: -60px; animation: pada 2.2s ease-in forwards; }
@keyframes pada { to { transform: translateY(110vh) rotate(540deg); } }

/* vítej */
.vitej { padding: 30px; max-width: 1100px; margin: 0 auto; text-align: center; }
.vitej h1 { font-size: 48px; color: var(--trava-tm); }
.vyber-srsti { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin: 14px 0 24px; }
.srst { border: 4px solid transparent; background: #fff; border-radius: 22px; padding: 8px; box-shadow: var(--stin); display: flex; flex-direction: column; align-items: center; font-weight: 700; }
.srst .kun-svg { width: 130px; }
.srst.vybrana { border-color: var(--oranz); background: #fff3dc; }

/* na výšku (Tab S9 FE otočený: ~800×1280) */
@media (orientation: portrait) {
  .hra, .zakazka, .dva-sloupce, .vyj-dole { grid-template-columns: 1fr; }
  .levy { min-height: 0; }
  .krmeni .kun-velky .kun-svg, .hribe .kun-velky .kun-svg { max-width: 260px; }
  .menu { grid-template-columns: repeat(3, 1fr); }
  .scena { min-height: 520px; }
  .kun-scena { width: 24%; }
}
@media (max-width: 700px) {
  .menu { grid-template-columns: repeat(2, 1fr); }
  .otazka { font-size: 48px; }
  .klavesy button { height: 70px; font-size: 32px; }
}

/* vyjížďka se musí vejít na 800 px výšky (Tab S9 FE na šířku) */
.vyjizdka { padding-top: 12px; }
.vyjizdka .trasa { height: 220px; }
.vyjizdka .jezdec { width: 180px; }
.vyjizdka .prekazka { font-size: 74px; }
.vyjizdka .displej { min-height: 64px; font-size: 44px; padding: 2px; margin-bottom: 10px; }
.vyjizdka .klavesy { gap: 10px; }
.vyjizdka .klavesy button { height: 64px; font-size: 34px; }
.kod { font-family: ui-monospace, Consolas, monospace; letter-spacing: 2px; background: #fff; padding: 2px 10px; border-radius: 8px; user-select: text; -webkit-user-select: text; }

/* Tab S9 FE ve skutečnosti: Chrome hlásí 640 × 1024 CSS px (dpr 2,25), na šířku 1024 × 640.
   Nízké obrazovky na šířku: všechno s klávesnicí se musí vejít bez posouvání. */
@media (orientation: landscape) and (max-height: 720px) {
  body { font-size: 18px; }
  .hl { padding: 6px 14px; }
  .hl h1 { font-size: 26px; }
  .zpet, .rodic { width: 50px; height: 50px; font-size: 26px; }
  .penize { font-size: 24px; }
  .hra { padding: 10px 14px; gap: 14px; }
  .levy { padding: 10px; }
  .kun-velky .kun-svg { max-width: 300px; }
  .otazka { font-size: 48px; margin: 0; }
  .hlaska { min-height: 30px; font-size: 20px; margin: 2px 0 6px; }
  .displej { min-height: 58px; font-size: 40px; padding: 2px; margin-bottom: 8px; }
  .klavesy { gap: 9px; max-width: 380px; }
  .klavesy button { height: 60px; font-size: 32px; }
  .klavesy .k-ok { font-size: 26px; }
  .domov { padding: 10px; gap: 6px; }
  .scena { min-height: 250px; }
  .velke { min-height: 112px; padding: 8px 6px; }
  .velke .em { font-size: 42px; height: 48px; }
  .velke .em .kun-svg { height: 48px; }
  .velke b { font-size: 22px; }
  .velke small { font-size: 14px; }
  .info { font-size: 20px; }
  h2 { font-size: 24px; }
  .velky-text { font-size: 20px; }
  .uloha-text { font-size: 24px; }
  .cip { min-height: 58px; font-size: 28px; }
  .stavba { font-size: 36px; margin: 6px 0 10px; }
  .tl { min-height: 52px; font-size: 20px; padding: 10px 18px; }
  .vyjizdka .trasa { height: 160px; }
  .vyjizdka .jezdec { width: 140px; }
  .vyjizdka .prekazka { font-size: 60px; }
  .vyjizdka .klavesy button { height: 54px; }
  .krajina::before { font-size: 52px; }
  .bublina-rec { font-size: 22px; }
}

/* Tab S9 FE na výšku: 640 × 1024 */
@media (orientation: portrait) and (min-width: 560px) and (max-width: 760px) {
  .menu { grid-template-columns: repeat(3, 1fr); }
  .scena { min-height: 430px; }
  .krmeni .kun-velky .kun-svg, .hribe .kun-velky .kun-svg { max-width: 200px; }
  .levy { padding: 10px; }
  .otazka { font-size: 52px; }
  .hra { gap: 12px; padding: 12px; }
}
