/* Strona główna: tło z kropelkami, tytuł, scena z naleśnikiem, przycisk „Gry”, karty gier. */
#bgfx { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.drop-bg {
  position: absolute; bottom: -60px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  opacity: .35; animation: rise linear infinite;
}
@keyframes rise { to { transform: translateY(-120vh) rotate(360deg); } }
.word-bg {
  position: absolute; bottom: -80px; font-weight: 700; white-space: nowrap; opacity: .22; letter-spacing: .02em;
  text-shadow: 0 2px 0 rgba(255,241,214,.6); animation: riseWord linear infinite;
}
@keyframes riseWord {
  0%   { transform: translateY(0) rotate(var(--tilt, 0deg)); }
  25%  { transform: translateY(-30vh) translateX(14px) rotate(calc(var(--tilt, 0deg) * -1)); }
  50%  { transform: translateY(-60vh) translateX(0) rotate(var(--tilt, 0deg)); }
  75%  { transform: translateY(-90vh) translateX(-14px) rotate(calc(var(--tilt, 0deg) * -1)); }
  100% { transform: translateY(-125vh) translateX(0) rotate(var(--tilt, 0deg)); }
}
@media (prefers-reduced-motion: reduce) { .word-bg { animation: none; display: none; } }

header { position: relative; z-index: 1; text-align: center; padding: 6px 16px 0; }
h1 {
  margin: 0; font-size: clamp(2.4rem, 9vw, 4.6rem); font-weight: 700; letter-spacing: .01em;
  color: var(--syrup);
  text-shadow: 0 3px 0 var(--syrup-dark), 0 8px 18px rgba(138,69,18,.25);
  transition: transform .08s;
}
h1.beat { transform: scale(1.05); }

main { position: relative; z-index: 1; width: 100%; max-width: 640px; padding: 0 16px; }
.pancake-stage { display: block; overflow: visible; width: 100%; height: auto; max-height: 62vh; margin: 0 auto; touch-action: manipulation; cursor: pointer; }

.games-toggle { position: relative; z-index: 2; display: flex; justify-content: center; margin: clamp(16px, 4vh, 48px) 0 40px; }

