/* Otevírání balíčků (opening.js): stůl s oltářem uprostřed, hromádky neotevřených balíčků a 5 karet v pětiúhelníku.
   Na širokém displeji jsou hromádky vlevo, na mobilu dole a při otáčení karet se schovají. */
.po { position: absolute; inset: 0; display: flex; flex-direction: column; overflow: hidden; user-select: none; -webkit-user-select: none;
  background: radial-gradient(ellipse 55% 45% at 50% 50%, rgba(130, 70, 210, .3), transparent 70%), radial-gradient(ellipse 95% 75% at 50% 58%, #1d0b35, #05030a 78%); }
.po-top { position: relative; z-index: 5; display: flex; align-items: center; gap: 14px;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px)); }
.po-top h2 { margin: 0; font: 900 clamp(20px, 4.6vw, 32px)/1 var(--font-display); text-transform: uppercase; color: var(--gold);
  text-shadow: 0 3px 0 #5a2a00, 0 0 24px rgba(255, 204, 77, .45); }
.po-back { padding: 10px 16px; font-size: 14px; }
.po-table { position: relative; flex: 1; min-height: 0; }
.po-actions { position: absolute; left: 0; right: 0; bottom: calc(env(safe-area-inset-bottom, 0px) + 18px); z-index: 6;
  display: flex; justify-content: center; gap: 12px; pointer-events: none; }
.po-actions .btn { pointer-events: auto; }
.po-actions .btn[hidden] { display: none; }

/* Oltář: zářící kruh s runovým prstencem, při nabíjení se roztočí paprsky */
.po-altar { --altar: clamp(240px, min(80vw, 56vh), 440px); position: absolute; z-index: 1; left: 50%; top: 50%; width: var(--altar); aspect-ratio: 1;
  translate: -50% -50%; border-radius: 50%; display: grid; place-items: center; transition: scale .25s, filter .25s, opacity .4s;
  background: radial-gradient(circle, rgba(255, 214, 120, .16), rgba(140, 80, 255, .13) 42%, transparent 68%); }
.po-ring { position: absolute; inset: 13%; border-radius: 50%; border: 2px dashed rgba(255, 214, 120, .45);
  box-shadow: 0 0 30px rgba(255, 204, 77, .22), inset 0 0 40px rgba(140, 80, 255, .3); animation: po-spin 30s linear infinite; transition: border-color .3s, box-shadow .3s; }
.po-ring::after { content: ''; position: absolute; inset: 7%; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .16); }
.po-rays { position: absolute; inset: -30%; border-radius: 50%; opacity: 0; pointer-events: none;
  background: repeating-conic-gradient(rgba(255, 240, 200, .55) 0 4deg, transparent 4deg 16deg);
  -webkit-mask: radial-gradient(circle, #000 8%, transparent 62%); mask: radial-gradient(circle, #000 8%, transparent 62%);
  transition: opacity .4s, scale .6s; animation: po-spin 14s linear infinite reverse; }
.po-altar.charging .po-rays { opacity: .9; animation-duration: 2.2s; }
.po-altar.charging .po-ring { border-color: rgba(255, 240, 200, .95); box-shadow: 0 0 70px rgba(255, 204, 77, .65), inset 0 0 60px rgba(255, 220, 150, .5); animation-duration: 3s; }
.po-altar.burst .po-rays { opacity: 0; scale: 1.9; transition: opacity .7s, scale .7s; }
.po-altar.hot { scale: 1.07; filter: brightness(1.45); }
.po[data-mode="cards"] .po-altar { opacity: .45; }
.po-slot { position: relative; z-index: 2; display: grid; place-items: center; }
.po-live { --pack-w: clamp(130px, min(40vw, 30vh), 230px); }
.po-hint { position: absolute; bottom: 3%; left: 6%; right: 6%; margin: 0; text-align: center; font: 700 clamp(13px, 2.4vw, 16px)/1.3 var(--font-body);
  color: #fff2cc; text-shadow: 0 2px 6px rgba(0, 0, 0, .7); animation: hint 1.6s ease-in-out infinite; transition: opacity .3s; }
.po:not([data-mode="idle"]) .po-hint { opacity: 0; animation: none; }
@keyframes po-spin { to { rotate: 360deg; } }

/* Hromádky neotevřených balíčků: balíčky leží na sobě, každý o kousek výš a trochu natočený */
.po-stacks { position: absolute; z-index: 3; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 20px); translate: -50% 0;
  display: flex; align-items: flex-end; gap: clamp(28px, 9vw, 64px); transition: opacity .35s; }
.po-stack { position: relative; display: grid; justify-items: center; gap: 10px; }
.po-stack.empty { visibility: hidden; }
.po-stack small { font: 700 11px/1 var(--font-display); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.po-pile { --pile-w: clamp(64px, min(18vw, 10.5vh), 112px); position: relative; width: var(--pile-w); aspect-ratio: 5 / 8; }
.po-pile .pack { --pack-w: var(--pile-w); --rx: 16deg; --ry: -6deg; position: absolute; left: 0; bottom: 0; touch-action: none; pointer-events: none; transition: transform .25s; }
.po-pile .pack .pack-3d { animation: none; }
.po-pile .pack:not(:first-child) .pack-shadow { display: none; }
.po-pile .pack:last-child { pointer-events: auto; cursor: grab; }
.po[data-mode="idle"] .po-pile .pack:last-child { animation: po-pick 1.6s ease-in-out infinite; }
@keyframes po-pick { 0%, 100% { filter: drop-shadow(0 0 6px rgba(255, 214, 120, .4)); } 50% { filter: drop-shadow(0 0 18px rgba(255, 214, 120, .95)); } }
.po-pile .pack.dragging { cursor: grabbing; z-index: 50 !important; transition: none; animation: none; filter: drop-shadow(0 18px 24px rgba(0, 0, 0, .6)); }
.po-count { position: absolute; z-index: 40; right: -16px; bottom: 18px; min-width: 36px; padding: 6px 9px; border-radius: 999px; text-align: center;
  font: 900 15px/1 var(--font-display); color: #2a1400; background: linear-gradient(180deg, #fff1b0, var(--gold) 55%, var(--gold-deep));
  box-shadow: 0 4px 12px rgba(0, 0, 0, .55); }

/* Široký displej: hromádky vlevo, oltář a karty uprostřed */
@media (min-width: 820px) and (min-aspect-ratio: 1/1) {
  .po-stacks { left: max(28px, 5vw); top: 50%; bottom: auto; translate: 0 -40%; flex-direction: column; align-items: center; gap: 64px; }
  .po-pile { --pile-w: clamp(80px, 13vh, 118px); }
}
/* Mobil: oltář výš nad hromádkami, při otáčení karet hromádky zmizí */
@media not all and (min-width: 820px) and (min-aspect-ratio: 1/1) {
  .po-altar { --altar: clamp(220px, min(78vw, 44vh), 400px); top: 40%; }
  .po-live { --pack-w: clamp(110px, min(36vw, 24vh), 200px); }
  .po[data-mode="cards"] .po-stacks { opacity: 0; pointer-events: none; }
}

/* Roztržení: odletující zalepený pruh a záblesk světla */
.po-strip { position: absolute; z-index: 8; pointer-events: none; border-radius: 2px; box-shadow: 0 4px 10px rgba(0, 0, 0, .45);
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .28) 0 4px, rgba(0, 0, 0, .3) 4px 8px), var(--crimp); }
.po-flash { position: absolute; inset: 0; z-index: 7; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at var(--fx) var(--fy), rgba(255, 255, 255, .95), rgba(255, 240, 200, .55) 16%, rgba(160, 110, 255, .2) 40%, transparent 70%); }

