/* Bevezető az első 30 másodpercre (onboarding.js), és az első küldetés / új csillag ünneplése.
   Utolsóként töltődik, a #shop-ui előtag pedig a store-flat.css általános gomb-, bekezdés- és címszabályait írja felül.
   iOS 15: nincs :has és color-mix; a dvh előtt mindig vh; a CSS-változó nincs @keyframes-ben.
   Az animációk sosem indulnak láthatatlanból: ha a telefon (vagy a 3D-től elfoglalt GPU) késve indítja őket, a
   szöveg akkor is ott van – az átlátszóság csak a díszítésen (szikrák, gyűrű) és az ünneplés végén változik. A
   lépésváltás és a beúszás left/top-pal megy (a fő szálon, nem a GPU-ra vár), így nem ragadhat félúton. */
#play-intro {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: #0812199e;
  pointer-events: auto;
  animation: intro-fade 0.25s ease-out;
}
/* a bevezető alatt a HUD nem kell (és nem kattintható): csak a bolt látszik mögötte */
.intro-open .play-mission,
.intro-open .play-bottom,
.intro-open .play-view-switch,
.intro-open .play-hunt,
.intro-open #play-joystick,
.intro-open #play-interact,
.intro-open #play-skip,
.intro-open #play-world-labels {
  display: none !important;
}
.intro-card {
  position: relative;
  width: min(440px, 100%);
  max-height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 16px 22px 20px;
  background: #142026f7;
  border: 1px solid #ffffff26;
  border-radius: 14px;
  box-shadow:
    0 30px 90px #0009,
    0 0 0 4px #f6ca350d;
  color: #f2f3ed;
  text-align: center;
  touch-action: pan-y;
}
.intro-top {
  display: flex;
  align-items: center;
  gap: 14px;
}
.intro-progress {
  display: flex;
  flex: 1;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.intro-progress li {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: #ffffff24;
  overflow: hidden;
}
.intro-progress li.done {
  background: var(--gold, #f6ca35);
}
.intro-progress li.now::after {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  background: var(--gold, #f6ca35);
  animation: intro-bar 0.45s ease-out both;
}
#shop-ui .intro-skip {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 8px 2px 8px 10px;
  background: none;
  border: 0;
  color: #b9c6d0;
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
#shop-ui .intro-skip:hover {
  color: #fff;
}
.intro-art {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 76px;
  margin: 10px auto 4px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 42%, #f6ca3538, #f6ca350a 64%, transparent 66%);
}
.intro-art::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 1.5px solid #f6ca3570;
  border-radius: 50%;
  animation: intro-ring 2.6s ease-out infinite;
}
.intro-art svg {
  width: 44px;
  height: 44px;
  fill: none;
  stroke: var(--gold, #f6ca35);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#shop-ui .intro-copy h2 {
  margin: 8px 0 6px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.4px;
  line-height: 1.2;
}
#shop-ui .intro-copy p {
  margin: 0 auto 12px;
  max-width: 360px;
  color: #d4dde3;
  font-size: 15px;
  line-height: 1.5;
}
.intro-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.intro-chips li {
  padding: 5px 10px;
  border: 1px solid #ffffff22;
  border-radius: 999px;
  background: #ffffff0d;
  color: #e9eef1;
  font-size: 12.5px;
  line-height: 1.3;
  white-space: nowrap;
}
.intro-chips li::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--gold, #f6ca35);
  vertical-align: 1px;
}
.intro-quest {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0 0;
  padding: 10px 12px;
  border: 1px solid #f6ca3566;
  border-radius: 10px;
  background: linear-gradient(90deg, #f6ca3524, #f6ca3506);
  text-align: left;
}
.intro-quest i {
  color: var(--gold, #f6ca35);
  font-size: 22px;
  font-style: normal;
  line-height: 1;
}
.intro-quest span {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}
.intro-quest small {
  color: var(--gold, #f6ca35);
  font-size: 10.5px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}
.intro-quest b {
  font-size: 15px;
}
.intro-quest em {
  color: #b9c6d0;
  font-size: 12.5px;
  font-style: normal;
}
.intro-quest strong {
  color: var(--gold, #f6ca35);
  font-size: 15px;
  white-space: nowrap;
}
.intro-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}
#shop-ui .intro-actions .play-primary {
  flex: 1;
  margin: 0;
  min-height: 50px;
  font-size: 16px;
}
#shop-ui .intro-back {
  flex: 0 0 50px;
  min-height: 50px;
  border: 1px solid #ffffff2b;
  background: #ffffff0d;
  font-size: 26px;
  line-height: 1;
}
#shop-ui .intro-back:hover {
  border-color: #ffffff5c;
}
.intro-card.enter {
  animation: intro-pop 0.28s ease-out;
}
.intro-main {
  position: relative;
}
.intro-card.from-right .intro-main {
  animation: intro-in-right 0.24s ease-out;
}
.intro-card.from-left .intro-main {
  animation: intro-in-left 0.24s ease-out;
}
/* álló telefonon alulról jön: a bolt és az avatar fent látszik */
@media (max-width: 600px) and (orientation: portrait) {
  #play-intro {
    align-items: flex-end;
    padding: 12px 10px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    background: linear-gradient(#08121900 18%, #081219d9 62%);
  }
  .intro-card {
    padding: 12px 18px 16px;
  }
  .intro-card.enter {
    animation: intro-up 0.3s ease-out;
  }
  .intro-art {
    width: 64px;
    height: 64px;
    margin-top: 6px;
  }
  .intro-art svg {
    width: 38px;
    height: 38px;
  }
  #shop-ui .intro-copy h2 {
    font-size: 22px;
  }
}
/* fekvő telefonon kevés a magasság: az ikon balra kerül, a szöveg mellé */
@media (orientation: landscape) and (max-height: 500px) {
  #play-intro {
    padding: 8px 12px;
  }
  .intro-card {
    width: min(620px, 100%);
    padding: 10px 18px 14px;
    text-align: left;
  }
  .intro-main {
    display: flex;
    align-items: center;
    gap: 18px;
  }
  .intro-art {
    flex: 0 0 64px;
    width: 64px;
    height: 64px;
    margin: 0;
  }
  .intro-art svg {
    width: 36px;
    height: 36px;
  }
  #shop-ui .intro-copy h2 {
    margin: 4px 0 2px;
    font-size: 20px;
  }
  #shop-ui .intro-copy p {
    margin: 0 0 8px;
    max-width: none;
    font-size: 14px;
  }
  .intro-chips {
    justify-content: flex-start;
  }
  .intro-chips li {
    padding: 4px 9px;
    font-size: 12px;
  }
  .intro-quest {
    margin-top: 8px;
    padding: 6px 10px;
  }
  .intro-actions {
    margin-top: 10px;
  }
  #shop-ui .intro-actions .play-primary,
  #shop-ui .intro-back {
    min-height: 44px;
  }
}
/* nagyon alacsony fekvő kijelző (pl. iPhone SE): az ikon és a küldetés leírása elmarad, a gomb látszik */
@media (orientation: landscape) and (max-height: 340px) {
  .intro-art,
  .intro-quest em {
    display: none;
  }
}