section.games:not([hidden]), .dock:not([hidden]) { animation: open .35s ease-out; }
@keyframes open { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: none; } }
section.games { position: relative; z-index: 1; width: 100%; max-width: 640px; padding: calc(env(safe-area-inset-top, 0px) + 14px) 16px 16px; }
section.games h2 { text-align: center; font-size: clamp(1.6rem, 6vw, 2.2rem); margin: 10px 0 16px; color: var(--syrup-dark); text-shadow: 0 2px 0 rgba(255,241,214,.8); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.card {
  position: relative; display: block; color: inherit; text-decoration: none;
  background: rgba(255,250,238,.85); border-radius: 18px; padding: 16px; text-align: center;
  box-shadow: 0 4px 0 #e6bf7a; border: 2px dashed var(--line);
}
a.card { border-style: solid; cursor: pointer; transition: transform .12s; }
a.card:hover { transform: translateY(-3px) rotate(-1deg); }
a.card:active { transform: translateY(3px); box-shadow: 0 1px 0 #e6bf7a; }
.card img { width: 3.2rem; height: 3.2rem; display: block; margin: 0 auto; }
.card b { display: block; margin-top: 6px; }
.card span { font-size: .9rem; opacity: .7; }
a.card span { opacity: 1; color: var(--syrup); font-weight: 700; }
.card .badge {
  position: absolute; top: 8px; right: 8px; font-size: .7rem; font-weight: 700; opacity: 1;
  background: #7c3aed; color: #fff; border-radius: 999px; padding: 2px 8px;
}

/* ---- widok „Wybierz grę” (/games/): mały tańczący naleśnik na dole obok przycisku powrotu ---- */
.dock {
  position: relative; z-index: 2; display: flex; align-items: center; justify-content: center; gap: 4px;
  margin: 8px auto 12px; padding: 0 16px;
}
.dock-pancake { width: 120px; flex: none; }
.dock-pancake main, .dock-pancake #pancake { padding: 0; max-width: none; }
.dock-pancake .pancake-stage { max-height: none; }
.dock-home { font-size: 1.1rem; padding: 12px 22px; }
body.view-games header, body.view-games .games-toggle { display: none; }
body.view-games section.games { padding-top: calc(env(safe-area-inset-top, 0px) + 64px); }
@media (min-width: 700px) { .dock-pancake { width: 150px; } }

/* ---- przycisk „Gry”: bryła syropu (SVG) z ociekającymi stróżkami; spada tylko jedna kropla ---- */
.syrup-blob {
  position: relative; display: block; width: clamp(200px, 52vw, 290px); aspect-ratio: 400 / 250;
  text-decoration: none; -webkit-tap-highlight-color: transparent; transition: transform .15s;
}
.syrup-blob .sb-art { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.sb-label {
  position: absolute; left: 0; right: 0; top: 8%; height: 44%; display: flex; align-items: center; justify-content: center; gap: .3em;
  font-size: clamp(1.7rem, 7vw, 2.35rem); font-weight: 700; color: #fff3dc; letter-spacing: .01em;
  text-shadow: 0 2px 0 #b8621b, 0 3px 0 #8a4512, 0 6px 10px rgba(80,35,5,.45);
}
.sb-label .arrow { font-size: .5em; margin-left: .25em; }
.syrup-blob:hover { transform: scale(1.03) rotate(-1.5deg); }
.syrup-blob:active { transform: translateY(3px) scale(.99); }
.syrup-blob:focus-visible { outline: 3px solid var(--syrup-dark); outline-offset: 6px; border-radius: 40px; }
.sb-drop {                       /* kropla wzbiera na końcu najdłuższej stróżki i spada */
  position: absolute; left: 43%; top: 85%; width: 6.5%; aspect-ratio: 1 / 1.25; margin-left: -3.25%;
  border-radius: 50% 50% 50% 50% / 42% 42% 58% 58%; transform-origin: 50% 0; opacity: 0; pointer-events: none; z-index: -1;
  background: radial-gradient(circle at 34% 30%, rgba(255,255,255,.8) 0 10%, transparent 12%), radial-gradient(circle at 50% 60%, #ffd27a, #c46d20 70%, #8f4512);
  animation: sbDrop 4.2s cubic-bezier(.5,0,.75,.4) infinite 1s;
}
@keyframes sbDrop {
  0%   { opacity: 1; transform: translateY(0) scale(.3); }
  58%  { opacity: 1; transform: translateY(4px) scale(.85, .95); }
  64%  { opacity: 1; transform: translateY(8px) scale(.75, 1.1); }
  86%  { opacity: 1; transform: translateY(70px) scale(.62, .75); }
  87%, 100% { opacity: 0; transform: translateY(72px) scale(.2); }
}
@media (prefers-reduced-motion: reduce) { .sb-drop { display: none; } .syrup-blob:hover { transform: none; } }

/* ---- układ strony głównej: wszystko na jednym ekranie – tytuł, naleśnik na środku, przycisk na dole ---- */
/* strona główna: jeden ekran bez przewijania (iOS przewijał treść pod notch) */
/* wysokość = „mały” widok iOS (z widocznymi paskami przeglądarki) -> treść zawsze się mieści, nie ma czego przewijać */
html.home-lock, html.home-lock body { overflow: hidden; overscroll-behavior: none; }
html.home-lock body { height: 100vh; height: 100svh; min-height: 0; }
body:not(.view-games) > header { flex: none; }
body:not(.view-games) > main#pancake {
  flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 6px 16px 0;
}
body:not(.view-games) > main#pancake .pancake-stage { height: 100%; width: auto; max-width: 100%; max-height: none; }
body:not(.view-games) .games-toggle { flex: none; margin: 4px 0 calc(env(safe-area-inset-bottom, 0px) + 18px); }
body.view-games .tap-hint { display: none; }

/* ---- rączka-podpowiedź: co 10 s „klika” naleśnika, dopóki ktoś sam go nie kliknie (localStorage) ---- */
.tap-hint { position: fixed; z-index: 5; left: 0; top: 0; width: 0; height: 0; pointer-events: none; }
.tap-hand {
  position: absolute; left: -14px; top: -2px; width: clamp(54px, 13vw, 76px); height: auto; opacity: 0;
  transform-origin: 26% 4%; filter: drop-shadow(0 4px 4px rgba(110,54,13,.35));
}
.tap-ripple {
  position: absolute; left: -26px; top: -26px; width: 52px; height: 52px; border-radius: 50%;
  border: 4px solid rgba(255,255,255,.95); box-shadow: 0 0 0 3px rgba(200,116,42,.45); opacity: 0;
}
.tap-hint.play .tap-hand { animation: tapHand 2.6s ease-in-out forwards; }
.tap-hint.play .tap-ripple { animation: tapRipple 2.6s ease-out forwards; }
@keyframes tapHand {
  0%   { opacity: 0; transform: translate(70px, 90px) rotate(12deg); }
  20%  { opacity: 1; transform: translate(0, 0) rotate(0); }
  28%  { transform: translate(0, 0) scale(.82); }
  36%  { transform: translate(0, 0) scale(1); }
  46%  { transform: translate(0, 0) scale(.82); }
  54%  { transform: translate(0, 0) scale(1); }
  78%  { opacity: 1; transform: translate(0, 0); }
  100% { opacity: 0; transform: translate(50px, 70px) rotate(10deg); }
}
@keyframes tapRipple {
  0%, 26% { opacity: 0; transform: scale(.3); }
  30%     { opacity: 1; transform: scale(.5); }
  40%     { opacity: 0; transform: scale(1.5); }
  44%     { opacity: 1; transform: scale(.5); }
  54%, 100% { opacity: 0; transform: scale(1.5); }
}
/* rączki naleśnika mają kreskę o stałej grubości w pikselach (non-scaling-stroke) – w małym naleśniku na dole wyglądały na za grube */
.dock-pancake [data-pc="armL"], .dock-pancake [data-pc="armR"] { vector-effect: none; }
