/* MAŠINKY */
.hra-masinky { background: #8fdc6a; }
.hra-masinky .platno { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hra-masinky .sonda { position: absolute; visibility: hidden; pointer-events: none; left: 0; top: 0;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); }

/* tlačítka výhybek */
.hra-masinky .vyhybka { position: absolute; z-index: 5; width: 66px; height: 66px; margin: -33px 0 0 -33px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.35), rgba(255,255,255,0) 55%), var(--b);
  border: 4px solid #fff; display: grid; place-items: center; touch-action: none;
  box-shadow: inset 0 -6px 0 rgba(0,0,0,.2), 0 5px 12px rgba(0,0,0,.25); transition: transform .12s; }
.hra-masinky .vyhybka::before { content: ""; position: absolute; inset: -9px; border-radius: 50%; border: 3px solid var(--b);
  opacity: .5; animation: masinky-pulz 2.2s ease-out infinite; pointer-events: none; }
.hra-masinky .vyhybka:active { transform: scale(.9); }
.hra-masinky .vyhybka svg { width: 44px; height: 44px; transition: transform .4s cubic-bezier(.3,1.6,.5,1);
  filter: drop-shadow(0 2px 0 rgba(0,0,0,.2)); }
.hra-masinky .vyhybka.cvak { animation: masinky-cvak .35s ease-out; }

/* panel: páka rychlosti + houkačka */
.hra-masinky .panel { position: absolute; z-index: 6; display: flex; align-items: center; gap: 12px; padding: 10px;
  border-radius: 40px; background: rgba(255,255,255,.6); box-shadow: 0 6px 18px rgba(0,0,0,.15), inset 0 2px 0 rgba(255,255,255,.7); }
