body {
  background: linear-gradient(180deg, var(--sky-1) 0%, var(--sky-2) 65%, #e8fbd9 100%);
  min-height: 100%;
  overflow-x: hidden;
}
.portal {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: max(20px, var(--sat)) max(24px, var(--sar)) max(40px, var(--sab)) max(24px, var(--sal));
}
.portal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}
.logo {
  margin: 0;
  font-size: clamp(44px, 7vw, 72px);
  font-weight: 900;
  letter-spacing: 1px;
  color: #fff;
  text-shadow: 0 4px 0 var(--purple), 0 8px 18px rgba(43, 35, 80, 0.25);
}
.logo-emoji { display: inline-block; animation: hr-float 3s ease-in-out infinite; }
.head-right { display: flex; align-items: center; gap: 14px; }
.stars-pill {
  background: #fff;
  border-radius: 999px;
  padding: 10px 24px 10px 14px;
  font-size: 30px;
  font-weight: 900;
  box-shadow: var(--shadow);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}
.stars-pill .sp-star { display: grid; font-size: 46px; }
/* icon buttons (shared/icons.js) */
#mute { color: var(--blue); }
#mute.off { color: #8a84a8; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 28px;
}
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: var(--ink);
  background: #fff;
  border-radius: 36px;
  padding: 22px 22px 26px;
  box-shadow: var(--shadow);
  animation: hr-bounce-in 0.5s ease both;
  transition: transform 0.15s ease;
}
.card:nth-child(2) { animation-delay: 0.08s; }
.card:nth-child(3) { animation-delay: 0.16s; }
@media (hover: hover) { a.card:hover { transform: translateY(-6px) rotate(-1deg); } }
a.card:active { transform: scale(0.97); }
a.card:focus-visible { outline: 6px solid var(--sun); outline-offset: 4px; }

.card-art {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 26px;
  overflow: hidden;
  display: grid;
  place-items: center;
}
.card-hole .card-art { background: linear-gradient(160deg, #a8e06c, #6cc54a); }
.art-hole {
  width: 46%;
  aspect-ratio: 1.6 / 1;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 35%, #2c2448 0%, #0d0a1a 70%);
  box-shadow: 0 0 0 10px #ffd23f, 0 0 0 16px #ff8c42;
  animation: hole-pulse 2.4s ease-in-out infinite;
}
@keyframes hole-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.art-item { position: absolute; font-size: clamp(38px, 5vw, 56px); filter: drop-shadow(0 4px 2px rgba(0,0,0,0.2)); }
.art-item.a1 { left: 10%; top: 14%; animation: fall-in 2.4s ease-in infinite; }
.art-item.a2 { right: 9%; top: 10%; }
.art-item.a3 { right: 18%; bottom: 10%; animation: hr-float 2s ease-in-out infinite; }
@keyframes fall-in {
  0%, 30% { transform: translate(0, 0) rotate(0) scale(1); opacity: 1; }
  80% { transform: translate(110%, 75%) rotate(40deg) scale(0.4); opacity: 0.9; }
  81%, 100% { opacity: 0; transform: translate(110%, 75%) scale(0.2); }
}
.card-title { margin-top: 16px; font-size: clamp(36px, 3.8vw, 44px); font-weight: 900; align-self: stretch; text-align: center; padding: 0 76px 0 4px; white-space: nowrap; }
.card-play {
  position: absolute;
  right: 18px;
  bottom: 18px;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 50px;
  display: grid;
  place-items: center;
  box-shadow: 0 5px 0 #2f9c58;
}
.card-play .ic { margin-left: 6%; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.14)); }
a.card.launch { transform: scale(0.97); }
.card.sel { box-shadow: 0 0 0 6px var(--sun), var(--shadow); }

