/* Vyhrat.sk — shared reward celebration styles (subtle, mobile-first) */

/* ── Toast container & popup ─────────────────────────────────────────── */

.vyhraj-toast-stack {
  position: fixed;
  left: 50%;
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 1080;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 0.5rem;
  pointer-events: none;
  max-width: calc(100vw - 2rem);
}

@media (min-width: 768px) {
  .vyhraj-toast-stack {
    left: auto;
    right: 1.25rem;
    bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
    transform: none;
    align-items: flex-end;
  }
}

.vyhraj-toast {
  pointer-events: auto;
  width: 100%;
  max-width: 340px;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  background: #fff;
  color: #1a1a2e;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.14), 0 2px 8px rgba(15, 23, 42, 0.08);
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  cursor: pointer;
  animation: vyhraj-toast-in 0.32s ease-out forwards;
  border: 1px solid rgba(51, 94, 234, 0.12);
}

.vyhraj-toast--success {
  border-color: rgba(40, 167, 69, 0.2);
}

.vyhraj-toast--info {
  border-color: rgba(51, 94, 234, 0.2);
}

.vyhraj-toast--out {
  animation: vyhraj-toast-out 0.28s ease-in forwards;
}

.vyhraj-toast__icon {
  flex-shrink: 0;
  font-size: 1.25rem;
  line-height: 1.2;
}

.vyhraj-toast__content {
  flex: 1;
  min-width: 0;
}

.vyhraj-toast__title {
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1.3;
  margin: 0;
}

.vyhraj-toast__body {
  font-size: 0.8125rem;
  line-height: 1.4;
  margin: 0.15rem 0 0;
  color: #4a5568;
}

.vyhraj-toast__link {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #335eea;
  text-decoration: none;
}

.vyhraj-toast__link:hover,
.vyhraj-toast__link:focus {
  text-decoration: underline;
}

@keyframes vyhraj-toast-in {
  from {
    opacity: 0;
    transform: translateY(1rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes vyhraj-toast-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(0.5rem);
  }
}

/* ── Coin burst ──────────────────────────────────────────────────────── */

.vyhraj-coin-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1075;
  overflow: hidden;
}

.vyhraj-coin {
  position: absolute;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  opacity: 0;
  animation: vyhraj-coin-fly 0.7s ease-out forwards;
  will-change: transform, opacity;
}

.vyhraj-coin::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffd54f 0%, #ffb300 100%);
  box-shadow: 0 1px 4px rgba(255, 179, 0, 0.45);
  z-index: -1;
}

@keyframes vyhraj-coin-fly {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(0.6);
  }
  40% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(var(--vyhraj-coin-x, 0px), -48px) scale(0.85);
  }
}

/* ── Pop (numbers / badges) ──────────────────────────────────────────── */

.vyhraj-pop {
  animation: vyhraj-pop-in 0.22s ease-out forwards;
}

@keyframes vyhraj-pop-in {
  from {
    opacity: 0.6;
    transform: scale(0.6);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ── Level-up card ───────────────────────────────────────────────────── */

.vyhraj-levelup {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
}

.vyhraj-levelup__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  animation: vyhraj-fade-in 0.25s ease-out forwards;
  cursor: pointer;
}

.vyhraj-levelup__card {
  position: relative;
  width: 88vw;
  max-width: 360px;
  padding: 1.5rem 1.25rem 1.25rem;
  border-radius: 1rem;
  background: #fff;
  text-align: center;
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.2);
  animation: vyhraj-levelup-in 0.35s ease-out forwards;
  overflow: hidden;
}

.vyhraj-levelup__card::after {
  content: '';
  position: absolute;
  top: 0;
  left: -120%;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    105deg,
    transparent 30%,
    rgba(255, 255, 255, 0.55) 50%,
    transparent 70%
  );
  animation: vyhraj-shine 0.9s ease-out 0.15s 1 forwards;
  pointer-events: none;
}

.vyhraj-levelup__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #335eea 0%, #5b7cfa 100%);
  color: #fff;
  font-weight: 800;
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}

.vyhraj-levelup__title {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
  color: #1a1a2e;
}

.vyhraj-levelup__body {
  font-size: 0.9rem;
  line-height: 1.45;
  margin: 0 0 1rem;
  color: #4a5568;
}

.vyhraj-levelup__close {
  display: inline-block;
  padding: 0.5rem 1.5rem;
  border: none;
  border-radius: 2rem;
  background: #335eea;
  color: #fff;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
}

