/* ==========================================================================
   v22 — care-first hub dock · hero on the garden path · one steady Wróć · bigger knight/princess
   Loaded after castle21.css. (castle22w.css = wardrobe art, separate file.)
   ========================================================================== */

/* —— Wróć never jumps: screens fade in with opacity only. A transform on .screen made the
   fixed corner button position itself inside the animating screen for the first 350 ms. —— */
@keyframes screenFade22 { from { opacity: 0; } to { opacity: 1; } }
.screen { animation-name: screenFade22 !important; }

/* —— knight & princess: same visual presence as Smoczek everywhere (slim figures need more height) —— */
.pet-sprite--human .pet-rig { scale: 1.3; }

/* —— HUB —— */
body.world-zamek .hub-screen.hub22 {
  display: block !important; position: relative; padding: 0 !important; margin: 0 !important;
  min-height: 0 !important; height: auto !important; grid-template: none !important;
}
@media (orientation: portrait) { body:has(.hub22) .sky { background-position: 53% 100% !important; } }
@media (orientation: landscape) { body:has(.hub22) .sky { background-position: 50% 100% !important; } }
.hub22-fx { position: fixed; inset: 0; pointer-events: none; z-index: 5; }

/* hero: a zero-size anchor at the feet point (set by placeHub22); sprite stands on it */
body.world-zamek .hub22 .hub22-pet {
  position: fixed !important; left: 50%; top: 70%; width: 0; height: 0; margin: 0 !important; padding: 0 !important;
  display: block !important; z-index: 3; translate: none !important; visibility: hidden; grid-area: auto !important;
}
body.world-zamek .hub22 .hub22-pet.is-placed { visibility: visible; }
body.world-zamek .hub22 .hub22-pet .pet-sprite {
  position: absolute !important; left: calc(var(--h22, 220px) / -2); top: calc(var(--h22, 220px) * -0.91);
  width: var(--h22, 220px); height: var(--h22, 220px);
}
body.world-zamek .hub22 .hub22-pet .hub-pet-img { height: var(--h22, 220px) !important; width: var(--h22, 220px) !important; max-width: none !important; }
body.world-zamek .hub22 .hub22-pet .pet-sprite::after { left: 32%; right: 32%; bottom: 7%; height: 5%; } /* soft contact shadow only */
body.world-zamek .hub22 .hub22-pet .hub-pet-name {
  position: absolute !important; left: 0; top: 2px; transform: translateX(-50%); margin: 0 !important;
  white-space: nowrap; font-size: .82rem; line-height: 1.25; padding: .02rem .75rem .08rem; min-width: 2.6em; text-align: center;
  border-radius: 9px; z-index: 4;
}
body.world-zamek .hub22 .hub-hint { display: none !important; }

/* Misje: compact scroll in the top-left corner; a small red "!" dot instead of the loose "Nowe!" sign */
body.world-zamek .hub22 .hub22-board {
  position: fixed !important; left: max(10px, env(safe-area-inset-left, 0px)); top: 84px; right: auto !important; bottom: auto !important;
  width: 66px !important; height: auto !important; min-height: 0 !important; margin: 0 !important; padding: 4px 4px 3px !important;
  display: flex !important; flex-direction: column; align-items: center; gap: 1px; z-index: 6; transform: none !important;
  background: linear-gradient(180deg, #FFFBF1, #F1DFB8) !important; border: 2px solid #C9A14A !important; border-radius: 14px !important;
  box-shadow: 0 3px 0 #9C7430, 0 6px 12px rgba(58, 18, 72, .22) !important; grid-area: auto !important;
}
body.world-zamek .hub22 .hub22-board img { position: static !important; width: 44px !important; height: 38px !important; object-fit: contain; transform: none !important; margin: 0 !important; }
body.world-zamek .hub22 .hub22-board .hub-board-lab {
  position: static !important; transform: none !important; margin: 0 !important; font-size: .74rem !important; line-height: 1.1; font-weight: 800; color: #3E1650 !important;
  background: none !important; border: 0 !important; box-shadow: none !important; padding: 0 !important; text-shadow: none !important;
}
body.world-zamek .hub22 .hub22-board .hub-board-new {
  display: none !important; position: absolute !important; left: auto !important; top: -7px !important; right: -7px !important; bottom: auto !important;
  width: 22px; height: 22px; padding: 0 !important; margin: 0 !important; transform: none !important; rotate: none !important;
  border-radius: 50%; background: linear-gradient(#FF6B7E, #D8264A) !important; border: 2px solid #fff !important; color: #fff !important;
  font: 800 .8rem/18px 'Baloo 2', system-ui, sans-serif !important; text-align: center; box-shadow: 0 2px 4px rgba(120, 10, 40, .35) !important;
  animation: h22dot 1.8s ease-in-out infinite;
}
body.world-zamek .hub22 .hub22-board.has-news .hub-board-new { display: block !important; }
@keyframes h22dot { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.15); } }