/* Robůtek card: a tiny floating island, the robot hops along the path to the flag */
.card-robot .card-art { background: linear-gradient(180deg, #7cc8ff 0%, #c9efff 70%, #fff3d6 100%); }
.art-island {
  position: absolute; left: 12%; right: 12%; top: 46%; height: 26%; border-radius: 18px;
  background: #82d95a; box-shadow: 0 10px 0 #b07a4a, 0 18px 0 -4px #8e705a, 0 22px 18px rgba(43, 35, 80, 0.2);
}
.art-tile { position: absolute; top: 22%; width: 19%; height: 56%; border-radius: 9px; background: #ffeec2; box-shadow: 0 4px 0 #f2cf86; }
.art-tile.t1 { left: 4%; background: #5ab8ff; box-shadow: 0 4px 0 #3a8fd6; }
.art-tile.t2 { left: 28%; } .art-tile.t3 { left: 52%; } .art-tile.t4 { left: 77%; background: #ffd23f; box-shadow: 0 4px 0 #e0a800; }
.art-bot { position: absolute; left: 16%; top: 28%; font-size: clamp(40px, 5.4vw, 60px); filter: drop-shadow(0 4px 2px rgba(0,0,0,0.2)); animation: bot-walk 3.6s ease-in-out infinite; }
@keyframes bot-walk {
  0%, 12% { transform: translate(0, 0); }
  20% { transform: translate(45%, -18%); } 28% { transform: translate(90%, 0); }
  40% { transform: translate(135%, -18%); } 48% { transform: translate(180%, 0); }
  60% { transform: translate(225%, -18%); } 68%, 92% { transform: translate(270%, 0) rotate(0); }
  76% { transform: translate(270%, -14%) rotate(-12deg); } 84% { transform: translate(270%, 0) rotate(12deg); }
  100% { transform: translate(0, 0); }
}
.art-bat { position: absolute; left: 50%; top: 30%; font-size: clamp(24px, 3vw, 34px); animation: hr-float 1.6s ease-in-out infinite; }
.art-flag { position: absolute; right: 13%; top: 20%; font-size: clamp(34px, 4.4vw, 48px); }
.art-cmds { position: absolute; left: 50%; bottom: 8%; transform: translateX(-50%); display: flex; gap: 6px; }
.ac { width: clamp(30px, 3.6vw, 40px); height: clamp(30px, 3.6vw, 40px); border-radius: 10px; display: grid; place-items: center; color: #fff; font-size: clamp(22px, 2.6vw, 30px); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.2); }
.ac.go { background: #2f7cf6; } .ac.right { background: #9b5cff; }
.card-soon { opacity: 0.75; filter: saturate(0.6); }
.card-soon .card-art { background: repeating-linear-gradient(45deg, #ece6ff 0 22px, #f6f2ff 22px 44px); }
.card-soon-2 .card-art { background: repeating-linear-gradient(-45deg, #e0f3ff 0 22px, #f1faff 22px 44px); }
.soon-emoji { font-size: 92px; opacity: 0.8; }
.card-lock {
  position: absolute; right: 18px; bottom: 18px; width: 64px; height: 64px; border-radius: 50%;
  display: grid; place-items: center; font-size: 38px; color: #fff; background: #a49cc4; box-shadow: 0 4px 0 #857ca8;
}

.clouds span {
  position: fixed;
  z-index: 0;
  font-size: 90px;
  opacity: 0.8;
  animation: drift 40s linear infinite;
  pointer-events: none;
}
.clouds span:nth-child(1) { top: 8%; left: -10%; }
.clouds span:nth-child(2) { top: 30%; left: -20%; animation-duration: 55s; animation-delay: -20s; font-size: 120px; }
.clouds span:nth-child(3) { top: 62%; left: -15%; animation-duration: 48s; animation-delay: -35s; }
@keyframes drift { from { transform: translateX(0); } to { transform: translateX(130vw); } }

@media (max-width: 700px) {
  .card-title { font-size: 36px; }
  .stars-pill { font-size: 24px; padding: 8px 18px 8px 12px; }
  .stars-pill .sp-star { font-size: 36px; }
}
/* "add to home screen" hint (iOS Safari only, portal.js): quiet round button + bubble for the parent */
.a2hs { position: relative; }
.a2hs-btn { width: 56px; height: 56px; min-width: 56px; min-height: 56px; color: #7b70ad; background: rgba(255, 255, 255, 0.75); font-size: 26px; }
.a2hs-pop {
  position: absolute; z-index: 5; top: calc(100% + 14px); right: -8px; width: max-content; max-width: calc(100vw - 24px);
  display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 16px; border-radius: 26px;
  background: #fff; box-shadow: var(--shadow); font-size: 20px; font-weight: 900; color: var(--ink);
  animation: hr-bounce-in 0.3s ease both;
}
.a2hs-pop[hidden] { display: none; }
.a2hs-pop::before { content: ''; position: absolute; top: -10px; right: 26px; border: 10px solid transparent; border-top: 0; border-bottom-color: #fff; }
.a2hs-ic { display: grid; font-size: 30px; color: var(--blue); }
.a2hs-next { font-size: 22px; color: #a49cc4; }
.a2hs-text { white-space: nowrap; }
.a2hs-close { width: 48px; height: 48px; min-width: 48px; min-height: 48px; color: #8a84a8; box-shadow: none; background: #f1edff; }

/* ---- phones (Phase 10b). Nothing under the notch / home indicator (padding uses the safe-area variables),
   buttons ≥ 56 px. Portrait: one column of wide cards (art left, name + ▶ right) → both games visible without
   scrolling. Landscape: the three cards in one row under a slim header. */
@media (max-width: 500px) {
  .portal { padding: max(12px, var(--sat)) max(14px, var(--sar)) max(20px, var(--sab)) max(14px, var(--sal)); }
  .portal-head { margin-bottom: 16px; gap: 8px; }
  .logo { font-size: 38px; white-space: nowrap; }
  .head-right { gap: 8px; }
  .stars-pill { font-size: 22px; padding: 6px 14px 6px 8px; gap: 4px; }
  .stars-pill .sp-star { font-size: 32px; }
  #mute { width: 58px; height: 58px; min-width: 58px; min-height: 58px; }
  .cards { grid-template-columns: 1fr; gap: 16px; }
  .card {
    display: grid; grid-template-columns: 54% 1fr; grid-template-rows: 1fr auto; grid-template-areas: 'art title' 'art play';
    align-items: center; justify-items: center; column-gap: 8px; row-gap: 6px; padding: 12px; border-radius: 30px;
  }
  .card-art { grid-area: art; border-radius: 20px; }
  .card-title { grid-area: title; margin: 0; padding: 0; font-size: 28px; align-self: end; }
  .card-play, .card-lock { grid-area: play; position: static; width: 64px; height: 64px; font-size: 44px; align-self: start; }
  .card-lock { font-size: 34px; }
  .art-item { font-size: 34px; }
  .art-bot { font-size: 34px; }
  .art-flag { font-size: 28px; }
  .art-bat { font-size: 20px; }
  .ac { width: 24px; height: 24px; font-size: 18px; border-radius: 7px; }
  .soon-emoji { font-size: 64px; }
  .clouds span { font-size: 64px; }
}
/* narrow phones (portrait, up to Pro Max 430 px): no balloon, smaller logo → the header (hint · stars · sound) fits in one row */
@media (max-width: 460px) {
  .logo-emoji { display: none; }
  .logo { font-size: 32px; }
  .head-right { gap: 6px; }
  .a2hs-btn { width: 48px; height: 48px; min-width: 48px; min-height: 48px; font-size: 24px; }
}
@media (max-height: 500px) {
  .portal { padding: max(10px, var(--sat)) max(20px, var(--sar)) max(12px, var(--sab)) max(20px, var(--sal)); }
  .portal-head { margin-bottom: 12px; }
  .logo { font-size: 40px; }
  .stars-pill { font-size: 22px; padding: 6px 14px 6px 8px; gap: 4px; }
  .stars-pill .sp-star { font-size: 32px; }
  #mute { width: 58px; height: 58px; min-width: 58px; min-height: 58px; }
  .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  .card { padding: 12px 12px 14px; border-radius: 28px; }
  .card-art { border-radius: 20px; }
  .card-title { margin-top: 8px; font-size: 26px; padding: 0 58px 0 2px; }
  .card-play, .card-lock { right: 12px; bottom: 10px; width: 56px; height: 56px; font-size: 38px; }
  .card-lock { font-size: 30px; }
  .art-item { font-size: 34px; }
  .art-bot { font-size: 34px; }
  .soon-emoji { font-size: 64px; }
  .clouds span { font-size: 60px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; }
}