/* ------------------------------------------------------------------ jutalom: első küldetés, új csillag */
#play-reward {
  position: absolute;
  left: 50%;
  top: 17%;
  z-index: 45;
  /* left: 50% mellett a zsugorodó szélesség csak a képernyő fele lenne: a tartalomhoz igazodik */
  width: max-content;
  max-width: calc(100vw - 24px);
  visibility: hidden;
  opacity: 0;
  transform: translateX(-50%);
  pointer-events: none;
}
#play-reward.show {
  visibility: visible;
  opacity: 1;
  animation: reward-pop 3.6s ease-out forwards;
}
.reward-card {
  position: relative;
  min-width: 250px;
  max-width: 330px;
  padding: 14px 22px 14px;
  border: 1px solid #f6ca3585;
  border-radius: 14px;
  background: #142026f2;
  box-shadow:
    0 20px 60px #0008,
    0 0 0 4px #f6ca3517;
  color: #f2f3ed;
  text-align: center;
}
.reward-card small {
  display: block;
  color: var(--gold, #f6ca35);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
}
.reward-card strong {
  display: block;
  margin-top: 2px;
  color: #ffe27a;
  font-size: 40px;
  font-weight: 800;
  line-height: 1.1;
  text-shadow: 0 0 22px #f6ca3570;
}
.reward-name {
  display: block;
  color: #e6ecef;
  font-size: 14px;
}
.reward-stars {
  margin-top: 8px;
  color: #ffffff4d;
  font-size: 20px;
  letter-spacing: 3px;
  line-height: 1;
}
.reward-stars b {
  display: inline-block;
  font-weight: 400;
}
.reward-stars b.on {
  color: var(--gold, #f6ca35);
}
.reward-stars b.new {
  animation: reward-star 0.9s 0.35s ease-out both;
}
.reward-bar {
  display: block;
  width: 160px;
  height: 5px;
  margin: 9px auto 0;
  overflow: hidden;
  border-radius: 3px;
  background: #ffffff1f;
}
.reward-bar b {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #f6ca35, #ffe27a);
  animation: reward-fill 1.1s 0.35s ease-out both;
}
#shop-ui .reward-card p {
  margin: 6px 0 0;
  color: #c4cfd7;
  font-size: 12.5px;
  line-height: 1.4;
}
/* szikrák: 10 sugár, mindegyik a saját irányába repül (elforgatott tartó, a pont a helyi Y tengelyen megy) */
.reward-burst {
  position: absolute;
  left: 50%;
  top: 44%;
}
.reward-burst i {
  position: absolute;
  left: 0;
  top: 0;
}
.reward-burst i::before {
  content: "";
  position: absolute;
  left: -4px;
  top: -4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold, #f6ca35);
  opacity: 0;
  animation: reward-spark 0.95s 0.12s ease-out both;
}
.reward-burst i:nth-child(2n)::before {
  width: 6px;
  height: 6px;
  background: #fff3b8;
  animation-delay: 0.2s;
}
.reward-burst i:nth-child(2) {
  transform: rotate(36deg);
}
.reward-burst i:nth-child(3) {
  transform: rotate(72deg);
}
.reward-burst i:nth-child(4) {
  transform: rotate(108deg);
}
.reward-burst i:nth-child(5) {
  transform: rotate(144deg);
}
.reward-burst i:nth-child(6) {
  transform: rotate(180deg);
}
.reward-burst i:nth-child(7) {
  transform: rotate(216deg);
}
.reward-burst i:nth-child(8) {
  transform: rotate(252deg);
}
.reward-burst i:nth-child(9) {
  transform: rotate(288deg);
}
.reward-burst i:nth-child(10) {
  transform: rotate(324deg);
}
/* telefonon közvetlenül a felső sáv alatt, kisebben: a munkatárs párbeszédkártyáját alig takarja */
@media (max-width: 600px), (max-height: 500px) {
  #play-reward {
    top: calc(62px + env(safe-area-inset-top));
  }
  .reward-card {
    min-width: 240px;
    padding: 10px 18px 11px;
  }
  .reward-card strong {
    font-size: 32px;
  }
  .reward-stars {
    margin-top: 5px;
    font-size: 17px;
  }
  .reward-bar {
    margin-top: 7px;
  }
}
.play-stars.pulse > span {
  display: inline-block;
  animation: stars-pulse 1.3s ease-out;
}
@keyframes intro-fade {
  from {
    background-color: transparent;
  }
}
@keyframes intro-pop {
  from {
    transform: scale(0.94);
  }
}
@keyframes intro-up {
  from {
    top: 28px;
  }
}
@keyframes intro-in-right {
  from {
    left: 22px;
  }
}
@keyframes intro-in-left {
  from {
    left: -22px;
  }
}
@keyframes intro-bar {
  from {
    width: 0;
  }
}
@keyframes intro-ring {
  0% {
    opacity: 0.9;
    transform: scale(1);
  }
  70%,
  100% {
    opacity: 0;
    transform: scale(1.35);
  }
}
@keyframes reward-pop {
  0% {
    opacity: 1;
    transform: translate(-50%, 14px) scale(0.84);
  }
  9% {
    transform: translate(-50%, 0) scale(1.05);
  }
  15% {
    transform: translate(-50%, 0) scale(1);
  }
  86% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -10px) scale(0.98);
  }
}
@keyframes reward-spark {
  0% {
    opacity: 0;
    transform: translateY(0) scale(1);
  }
  12% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-130px) scale(0.4);
  }
}
@keyframes reward-star {
  0% {
    transform: scale(1);
  }
  60% {
    transform: scale(1.6) rotate(8deg);
    text-shadow: 0 0 16px #f6ca35;
  }
  100% {
    transform: scale(1) rotate(0);
  }
}
@keyframes reward-fill {
  from {
    width: 0;
  }
}
@keyframes stars-pulse {
  0% {
    transform: scale(1);
  }
  25% {
    transform: scale(1.35);
    text-shadow: 0 0 14px #f6ca35;
  }
  100% {
    transform: scale(1);
  }
}
@media (prefers-reduced-motion: reduce) {
  #play-intro,
  .intro-card,
  .intro-card .intro-main,
  .intro-art::before,
  .intro-progress li.now::after,
  .reward-burst,
  .reward-stars b.new,
  .reward-bar b,
  .play-stars.pulse > span {
    animation: none !important;
  }
  .reward-burst {
    display: none;
  }
  #play-reward.show {
    animation: none;
    opacity: 1;
  }
}
