:root {
  --bg: #fdf2f8;
  --bg-soft: #ffe4f2;
  --card: #ffffff;
  --accent: #ec4899;
  --accent-soft: #f9a8d4;
  --accent-strong: #db2777;
  --text: #1f2933;
  --muted: #6b7280;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex;
  justify-content: center;
  background: radial-gradient(circle at top, #fce7f3 0, #fee2e2 40%, #fdf2f8 100%);
  color: var(--text);
}

.page {
  width: 100%;
  max-width: 960px;
  padding: 20px;
}

.header {
  text-align: center;
  margin-bottom: 16px;
}

.header-title {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--accent);
}

.header-sub {
  font-size: 0.95rem;
  color: var(--muted);
  margin-top: 6px;
}

.layout {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 16px;
}

@media (max-width: 768px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--card);
  border-radius: 16px;
  padding: 16px 18px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.08);
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--accent-strong);
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-subtitle {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 8px;
}

/* Spinner */
.spinner-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.spinner {
  width: 220px;
  height: 220px;
  border-radius: 999px;
  border: 10px solid #fee2f2;
  background: conic-gradient(
    from 0deg,
    #f9a8d4,
    #f973a9,
    #fb7185,
    #fbbf24,
    #f9a8d4
  );
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 16px 36px rgba(236, 72, 153, 0.4);
  transition: transform 3s cubic-bezier(0.19, 1, 0.22, 1);
}

.spinner-inner {
  width: 65%;
  height: 65%;
  border-radius: 999px;
  background: rgba(255,255,255,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px;
  font-size: 0.9rem;
  color: var(--accent-strong);
  font-weight: 600;
}

.pointer {
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-bottom: 18px solid #fb7185;
  margin-bottom: 4px;
}

button {
  border-radius: 999px;
  border: none;
  margin-top: 10px;
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease,
    background 0.16s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #ec4899, #fb7185);
  color: #fff;
  box-shadow: 0 8px 18px rgba(236, 72, 153, 0.5);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(236, 72, 153, 0.6);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: default;
  box-shadow: none;
  transform: none;
}

.btn-secondary {
  background: #f3f4f6;
  color: var(--text);
}

.btn-secondary:hover {
  background: #e5e7eb;
}

.btn-option {
  background: #f3f4f6;
  color: var(--text);
  width: 100%;
  justify-content: center;
}

.btn-option.correct {
  background: #bbf7d0;
  color: #166534;
}

.btn-option.wrong {
  background: #fecaca;
  color: #991b1b;
}

.question-card {
  margin-top: 10px;
  border-radius: 14px;
  padding: 10px 12px;
  background: #fff7fb;
  border: 1px solid #fed7e2;
  font-size: 0.9rem;
}

.question-ref {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 4px;
}

.question-text {
  margin-bottom: 8px;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.feedback {
  margin-top: 6px;
  font-size: 0.85rem;
}

.feedback.ok {
  color: #15803d;
}

.feedback.bad {
  color: #b91c1c;
}

/* Scratch card */
.scratch-info {
  font-size: 0.87rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.stats {
display: none;
}

.stat-pill {
  padding: 4px 10px;
  border-radius: 999px;
  background: #fce7f3;
  color: var(--accent-strong);
  font-weight: 500;
}

.scratch-card {
  margin-top: 6px;
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  background: linear-gradient(135deg, #f9a8d4, #f973a9);
  box-shadow: 0 10px 22px rgba(236, 72, 153, 0.45);
}

.scratch-content {
  padding: 16px 14px;
  text-align: center;
  color: #fff;
  position: relative;
  z-index: 1;
  min-height: 90px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.scratch-title {
  font-size: 0.95rem;
  font-weight: 700;
}

.scratch-text {
  font-size: 0.9rem;
}

canvas#scratch-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  touch-action: none;
  cursor: crosshair;
}

.scratch-hint {
  font-size: 0.78rem;
  color: #fef2f2;
  margin-top: 4px;
}

.hidden {
  display: none !important;
}

.prize-list {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--muted);
}

/* Modal final */
.final-modal {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}

.final-modal.active {
  display: flex;
}

.final-box {
  background: #fff;
  border-radius: 18px;
  padding: 18px 18px 14px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0,0,0,0.32);
}

.final-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent-strong);
  margin-bottom: 8px;
}

.final-text {
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 10px;
}

.final-extra {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 10px;
}

.final-buttons {
  display: flex;
  justify-content: center;
  gap: 8px;
}

/* Confeti */
.confetti {
  position: fixed;
  top: -10px;
  width: 8px;
  height: 14px;
  border-radius: 4px;
  opacity: 0.95;
  animation: confetti-fall 2.7s linear forwards;
  z-index: 60;
}

@keyframes confetti-fall {
  0% {
    transform: translateY(0) rotate(0deg);
  }
  100% {
    transform: translateY(110vh) rotate(360deg);
  }
}
