/* BeeSpeaker Market Memory — komiksowy targ: promienie, kropki, grube kontury, przesunięte cienie; akcent: mandarynkowy. */
:root {
  --navy: #1d1e4f;
  --navy-2: #2a2b6e;
  --yellow: #ffd801;
  --pink: #ff4f9a;
  --orange: #ff8a1f;
  --mint: #3ee09a;
  --red: #ff5d5d;
  --ink: #1d1e4f;
  --paper: #fffdf4;
  --wood: #c98a4b;
  --wood-2: #a8683a;
  --stall: #3ecf6e;
  --stall2: #ffffff;
  /* M PLUS Rounded 1c ładuje game.js tylko dla interfejsu po japońsku (znaki, których brak w Bungee i Baloo 2) */
  --display: "Bungee", "M PLUS Rounded 1c", "Baloo 2", system-ui, sans-serif;
  --body: "Baloo 2", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body {
  height: 100%;
  margin: 0;
  background: var(--navy);
  color: #fff;
  font-family: var(--body);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  overscroll-behavior: none;
  overflow: hidden;
}
button { font: inherit; color: inherit; -webkit-appearance: none; appearance: none; cursor: pointer; touch-action: manipulation; }
button, .chip, .slot { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
[hidden] { display: none !important; }

.app {
  position: relative;
  width: 100%;
  max-width: 520px;
  height: 100%;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: max(8px, env(safe-area-inset-top)) 12px max(10px, env(safe-area-inset-bottom));
}
.app.shake { animation: shake .4s linear; }
@keyframes shake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-6px, 3px) rotate(-.5deg); }
  40% { transform: translate(6px, -4px) rotate(.5deg); }
  60% { transform: translate(-4px, 3px); }
  80% { transform: translate(3px, -2px); }
}
/* tło: obracające się promienie + kropki rastra */
.rays, .dots { position: absolute; left: 0; top: 0; right: 0; bottom: 0; pointer-events: none; }
.rays {
  left: -60%; top: -60%; right: -60%; bottom: -60%;
  background: repeating-conic-gradient(from 0deg, rgba(120, 126, 255, .17) 0deg 12deg, rgba(120, 126, 255, 0) 12deg 24deg);
  animation: spin 70s linear infinite;
}
.dots { background-image: radial-gradient(rgba(255, 255, 255, .09) 2px, transparent 2.5px); background-size: 18px 18px; }
@keyframes spin { to { transform: rotate(360deg); } }

.screen { position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; min-height: 0; }

/* ---------- tytuł ---------- */
.title {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: 44px;
  line-height: .95;
  text-align: center;
  color: var(--yellow);
  text-shadow: 3px 3px 0 var(--navy), 5px 5px 0 rgba(0, 0, 0, .35);
  letter-spacing: .02em;
}
.title .alt { color: var(--orange); }
.title.small { font-size: 24px; margin: 2px 0 2px; }
.idle { align-items: center; justify-content: center; gap: 10px; }
.idle-art { position: relative; width: 300px; height: 210px; flex: none; }
.idle-art .bear { position: absolute; left: 0; bottom: 0; width: 170px; top: auto; }
.idle-art .shopper { right: 4px; bottom: 0; }

