/* Teano PWA — „Pasjans Anielski" (pasjans.js). Wszystko pod .pasjans; tokeny z app.css (:root).
   Wzór: android/.../feature/game/PasjansScreen.kt (TeanoSpace l=16, s=8, xs=4, xl=24; TeanoRadius m). */

.pasjans {
  --pj-gold: var(--gold, #F4C97A);
  --pj-ink: var(--ink, #F5EFE4);
  --pj-muted: var(--ink-muted, #C9C0D8);
  --pj-faint: var(--ink-faint, #9A92AC);
  --pj-surface: var(--surface, rgba(23, 18, 51, .62));
  --pj-outline: var(--outline, rgba(183, 166, 255, .16));
  display: flex; flex-direction: column; gap: 16px;
  width: 100%; min-width: 0;
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  color: var(--pj-ink); font-family: var(--font, "Jost", system-ui, sans-serif);
  -webkit-user-select: none; user-select: none;
}
.pasjans [hidden] { display: none !important; }
.pasjans button { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }

/* Nagłówek: strzałka wstecz + tytuł displayL wersalikami (ScreenHeader) */
.pasjans .pj-head { display: flex; align-items: center; gap: 4px; margin: -4px 0 -6px -10px; }
.pasjans .pj-back {
  width: 44px; height: 44px; flex: none; display: grid; place-items: center; padding: 0 0 4px;
  border: 0; border-radius: 50%; background: none; cursor: pointer;
  font-size: 34px; line-height: 1; font-weight: 300; color: var(--pj-gold);
}
.pasjans .pj-back:active { background: rgba(244, 201, 122, .12); }
.pasjans .pj-title {
  margin: 0; min-width: 0; font-size: clamp(19px, 6.2vw, 26px); line-height: 1.25; font-weight: 400;
  letter-spacing: .1em; text-transform: uppercase; overflow-wrap: anywhere;
}

.pasjans .pj-intro { margin: 0; font-size: 16px; line-height: 1.5; color: var(--pj-muted); }

.pasjans .pj-label { font: 500 11px/1.45 var(--font); letter-spacing: 2px; text-transform: uppercase; color: var(--pj-faint); }
.pasjans .pj-gold { color: var(--pj-gold); }

.pasjans .pj-glass {
  background: var(--pj-surface); border: 1px solid var(--pj-outline); border-radius: var(--radius, 24px);
  -webkit-backdrop-filter: blur(18px) saturate(140%); backdrop-filter: blur(18px) saturate(140%);
}

.pasjans .pj-play { display: flex; flex-direction: column; gap: 16px; }
.pasjans .pj-info { display: flex; flex-direction: column; gap: 16px; }
.pasjans .pj-info:empty { display: none; }

/* Nowość rozdania — złota pigułka, tap chowa (Surface z TeanoGold 14%) */
.pasjans .pj-novelty {
  display: flex; flex-direction: column; gap: 4px; width: 100%; text-align: left; cursor: pointer;
  padding: 14px 16px; border: 0; border-radius: 16px; background: rgba(244, 201, 122, .14);
}
.pasjans .pj-novelty .pj-label { color: var(--pj-ink); }
.pasjans .pj-novelty-text { font-size: 14.5px; line-height: 21px; }

/* Pochwała za serię (PraiseOverlay): stała wysokość — nic nie skacze */
.pasjans .pj-praise { height: 44px; margin: -8px 0; display: grid; place-items: center; pointer-events: none; }
.pasjans .pj-praise span {
  opacity: 0; padding: 6px 22px; border-radius: 999px; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
  background: linear-gradient(90deg, rgba(30, 26, 56, .9), rgba(42, 36, 80, .9), rgba(30, 26, 56, .9));
  border: 1px solid rgba(244, 201, 122, .55);
  color: var(--pj-gold); font-size: 20px; line-height: 28px; letter-spacing: 2px; text-transform: uppercase;
  text-shadow: 0 0 14px rgba(244, 201, 122, .45);
}
.pasjans .pj-praise span.is-on { animation: pj-praise 1.42s ease-out both; }
@keyframes pj-praise {
  0% { opacity: 0; transform: translateY(-10px) scale(.7); }
  18% { opacity: 1; transform: none; }
  75% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateY(-10px) scale(.7); }
}

/* Plansza — ścieżki na szkle */
.pasjans .pj-board {
  padding: 8px; border-radius: var(--radius, 24px);
  background: var(--pj-surface); border: 1px solid var(--pj-outline);
  -webkit-backdrop-filter: blur(18px) saturate(140%); backdrop-filter: blur(18px) saturate(140%);
}
.pasjans .pj-path { position: relative; width: 100%; min-height: 60px; }

/* Kafelek: 5% marginesu wokół lica — tam prześwituje złota poświata grywalnej karty */
.pasjans .pj-tile {
  position: absolute; padding: 0; margin: 0; border: 0; background: none; cursor: default;
  touch-action: manipulation;
}
.pasjans .pj-tile.is-playable { cursor: pointer; }
.pasjans .pj-tile:disabled { opacity: 1; }
.pasjans .pj-tile::before {
  content: ""; position: absolute; inset: -14%; border-radius: 30%; opacity: 0; pointer-events: none;
  background: radial-gradient(closest-side, rgba(244, 201, 122, .95), rgba(244, 201, 122, 0));
  transition: opacity .28s;
}
.pasjans .pj-tile.is-playable::before { animation: pj-glow 1.8s ease-in-out infinite alternate; }
@keyframes pj-glow { from { opacity: .25; } to { opacity: .6; } }
.pasjans .pj-tile.is-playable .pj-face { transform: translateY(-2px); box-shadow: 0 0 0 1px rgba(244, 201, 122, .7), 0 6px 16px rgba(0, 0, 0, .45); }

.pasjans .pj-face {
  position: absolute; inset: 5%; overflow: hidden; display: block;
  border-radius: calc(var(--cw, 60px) * .14);
  background: #171233; box-shadow: 0 2px 8px rgba(0, 0, 0, .45), 0 0 0 1px rgba(183, 166, 255, .18);
  transition: transform .28s, box-shadow .28s;
}
.pasjans .pj-face img, .pasjans .pj-card img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none;
}
.pasjans .pj-shade { position: absolute; inset: 0; background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .62)); pointer-events: none; }
.pasjans .pj-rank {
  position: absolute; left: 0; right: 0; bottom: 0; text-align: center; pointer-events: none;
  font-weight: 300; font-variant-numeric: tabular-nums; color: #fff;
  font-size: min(34px, calc(var(--cw, 60px) * .56)); line-height: 1.18;
  text-shadow: 0 1px 6px rgba(0, 0, 0, .55);
}
.pasjans .pj-flip { animation: pj-flip .32s cubic-bezier(.2, .8, .2, 1); }
@keyframes pj-flip { from { transform: scaleX(0); } }