.vyhraj-levelup__close:hover,
.vyhraj-levelup__close:focus {
  background: #2a4fd4;
  outline: none;
}

@keyframes vyhraj-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes vyhraj-levelup-in {
  from {
    opacity: 0;
    transform: scale(0.88);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes vyhraj-shine {
  from { left: -120%; }
  to { left: 140%; }
}

/* ── Centered reward card (badges, missions) ─────────────────────────── */

.vyhraj-reward {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
}

.vyhraj-reward-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  animation: vyhraj-fade-in 0.25s ease-out forwards;
  cursor: pointer;
}

.vyhraj-reward-card {
  position: relative;
  width: 88vw;
  max-width: 360px;
  margin-top: 1.5rem;
  padding: 2.25rem 1.25rem 1.25rem;
  border-radius: 1rem;
  background: #18233d;
  text-align: center;
  border: 1px solid rgba(255, 215, 0, 0.55);
  box-shadow:
    0 0 0 1px rgba(255, 215, 0, 0.12),
    0 16px 48px rgba(0, 0, 0, 0.45),
    0 0 28px rgba(255, 193, 7, 0.1);
  animation: vyhraj-reward-in 0.35s ease-out forwards;
  color: #f1f5f9;
}

.vyhraj-reward-icon {
  position: absolute;
  top: -2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  font-size: 1.75rem;
  line-height: 1;
  background: linear-gradient(135deg, #335eea 0%, #5b7cfa 100%);
  border: 2px solid rgba(255, 215, 0, 0.65);
  box-shadow: 0 4px 16px rgba(51, 94, 234, 0.35);
}

.vyhraj-reward-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.vyhraj-reward-close:hover,
.vyhraj-reward-close:focus {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  outline: none;
}

.vyhraj-reward-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
  color: #fff;
}

.vyhraj-reward-body {
  font-size: 0.9rem;
  line-height: 1.45;
  margin: 0 0 1rem;
  color: rgba(255, 255, 255, 0.78);
}

.vyhraj-reward-cta {
  display: inline-block;
  padding: 0.5rem 1.5rem;
  border: none;
  border-radius: 2rem;
  background: #335eea;
  color: #fff;
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
}

.vyhraj-reward-cta:hover,
.vyhraj-reward-cta:focus {
  background: #2a4fd4;
  color: #fff;
  text-decoration: none;
  outline: none;
}

@keyframes vyhraj-reward-in {
  from {
    opacity: 0;
    transform: scale(0.88);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ── Streak pulse ────────────────────────────────────────────────────── */

.vyhraj-pulse {
  animation: vyhraj-pulse-glow 0.9s ease-out 1 forwards;
}

@keyframes vyhraj-pulse-glow {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(51, 94, 234, 0);
  }
  35% {
    transform: scale(1.08);
    box-shadow: 0 0 0 6px rgba(51, 94, 234, 0.25);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(51, 94, 234, 0);
  }
}

/* ── Reduced motion ──────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .vyhraj-toast {
    animation: vyhraj-fade-only-in 0.2s ease-out forwards;
  }

  .vyhraj-toast--out {
    animation: vyhraj-fade-only-out 0.2s ease-in forwards;
  }

  .vyhraj-coin {
    display: none;
  }

  .vyhraj-pop,
  .vyhraj-levelup__card,
  .vyhraj-levelup__backdrop,
  .vyhraj-reward-card,
  .vyhraj-reward-backdrop,
  .vyhraj-reward-icon,
  .vyhraj-pulse {
    animation: none !important;
    transform: none !important;
  }

  .vyhraj-reward-icon {
    transform: translateX(-50%) !important;
  }

  .vyhraj-levelup__card::after {
    display: none;
  }

  @keyframes vyhraj-toast-in,
  @keyframes vyhraj-toast-out,
  @keyframes vyhraj-coin-fly,
  @keyframes vyhraj-pop-in,
  @keyframes vyhraj-levelup-in,
  @keyframes vyhraj-reward-in,
  @keyframes vyhraj-shine,
  @keyframes vyhraj-pulse-glow {
    from, to {
      transform: none;
    }
  }

  @keyframes vyhraj-fade-only-in {
    from { opacity: 0; }
    to { opacity: 1; }
  }

  @keyframes vyhraj-fade-only-out {
    from { opacity: 1; }
    to { opacity: 0; }
  }
}