/* the dock: six equal plaques in reading order (one row in landscape, 3 × 2 in portrait) */
body.world-zamek .hub22 .hub22-dock {
  position: fixed; left: 50%; bottom: max(10px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  z-index: 4; display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px;
  width: min(calc(100vw - 24px), 900px); padding: 8px; box-sizing: border-box;
  background: linear-gradient(180deg, rgba(255, 249, 236, .55), rgba(244, 228, 198, .72));
  border: 2px solid rgba(201, 161, 74, .85); border-radius: 22px;
  box-shadow: 0 6px 18px rgba(58, 18, 72, .22), inset 0 1px 0 rgba(255, 255, 255, .7);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
body.world-zamek .hub22 .hub-btn.h22t {
  --pa: #FFFBF1; --pb: #F1DFB8; --rim: #C9A14A; --deep: #9C7430;
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  width: auto; min-width: 0; height: 118px; min-height: 0; margin: 0; padding: 6px 4px 7px; gap: 1px; box-sizing: border-box;
  background: linear-gradient(180deg, var(--pa), var(--pb)) !important; border: 2.5px solid var(--rim) !important;
  border-radius: 46% 46% 14px 14px / 30px 30px 14px 14px !important;
  box-shadow: 0 4px 0 var(--deep), 0 8px 14px rgba(58, 18, 72, .2), inset 0 1px 0 rgba(255, 255, 255, .8) !important;
  font-family: 'Baloo 2', system-ui, sans-serif; color: #3E1650; cursor: pointer; transform: none; animation: none;
  transition: transform .18s cubic-bezier(.3, 1.6, .5, 1), box-shadow .18s ease;
  -webkit-tap-highlight-color: transparent; grid-area: auto !important; justify-self: stretch; align-self: stretch;
}
body.world-zamek .hub22 .hub-btn.h22t::before, body.world-zamek .hub22 .hub-btn.h22t::after { content: none !important; }
body.world-zamek .hub22 .hub-btn.h22t:active { transform: translateY(3px) scale(.97); box-shadow: 0 1px 0 var(--deep), 0 4px 8px rgba(58, 18, 72, .2) !important; }
@media (hover: hover) { body.world-zamek .hub22 .hub-btn.h22t:hover { transform: translateY(-3px); } }
.h22t-art { flex: 1 1 auto; min-height: 0; width: 100%; display: flex; align-items: center; justify-content: center; }
.h22t-art img { max-width: 78%; max-height: 100%; height: 64px; width: auto; object-fit: contain; filter: drop-shadow(0 3px 2px rgba(60, 25, 70, .25)); }
.h22t-lab {
  display: block; max-width: 100%; font-weight: 800; font-size: .98rem; line-height: 1.05; white-space: nowrap; letter-spacing: .01em;
  color: #FFF3D6; padding: 2px 9px 3px; border-radius: 9px; overflow: hidden; text-overflow: ellipsis; box-sizing: border-box;
  background: linear-gradient(180deg, #8E4FC0, #5A2370); border: 1.5px solid #E9C46A; box-shadow: 0 2px 0 #3A1248; text-shadow: 0 1px 0 rgba(40, 10, 50, .5);
}
.h22t-sub { display: block; font-weight: 700; font-size: .72rem; line-height: 1.05; color: #6B4A2A; margin-top: 2px; white-space: nowrap; }
.h22t--rose  { --pa: #FFF6F4 !important; --pb: #F9D2D2 !important; }
.h22t--plum  { --pa: #FBF4FF !important; --pb: #E3CDF3 !important; }
.h22t--sky   { --pa: #F4FBFF !important; --pb: #CFE6F7 !important; }
.h22t--night { --pa: #EEE6FF !important; --pb: #BFA9E8 !important; }
.h22t--gold  { --pa: #FFFBEA !important; --pb: #F5DE9E !important; }
.h22t--mint  { --pa: #F3FFF7 !important; --pb: #CDEFD9 !important; }
/* Nakarm — the first thing to do: gold rim, warm glow, a gentle breathing shine */
body.world-zamek .hub22 .hub-btn.h22t--main {
  --rim: #E0A92E; --deep: #A8641A;
  box-shadow: 0 4px 0 var(--deep), 0 0 0 3px rgba(255, 214, 102, .65), 0 8px 18px rgba(214, 120, 40, .35), inset 0 1px 0 rgba(255, 255, 255, .8) !important;
}
body.world-zamek .hub22 .hub-btn.h22t--main .h22t-lab { background: linear-gradient(180deg, #E5566F, #A82648); border-color: #FFD873; box-shadow: 0 2px 0 #6E1430; }
body.world-zamek .hub22 .hub-btn.h22t--main .h22t-art img { animation: h22bob 2.6s ease-in-out infinite; }
@keyframes h22bob { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-3px) rotate(-3deg); } }

/* phone landscape: slim single row */
@media (orientation: landscape) and (max-height: 500px) {
  body.world-zamek .hub22 .hub22-dock { gap: 7px; padding: 6px; border-radius: 18px; width: min(calc(100vw - 150px), 720px); left: calc(50% - 30px); }
  body.world-zamek .hub22 .hub-btn.h22t { height: 82px; padding: 4px 3px 5px; border-radius: 44% 44% 12px 12px / 22px 22px 12px 12px !important; }
  .h22t-art img { height: 42px; }
  .h22t-lab { font-size: .82rem; padding: 1px 7px 2px; }
  .h22t-sub { display: none; }
  body.world-zamek .hub22 .hub22-board { width: 58px !important; }
  body.world-zamek .hub22 .hub22-board img { width: 38px !important; height: 30px !important; }
}
/* portrait: 3 × 2 */
@media (orientation: portrait) {
  body.world-zamek .hub22 .hub22-dock { grid-template-columns: repeat(3, 1fr); width: min(calc(100vw - 20px), 600px); gap: 9px; padding: 8px; }
  body.world-zamek .hub22 .hub-btn.h22t { height: 112px; }
  .h22t-art img { height: 60px; }
}
@media (orientation: portrait) and (max-width: 480px) {
  body.world-zamek .hub22 .hub22-dock { gap: 7px; padding: 6px; border-radius: 18px; }
  body.world-zamek .hub22 .hub-btn.h22t { height: 92px; }
  .h22t-art img { height: 46px; }
  .h22t-lab { font-size: .88rem; }
  .h22t-sub { font-size: .66rem; }
}
@media (orientation: portrait) and (min-width: 700px) {
  body.world-zamek .hub22 .hub-btn.h22t { height: 126px; }
  .h22t-art img { height: 70px; }
  .h22t-lab { font-size: 1.12rem; }
  .h22t-sub { font-size: .8rem; }
}
/* big landscape (tablet / desktop) */
@media (orientation: landscape) and (min-height: 501px) {
  body.world-zamek .hub22 .hub22-dock { width: min(calc(100vw - 200px), 920px); }
  body.world-zamek .hub22 .hub-btn.h22t { height: 136px; }
  .h22t-art img { height: 74px; }
  .h22t-lab { font-size: 1.06rem; }
}
@media (orientation: landscape) and (max-height: 500px) and (max-width: 700px) {
  body.world-zamek .hub22 .hub22-dock { gap: 5px; padding: 5px; width: calc(100vw - 120px); }
  .h22t-lab { font-size: .74rem; padding: 1px 5px 2px; }
}

/* —— Pokój zabaw: the hero gets real presence; the knight/princess rig scale grows upward, so leave headroom —— */
body.world-zamek .pg19-pet .playroom-pet { height: min(38vh, 220px); }
body.world-zamek .pg19-pet .pet-sprite--human { margin-top: calc(min(38vh, 220px) * .27); }
@media (orientation: portrait) {
  body.world-zamek .pg19-pet .playroom-pet { height: min(16vh, 180px); }
  body.world-zamek .pg19-pet .pet-sprite--human { margin-top: calc(min(16vh, 180px) * .27); }
}

/* —— in-game hero (portrait: it peeks above the task card) — keep the taller knight/princess head below the top bar —— */
@media (orientation: portrait) {
  body.world-zamek .pr-game .pr-dragon .pet-sprite--human { margin-top: 30px; }
  body.world-zamek .pr-game .pr-dragon .pet-sprite { margin-top: 6px; }
  body.world-zamek .pr-game .pr-dragon .pet-sprite.pet-sprite--human { margin-top: 32px; }
}
@media (orientation: portrait) and (min-width: 700px) {
  body.world-zamek .pr-game .pr-dragon .pet-sprite { margin-top: 10px; }
  body.world-zamek .pr-game .pr-dragon .pet-sprite.pet-sprite--human { margin-top: 50px; }
}