/* ---------- HUD ---------- */
.hud { position: relative; z-index: 2; display: flex; align-items: center; gap: 8px; min-height: 44px; flex: none; }
.lives { display: flex; gap: 3px; align-items: center; min-width: 78px; }
.lives .heart { width: 24px; height: 22px; display: block; }
.lives .heart svg { width: 100%; height: 100%; display: block; fill: var(--pink); }
.lives .heart.lost svg { fill: rgba(255, 255, 255, .16); }
.lives .heart.losing { animation: heartLose .5s ease-in; }
@keyframes heartLose { 30% { transform: scale(1.5) rotate(-14deg); } 60% { transform: scale(.7) rotate(10deg); } }
.lives .pl {
  width: 24px; height: 24px; border-radius: 50%; border: 2.5px solid var(--navy); display: grid; place-items: center;
  font-family: var(--display); font-size: 11px; color: var(--navy); box-shadow: 0 0 0 0 transparent; flex: none;
}
.lives .pl.cur { box-shadow: 0 0 0 3px #fff; transform: scale(1.12); }
.lives .pl.out { background: #54558a !important; color: #9a9bc8; text-decoration: line-through; }
.goal {
  margin: 0 auto; display: flex; align-items: center; gap: 6px; background: var(--navy); border: 3px solid var(--yellow); border-radius: 999px;
  padding: 2px 12px 2px 8px; font-family: var(--display); font-size: 16px; color: var(--yellow); box-shadow: 3px 3px 0 rgba(0, 0, 0, .35); white-space: nowrap;
}
.goal .goal-ico { font-size: 17px; }
.goal.done { background: var(--mint); color: var(--navy); border-color: var(--navy); }
.goal.bump { animation: bump .4s ease-out; }
.pts {
  font-family: var(--display); font-size: 17px; color: var(--navy); background: var(--yellow);
  padding: 4px 11px; border-radius: 999px; border: 3px solid var(--navy); box-shadow: 3px 3px 0 rgba(0, 0, 0, .35);
  min-width: 58px; text-align: center;
}
.pts.bump { animation: bump .4s ease-out; }
@keyframes bump { 40% { transform: scale(1.25) rotate(-4deg); } }
.icon-btn { background: rgba(255, 255, 255, .12); border: 0; width: 42px; height: 42px; border-radius: 12px; font-size: 18px; flex: none; padding: 0; }

/* ---------- wybór języka, straganu, trybu ---------- */
.setup { justify-content: center; overflow-y: auto; }
.setup-main, .setup-party { display: flex; flex-direction: column; gap: 7px; padding: 4px 0; }
.label { margin: 3px 0 0; font-size: 16px; font-weight: 800; text-align: center; color: #fff; line-height: 1.15; }
.langs { display: flex; justify-content: center; gap: 10px; }
.lang-card {
  flex: 1 1 0; max-width: 220px; min-height: 50px; border: 3px solid var(--navy); border-radius: 16px; background: var(--paper); color: var(--ink);
  padding: 6px 10px; display: flex; align-items: center; gap: 9px; box-shadow: 4px 4px 0 rgba(0, 0, 0, .4); text-align: left; transition: transform .12s ease;
}
.lang-card .flag { width: 38px; height: 26px; border-radius: 5px; overflow: hidden; border: 2px solid var(--navy); display: block; flex: none; }
.lang-card .flag svg { width: 100%; height: 100%; display: block; }
.lang-card span.nm { display: flex; flex-direction: column; min-width: 0; }
.lang-card b { font-family: var(--display); font-weight: 400; font-size: 15px; line-height: 1.05; }
.lang-card small { font-size: 12.5px; color: #5a5b8a; font-weight: 700; line-height: 1.1; }
.lang-card[aria-checked="true"] { background: var(--yellow); transform: translate(-2px, -2px) rotate(-1.5deg); box-shadow: 6px 6px 0 var(--orange); }

.stalls { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.stall-card {
  position: relative; border: 3px solid var(--navy); border-radius: 16px; background: var(--paper); color: var(--ink); overflow: hidden;
  padding: 16px 6px 6px; display: flex; flex-direction: column; align-items: center; gap: 0; min-height: 80px;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, .4); transition: transform .12s ease;
}
.stall-card::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 12px; border-bottom: 3px solid var(--navy);
  background: repeating-linear-gradient(90deg, var(--stall) 0 16px, var(--stall2) 16px 32px);
}
.stall-card .deco { font-size: 21px; line-height: 1.15; letter-spacing: 2px; }
.stall-card b { font-family: var(--display); font-weight: 400; font-size: 13.5px; line-height: 1.1; text-align: center; }
.stall-card small { font-size: 12.5px; font-weight: 700; color: #5a5b8a; line-height: 1.2; text-align: center; }
.stall-card .stars { color: #c9c9dd; letter-spacing: 1px; font-size: 13px; }
.stall-card .stars i { font-style: normal; color: var(--orange); }
.stall-card[aria-checked="true"] { background: var(--yellow); transform: translate(-2px, -2px) rotate(-1deg); box-shadow: 6px 6px 0 var(--orange); }
.stall-card.locked { background: #b9bad6; color: #50517e; box-shadow: 3px 3px 0 rgba(0, 0, 0, .3); }
.stall-card.locked .deco { filter: grayscale(1); opacity: .55; }
.stall-card.nope { animation: nope .35s ease-in-out; }
@keyframes nope { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

.modes { display: grid; grid-template-columns: 1fr 1.25fr; gap: 9px; margin-top: 3px; }
.mode-btn {
  border: 3px solid var(--navy); border-radius: 999px; background: rgba(255, 255, 255, .13); color: #fff; min-height: 48px;
  padding: 4px 12px; display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 8px; text-align: left; line-height: 1.05;
}
.mode-btn span { font-size: 22px; grid-row: span 2; }
.mode-btn b { font-family: var(--display); font-weight: 400; font-size: 15px; align-self: center; }
.mode-btn small { font-size: 11.5px; font-weight: 700; color: #dcdcf5; align-self: start; word-break: keep-all; }
.mode-btn[data-mode="solo"] b { grid-row: span 2; }
.mode-btn[aria-checked="true"] { background: var(--pink); box-shadow: 3px 3px 0 var(--navy); }
.go {
  margin: 8px auto 0; display: block; width: 100%; max-width: 380px; border: 4px solid var(--navy); border-radius: 999px;
  padding: 12px 18px; font-family: var(--display); font-size: 21px; line-height: 1.1; color: var(--navy);
  background: linear-gradient(180deg, #ffe85a, var(--yellow) 55%, #f6b60b);
  box-shadow: 0 6px 0 var(--navy), 0 10px 24px rgba(0, 0, 0, .35); animation: pulse 1.6s ease-in-out infinite;
}
.go:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--navy); }
@keyframes pulse { 50% { transform: scale(1.03); } }
.note { margin: 6px 0 0; text-align: center; font-size: 13px; color: #cfd0f2; min-height: 1em; line-height: 1.25; }
.link-btn { background: none; border: 0; color: #cfd0f2; font-weight: 800; text-decoration: underline; padding: 10px; margin: 0 auto; display: block; }

.stepper { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 4px 0; }
.stepper b { font-family: var(--display); font-weight: 400; font-size: 44px; color: var(--yellow); min-width: 50px; text-align: center; text-shadow: 3px 3px 0 var(--navy); }
.step {
  width: 52px; height: 52px; border-radius: 50%; border: 3px solid var(--navy); background: var(--paper); color: var(--navy);
  font-family: var(--display); font-size: 26px; line-height: 1; box-shadow: 3px 3px 0 rgba(0, 0, 0, .35); padding: 0;
}
.step:disabled { opacity: .4; }
.names { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 2px; }
.name-row {
  display: flex; align-items: center; gap: 6px; border: 3px solid var(--navy); border-radius: 14px; background: var(--paper); padding: 4px 8px;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, .35);
}
.name-row .dot { width: 30px; height: 30px; flex: none; }
.name-row .dot svg { width: 100%; height: 100%; display: block; }
.name-row input {
  flex: 1; min-width: 0; width: 100%; border: 0; background: transparent; color: var(--navy); font: 800 16px var(--body); padding: 6px 0; outline: none;
}

/* ---------- rozgrywka: scena ---------- */
.play { gap: 6px; padding-top: 2px; }
/* scena ma wysokość z szerokości (360×262 w skali); gdy brakuje miejsca (długie łańcuchy kart), kurczy się ona, nie karty */
.stage { position: relative; flex: 0 1 262px; min-height: 80px; }
.stage-in {
  position: absolute; left: 50%; bottom: 0; width: 360px; height: 260px; transform-origin: 50% 100%;
  transform: translateX(-50%) scale(1);
}
.wall {
  position: absolute; left: 8px; right: 8px; top: 24px; bottom: 40px; background: #24256a; border: 4px solid var(--navy);
  background-image: radial-gradient(rgba(255, 255, 255, .07) 2px, transparent 2.5px); background-size: 14px 14px;
}
.wall::before, .wall::after { content: ""; position: absolute; top: 0; bottom: 0; width: 9px; background: var(--wood-2); border: 3px solid var(--navy); border-top: 0; border-bottom: 0; }
.wall::before { left: 4px; }
.wall::after { right: 4px; }
.awning { position: absolute; left: 0; right: 0; top: 0; height: 52px; z-index: 2; filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .25)); }
.awning svg { width: 100%; height: 100%; display: block; overflow: visible; }
.bear { position: absolute; left: 10px; top: 54px; width: 164px; z-index: 1; transform-origin: 45% 100%; }
.bear svg { width: 100%; height: auto; display: block; overflow: visible; }
.bear .m, .bee .m { display: none; }
.bear[data-mood="idle"] .m-idle, .bear[data-mood="call"] .m-call, .bear[data-mood="wow"] .m-wow,
.bear[data-mood="laugh"] .m-laugh, .bear[data-mood="oops"] .m-oops { display: inline; }
.bear[data-mood="idle"] { animation: breathe 3s ease-in-out infinite; }
.bear[data-mood="call"] { animation: lean .7s ease-in-out infinite; }
.bear[data-mood="call"] .shout { animation: blink .35s steps(2) infinite; }
.bear[data-mood="wow"] { animation: hop .5s ease-out 2; }
.bear[data-mood="wow"] .sparks { animation: blink .4s steps(2) infinite; }
.bear[data-mood="laugh"] { animation: chuckle .22s ease-in-out infinite; }
.bear[data-mood="oops"] { animation: wince .5s ease-out; }
@keyframes breathe { 50% { transform: scaleY(1.02); } }
@keyframes lean { 50% { transform: rotate(3deg) translateX(3px); } }
@keyframes blink { 50% { opacity: .25; } }
@keyframes hop { 40% { transform: translateY(-14px) scale(1.03); } }
@keyframes chuckle { 50% { transform: translateY(-4px) rotate(-1.5deg); } }
@keyframes wince { 30% { transform: translateY(6px) scaleY(.95); } }

.counter {
  position: absolute; left: 0; right: 0; bottom: 0; height: 62px; z-index: 2; background: var(--wood); border: 4px solid var(--navy); border-radius: 6px 6px 14px 14px;
  background-image: linear-gradient(rgba(29, 30, 79, .22), rgba(29, 30, 79, .22)), linear-gradient(rgba(29, 30, 79, .22), rgba(29, 30, 79, .22));
  background-size: 100% 3px, 100% 3px; background-position: 0 18px, 0 38px; background-repeat: no-repeat;
  box-shadow: 0 5px 0 rgba(0, 0, 0, .3);
}
.counter::before { content: ""; position: absolute; left: -6px; right: -6px; top: -10px; height: 12px; background: #e0a868; border: 4px solid var(--navy); border-radius: 6px; }
.sign {
  position: absolute; left: 12px; top: 13px; max-width: 228px; padding: 4px 12px 3px; background: var(--paper); color: var(--navy); border: 3px solid var(--navy); border-radius: 8px;
  font-family: var(--display); font-weight: 400; font-size: 13.5px; line-height: 1.15; transform: rotate(-2deg); box-shadow: 3px 3px 0 rgba(0, 0, 0, .3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.crate {
  position: absolute; left: 160px; top: -38px; width: 78px; height: 30px; background: var(--wood-2); border: 3px solid var(--navy); border-radius: 4px;
  background-image: linear-gradient(90deg, transparent 24px, rgba(29, 30, 79, .35) 24px 27px, transparent 27px 50px, rgba(29, 30, 79, .35) 50px 53px, transparent 53px);
}
.crate span { position: absolute; bottom: 16px; font-size: 22px; line-height: 1; }
.crate span:nth-child(1) { left: 0; transform: rotate(-12deg); }
.crate span:nth-child(2) { left: 24px; bottom: 20px; }
.crate span:nth-child(3) { left: 48px; transform: rotate(12deg); }

.bubble {
  position: absolute; left: 150px; top: 58px; max-width: 152px; z-index: 4; padding: 7px 10px 6px; background: #fff; color: var(--navy);
  border: 3px solid var(--navy); border-radius: 14px; box-shadow: 3px 3px 0 rgba(0, 0, 0, .3); animation: bubIn .25s cubic-bezier(.3, 1.6, .5, 1) both;
  transform-origin: 0 100%;
}
.bubble::before { content: ""; position: absolute; left: -14px; bottom: 9px; border-style: solid; border-width: 7px 14px 7px 0; border-color: transparent var(--navy) transparent transparent; }
.bubble::after { content: ""; position: absolute; left: -8px; bottom: 11px; border-style: solid; border-width: 5px 10px 5px 0; border-color: transparent #fff transparent transparent; }
.bubble b { display: block; font-weight: 800; font-size: 13.5px; line-height: 1.15; }
.bubble.learn b { font-size: 15.5px; }
.bubble small { display: block; margin-top: 2px; font-size: 11.5px; font-weight: 700; color: #5a5b8a; line-height: 1.15; }
.bubble small:empty { display: none; }
@keyframes bubIn { from { transform: scale(.3); opacity: 0; } }

/* pszczoła z koszem i stertą zakupów */
.shopper { position: absolute; right: 8px; bottom: 2px; width: 96px; height: 104px; z-index: 3; }
.bee { position: absolute; left: 0; top: 0; width: 100%; height: 100%; transform-origin: 50% 100%; animation: sway var(--wobDur, 2.6s) ease-in-out infinite; }
.bee svg { width: 100%; height: 100%; display: block; overflow: visible; }
.shopper[data-mood="happy"] .m-happy, .shopper[data-mood="strain"] .m-strain, .shopper[data-mood="panic"] .m-panic,
.shopper[data-mood="dizzy"] .m-dizzy, .shopper[data-mood="cheer"] .m-cheer { display: inline; }
.bee .wing { animation: flap .16s ease-in-out infinite alternate; }
@keyframes flap { from { opacity: 1; } to { opacity: .5; } }
@keyframes sway { 0%, 100% { transform: rotate(calc(var(--amp, 1deg) * -.5)); } 50% { transform: rotate(calc(var(--amp, 1deg) * .5)); } }
.shopper[data-mood="cheer"] .bee { animation: hop .45s ease-out 2; }
.shopper[data-mood="dizzy"] .bee { animation: dizzy .5s ease-in-out 3; }
@keyframes dizzy { 25% { transform: rotate(-12deg); } 75% { transform: rotate(12deg); } }
.pile { position: absolute; left: 50%; bottom: 84px; width: 0; height: 0; transform-origin: 50% 100%; animation: wob var(--wobDur, 2.6s) ease-in-out infinite; z-index: 1; }
@keyframes wob { 0%, 100% { transform: rotate(calc(var(--amp, 1deg) * -1)); } 50% { transform: rotate(var(--amp, 1deg)); } }
.pile span {
  position: absolute; font-size: 25px; line-height: 1; width: 30px; margin-left: -15px; text-align: center;
  filter: drop-shadow(0 2px 0 rgba(29, 30, 79, .55));
}
.pile span.in { animation: dropIn .4s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes dropIn { from { transform: translateY(-60px) scale(1.5) rotate(0deg); opacity: 0; } }
.pile span.out { animation: fallOut .9s cubic-bezier(.3, .1, .7, 1) forwards; }
@keyframes fallOut {
  25% { transform: translate(calc(var(--tx) * .35), -26px) rotate(calc(var(--tr) * .3)); opacity: 1; }
  100% { transform: translate(var(--tx), var(--ty)) rotate(var(--tr)); opacity: 0; }
}

/* nowy przedmiot na metce z ceną */
.spot {
  position: absolute; left: 50%; top: 50px; width: 132px; margin-left: -66px; z-index: 6; padding: 14px 8px 8px; text-align: center;
  background: var(--paper); color: var(--navy); border: 4px solid var(--navy); border-radius: 14px; box-shadow: 5px 5px 0 var(--orange), 0 10px 24px rgba(0, 0, 0, .4);
  transform: rotate(-3deg); animation: spotIn .35s cubic-bezier(.2, 1.6, .4, 1) both; transition: transform .42s cubic-bezier(.5, -.3, .8, 1), opacity .42s ease-in;
}
.spot::before { content: ""; position: absolute; left: 50%; top: 5px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: var(--navy); }
.spot::after { content: ""; position: absolute; left: 50%; top: -22px; width: 3px; height: 28px; margin-left: -1px; background: var(--paper); border-radius: 2px; transform: rotate(8deg); transform-origin: 50% 100%; }
.spot-pre { font-size: 12.5px; font-weight: 800; color: #5a5b8a; line-height: 1; margin: -2px 0 -4px; }
.spot-pre:empty { display: none; }
.spot-emoji { font-size: 58px; line-height: 1.12; }
.spot-word { font-weight: 800; font-size: 20px; line-height: 1.05; margin-top: 2px; }
.spot-word.long { font-size: 16.5px; }
.spot-mean { font-size: 13px; font-weight: 700; color: #5a5b8a; line-height: 1.15; margin-top: 2px; }
.spot-mean:empty { display: none; }
.spot-acc { position: absolute; right: 5px; top: 5px; font-family: var(--display); font-size: 9.5px; color: #fff; background: var(--navy); border-radius: 6px; padding: 1px 5px; }
.spot-acc:empty { display: none; }
.spot.small { top: 62px; width: 112px; margin-left: -56px; padding-top: 13px; }
.spot.small .spot-emoji { font-size: 42px; }
.spot.small .spot-word { font-size: 17px; }
.spot.fly { transform: translate(112px, 26px) scale(.16) rotate(20deg); opacity: .3; }
@keyframes spotIn { from { transform: scale(.2) rotate(-30deg); opacity: 0; } }

.burst {
  position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%) rotate(-6deg); z-index: 8;
  padding: 10px 18px; background: var(--yellow); color: var(--navy); font-family: var(--display); font-size: 25px; line-height: 1.05;
  border: 4px solid var(--navy); border-radius: 16px; box-shadow: 6px 6px 0 var(--pink), 0 10px 26px rgba(0, 0, 0, .4);
  max-width: 94%; width: max-content; text-align: center; animation: pop .45s cubic-bezier(.2, 1.6, .4, 1) both;
}
.burst.bad { background: var(--red); color: #fff; box-shadow: 6px 6px 0 var(--navy), 0 10px 26px rgba(0, 0, 0, .4); }
.burst.good { background: var(--mint); }
.burst small { display: block; font-size: 22px; letter-spacing: 3px; margin-top: 4px; color: var(--navy); }
@keyframes pop { from { transform: translate(-50%, -50%) scale(.2) rotate(-30deg); opacity: 0; } }
.gain {
  position: absolute; right: 14px; top: 16px; z-index: 7; font-family: var(--display); font-size: 22px; color: var(--mint);
  text-shadow: 2px 2px 0 var(--navy), -1px -1px 0 var(--navy), 1px -1px 0 var(--navy), -1px 1px 0 var(--navy); animation: gainUp 1s ease-out both; pointer-events: none;
}
.gain.minus { color: var(--red); }
@keyframes gainUp { from { transform: translateY(18px) scale(.6); opacity: 0; } 25% { opacity: 1; transform: translateY(0) scale(1.15); } to { transform: translateY(-26px); opacity: 0; } }

/* ---------- łańcuch: skrzynki z numerami / metki z obrazkami ---------- */
.strip { --sg: 5px; --smax: 50px; display: flex; flex-wrap: wrap; justify-content: center; gap: var(--sg); min-height: 46px; flex: none; width: 100%; max-width: calc(var(--per, 7) * (var(--smax) + var(--sg))); align-self: center; }
.slot { position: relative; width: calc((100% - (var(--per, 7) - 1) * var(--sg)) / var(--per, 7) - .2px); max-width: var(--smax); height: 46px; perspective: 320px; }
.slot .flip { position: absolute; left: 0; top: 0; right: 0; bottom: 0; transform-style: preserve-3d; -webkit-transform-style: preserve-3d; transition: transform .34s cubic-bezier(.3, 1.5, .5, 1); }
.slot.open .flip { transform: rotateY(180deg); }
.face {
  position: absolute; left: 0; top: 0; right: 0; bottom: 0; -webkit-backface-visibility: hidden; backface-visibility: hidden;
  border: 3px solid var(--navy); border-radius: 10px; display: flex; align-items: center; justify-content: center;
}
.face.back {
  background: var(--wood); color: var(--navy); font-family: var(--display); font-size: 16px;
  background-image: linear-gradient(rgba(29, 30, 79, .25), rgba(29, 30, 79, .25)), linear-gradient(rgba(29, 30, 79, .25), rgba(29, 30, 79, .25));
  background-size: 100% 2px, 100% 2px; background-position: 0 30%, 0 70%; background-repeat: no-repeat;
}
.face.back b { font-weight: 400; background: var(--paper); border-radius: 50%; width: 24px; height: 24px; display: grid; place-items: center; font-size: 13px; }
.face.front { background: var(--paper); transform: rotateY(180deg); font-size: 25px; line-height: 1; }
.slot.cur .back { background-color: var(--yellow); animation: curPulse .8s ease-in-out infinite; }
@keyframes curPulse { 50% { box-shadow: 0 0 0 4px rgba(255, 216, 1, .35); } }
.slot.ghost { border: 3px dashed rgba(255, 255, 255, .32); border-radius: 10px; }
.slot.ghost .flip { display: none; }
.slot.flag::after { content: "🏁"; position: absolute; right: -5px; top: -9px; font-size: 15px; z-index: 2; }
.slot.just { animation: slotPop .34s cubic-bezier(.3, 1.8, .5, 1); z-index: 2; }
@keyframes slotPop { 40% { transform: scale(1.3) rotate(-5deg); } }
.slot.born { animation: slotBorn .4s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes slotBorn { from { transform: scale(0) rotate(40deg); } }
.slot.bad .front { background: #ffd9d9; border-color: var(--red); }
.slot.bad { animation: nope .35s ease-in-out 2; }

.timer { height: 10px; border-radius: 999px; background: rgba(255, 255, 255, .14); border: 2px solid var(--navy); overflow: hidden; flex: none; opacity: 0; transition: opacity .2s; }
.timer.on { opacity: 1; }
.timer i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--mint), #b6f36b); border-radius: 999px; transform-origin: 0 50%; }
.timer.low i { background: var(--red); }

/* ---------- odpowiedź: głos / karty słów / wybór w trybie imprezowym ---------- */
.answer { position: relative; flex: 1 0 auto; min-height: 124px; display: flex; flex-direction: column; justify-content: center; }
.listen-box {
  position: absolute; left: 0; right: 0; top: 0; bottom: 0; display: flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 800; font-size: 17px; color: #e9e9ff; pointer-events: none;
}
.listen-box .ear { font-size: 26px; animation: earBob 1s ease-in-out infinite; }
@keyframes earBob { 50% { transform: scale(1.18) rotate(-8deg); } }
.voice-box { display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center; }
.orb {
  width: 62px; height: 62px; border-radius: 50%; border: 4px solid var(--navy); display: grid; place-items: center; font-size: 28px; line-height: 1;
  background: linear-gradient(180deg, #8f90c8, #6b6ca8); box-shadow: 0 5px 0 var(--navy); transition: background .2s;
}
.orb.wait { animation: pulse 1s ease-in-out infinite; }
.orb.live { background: linear-gradient(180deg, #ff7fb4, var(--pink)); animation: rec 1s ease-in-out infinite; }
.orb.hit { animation: orbHit .25s ease-out; }
@keyframes rec { 50% { box-shadow: 0 5px 0 var(--navy), 0 0 0 11px rgba(255, 79, 154, .28); } }
@keyframes orbHit { 40% { transform: scale(1.22); } }
.voice-hint { margin: 4px 0 0; font-weight: 800; font-size: 16.5px; line-height: 1.15; }
.heard { margin: 0; min-height: 1.3em; font-size: 14.5px; color: #dcdcf5; font-style: italic; line-height: 1.3; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cards { display: flex; flex-wrap: wrap; justify-content: center; align-content: center; gap: 7px; padding: 2px 0; }
.cards.pre { visibility: hidden; }
.cards.fade .chip:not(.wrong) { opacity: 0; transition: opacity .3s; }
.chip {
  border: 3px solid var(--navy); border-radius: 14px; background: var(--paper); color: var(--navy); font-weight: 800; font-size: 17px; line-height: 1.1;
  padding: 6px 12px; min-height: 44px; box-shadow: 3px 3px 0 rgba(0, 0, 0, .38); animation: chipIn .3s cubic-bezier(.3, 1.6, .5, 1) both;
}
.chip { position: relative; }
.chip:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 rgba(0, 0, 0, .38); }
.chip.used { visibility: hidden; }
.chip.wrong { background: var(--red); color: #fff; animation: nope .35s ease-in-out; }
.chip.playing { background: var(--yellow); }
.chip .w { display: block; }
/* 🔊 w rogu karty: posłuchaj słowa bez odpowiadania (pole dotyku większe niż kółko) */
.chip .say {
  position: absolute; right: -8px; top: -10px; width: 23px; height: 23px; border-radius: 50%; background: var(--yellow); border: 2px solid var(--navy);
  font-size: 11px; line-height: 19px; text-align: center; box-shadow: 1px 1px 0 rgba(0, 0, 0, .35); font-weight: 400;
}
.chip .say::before { content: ""; position: absolute; left: -9px; top: -9px; right: -9px; bottom: -9px; }
.chip.playing .say { background: var(--pink); animation: sayPing .9s ease-out; }
@keyframes sayPing { 30% { transform: scale(1.35) rotate(-10deg); } }
.cards.many .chip { font-size: 15px; padding: 4px 9px; min-height: 40px; border-radius: 12px; }
.cards.lots .chip { font-size: 14px; padding: 3px 7px; min-height: 38px; border-width: 2.5px; }
@keyframes chipIn { from { transform: scale(.4); opacity: 0; } }

.choose { text-align: center; }
.choose-title { margin: 0 0 8px; font-weight: 800; font-size: 17px; }
.choose-row { display: flex; justify-content: center; gap: 12px; }
.pick {
  width: 84px; height: 84px; border: 4px solid var(--navy); border-radius: 16px; background: var(--paper); font-size: 44px; line-height: 1; padding: 0;
  box-shadow: 4px 4px 0 var(--orange); animation: chipIn .3s cubic-bezier(.3, 1.6, .5, 1) both;
}
.pick:nth-child(2) { animation-delay: .08s; }
.pick:nth-child(3) { animation-delay: .16s; }
.pick:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--orange); }

.tools { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 44px; flex: none; }
.pill {
  border: 3px solid var(--navy); border-radius: 999px; background: #fff; color: var(--navy); padding: 6px 14px; min-height: 42px; font-weight: 800; font-size: 15px; line-height: 1.1;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, .35); white-space: nowrap;
}
.pill:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 rgba(0, 0, 0, .35); }
.pill:disabled { opacity: .45; }
.pill b { font-family: var(--display); font-weight: 400; font-size: 13px; }
.pill.nudge { background: var(--yellow); animation: pulse .8s ease-in-out 4; }
#modeBtn { margin-left: auto; }

/* ---------- tryb imprezowy ---------- */
.overlay {
  position: absolute; left: -12px; right: -12px; top: -60px; bottom: -12px; z-index: 20; background: rgba(29, 30, 79, .93);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.pass-card {
  width: 100%; max-width: 340px; background: var(--paper); color: var(--navy); border: 4px solid var(--navy); border-radius: 26px; padding: 20px 18px 22px;
  text-align: center; box-shadow: 8px 8px 0 var(--orange); animation: pop2 .4s cubic-bezier(.2, 1.5, .4, 1) both;
}
@keyframes pop2 { from { transform: scale(.4) rotate(-8deg); opacity: 0; } }
.pass-top { margin: 0; font-weight: 800; font-size: 18px; color: #5a5b8a; }
.pass-badge { width: 96px; height: 96px; margin: 8px auto 2px; animation: hopLoop 1s ease-in-out infinite; }
.pass-badge svg { width: 100%; height: 100%; display: block; }
@keyframes hopLoop { 50% { transform: translateY(-8px) rotate(4deg); } }
.pass-name { margin: 0; font-family: var(--display); font-weight: 400; font-size: 38px; line-height: 1.05; word-break: break-word; }
.pass-lives { min-height: 24px; display: flex; justify-content: center; gap: 4px; margin: 4px 0 2px; }
.pass-lives .heart { width: 24px; height: 22px; }
.pass-lives .heart svg { width: 100%; height: 100%; display: block; fill: var(--pink); }
.pass-lives .heart.lost svg { fill: #d5d5e6; }
.pass-card .go { margin-top: 12px; font-size: 19px; }
.cup { width: 150px; height: 178px; margin: 0 auto; animation: cupIn .7s cubic-bezier(.2, 1.5, .4, 1) both; }
.cup svg { width: 100%; height: 100%; display: block; overflow: visible; }
.cup .cup-rays { transform-origin: 80px 80px; animation: spin 9s linear infinite; }
@keyframes cupIn { from { transform: translateY(-80px) rotate(-30deg) scale(.4); opacity: 0; } }
.trophy-card .pass-name { font-size: 32px; }
.trophy-line { margin: 6px 0 0; font-weight: 700; font-size: 16px; color: #3c3d6e; line-height: 1.25; }

.confetti { position: absolute; left: 0; right: 0; top: 0; bottom: 0; pointer-events: none; overflow: hidden; z-index: 30; }
.confetti i { position: absolute; top: -30px; font-style: normal; font-size: 22px; animation: confFall var(--d, 1.8s) cubic-bezier(.3, .2, .6, 1) forwards; }
.confetti i.sq { width: 10px; height: 14px; border-radius: 2px; }
@keyframes confFall { to { transform: translate(var(--x, 0), var(--fall, 800px)) rotate(var(--r, 360deg)); } }

/* ---------- wysokie ekrany: więcej miejsca na odpowiedź ---------- */
@media (min-height: 700px) {
  /* girlanda chorągiewek nad straganem — wypełnia wysoki ekran */
  .stage { margin-top: 30px; }
  .stage::before {
    content: ""; position: absolute; left: -12px; right: -12px; top: -34px; height: 40px; pointer-events: none; transform-origin: 50% 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 40'%3E%3Cpath d='M0 4 Q30 16 60 4 Q90 16 120 4' fill='none' stroke='%231d1e4f' stroke-width='2.5'/%3E%3Cpath d='M8 7 L20 9.5 L13 30 Z' fill='%23ff4f9a' stroke='%231d1e4f' stroke-width='2' stroke-linejoin='round'/%3E%3Cpath d='M28 10 L41 10 L35 31 Z' fill='%23ffd801' stroke='%231d1e4f' stroke-width='2' stroke-linejoin='round'/%3E%3Cpath d='M48 7 L58 4.5 L56 26 Z' fill='%233ee09a' stroke='%231d1e4f' stroke-width='2' stroke-linejoin='round'/%3E%3Cpath d='M68 7 L80 9.5 L73 30 Z' fill='%235cc8ff' stroke='%231d1e4f' stroke-width='2' stroke-linejoin='round'/%3E%3Cpath d='M88 10 L101 10 L95 31 Z' fill='%23ff8a1f' stroke='%231d1e4f' stroke-width='2' stroke-linejoin='round'/%3E%3Cpath d='M108 7 L118 4.5 L116 26 Z' fill='%23b68cff' stroke='%231d1e4f' stroke-width='2' stroke-linejoin='round'/%3E%3C/svg%3E") repeat-x 0 0 / 120px 40px;
    animation: flutter 3.2s ease-in-out infinite;
  }
  @keyframes flutter { 50% { transform: skewX(2deg) scaleY(.93); } }
}
@media (min-height: 760px) {
  .slot { height: 52px; }
  .face.front { font-size: 29px; }
  .face.back b { width: 27px; height: 27px; font-size: 14px; }
  .strip { --sg: 6px; --smax: 54px; min-height: 52px; }
  .chip { font-size: 18px; min-height: 48px; padding: 7px 14px; }
  .cards { gap: 10px 9px; }
  .orb { width: 72px; height: 72px; font-size: 32px; }
  .voice-hint { font-size: 18px; }
  .answer { min-height: 150px; }
}

/* ---------- małe ekrany ---------- */
@media (max-height: 640px) {
  .title { font-size: 36px; }
  .setup .title.small { display: none; }
  .setup-main, .setup-party { gap: 5px; }
  .stall-card { min-height: 72px; padding-top: 15px; }
  .stall-card .deco { font-size: 18px; }
  .go { padding: 9px 16px; font-size: 19px; margin-top: 5px; }
  .note { font-size: 12px; margin-top: 3px; }
  .play { gap: 4px; }
  .slot { height: 40px; }
  .face.front { font-size: 22px; }
  .strip { --smax: 44px; min-height: 40px; }
  .answer { min-height: 112px; }
  .orb { width: 54px; height: 54px; font-size: 24px; }
  .chip { font-size: 16px; min-height: 42px; padding: 5px 10px; }
  .cards.many .chip { min-height: 38px; }
  .cards.lots .chip { min-height: 36px; font-size: 13.5px; }
  .pill { min-height: 40px; font-size: 14px; padding: 5px 12px; }
  .tools { min-height: 40px; }
  .pick { width: 74px; height: 74px; font-size: 38px; }
  .idle-art { transform: scale(.85); margin: -14px 0; }
}
@media (max-width: 345px) {
  .lang-card b { font-size: 13.5px; }
  .lang-card { padding: 6px 7px; gap: 7px; }
  .mode-btn { padding: 4px 9px; }
  .mode-btn b { font-size: 13.5px; }
  .chip { font-size: 15.5px; padding: 5px 9px; }
  .goal { font-size: 14.5px; padding-right: 9px; }
  .pts { min-width: 50px; padding: 4px 8px; font-size: 15.5px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .rays { animation: none !important; }
}
