/* ==========================================================================
   TOASTY — wyglad (od 10.10.2026, toast.js). Stos kart jak iOS, szklo
   z ciemnym rdzeniem pod tekstem („soczewka czytelna”, wybor Matta 10.10).
   Kolory: ok = --accent, info = --sys, err = --danger, nagroda = --trofeum.
   Klasy z przedrostkiem „tst-”.
   ========================================================================== */

:root {
  /* sprezyna z lekkim przeskokiem (jak iOS); starsze przegladarki: cubic-bezier */
  --tst-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --tst-spring: linear(0, 0.009, 0.035 2.1%, 0.141, 0.281 6.7%, 0.723 12.9%, 0.938 16.7%, 1.017, 1.077, 1.121, 1.149 24.3%,
    1.159, 1.163, 1.161, 1.154 29.9%, 1.129 32.8%, 1.051 39.6%, 1.017 43.1%, 0.991, 0.977 51%, 0.974 53.8%, 0.975 57.1%,
    0.997 69.8%, 1.003 76.9%, 1.004 83.8%, 1);
}

/* pojemnik: PC prawy dolny rog (nad pigulka postepu z #toast-container) */
.tst-host {
  position: fixed; z-index: 9999; pointer-events: none;
  right: 24px; bottom: calc(24px + var(--tst-lift, 0px)); width: 380px; height: 0;
}

