/*
 * Quiz Platform — decorative backgrounds («Декор фону»).
 * Pure CSS, no images: tinted by the quiz accent (--quiz-accent) and text colour
 * (--quiz-text), so every set adapts to light, dark and auto backgrounds.
 * Intentionally quiet: low opacity, content always stays on top.
 * Used by the quiz page (fixed layer behind the shell) and by admin thumbnails.
 */
.quiz-decor {
  --decor-a: var(--quiz-accent, #0db209);
  --decor-t: var(--quiz-text, #f2f2f4);
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
body.has-decor { position: relative; isolation: isolate; }
/* Over a photo: photo (::before) → dimming (::after) → decor → quiz content. */
body.background-image.has-decor::before,
body.background-image.has-decor::after { z-index: -2; }
body.background-image .quiz-decor { --decor-t: #ffffff; }
.quiz-decor::before,
.quiz-decor::after { content: ""; position: absolute; pointer-events: none; }

/* 1. Світло в кутах — two soft glows in opposite corners. */
.decor-glow::before {
  inset: 0;
  background:
    radial-gradient(60% 50% at 100% 0%, color-mix(in srgb, var(--decor-a) 16%, transparent), transparent 70%),
    radial-gradient(55% 45% at 0% 100%, color-mix(in srgb, var(--decor-t) 6%, transparent), transparent 70%);
}

/* 2. Аврора — slow drifting colour clouds. */
.decor-aurora::before,
.decor-aurora::after {
  width: 70vmax;
  height: 70vmax;
  border-radius: 50%;
  filter: blur(70px);
  opacity: .16;
  animation: decor-drift 38s ease-in-out infinite alternate;
}
.decor-aurora::before { top: -30vmax; right: -20vmax; background: var(--decor-a); }
.decor-aurora::after {
  bottom: -35vmax;
  left: -25vmax;
  background: color-mix(in srgb, var(--decor-a) 45%, #3b6fd8);
  opacity: .12;
  animation-duration: 46s;
  animation-direction: alternate-reverse;
}

/* 3. Кола — thin concentric rings from the top-right corner. */
.decor-rings::before {
  inset: 0;
  background: repeating-radial-gradient(circle at 100% 0%,
    transparent 0 46px,
    color-mix(in srgb, var(--decor-t) 10%, transparent) 46px 47px);
  -webkit-mask-image: radial-gradient(90% 80% at 100% 0%, #000, transparent 75%);
  mask-image: radial-gradient(90% 80% at 100% 0%, #000, transparent 75%);
}

/* 4. Сітка — fine grid fading towards the edges. */
.decor-grid::before {
  inset: 0;
  background:
    linear-gradient(color-mix(in srgb, var(--decor-t) 8%, transparent) 1px, transparent 1px) 0 0 / 44px 44px,
    linear-gradient(90deg, color-mix(in srgb, var(--decor-t) 8%, transparent) 1px, transparent 1px) 0 0 / 44px 44px;
  -webkit-mask-image: radial-gradient(75% 65% at 50% 35%, #000, transparent 80%);
  mask-image: radial-gradient(75% 65% at 50% 35%, #000, transparent 80%);
}

/* 5. Крапки — soft dotted field. */
.decor-dots::before {
  inset: 0;
  background: radial-gradient(circle, color-mix(in srgb, var(--decor-t) 13%, transparent) 1.2px, transparent 1.6px) 0 0 / 22px 22px;
  -webkit-mask-image: linear-gradient(160deg, #000 0%, transparent 70%);
  mask-image: linear-gradient(160deg, #000 0%, transparent 70%);
}

/* 6. Хвилі — layered waves along the bottom edge. */
.decor-waves::before,
.decor-waves::after {
  left: -5%;
  right: -5%;
  bottom: 0;
  height: 38vh;
  min-height: 180px;
  background: var(--decor-a);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 320' preserveAspectRatio='none'%3E%3Cpath d='M0 160c120 40 240 60 360 40s240-80 360-80 240 60 360 80 240-20 360-60v180H0z'/%3E%3C/svg%3E") bottom / 100% 100% no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 320' preserveAspectRatio='none'%3E%3Cpath d='M0 160c120 40 240 60 360 40s240-80 360-80 240 60 360 80 240-20 360-60v180H0z'/%3E%3C/svg%3E") bottom / 100% 100% no-repeat;
  opacity: .07;
}
.decor-waves::after {
  height: 26vh;
  min-height: 120px;
  opacity: .06;
  transform: scaleX(-1);
  animation: decor-sway 30s ease-in-out infinite alternate;
}

/* 7. Світлові плями — scattered soft glows (bokeh). */
.decor-bubbles::before {
  inset: 0;
  background:
    radial-gradient(circle at 12% 22%, color-mix(in srgb, var(--decor-a) 15%, transparent) 0, transparent 90px),
    radial-gradient(circle at 88% 16%, color-mix(in srgb, var(--decor-a) 12%, transparent) 0, transparent 150px),
    radial-gradient(circle at 78% 82%, color-mix(in srgb, var(--decor-t) 5%, transparent) 0, transparent 200px),
    radial-gradient(circle at 22% 88%, color-mix(in srgb, var(--decor-a) 11%, transparent) 0, transparent 60px),
    radial-gradient(circle at 55% 8%, color-mix(in srgb, var(--decor-t) 5%, transparent) 0, transparent 40px);
  animation: decor-float 40s ease-in-out infinite alternate;
}

/* 8. Промені — faint diagonal light beams. */
.decor-beams::before {
  inset: -20%;
  background: repeating-linear-gradient(115deg,
    transparent 0 90px,
    color-mix(in srgb, var(--decor-a) 7%, transparent) 90px 150px,
    transparent 150px 260px);
  -webkit-mask-image: linear-gradient(180deg, #000, transparent 75%);
  mask-image: linear-gradient(180deg, #000, transparent 75%);
}

@keyframes decor-drift { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(-6vmax, 5vmax, 0) scale(1.12); } }
@keyframes decor-sway { from { transform: scaleX(-1) translate3d(0, 0, 0); } to { transform: scaleX(-1) translate3d(4%, 6px, 0); } }
@keyframes decor-float { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(0, -18px, 0); } }
@media (prefers-reduced-motion: reduce) {
  .quiz-decor::before, .quiz-decor::after { animation: none !important; }
}
