/* =========================================================
   Bintang Belajar – Space Academy SD
   Custom animations, components and Tailwind overrides
   ========================================================= */

:root {
  --space-950: #060d29;
  --space-900: #0b1640;
  --space-800: #13235e;
  --space-700: #1d3a8a;
  --blue: #2563eb;
  --blue-light: #60a5fa;
  --sun: #ffd93d;
  --sun-soft: #fff3b0;
  --green: #22c55e;
  --green-dark: #15803d;
  --red: #ef4444;
  --ink: #0f172a;
  --card: #ffffff;
  --radius: 1.5rem;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Fredoka', 'Comic Neue', ui-rounded, system-ui, sans-serif;
  font-size: 18px;
  background: radial-gradient(ellipse at top, #1d3a8a 0%, #0b1640 45%, #060d29 100%) fixed;
  background-color: var(--space-900);
}

/* ---------- Accessibility ---------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 100;
  background: var(--sun);
  color: var(--ink);
  padding: .5rem 1rem;
  border-radius: 999px;
  font-weight: 600;
}
.skip-link:focus { left: 8px; }

:focus-visible {
  outline: 4px solid var(--sun);
  outline-offset: 3px;
  border-radius: 12px;
}

/* ---------- Starfield ---------- */
#starfield {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
#starfield .star {
  position: absolute;
  border-radius: 50%;
  background: #fff;
  opacity: .7;
  animation: twinkle 3s ease-in-out infinite;
}
#starfield .planet {
  position: absolute;
  border-radius: 50%;
  filter: blur(.5px);
  opacity: .35;
}
@keyframes twinkle {
  0%, 100% { opacity: .2; transform: scale(.8); }
  50% { opacity: 1; transform: scale(1.15); }
}

