/* =========================================================
   Kids Quiz — светъл дизайн, един екран, картички
   ========================================================= */

:root {
  --bg-sky-top: #b8dff8;
  --bg-sky-mid: #e8f4fc;
  --bg-cream: #faf8f3;
  --surface: #ffffff;
  --ink: #1a1f2e;
  --ink-soft: #5a6478;
  --lime: #c6f25a;
  --lime-deep: #9ed428;
  --pink: #ff7eb3;
  --coral: #ff6b6b;
  --sky: #5bb8f5;
  --blue-soft: #d6ecfb;
  --shadow: 0 18px 40px rgba(26, 31, 46, 0.1);
  --shadow-soft: 0 8px 24px rgba(26, 31, 46, 0.08);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-pill: 999px;
  --font: "Nunito", system-ui, sans-serif;
  --screen-max: 920px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg-cream);
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

img {
  max-width: 100%;
  display: block;
}

[hidden] {
  display: none !important;
}

/* ---------- Atmosphere ---------- */

.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, var(--bg-sky-top), transparent 70%),
    linear-gradient(180deg, var(--bg-sky-mid) 0%, var(--bg-cream) 55%, var(--bg-cream) 100%);
}

.cloud {
  position: absolute;
  background: rgba(255, 255, 255, 0.85);
  border-radius: var(--radius-pill);
  filter: blur(1px);
}

.cloud::before,
.cloud::after {
  content: "";
  position: absolute;
  background: inherit;
  border-radius: 50%;
}

.cloud--1 {
  width: 140px;
  height: 40px;
  top: 8%;
  left: 8%;
}
.cloud--1::before {
  width: 50px;
  height: 50px;
  top: -28px;
  left: 24px;
}
.cloud--1::after {
  width: 70px;
  height: 70px;
  top: -36px;
  left: 55px;
}

.cloud--2 {
  width: 180px;
  height: 48px;
  top: 14%;
  right: 10%;
}
.cloud--2::before {
  width: 60px;
  height: 60px;
  top: -32px;
  left: 30px;
}
.cloud--2::after {
  width: 80px;
  height: 80px;
  top: -42px;
  left: 70px;
}

.cloud--3 {
  width: 110px;
  height: 32px;
  top: 28%;
  left: 42%;
  opacity: 0.7;
}
.cloud--3::before {
  width: 40px;
  height: 40px;
  top: -22px;
  left: 18px;
}
.cloud--3::after {
  width: 55px;
  height: 55px;
  top: -28px;
  left: 42px;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.35;
}

.blob--lime {
  width: 220px;
  height: 220px;
  background: var(--lime);
  bottom: 8%;
  right: 6%;
}

.blob--pink {
  width: 180px;
  height: 180px;
  background: var(--pink);
  bottom: 18%;
  left: 4%;
}

.star {
  position: absolute;
  width: 14px;
  height: 14px;
  background: var(--lime);
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

.star--1 { top: 22%; left: 18%; }
.star--2 { top: 12%; right: 22%; background: var(--pink); }
.star--3 { bottom: 30%; right: 18%; background: var(--sky); width: 10px; height: 10px; }

/* ---------- Single screen shell ---------- */

.screen {
  position: relative;
  z-index: 1;
  width: min(100% - 32px, var(--screen-max));
  height: min(100dvh - 32px, 860px);
  margin: 16px auto;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(16px);
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* ---------- Mascot (извън .screen) ---------- */

.mascot {
  position: fixed;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(8px, env(safe-area-inset-bottom));
  z-index: 2;
  width: clamp(90px, 13vw, 160px);
  height: auto;
  pointer-events: none;
  user-select: none;
  transform-origin: 50% 100%;
  filter: drop-shadow(0 12px 24px rgba(26, 31, 46, 0.18));
}

.topbar {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr;
  align-items: center;
  gap: 12px;
  padding: 16px 22px 8px;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand__mark {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--lime), var(--sky));
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.12);
}

.brand__name {
  font-weight: 800;
  font-size: 1rem;
}

.progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.progress__label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-soft);
  text-align: center;
}

.progress__track {
  height: 10px;
  border-radius: var(--radius-pill);
  background: var(--blue-soft);
  overflow: hidden;
}

.progress__fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--sky), var(--lime));
  transition: width 0.35s ease;
}

.score-pill {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  background: var(--lime);
  font-weight: 800;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.12);
}

.score-pill__label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.score-pill__value {
  font-size: 1.15rem;
  min-width: 1.5ch;
  text-align: center;
}

/* ---------- Stage panels ---------- */

.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  padding: 8px 22px 22px;
}

.panel {
  position: absolute;
  inset: 8px 22px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sky);
}

.hero-title {
  margin: 0;
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.hero-title em {
  font-style: italic;
  color: transparent;
  -webkit-text-stroke: 2px var(--ink);
}

.hero-sub {
  margin: 14px 0 0;
  max-width: 28rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink-soft);
  line-height: 1.45;
}

.rules {
  list-style: none;
  margin: 22px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.rules li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  font-weight: 700;
  font-size: 0.95rem;
}

.badge {
  display: inline-grid;
  place-items: center;
  min-width: 42px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-weight: 900;
  font-size: 0.85rem;
}

.badge--ok {
  background: var(--lime);
  color: var(--ink);
}

.badge--bad {
  background: #ffe0e0;
  color: var(--coral);
}

/* ---------- Category picker ---------- */

.categories-title {
  margin: 0;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 900;
  letter-spacing: -0.02em;
}

.categories-sub {
  margin-top: 8px !important;
}