.hra-masinky.na-vysku .panel { left: 50%; transform: translateX(-50%); bottom: calc(10px + var(--bezpecne-dole)); flex-direction: row; }
.hra-masinky.na-sirku .panel { right: calc(10px + var(--bezpecne-vpravo)); top: 50%; transform: translateY(-50%); flex-direction: column; }
.hra-masinky .paka { position: relative; display: flex; gap: 4px; padding: 6px; border-radius: 36px; touch-action: none;
  background: linear-gradient(180deg, #8d5a3b, #6b3f20); box-shadow: inset 0 3px 6px rgba(0,0,0,.35), 0 2px 0 rgba(255,255,255,.6); }
.hra-masinky.na-sirku .paka { flex-direction: column-reverse; }
.hra-masinky .stupen { position: relative; z-index: 2; width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; }
.hra-masinky .stupen svg { width: 42px; height: 42px; opacity: .55; transition: transform .25s, opacity .25s; }
.hra-masinky .stupen.vybrany svg { opacity: 1; transform: scale(1.1); }
.hra-masinky .knob { position: absolute; z-index: 1; left: 0; top: 0; width: 58px; height: 58px; border-radius: 50%;
  background: #fff; border: 4px solid var(--kb, #ffd93d); box-sizing: border-box;
  box-shadow: 0 4px 0 rgba(0,0,0,.25), 0 6px 12px rgba(0,0,0,.25); transition: transform .35s cubic-bezier(.3,1.5,.5,1), border-color .3s; }
.hra-masinky .knob.k0 { --kb: #ff4d4d; } .hra-masinky .knob.k1 { --kb: #6bcb77; }
.hra-masinky .knob.k2 { --kb: #ffd93d; } .hra-masinky .knob.k3 { --kb: #ff9f1c; }
.hra-masinky .houkacka { width: 78px; height: 78px; border-radius: 50%; display: grid; place-items: center; touch-action: none;
  background: radial-gradient(circle at 35% 30%, #ff8080, #ff4d4d 60%, #e03a3a); border: 4px solid #fff;
  box-shadow: inset 0 -6px 0 rgba(0,0,0,.2), 0 5px 12px rgba(0,0,0,.25); transition: transform .1s; }
.hra-masinky .houkacka:active { transform: scale(.9); }
.hra-masinky .houkacka svg { width: 54px; height: 54px; }
.hra-masinky .houkacka.troubi svg { animation: masinky-troubi .6s ease-out; }
.hra-masinky .houkacka.troubi .vlna1 { animation: masinky-vlna .6s ease-out; }
.hra-masinky .houkacka.troubi .vlna2 { animation: masinky-vlna .6s .12s ease-out; }

/* menší telefony */
@media (max-width: 370px), (max-height: 370px) {
  .hra-masinky .stupen, .hra-masinky .knob { width: 52px; height: 52px; }
  .hra-masinky .stupen svg { width: 38px; height: 38px; }
  .hra-masinky .houkacka { width: 70px; height: 70px; }
}

/* nápověda: výhybka, kterou je třeba přehodit, jemně bliká */
.hra-masinky .vyhybka.napoveda { animation: masinky-napoveda 1.1s ease-in-out infinite; }
.hra-masinky .vyhybka.napoveda::before { animation-duration: 1.1s; opacity: .9; border-width: 5px; }

/* přepínač úkolů pro rodiče (podržet) */
.hra-masinky .prepinac { position: absolute; z-index: 7; width: 50px; height: 50px; margin: -25px 0 0 -25px; padding: 0;
  border-radius: 50%; border: 3px solid #fff; background: rgba(255,255,255,.75); display: grid; place-items: center;
  box-shadow: 0 3px 8px rgba(0,0,0,.2); touch-action: none; transition: filter .3s, opacity .3s, transform .15s; }
.hra-masinky .prepinac svg { width: 34px; height: 34px; }
.hra-masinky .prepinac.vyp { filter: grayscale(1); opacity: .6; }
.hra-masinky .prepinac .prsten { position: absolute; inset: -6px; border-radius: 50%; pointer-events: none; opacity: 0;
  background: conic-gradient(#ff9f1c var(--p, 0%), transparent 0); -webkit-mask: radial-gradient(circle, transparent 27px, #000 28px);
  mask: radial-gradient(circle, transparent 27px, #000 28px); }
.hra-masinky .prepinac.drzi { transform: scale(.92); }
.hra-masinky .prepinac.drzi .prsten { opacity: 1; animation: masinky-drzi .8s linear forwards; }
@property --p { syntax: '<percentage>'; inherits: false; initial-value: 0%; }
.hra-masinky .vzkaz { position: absolute; z-index: 8; left: 50%; top: calc(14px + env(safe-area-inset-top, 0px)); transform: translate(-50%, -8px);
  padding: 8px 16px; border-radius: 20px; background: rgba(43,45,53,.85); color: #fff; font: 600 14px/1.2 system-ui, sans-serif;
  white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; }
.hra-masinky .vzkaz.videt { opacity: 1; transform: translate(-50%, 0); }

@keyframes masinky-napoveda { 0%, 100% { transform: scale(1); box-shadow: inset 0 -6px 0 rgba(0,0,0,.2), 0 5px 12px rgba(0,0,0,.25); }
  50% { transform: scale(1.16); box-shadow: inset 0 -6px 0 rgba(0,0,0,.2), 0 0 0 8px rgba(255,255,255,.75), 0 5px 18px rgba(0,0,0,.3); } }
@keyframes masinky-drzi { from { --p: 0%; } to { --p: 100%; } }

@keyframes masinky-pulz { 0% { transform: scale(.85); opacity: .6; } 70%, 100% { transform: scale(1.25); opacity: 0; } }
@keyframes masinky-cvak { 0% { transform: scale(1); } 35% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes masinky-troubi { 0% { transform: scale(1) rotate(0); } 30% { transform: scale(1.2) rotate(-8deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes masinky-vlna { 0% { opacity: 0; transform: translateX(-6px); } 50% { opacity: 1; } 100% { opacity: 1; transform: none; } }