/* ---------- Layout chrome ---------- */
.topbar {
  background: rgba(11, 22, 64, .85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 2px solid rgba(96, 165, 250, .25);
}

.logo-badge {
  display: grid;
  place-items: center;
  width: 3.25rem;
  height: 3.25rem;
  font-size: 1.75rem;
  border-radius: 1rem;
  background: linear-gradient(135deg, var(--sun), #fb923c);
  box-shadow: 0 6px 0 #c2410c;
}
.logo-badge-sm { width: 2.75rem; height: 2.75rem; font-size: 1.4rem; box-shadow: 0 4px 0 #c2410c; }
.spin-hover:hover { animation: wiggle .6s ease-in-out; }

.side-link,
.bottom-link {
  display: flex;
  align-items: center;
  gap: .85rem;
  color: #dbeafe;
  font-weight: 600;
  transition: transform .15s ease, background-color .15s ease, color .15s ease;
}
.side-link {
  padding: .85rem 1rem;
  border-radius: 1.1rem;
  font-size: 1.05rem;
  line-height: 1.15;
}
.side-link svg { width: 1.6rem; height: 1.6rem; flex-shrink: 0; }
.side-link:hover { background: rgba(96, 165, 250, .18); transform: translateX(4px); }
.side-link.is-active {
  background: var(--sun);
  color: var(--ink);
  box-shadow: 0 5px 0 #ca8a04;
}

.side-tip {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  padding: 1rem;
  border-radius: 1.1rem;
  background: rgba(19, 35, 94, .8);
  border: 2px dashed rgba(255, 217, 61, .4);
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .25rem;
  padding: .5rem .5rem calc(.5rem + env(safe-area-inset-bottom));
  background: rgba(6, 13, 41, .95);
  border-top: 2px solid rgba(96, 165, 250, .3);
  backdrop-filter: blur(10px);
}
.bottom-link {
  flex-direction: column;
  justify-content: center;
  gap: .2rem;
  padding: .45rem .25rem;
  border-radius: 1rem;
  font-size: .78rem;
  text-align: center;
  line-height: 1.1;
}
.bottom-link svg { width: 1.6rem; height: 1.6rem; }
.bottom-link.is-active { background: var(--sun); color: var(--ink); }

/* ---------- Grade selector ---------- */
.grade-pills {
  display: flex;
  gap: .4rem;
  overflow-x: auto;
  scrollbar-width: none;
  padding: .25rem .1rem .45rem;
}
.grade-pills::-webkit-scrollbar { display: none; }
.grade-pill {
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 999px;
  font-size: 1.25rem;
  font-weight: 700;
  color: #dbeafe;
  background: var(--space-800);
  border: 2px solid rgba(96, 165, 250, .5);
  box-shadow: 0 4px 0 #060d29;
  transition: transform .15s ease, background-color .15s ease;
}
@media (max-width: 639px) {
  .grade-pill { width: 2.5rem; height: 2.5rem; font-size: 1.15rem; }
}
.grade-pill:hover { transform: translateY(-2px); background: var(--space-700); }
.grade-pill:active { transform: translateY(2px); box-shadow: 0 1px 0 #060d29; }
.grade-pill.is-active {
  background: var(--green);
  border-color: #bbf7d0;
  color: #fff;
  box-shadow: 0 4px 0 var(--green-dark);
  transform: scale(1.08);
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .4rem .8rem;
  border-radius: 999px;
  background: var(--space-800);
  border: 2px solid rgba(255, 217, 61, .5);
  color: #fff;
  font-weight: 700;
  white-space: nowrap;
}
.stat-pill svg { width: 1.2rem; height: 1.2rem; }
.icon-btn {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 999px;
  background: var(--space-800);
  border: 2px solid rgba(96, 165, 250, .5);
  color: #dbeafe;
  transition: transform .15s ease;
}
.icon-btn:hover { transform: scale(1.08); }
.icon-btn svg { width: 1.3rem; height: 1.3rem; }

/* ---------- Cards & buttons ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: 0 8px 0 rgba(6, 13, 41, .35), 0 20px 40px rgba(0, 0, 0, .2);
}
.card-soft {
  background: var(--sun-soft);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: 0 8px 0 rgba(202, 138, 4, .35);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  min-height: 3.5rem;
  padding: .8rem 1.5rem;
  border-radius: 999px;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
  user-select: none;
}
.btn svg { width: 1.4rem; height: 1.4rem; flex-shrink: 0; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-yellow { background: var(--sun); color: var(--ink); box-shadow: 0 6px 0 #ca8a04; }
.btn-green  { background: var(--green); color: #fff; box-shadow: 0 6px 0 var(--green-dark); }
.btn-blue   { background: var(--blue); color: #fff; box-shadow: 0 6px 0 #1e40af; }
.btn-white  { background: #fff; color: var(--space-800); box-shadow: 0 6px 0 #94a3b8; }
.btn-red    { background: var(--red); color: #fff; box-shadow: 0 6px 0 #b91c1c; }
.btn-ghost  { background: rgba(255,255,255,.12); color: #fff; border: 2px solid rgba(255,255,255,.4); }
.btn-sm { min-height: 2.75rem; padding: .5rem 1rem; font-size: 1rem; }

.btn-bounce:not(:disabled):hover { transform: translateY(-3px) scale(1.03); filter: brightness(1.05); }
.btn-bounce:not(:disabled):active { transform: translateY(4px) scale(.97); box-shadow: 0 2px 0 rgba(0,0,0,.25); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .3rem .85rem;
  border-radius: 999px;
  background: rgba(255,255,255,.2);
  color: #fff;
  font-weight: 600;
  font-size: .95rem;
  border: 2px solid rgba(255,255,255,.35);
}
.chip-light {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .25rem .75rem;
  border-radius: 999px;
  background: #e0f2fe;
  color: #075985;
  font-weight: 600;
  font-size: .9rem;
}

.input {
  width: 100%;
  min-height: 3.25rem;
  padding: .6rem 1rem;
  border-radius: 1rem;
  border: 3px solid #bfdbfe;
  font-size: 1.1rem;
  background: #fff;
  color: var(--ink);
}
.input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(37, 99, 235, .2); }

/* ---------- Hero ---------- */
.hero-card {
  position: relative;
  overflow: hidden;
  border-radius: 2rem;
  box-shadow: 0 10px 0 rgba(6, 13, 41, .5);
}
.hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .28;
  mix-blend-mode: luminosity;
}
.hero-planet {
  font-size: 7rem;
  line-height: 1;
  filter: drop-shadow(0 12px 20px rgba(0,0,0,.35));
}

.page-banner {
  position: relative;
  overflow: hidden;
  border-radius: 1.75rem;
  box-shadow: 0 8px 0 rgba(6, 13, 41, .5);
}
.page-banner img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .25;
}

.path-card {
  display: block;
  overflow: hidden;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 8px 0 rgba(6, 13, 41, .35);
  transition: transform .2s ease;
}
.path-card:hover { transform: translateY(-6px) rotate(-.5deg); }
.path-card .path-img {
  height: 9rem;
  background-size: cover;
  background-position: center;
  position: relative;
}

.topic-card {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  text-align: left;
  background: #fff;
  border-radius: var(--radius);
  padding: 1.35rem;
  box-shadow: 0 8px 0 rgba(6, 13, 41, .35);
  border: 3px solid transparent;
  transition: transform .2s ease, border-color .2s ease;
}
.topic-card:hover { transform: translateY(-5px); border-color: var(--sun); }
.topic-card:active { transform: translateY(2px); }
.topic-icon {
  display: grid;
  place-items: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 1.1rem;
  color: #fff;
}
.topic-icon svg { width: 1.9rem; height: 1.9rem; }

.progress-track {
  width: 100%;
  height: 1rem;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green), #a3e635);
  transition: width .5s ease;
}
.progress-fill.blue { background: linear-gradient(90deg, var(--blue), var(--blue-light)); }
.progress-fill.yellow { background: linear-gradient(90deg, #f59e0b, var(--sun)); }

/* Streak week */
.week-dot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .2rem;
  font-size: .75rem;
  font-weight: 600;
  color: #64748b;
}
.week-dot span:first-child {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: #f1f5f9;
  font-size: 1rem;
}
.week-dot.is-lit span:first-child { background: #fed7aa; }
.week-dot.is-today span:last-child { color: var(--ink); text-decoration: underline; }

/* ---------- Quiz ---------- */
.quiz-card {
  background: #fff;
  border-radius: 2rem;
  padding: 1.5rem;
  box-shadow: 0 10px 0 rgba(6, 13, 41, .4);
}
@media (min-width: 640px) { .quiz-card { padding: 2.25rem; } }

.question-text {
  font-size: clamp(1.6rem, 4.5vw, 2.6rem);
  font-weight: 700;
  color: var(--space-800);
  text-align: center;
  line-height: 1.25;
}
.question-text.is-long { font-size: clamp(1.2rem, 3vw, 1.6rem); }

.option-btn {
  display: flex;
  align-items: center;
  gap: .9rem;
  width: 100%;
  min-height: 4.25rem;
  padding: .75rem 1.1rem;
  border-radius: 1.25rem;
  background: #eff6ff;
  border: 3px solid #bfdbfe;
  font-size: clamp(1.15rem, 3vw, 1.5rem);
  font-weight: 600;
  color: var(--space-800);
  text-align: left;
  box-shadow: 0 5px 0 #93c5fd;
  transition: transform .15s ease, background-color .15s ease, border-color .15s ease;
}
.option-btn:not(:disabled):hover { transform: translateY(-3px); background: #fef9c3; border-color: var(--sun); box-shadow: 0 5px 0 #eab308; }
.option-btn:not(:disabled):active { transform: translateY(3px); box-shadow: 0 1px 0 #93c5fd; }
.option-btn:disabled { cursor: default; }
.option-key {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: .8rem;
  background: var(--space-800);
  color: #fff;
  font-size: 1.1rem;
}
.option-btn.is-correct { background: #dcfce7; border-color: var(--green); box-shadow: 0 5px 0 var(--green-dark); animation: pop .4s ease; }
.option-btn.is-correct .option-key { background: var(--green); }
.option-btn.is-wrong { background: #fee2e2; border-color: var(--red); box-shadow: 0 5px 0 #b91c1c; animation: shake .4s ease; }
.option-btn.is-wrong .option-key { background: var(--red); }
.option-btn.is-dim { opacity: .55; }

.feedback {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  border-radius: 1.25rem;
  padding: 1rem 1.25rem;
  font-size: 1.15rem;
  animation: slide-up .3s ease;
}
.feedback.good { background: #dcfce7; color: #14532d; border: 3px solid var(--green); }
.feedback.bad  { background: #fef3c7; color: #78350f; border: 3px solid #f59e0b; }
.feedback svg { width: 2rem; height: 2rem; flex-shrink: 0; }

.passage {
  background: var(--sun-soft);
  border-radius: 1.5rem;
  padding: 1.5rem;
  font-size: 1.15rem;
  line-height: 1.75;
  color: #422006;
  border: 3px solid #fde68a;
}

/* Counting visual */
.count-visual {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  margin-bottom: 1rem;
}
.count-group {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .25rem;
  max-width: 16rem;
  padding: .5rem .75rem;
  border-radius: 1rem;
  background: #f0f9ff;
  border: 2px dashed #7dd3fc;
}
.count-item { font-size: 1.9rem; line-height: 1.1; }
.count-item.is-crossed { opacity: .3; position: relative; }
.count-item.is-crossed::after {
  content: '';
  position: absolute;
  left: -2px;
  right: -2px;
  top: 50%;
  height: 4px;
  background: var(--red);
  border-radius: 4px;
  transform: rotate(-30deg);
}
.count-op { font-size: 2rem; font-weight: 700; color: var(--space-800); }

/* ---------- Flashcards ---------- */
.flip-card {
  display: block;
  width: 100%;
  max-width: 26rem;
  height: 22rem;
  margin: 0 auto;
  perspective: 1200px;
  background: transparent;
  cursor: pointer;
}
.flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform .6s cubic-bezier(.3, 1.4, .5, 1);
  transform-style: preserve-3d;
}
.flip-card.is-flipped .flip-inner { transform: rotateY(180deg); }
.flip-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  padding: 1.5rem;
  border-radius: 2rem;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: 0 10px 0 rgba(6, 13, 41, .4);
}
.flip-front { background: #fff; border: 5px solid var(--blue-light); }
.flip-back {
  background: linear-gradient(135deg, var(--sun), #fde68a);
  border: 5px solid #f59e0b;
  transform: rotateY(180deg);
}
.flip-emoji { font-size: 6rem; line-height: 1; }
.flip-numeral { font-size: 6rem; font-weight: 700; color: var(--blue); line-height: 1; }
.flip-swatch {
  width: 7rem;
  height: 7rem;
  border-radius: 999px;
  border: 5px solid var(--space-800);
}
.flip-word { font-size: 2.6rem; font-weight: 700; color: var(--space-800); }
.flip-hint { font-size: 1rem; color: #64748b; display: flex; align-items: center; gap: .35rem; }

.dot-row { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem; }
.dot-row span {
  width: .85rem;
  height: .85rem;
  border-radius: 999px;
  background: rgba(255,255,255,.3);
}
.dot-row span.is-known { background: var(--green); }
.dot-row span.is-current { outline: 3px solid var(--sun); outline-offset: 2px; }

/* ---------- Matching game ---------- */
.match-tile {
  width: 100%;
  min-height: 4rem;
  padding: .75rem 1rem;
  border-radius: 1.1rem;
  background: #fff;
  border: 3px solid #bfdbfe;
  box-shadow: 0 5px 0 #93c5fd;
  font-size: clamp(1rem, 2.6vw, 1.25rem);
  font-weight: 600;
  color: var(--space-800);
  text-align: center;
  transition: transform .15s ease, background-color .15s ease;
}
.match-tile:not(:disabled):hover { transform: translateY(-3px); border-color: var(--sun); }
.match-tile.is-selected { background: #fef9c3; border-color: #eab308; box-shadow: 0 5px 0 #ca8a04; transform: scale(1.03); }
.match-tile.is-matched { background: #dcfce7; border-color: var(--green); box-shadow: 0 5px 0 var(--green-dark); opacity: .75; }
.match-tile.is-wrong { background: #fee2e2; border-color: var(--red); animation: shake .4s ease; }

/* ---------- Badges ---------- */
.badge-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
  padding: 1rem .75rem;
  border-radius: 1.25rem;
  background: #fff;
  text-align: center;
  box-shadow: 0 6px 0 rgba(6, 13, 41, .3);
}
.badge-svg { filter: drop-shadow(0 6px 8px rgba(0,0,0,.25)); }

/* ---------- Parent panel ---------- */
.bar-row { display: grid; grid-template-columns: 4.5rem 1fr; gap: .75rem; align-items: center; }
.bar-pair { display: flex; flex-direction: column; gap: .3rem; }
.bar {
  height: 1.1rem;
  border-radius: 999px;
  min-width: .5rem;
  transition: width .6s ease;
}
.bar.math { background: linear-gradient(90deg, var(--blue), var(--blue-light)); }
.bar.eng { background: linear-gradient(90deg, var(--green), #a3e635); }

.data-table { width: 100%; border-collapse: collapse; font-size: 1rem; }
.data-table th {
  text-align: left;
  padding: .6rem .75rem;
  background: #eff6ff;
  color: var(--space-800);
  font-weight: 600;
  white-space: nowrap;
}
.data-table td { padding: .6rem .75rem; border-bottom: 1px solid #e2e8f0; }
.data-table tr:last-child td { border-bottom: none; }

/* PIN pad */
.pin-dots { display: flex; justify-content: center; gap: 1rem; }
.pin-dots span {
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 999px;
  border: 3px solid var(--space-800);
  transition: background-color .15s ease, transform .15s ease;
}
.pin-dots span.is-filled { background: var(--space-800); transform: scale(1.1); }
.pin-dots.is-error { animation: shake .4s ease; }
.pin-dots.is-error span { border-color: var(--red); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; }
.pin-key {
  height: 4rem;
  border-radius: 1.1rem;
  background: #eff6ff;
  border: 3px solid #bfdbfe;
  box-shadow: 0 5px 0 #93c5fd;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--space-800);
  display: grid;
  place-items: center;
  transition: transform .1s ease;
}
.pin-key:hover { background: #fef9c3; }
.pin-key:active { transform: translateY(3px); box-shadow: 0 1px 0 #93c5fd; }
.pin-key svg { width: 1.6rem; height: 1.6rem; }

/* ---------- Modal & toast ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(6, 13, 41, .75);
  backdrop-filter: blur(4px);
  animation: fade-in .2s ease;
}
.modal-card {
  width: 100%;
  max-width: 26rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  background: #fff;
  border-radius: 2rem;
  padding: 1.75rem;
  box-shadow: 0 12px 0 rgba(0,0,0,.35);
  animation: pop .3s ease;
}

.toast-root {
  position: fixed;
  left: 50%;
  bottom: 6.5rem;
  transform: translateX(-50%);
  z-index: 70;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 2rem);
}
@media (min-width: 1024px) { .toast-root { bottom: 2rem; } }
.toast {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .8rem 1.25rem;
  border-radius: 999px;
  background: var(--space-800);
  color: #fff;
  font-weight: 600;
  border: 2px solid var(--sun);
  box-shadow: 0 8px 20px rgba(0,0,0,.35);
  animation: slide-up .3s ease;
}
.toast svg { width: 1.3rem; height: 1.3rem; color: var(--sun); }
.toast.is-leaving { animation: fade-out .3s ease forwards; }

/* ---------- Confetti / celebration ---------- */
.confetti-piece {
  position: fixed;
  top: -2rem;
  z-index: 80;
  font-size: 1.6rem;
  pointer-events: none;
  animation: confetti-fall linear forwards;
}

/* ---------- Decorative animations ---------- */
.float { animation: float 3.5s ease-in-out infinite; }
.spin-slow { animation: spin 8s linear infinite; }
.bounce-soft { animation: bounce-soft 1.6s ease-in-out infinite; }
.pulse-glow { animation: pulse-glow 2s ease-in-out infinite; }

@keyframes float { 0%, 100% { transform: translateY(0) rotate(-6deg); } 50% { transform: translateY(-14px) rotate(4deg); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes bounce-soft { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes pulse-glow { 0%, 100% { box-shadow: 0 6px 0 #ca8a04, 0 0 0 0 rgba(255,217,61,.6); } 50% { box-shadow: 0 6px 0 #ca8a04, 0 0 0 12px rgba(255,217,61,0); } }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-12deg); } 75% { transform: rotate(12deg); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@keyframes pop { 0% { transform: scale(.85); opacity: .4; } 60% { transform: scale(1.05); opacity: 1; } 100% { transform: scale(1); } }
@keyframes slide-up { from { transform: translateY(16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { to { opacity: 0; transform: translateY(10px); } }
@keyframes confetti-fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: .8; }
}

.view-enter { animation: slide-up .35s ease; }

/* Lucide icon sizing default */
[data-lucide] { width: 1.4rem; height: 1.4rem; }
svg.lucide { flex-shrink: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .confetti-piece { display: none; }
}

/* =========================================================
   Print: badges/certificates and progress report
   ========================================================= */
#print-area { display: none; }

.certificate {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px;
  border: 10px double #1d3a8a;
  border-radius: 24px;
  text-align: center;
  font-family: 'Fredoka', sans-serif;
  color: #0f172a;
  background: #fffdf2;
}
.certificate .cert-title { font-size: 36px; font-weight: 700; color: #1d3a8a; margin: 0; }
.certificate .cert-sub { font-size: 20px; color: #475569; margin: 4px 0 24px; }
.certificate .cert-name { font-size: 40px; font-weight: 700; margin: 16px 0 8px; border-bottom: 3px dashed #94a3b8; display: inline-block; padding: 0 24px 6px; }
.certificate .cert-text { font-size: 20px; line-height: 1.6; margin: 12px 0; }
.certificate .cert-badge-name { font-size: 28px; font-weight: 700; color: #b45309; }
.certificate .cert-footer { display: flex; justify-content: space-between; margin-top: 36px; font-size: 16px; color: #475569; }
.certificate .cert-footer div { border-top: 2px solid #94a3b8; padding-top: 6px; min-width: 200px; }

@media print {
  @page { margin: 14mm; }
  body { background: #fff !important; font-size: 12pt; }
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block !important; }
  .certificate { page-break-inside: avoid; }
}