/* Karty: rubem nahoru, vzácnější září už na rubu (modrá, fialová, zlatá) */
.po-cards { position: absolute; z-index: 4; left: 50%; top: 50%; width: 0; height: 0; }
.po-card { position: absolute; left: calc(var(--card-w) / -2); top: calc(var(--card-w) * -.7); width: var(--card-w); aspect-ratio: 5 / 7;
  padding: 0; border: 0; background: none; cursor: pointer; perspective: 900px; transition: scale .2s; -webkit-tap-highlight-color: transparent; }
.po-card .card-back { width: 100%; box-shadow: 0 10px 24px rgba(0, 0, 0, .6), 0 0 0 2px rgba(255, 214, 120, .5); transition: box-shadow .3s; }
.po-card .card { --card-w: 100%; width: 100%; }
.po-card.open { cursor: default; }
.po-aura { position: absolute; inset: -20%; z-index: -1; border-radius: 34%; opacity: 0; pointer-events: none;
  background: radial-gradient(closest-side, var(--aura, transparent), transparent); transition: opacity .3s, scale .3s; }
.po-card.r-vzacna { --aura: rgba(70, 160, 255, .9); }
.po-card.r-epicka { --aura: rgba(176, 92, 255, .95); }
.po-card.r-legendarni { --aura: rgba(255, 168, 36, 1); }
.po-card:is(.r-vzacna, .r-epicka, .r-legendarni):not(.open) .po-aura { opacity: .75; animation: po-aura 1.6s ease-in-out infinite; }
.po-card.r-epicka:not(.open) .po-aura { inset: -26%; }
.po-card.r-legendarni:not(.open) .po-aura { inset: -34%; animation-duration: 1.05s;
  background: radial-gradient(closest-side, var(--aura), rgba(255, 140, 20, .35) 60%, transparent),
    repeating-conic-gradient(from 0deg, rgba(255, 230, 150, .5) 0 6deg, transparent 6deg 22deg);
  -webkit-mask: radial-gradient(closest-side, #000 55%, transparent); mask: radial-gradient(closest-side, #000 55%, transparent); }
.po-card.r-vzacna:not(.open) .card-back { box-shadow: 0 10px 24px rgba(0, 0, 0, .6), 0 0 0 2px #5fb4ff, 0 0 22px rgba(70, 160, 255, .8); }
.po-card.r-epicka:not(.open) .card-back { box-shadow: 0 10px 24px rgba(0, 0, 0, .6), 0 0 0 2px #c48bff, 0 0 26px rgba(176, 92, 255, .9); }
.po-card.r-legendarni:not(.open) .card-back { box-shadow: 0 10px 24px rgba(0, 0, 0, .6), 0 0 0 2px #ffd36b, 0 0 32px rgba(255, 168, 36, 1); }
.po-card.rising .po-aura { opacity: 1; scale: 1.45; animation: none; }
@keyframes po-aura { 50% { opacity: 1; scale: 1.1; } }
@media (hover: hover) {
  .po-card:not(.open, .flipping):hover { scale: 1.07; }
  .po-card:not(.open, .flipping):hover .po-aura { opacity: 1; scale: 1.18; }
}
.po-card:not(.open, .flipping):active { scale: .97; }
.po-card.r-vzacna.open .card-body { box-shadow: 0 0 0 1.2cqw #5fb4ff, 0 0 12cqw rgba(70, 160, 255, .6), 0 3cqw 8cqw rgba(0, 0, 0, .55); }
.po-card.r-epicka.open .card-body { box-shadow: 0 0 0 1.4cqw #b05cff, 0 0 16cqw rgba(176, 92, 255, .7), 0 3cqw 8cqw rgba(0, 0, 0, .55); }
.po-card.r-legendarni.open .card-body { box-shadow: 0 0 0 1.4cqw #ffcc4d, 0 0 18cqw rgba(255, 176, 46, .75), 0 3cqw 8cqw rgba(0, 0, 0, .55); }

@media (prefers-reduced-motion: reduce) {
  .po-ring, .po-rays, .po-hint, .po-aura, .po[data-mode="idle"] .po-pile .pack:last-child { animation: none !important; }
}