.category-grid {
  width: 100%;
  max-width: 640px;
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.category-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 12px 16px;
  border-radius: var(--radius-lg);
  border: 2px solid transparent;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  background-image: linear-gradient(var(--surface), var(--surface)),
    linear-gradient(180deg, var(--cat-accent, var(--blue-soft)), #fff);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
  font-family: inherit;
}

.category-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.category-card:active {
  transform: translateY(0);
}

.category-card__emoji {
  font-size: 2rem;
  line-height: 1;
}

.category-card__title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--ink);
}

.category-card__meta {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.btn--ghost {
  margin-top: 18px;
  padding: 12px 22px;
  border-radius: var(--radius-pill);
  border: 2px solid #e0e6f0;
  background: rgba(255, 255, 255, 0.7);
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--ink-soft);
  transition: border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.btn--ghost:hover {
  border-color: var(--sky);
  color: var(--ink);
  transform: translateY(-1px);
}

.results-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.results-actions .btn--primary {
  margin-top: 22px;
}

.results-actions .btn--ghost {
  margin-top: 8px;
}

a.page-link {
  text-decoration: none;
  display: inline-flex;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 28px;
  padding: 14px 28px;
  border-radius: var(--radius-pill);
  font-size: 1.05rem;
  font-weight: 800;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
}

.btn--primary {
  background: var(--lime);
  color: var(--ink);
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.15);
}

.btn--primary:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 7px 0 rgba(0, 0, 0, 0.15);
}

.btn--primary:not(:disabled):active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.15);
}

.btn__icon {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.12);
  font-size: 0.95rem;
}

/* ---------- Question card ---------- */

.panel--quiz {
  justify-content: stretch;
  padding: 0;
}

.card-deck {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.question-card {
  width: min(100%, 520px);
  max-height: 100%;
  padding: 28px 28px 24px;
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 18px;
  text-align: left;
  overflow: auto;
}

.question-card__type {
  align-self: flex-start;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--blue-soft);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.question-card__type--visual {
  background: #ffe8f2;
}

.question-card__media {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: linear-gradient(145deg, var(--blue-soft), #fff);
  display: grid;
  place-items: center;
}

.question-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.question-card__media-placeholder {
  font-size: 4rem;
  line-height: 1;
  user-select: none;
}

.question-card__prompt {
  margin: 0;
  font-size: clamp(1.25rem, 3vw, 1.55rem);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.answers {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.answer-btn {
  width: 100%;
  text-align: left;
  padding: 14px 18px;
  border-radius: var(--radius-pill);
  border: 2px solid #e8edf5;
  background: #f7f9fc;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 12px;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.answer-btn:hover:not(:disabled) {
  border-color: var(--sky);
  background: #fff;
  transform: translateX(4px);
}

.answer-btn:disabled {
  cursor: default;
}

.answer-btn__letter {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 2px solid #dfe6f0;
  font-weight: 900;
  font-size: 0.85rem;
}

.answer-btn.is-correct {
  border-color: var(--lime-deep);
  background: #f0ffd4;
}

.answer-btn.is-wrong {
  border-color: var(--coral);
  background: #ffe8e8;
}

/* ---------- Results ---------- */

.results-title {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 900;
}

.stat-card {
  margin-top: 22px;
  width: min(100%, 280px);
  padding: 32px 24px;
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.stat-card__number {
  font-size: clamp(3.5rem, 10vw, 5rem);
  font-weight: 900;
  line-height: 1;
  color: var(--lime-deep);
  letter-spacing: -0.04em;
}

.stat-card__unit {
  font-weight: 800;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.85rem;
}

.results-msg {
  margin: 18px 0 0;
  max-width: 22rem;
  font-weight: 700;
  color: var(--ink-soft);
  font-size: 1.05rem;
}

/* ---------- Feedback video overlay ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
}

.overlay__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 31, 46, 0.45);
  backdrop-filter: blur(6px);
}

.feedback-modal {
  position: relative;
  z-index: 1;
  width: min(100%, 480px);
  padding: 24px;
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
}

.feedback-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.feedback-modal__title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 900;
}

.feedback-modal__points {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-weight: 900;
  font-size: 1rem;
  background: var(--lime);
}

.feedback-modal__points.is-negative {
  background: #ffe0e0;
  color: var(--coral);
}

.feedback-modal__video-wrap {
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #111827;
  aspect-ratio: 16 / 9;
  position: relative;
}

.feedback-modal__video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #111827;
}

.feedback-modal__hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  padding: 10px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.65));
  pointer-events: none;
}

.feedback-modal .btn {
  margin-top: 4px;
  width: 100%;
}

.feedback-modal.is-correct .feedback-modal__title {
  color: var(--lime-deep);
}

.feedback-modal.is-wrong .feedback-modal__title {
  color: var(--coral);
}

/* ---------- Responsive ---------- */

@media (max-width: 720px) {
  .screen {
    width: 100%;
    height: 100dvh;
    margin: 0;
    border-radius: 0;
    border: none;
  }

  .topbar {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand score"
      "progress progress";
    padding: 14px 16px 6px;
  }

  .brand { grid-area: brand; }
  .score-pill { grid-area: score; }
  .progress { grid-area: progress; }

  .stage,
  .panel {
    inset: auto;
    position: relative;
    padding: 8px 16px 16px;
    height: 100%;
  }

  .panel--start,
  .panel--categories,
  .panel--results {
    position: absolute;
    inset: 0;
    padding: 16px;
  }

  .category-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    max-height: 52vh;
    overflow: auto;
    padding: 4px;
  }

  .category-card {
    padding: 14px 10px;
  }

  .category-card__emoji {
    font-size: 1.6rem;
  }

  .question-card {
    padding: 20px 18px 18px;
  }

  .mascot {
    width: clamp(70px, 22vw, 110px);
    right: 4px;
    bottom: 4px;
    opacity: 0.95;
  }
}
