/* ═══ v21 (Sara pt94u + updates) ═══ */
/* name step: typed name + optional chips */
.st21-nmwrap { display: flex; flex-direction: column; align-items: center; gap: 2px; width: min(100%, 320px); }
.st21-nmlab { font-weight: 800; color: #4A1F5C; font-size: clamp(.95rem, 2.8vh, 1.1rem); }
.st21-nm { font-family: inherit; font-size: clamp(1.2rem, 4vh, 1.5rem); font-weight: 800; color: #4A1F5C; text-align: center; width: 100%; padding: .25rem .8rem .3rem; border: 3px solid #C99A3C; border-radius: 16px; background: #FFFDF5; box-shadow: inset 0 2px 0 rgba(74, 31, 92, .08), 0 3px 0 #B88A2E; outline: none; -webkit-appearance: none; appearance: none; -webkit-user-select: text; user-select: text; }
.st21-nm:focus { border-color: #8E4FC0; box-shadow: 0 0 0 3px rgba(142, 79, 192, .25), 0 3px 0 #6B2E92; }
.st21-nm::placeholder { color: #B9A3C6; font-weight: 700; }
.st21-or { margin: 0; font-size: clamp(.85rem, 2.4vh, 1rem); color: #6B4A7A; font-weight: 700; }
@media (orientation: landscape) and (max-height: 430px) {
  .st19-card--name .st19-h { font-size: 1.25rem; margin: 0; }
  .st19-card--name .st19-lead { display: none; }
  .st19-card--name .st19-name-r { gap: 5px; }
  .st19-card--name .st19-nm { padding: .1rem .7rem .15rem; font-size: .95rem; }
  .st21-nm { font-size: 1.15rem; padding: .1rem .6rem .15rem; }
}
@media (orientation: portrait) {
  .st19-card--name .st19-name-art { height: clamp(120px, 22vh, 260px); }
  .st19-card--name .st19-names { grid-template-columns: repeat(3, auto); gap: 6px; }
  .st19-card--name .st19-nm { min-width: 4.4em; padding: .12rem .6rem .18rem; }
  .st19-card--name .st19-name-r { gap: clamp(4px, 1.2vh, 12px); }
}

/* —— v21: tabs obviously tappable — heading + strong active tab —— */
.pg21-tabhead { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; gap: .5rem; flex-wrap: wrap; }
.pg21-ask {
  font: 800 clamp(.78rem, 2vh, 1.05rem)/1.1 var(--font, 'Baloo 2', system-ui, sans-serif); color: #FFF6DC;
  background: linear-gradient(180deg, #6B3A86, #4A1F5C); border: 2px solid #E9C46A; border-radius: 999px;
  padding: .16rem .7rem .2rem; box-shadow: 0 2px 0 rgba(40, 10, 50, .5); white-space: nowrap;
}
.pg20-tab:not(.is-on) { opacity: .96; }
.pg20-tab:not(.is-on):active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(110, 74, 22, .45); }
.pg20-tab.is-on {
  position: relative; background: linear-gradient(180deg, #A35BD6, #5A2370); border: 3px solid #FFD54F; color: #FFF8E1;
  box-shadow: 0 3px 0 #3A1248, 0 0 0 3px rgba(255, 213, 79, .55), 0 0 14px rgba(255, 213, 79, .65); transform: translateY(-2px) scale(1.06);
}
.pg20-tab.is-on::after {
  content: ''; position: absolute; left: 50%; bottom: -9px; width: 0; height: 0; transform: translateX(-50%);
  border-left: 8px solid transparent; border-right: 8px solid transparent; border-top: 8px solid #FFD54F;
}
@media (orientation: landscape) and (max-height: 500px) {
  .pg21-ask { font-size: .72rem; padding: .1rem .5rem .14rem; }
  .pg21-tabhead { gap: .35rem; flex-wrap: nowrap; }
}
@media (orientation: portrait) {
  .pg21-tabhead { flex-direction: column; gap: .3rem; }
  .pg21-tabhead .pg20-tabs { align-self: stretch; }
  .pg21-ask { font-size: clamp(.8rem, 3.4vw, 1.05rem); }
}

/* —— v21: fractions cake — bigger, berries countable —— */
.nx-pie.nx-cake21 { width: clamp(120px, 30vh, 210px); overflow: visible; }
@media (orientation: landscape) and (max-height: 500px) { .nx-pie.nx-cake21 { width: clamp(100px, 31vh, 140px); } }
@media (orientation: portrait) { .nx-pie.nx-cake21 { width: clamp(170px, 56vw, 260px); } }

/* v21 H — Klasa 1 number line 0–20 */
.mp-l.mp-l--sm { font-size: .74rem; opacity: .8; }
.mp-t.is-big { height: 14px; }
.mp-t.is-big.is-five { height: 20px; }
.mp-t.is-big.is-ten { height: 26px; }
@media (max-width: 500px) { .mp-l.mp-l--sm { font-size: .58rem; } }

/* v21 F — smooth catch basket: moved by transform in a rAF loop */
.ct-sky { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.ct-basket { transition: none !important; will-change: transform; left: 0; }
.ct-basket.is-cheer { animation: none; }
.ct-basket.is-cheer img { animation: goodPop .6s var(--spring); }

/* v21 top bar — labelled meters + 'Nauka: N/30 gier' */
.tb-meter { gap: .2rem; }
.tb-meter-lab { font: 800 .72rem/1 var(--font, 'Baloo 2'), sans-serif; color: #4A1F5C; white-space: nowrap; letter-spacing: .01em; }
.tb-prog21 { gap: .3rem; }
.tb-prog21 .tb-prog21-t { display: inline !important; font: 800 .74rem/1 var(--font, 'Baloo 2'), sans-serif; color: #4A1F5C; white-space: nowrap; }
.tb-prog21 .tb-prog21-t em { font-style: normal; color: #8E2FB8; }
.tb-prog21 .tb-prog-track { width: 46px; }
@media (max-width: 500px) {
  .tb-meter-lab { font-size: .6rem; }
  .tb-prog21 .tb-prog-track { display: none; }
  .tb-prog21 .tb-prog21-t { font-size: .66rem; }
}
@media (orientation: landscape) and (max-height: 420px) {
  .tb-meter-lab { font-size: .64rem; }
  .tb-prog21 .tb-prog-track { width: 34px; }
}
@media (max-width: 520px) {
  .topbar--castle .tb-center { flex: 1 1 auto; min-width: 0; overflow: hidden; }
  .topbar--castle.topbar--care .tb-meters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .1rem .35rem; width: 100%; }
  .topbar--castle .tb-meter { min-width: 0; gap: .15rem; }
  .topbar--castle .tb-meter-ico { width: 16px; height: 16px; }
  .topbar--castle .tb-meter-lab { font-size: .6rem; }
  .topbar--castle .tb-meter-track { flex: 1 1 auto; min-width: 14px; width: auto; height: 7px; }
  .topbar--castle .tb-pet-row { gap: .25rem; }
  .topbar--castle .tb-prog21 img { width: 14px; height: 14px; }
  .topbar--castle .tb-right { gap: .25rem; }
}

/* v21 — „Jak to działa?” explanation card + '?' button */
.ex21-modal { position: fixed; inset: 0; z-index: 400; display: grid; place-items: center; padding: max(10px, env(safe-area-inset-top)) 12px 12px; background: rgba(46, 18, 60, .55); animation: ex21In .25s ease-out; }
@keyframes ex21In { from { opacity: 0; } to { opacity: 1; } }
.ex21-card { width: min(560px, 100%); max-height: calc(100dvh - 24px); overflow: auto; background: linear-gradient(180deg, #FFFBF2, #FFF1D6); border: 4px solid #C99A3C; border-radius: 26px; box-shadow: 0 0 0 3px #FFF6E0 inset, 0 14px 34px rgba(40, 10, 50, .45); padding: .8rem 1.1rem 1rem; color: #4A1F5C; font-family: var(--font, 'Baloo 2'), sans-serif; text-align: center; }
.ex21-head { display: flex; align-items: center; justify-content: center; gap: .6rem; margin-bottom: .3rem; }
.ex21-head img { width: 52px; height: 52px; object-fit: contain; filter: drop-shadow(0 3px 3px rgba(60, 25, 70, .3)); }
.ex21-head span { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.05; }
.ex21-head small { font-weight: 800; font-size: .85rem; color: #8E4FC0; text-transform: uppercase; letter-spacing: .06em; }
.ex21-head b { font-size: 1.35rem; font-weight: 800; }
.ex21-t { margin: .2rem 0 .5rem; font-size: 1.12rem; font-weight: 700; line-height: 1.35; }
.ex21-ex { background: #fff; border: 2px dashed #E0BE7A; border-radius: 18px; padding: .45rem .6rem .55rem; margin: 0 auto .5rem; }
.ex21-lab { display: block; font-weight: 800; font-size: .85rem; color: #A0702A; margin-bottom: .25rem; text-align: left; }
.ex21-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .45rem .7rem; }
.ex21-col { display: inline-flex; flex-direction: column; align-items: center; gap: .2rem; max-width: 46%; }
.ex21-col > b { font-size: 1.1rem; }
.ex21-col .ex21-i { margin: 1px; }
.ex21-col { flex-direction: row; flex-wrap: wrap; justify-content: center; }
.ex21-col > b { flex-basis: 100%; text-align: center; }
.ex21-i { width: 26px; height: 26px; object-fit: contain; }
.ex21-i.ex21-sm { width: 16px; height: 16px; }
.ex21-i.ex21-big { width: 40px; height: 40px; }
.ex21-i.ex21-bar { width: 48px; height: 30px; }
.ex21-grp { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 2px; max-width: 96px; padding: .25rem .35rem; border: 2px solid #E0BE7A; border-radius: 14px; background: #FFF8E8; }
.ex21-cup { flex-direction: column; align-items: center; }
.ex21-sign { font-size: 1.8rem; font-weight: 800; color: #8E2FB8; }
.ex21-eq { margin-top: .35rem; font-size: 1.08rem; font-weight: 700; }
.ex21-eq b { color: #8E2FB8; font-size: 1.2em; }
.ex21-flags b, .ex21-cards b, .ex21-star { display: inline-grid; place-items: center; min-width: 46px; height: 46px; padding: 0 .5rem; border-radius: 12px; background: #F3E6FF; border: 2px solid #8E4FC0; font-size: 1.2rem; font-weight: 800; }
.ex21-flags b.is-me, .ex21-cards b.is-on, .ex21-star.is-on { background: #FFE58A; border-color: #E0A000; }
.ex21-star { border-radius: 50%; background: #FFF3C2; border-color: #E0B000; }
.ex21-days b { min-width: 34px; height: 36px; font-size: .95rem; }
.ex21-line { display: flex; justify-content: center; gap: 0; border-bottom: 3px solid #8E4FC0; padding-bottom: 2px; }
.ex21-line span { width: 36px; text-align: center; font-weight: 800; font-size: 1.05rem; position: relative; padding-top: 14px; }
.ex21-line span::before { content: ''; position: absolute; left: 50%; bottom: -6px; width: 2px; height: 10px; background: #8E4FC0; }
.ex21-line span.is-on { color: #8E2FB8; }
.ex21-line span.is-on:not(:first-child)::after { content: ''; position: absolute; left: -50%; top: 0; width: 100%; height: 12px; border: 2px solid #E08A00; border-bottom: 0; border-radius: 18px 18px 0 0; }
.ex21-line span.is-end { background: #FFE58A; border-radius: 8px; }
.ex21-wall { display: inline-flex; flex-direction: column; gap: 2px; }
.ex21-wall span { display: flex; gap: 2px; }
.ex21-i.ex21-brick { width: 40px; height: 22px; object-fit: cover; }
.ex21-clock svg, .ex21-shapes svg { width: 90px; height: 90px; }
.ex21-shapes svg { width: 64px; height: 64px; }
.ex21-ruler svg { width: min(320px, 100%); height: auto; }
.ex21-cake svg { width: 130px; height: auto; }
.ex21-loose .nx-frame { grid-template-columns: repeat(3, auto); }
.ex21-grid { display: inline-grid; grid-template-columns: repeat(4, 34px); grid-auto-rows: 30px; gap: 2px; }
.ex21-grid b { display: grid; place-items: center; font-weight: 800; }
.ex21-grid i { border: 2px solid #C99A3C; border-radius: 6px; background: #FFF8E8; }
.ex21-grid i.is-on { background: #FFD54F; border-color: #E08A00; }
.ex21-go { margin-top: .4rem; }
.pr-help21 { width: 40px; height: 40px; border-radius: 50%; border: 3px solid #C99A3C; background: radial-gradient(circle at 40% 35%, #FFF7D6, #FFD54F); color: #4A1F5C; font: 800 1.35rem/1 var(--font, 'Baloo 2'), sans-serif; display: grid; place-items: center; cursor: pointer; box-shadow: 0 3px 0 #A0702A; flex-shrink: 0; padding: 0; }
.pr-help21:active { transform: translateY(2px); box-shadow: 0 1px 0 #A0702A; }
@media (orientation: landscape) and (max-height: 500px) {
  .ex21-card { width: min(720px, 100%); padding: .5rem .9rem .6rem; }
  .ex21-head img { width: 40px; height: 40px; }
  .ex21-head b { font-size: 1.15rem; }
  .ex21-t { font-size: 1rem; margin-bottom: .3rem; }
  .ex21-ex { padding: .3rem .5rem .4rem; margin-bottom: .3rem; }
  .ex21-eq { font-size: .98rem; margin-top: .2rem; }
  .ex21-go { margin-top: .2rem; padding-top: .35rem; padding-bottom: .4rem; }
  .pr-help21 { width: 34px; height: 34px; font-size: 1.15rem; }
}
@media (max-width: 420px) { .ex21-t { font-size: 1.02rem; } .pr-help21 { width: 36px; height: 36px; } }
.ex21-line span.is-st { color: #8E2FB8; text-decoration: underline 3px #8E4FC0; text-underline-offset: 3px; }
@media (max-width: 420px) {
  .ex21-col { max-width: 42%; }
  .ex21-col .ex21-i { width: 17px; height: 17px; margin: 0; }
  .ex21-row .ex21-sign { align-self: center; }
}
/* v21: K3 kitchen has up to 6 cupcakes — keep them inside the field (L: smaller, P: 3 per row) */
.kt-row--many .kt-cake { width: clamp(48px, 8.4vw, 96px); }
.pr-field--kitchen:has(.kt-row--many) .kt-bowl { width: clamp(80px, 11vw, 130px); }
@media (orientation: portrait) {
  .kt-row--many { flex-wrap: wrap; max-width: 100%; row-gap: 6px; }
  .kt-row--many .kt-cake { width: clamp(64px, 25vw, 130px); }
  .pr-field--kitchen:has(.kt-row--many) .kt-bowl { width: clamp(96px, 26vw, 160px); }
}
@media (min-width: 760px) and (min-height: 1000px) and (orientation: portrait) {
  .kt-row--many .kt-cake { width: 120px; }
  .kt-row--many { flex-wrap: nowrap; }
}
/* v21: K3 tower has up to 6 floors — on short landscape screens shrink bricks by floor count so the tower stays under the question */
@media (orientation: landscape) and (max-height: 520px) {
  body.world-zamek .tw-site { --bw: max(15px, min(46px, calc(400px / var(--b)), calc((112px / var(--a) - 5px) * 1.23))); }
  body.world-zamek .tw-floors { gap: 1px; }
  body.world-zamek .tw-row { padding: 2px 3px; }
  .tw-sum b { height: 22px; font-size: .92rem; min-width: 30px; }
}

/* v21 E: grid board in short landscape — choices go beside the board so all rows + letters stay visible */
@media (orientation: landscape) and (max-height: 520px) {
  body.world-zamek .pr-field:has(> .nx-card--grid) { display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 18px; }
  body.world-zamek .pr-field:has(> .nx-card--grid) > .nx-choices { flex-direction: column; width: auto; gap: 6px; margin: 0; }
  body.world-zamek .pr-field:has(> .nx-card--grid) > .nx-choices .pr-medal { width: 56px; height: 56px; font-size: 1.15rem; }
  body.world-zamek .nx-card--grid .nx-board { --c: clamp(20px, calc((100vh - 170px) / (var(--n) + 1)), 40px); }
  body.world-zamek .nx-card--grid.nx-card--tap .nx-board { --c: clamp(22px, calc((100vh - 180px) / (var(--n) + 1)), 40px); }
}

/* v21 D: humans read as big as Smoczek (narrow figures looked small in the same box) — scale from the feet, no pedestal */
.pet-sprite--human .pet-rig { scale: 1.14; }
.pet-sprite--human { filter: drop-shadow(0 2px 1.5px rgba(60, 25, 70, .22)); }
/* v21b: knight's 7-day chest shows the golden helmet instead of the star crown */
.qb-chest .qb-chest-crown--helm { width: 38%; left: 31%; bottom: 52%; }