.tst {
  --tst-c: var(--sys);
  position: absolute; right: 0; bottom: 0; width: 100%; box-sizing: border-box; pointer-events: auto;
  display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 16px; overflow: hidden; color: #fff; touch-action: pan-y; user-select: none;
  font-family: inherit;
  /* szklo: ciemny rdzen pod tekstem, przejrzyste brzegi (tam dziala soczewka) */
  background:
    radial-gradient(120% 140% at 50% 50%, rgba(8, 10, 14, 0.66) 40%, rgba(8, 10, 14, 0.42) 70%, rgba(8, 10, 14, 0.12) 100%),
    linear-gradient(135deg, color-mix(in srgb, var(--tst-c) 14%, rgba(255, 255, 255, 0.10)), rgba(255, 255, 255, 0.03) 55%, color-mix(in srgb, var(--tst-c) 8%, rgba(255, 255, 255, 0.05)));
  -webkit-backdrop-filter: blur(18px) saturate(1.9) brightness(0.82);
  backdrop-filter: blur(18px) saturate(1.9) brightness(0.82);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), inset 0 -1px 0 rgba(255, 255, 255, 0.10),
    inset 1px 0 0 rgba(255, 255, 255, 0.12), inset 0 0 22px rgba(255, 255, 255, 0.05),
    0 18px 44px rgba(0, 0, 0, 0.45), 0 0 26px color-mix(in srgb, var(--tst-c) 14%, transparent);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85), 0 0 10px rgba(0, 0, 0, 0.5);
  transform-origin: 50% 100%;
  transition: transform 0.55s var(--tst-spring), opacity 0.3s, filter 0.3s;
  will-change: transform; backface-visibility: hidden;
}
.tst.ok { --tst-c: var(--accent); }
.tst.err { --tst-c: var(--danger, #ff4d4d); }
.tst.info { --tst-c: var(--sys); }
.tst.rew { --tst-c: var(--trofeum, #ffd966); border-color: color-mix(in srgb, var(--trofeum, #ffd966) 55%, rgba(255, 255, 255, 0.25)); }
/* odblask: jasna smuga w gornym lewym rogu */
.tst::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(120% 90% at 0% 0%, rgba(255, 255, 255, 0.20), transparent 45%),
    radial-gradient(80% 60% at 100% 100%, rgba(255, 255, 255, 0.06), transparent 60%);
}

.tst-ico {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 16px;
  color: var(--tst-c); background: rgba(8, 10, 14, 0.45); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.tst-tx { min-width: 0; display: flex; flex-direction: column; gap: 2px; transition: opacity 0.25s; }
.tst-tx b { font-size: var(--fs-body, 14px); font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.tst-tx .tst-s { font-size: var(--fs-small, 12px); color: #f1f4f6; line-height: 1.35; overflow-wrap: anywhere; }
.tst-tx em { font-style: normal; font-size: var(--fs-tag, 11px); font-weight: 700; letter-spacing: 2px; color: var(--tst-c); }
/* licznik powtorzen ×N */
.tst-n {
  font-style: normal; font-size: var(--fs-tag, 11px); font-weight: 700; padding: 1px 6px; margin-left: 6px; border-radius: 6px;
  color: #000; background: var(--tst-c); display: inline-block; text-shadow: none; vertical-align: 1px;
  animation: tst-pop 0.4s var(--tst-spring);
}
@keyframes tst-pop { from { transform: scale(0.4); } }
.tst-act { display: flex; align-items: center; gap: 6px; transition: opacity 0.25s; }
.tst-go {
  font: inherit; font-size: var(--fs-tag, 11px); font-weight: 700; letter-spacing: 1px; padding: 7px 11px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--tst-c); color: var(--tst-c); background: rgba(8, 10, 14, 0.55); text-shadow: none;
}
.tst-go:hover { background: color-mix(in srgb, var(--tst-c) 18%, rgba(8, 10, 14, 0.55)); }
.tst-x {
  width: 28px; height: 28px; border-radius: 8px; border: 0; background: none; color: #c9d0d6; cursor: pointer;
  display: grid; place-items: center; font-size: 14px;
}
.tst-x:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.tst:not(.err) .tst-x { opacity: 0; }
.tst:not(.err):hover .tst-x, .tst-x:focus-visible { opacity: 1; }
/* kreska czasu */
.tst-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--tst-c); opacity: 0.6; transform-origin: 0 50%; pointer-events: none; }
/* licznik schowanych pod spodem — jak plakietka na ikonie aplikacji */
.tst-more {
  position: absolute; top: 4px; left: 40px; z-index: 2; min-width: 20px; height: 20px; border-radius: 10px; padding: 0 6px;
  font-size: 11px; font-weight: 700; display: grid; place-items: center; background: var(--tst-c); color: #000; text-shadow: none;
}
/* starsze w stosie: tresc schowana */
.tst.behind .tst-tx, .tst.behind .tst-act, .tst.behind .tst-bar { opacity: 0; }
.tst.behind { filter: brightness(0.85); }

/* NAGRODA: polysk przebiegajacy po karcie, ikona podskakuje */
.tst.rew .tst-ico { background: radial-gradient(circle at 30% 30%, color-mix(in srgb, var(--trofeum, #ffd966) 45%, transparent), rgba(8, 10, 14, 0.5)); }
.tst.rew::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(110deg, transparent 30%, color-mix(in srgb, var(--trofeum, #ffd966) 22%, transparent) 50%, transparent 70%);
  transform: translateX(-100%); animation: tst-shine 1.4s 0.35s ease-out;
}
@keyframes tst-shine { to { transform: translateX(100%); } }
.tst.rew .tst-ico i, .tst.rew .tst-rank { animation: tst-wiggle 0.9s 0.3s var(--tst-spring); }
@keyframes tst-wiggle { 30% { transform: scale(1.35) rotate(-12deg); } 60% { transform: scale(1) rotate(8deg); } }
.tst-rank { width: 22px; height: 22px; background: var(--tst-c); -webkit-mask: center / contain no-repeat; mask: center / contain no-repeat; }

/* ZOBACZ przy dodanej grze (window.revealGame): kafel na chwile swieci akcentem */
.tst-flash { animation: tst-flash 1.8s ease-in-out; }
@keyframes tst-flash {
  0%, 100% { box-shadow: none; }
  25%, 65% { box-shadow: 0 0 0 3px var(--accent), 0 0 30px color-mix(in srgb, var(--accent) 60%, transparent); }
}

/* TELEFON: u gory pod paskiem, na cala szerokosc */
@media (max-width: 768px) {
  .tst-host { left: 10px; right: 10px; width: auto; top: calc(var(--navbar-h, 64px) + 8px); bottom: auto; }
  /* pasek zakryty przez okno — toast na samej gorze ekranu (jak powiadomienie iOS) */
  .tst-host.tst-top { top: calc(env(safe-area-inset-top, 0px) + 8px); }
  .tst-host { transition: top 0.4s var(--tst-spring); }
  .tst { top: 0; bottom: auto; transform-origin: 50% 0; }
  .tst-x { display: none; }
  .tst.err .tst-x { display: grid; opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .tst { transition: opacity 0.2s; }
  .tst.rew::before, .tst.rew .tst-ico i, .tst.rew .tst-rank, .tst-n { animation: none; }
}