/* Lecąca karta (klon kafelka) */
.pasjans .pj-tile.pj-ghost { position: fixed; z-index: 50; pointer-events: none; transform-origin: center; will-change: transform; }

/* Stos i wierzch */
.pasjans .pj-piles { display: flex; justify-content: center; align-items: flex-start; gap: 24px; }
.pasjans .pj-pile { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.pasjans .pj-card {
  position: relative; width: 72px; height: 104px; padding: 0; border: 0; border-radius: 12px; overflow: hidden;
  background: #171233; box-shadow: 0 6px 20px rgba(0, 0, 0, .45), 0 0 0 1px var(--pj-outline);
  --cw: 72px;
}
.pasjans .pj-waste .pj-rank { font-size: 34px; }
.pasjans .pj-stock { cursor: pointer; transition: transform .15s, opacity .2s; touch-action: manipulation; }
.pasjans .pj-stock:active:not(:disabled) { transform: scale(.96); }
.pasjans .pj-stock:disabled { opacity: .35; cursor: default; }
.pasjans .pj-cap { font: 500 11px/16px var(--font); letter-spacing: 2px; text-transform: uppercase; color: var(--pj-ink); white-space: nowrap; }

.pasjans .pj-status { margin: 0; text-align: center; font: 500 11px/16px var(--font); letter-spacing: 2px; color: var(--pj-ink); white-space: pre-wrap; }

/* Karta informacyjna (InfoCard) */
.pasjans .pj-infocard { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 28px 20px; text-align: center; }
.pasjans .pj-emoji { font-size: 40px; line-height: 1.1; }
.pasjans .pj-info-title { margin: 0; font-size: 19px; line-height: 25px; font-weight: 400; letter-spacing: .2px; }
.pasjans .pj-info-body { margin: 0; font-size: 12.5px; line-height: 17px; color: var(--pj-muted); }
.pasjans .pj-btn {
  appearance: none; border: 0; border-radius: 999px; padding: 15px 22px; min-height: 48px; width: 100%; cursor: pointer;
  font: 500 13px var(--font); letter-spacing: 2.6px; text-transform: uppercase;
  background: var(--purple, #6D4AFF); color: #fff; box-shadow: 0 6px 24px rgba(109, 74, 255, .30);
}
.pasjans .pj-btn.pj-ghost { background: transparent; color: var(--pj-ink); border: 1px solid var(--pj-outline); box-shadow: none; }

/* Przesłanie Anioła po ułożonej ścieżce */
.pasjans .pj-angel { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px; text-align: center; }
.pasjans .pj-angel-img {
  width: 140px; aspect-ratio: .72; object-fit: cover; border-radius: 12px; display: block;
  box-shadow: 0 10px 40px rgba(109, 74, 255, .4), 0 0 0 1px var(--gold-dim, rgba(244, 201, 122, .45));
  animation: pj-reveal .6s cubic-bezier(.2, .8, .2, 1);
}
@keyframes pj-reveal { from { transform: rotateY(-90deg) scale(1.05); opacity: .3; } }
.pasjans .pj-angel-name { margin: 4px 0 0; font-size: 19px; line-height: 25px; font-weight: 400; letter-spacing: .2px; color: var(--pj-gold); }
.pasjans .pj-angel-motto { margin: 0; font-size: 16px; line-height: 24px; }
.pasjans .pj-angel-aff { margin: 0; font-size: 14.5px; line-height: 21px; color: var(--pj-muted); }

@media (prefers-reduced-motion: reduce) {
  .pasjans *, .pasjans *::before { animation: none !important; transition: none !important; }
  .pasjans .pj-tile.is-playable::before { opacity: .45; }
  .pasjans .pj-praise span.is-on { opacity: 1; }
}
