:root {
  --pink: #ffd6e7;
  --lavender: #e6dcff;
  --mint: #d9f7e2;
  --sky: #dcebff;
  --peach: #ffe8d6;
  --ink: #6b5b85;
  --ink-soft: #9a8bb4;
  --card: rgba(255, 255, 255);
  --shadow: 0 18px 40px rgba(140, 110, 180, 0.18);
  --radius: 26px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: "Trebuchet MS", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: linear-gradient(155deg, var(--pink), var(--lavender) 45%, var(--sky) 80%, var(--mint));
  background-attachment: fixed;
  overflow-x: hidden;
  display: flex;
  justify-content: center;
  padding: 24px 16px 40px;
}

/* ---------- cute background ---------- */

.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; }

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(46px);
  opacity: 0.6;
  animation: drift 16s ease-in-out infinite alternate;
}
.b1 { width: 340px; height: 340px; background: #ffc8de; top: -80px; left: -90px; }
.b2 { width: 300px; height: 300px; background: #c9b8ff; bottom: -70px; right: -70px; animation-duration: 20s; }
.b3 { width: 260px; height: 260px; background: #bfe9ff; top: 38%; left: 62%; animation-duration: 24s; opacity: 0.45; }

@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(34px, -26px) scale(1.12); }
}

.dot {
  position: absolute;
  background: rgba(255, 255, 255, 0.75);
  border-radius: 50%;
  animation: twinkle 5s ease-in-out infinite;
}
.d1 { width: 12px; height: 12px; top: 12%; left: 16%; }
.d2 { width: 7px;  height: 7px;  top: 28%; left: 78%; animation-delay: 0.8s; }
.d3 { width: 10px; height: 10px; top: 66%; left: 9%;  animation-delay: 1.4s; }
.d4 { width: 6px;  height: 6px;  bottom: 18%; left: 58%; animation-delay: 2s; }
.d5 { width: 14px; height: 14px; top: 8%;  right: 14%; animation-delay: 2.6s; }
.d6 { width: 8px;  height: 8px;  bottom: 12%; right: 26%; animation-delay: 1s; }
.d7 { width: 5px;  height: 5px;  top: 50%; left: 88%; animation-delay: 3.1s; }
.d8 { width: 9px;  height: 9px;  top: 84%; left: 34%; animation-delay: 1.8s; }

@keyframes twinkle {
  0%, 100% { transform: scale(1);   opacity: 0.75; }
  50%      { transform: scale(1.45); opacity: 0.35; }
}

/* ---------- layout ---------- */

.wrap {
  width: min(460px, 100%);
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
}

.deck-header { text-align: center; }

.deck-header h1 {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #7c6aa0;
}

.subtitle { color: var(--ink-soft); margin-top: 4px; font-size: 0.95rem; }

.flashcard {
  width: 100%;
  height: 340px;
  perspective: 1400px;
  cursor: pointer;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.65s cubic-bezier(0.4, 0.1, 0.2, 1);
}

.flashcard.flipped .card-inner { transform: rotateY(180deg); }

.face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 28px;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.face.back { transform: rotateY(180deg); }

.label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  padding: 5px 14px;
  border-radius: 999px;
  color: #fff;
}
.label--today { background: linear-gradient(135deg, #ff9ec6, #c3a6ff); }
.label--answer { background: linear-gradient(135deg, #7ed7a2, #8ec5ff); }

.big-text {
  font-size: 1.7rem;
  font-weight: 700;
  text-align: center;
  color: #6a5790;
  word-break: break-word;
}

.hint { color: var(--ink-soft); font-size: 0.85rem; font-style: italic; }

.actions { display: flex; gap: 12px; }

.btn {
  border: none;
  border-radius: 999px;
  padding: 12px 22px;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(120, 95, 170, 0.25);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.05); }
.btn:active { transform: translateY(0); }
.btn--right { background: linear-gradient(135deg, #6fdd9a, #43c07e); }
.btn--wrong { background: linear-gradient(135deg, #ff9f9f, #f87e94); }
.btn--next {
  background: linear-gradient(135deg, #9ec0ff, #b58bff);
  font-size: 1.05rem;
  padding: 14px 34px;
}

.play-area { width: 100%; text-align: center; }

.weight-badge {
  margin-top: 14px;
  font-size: 0.8rem;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.5);
  padding: 4px 14px;
  border-radius: 999px;
  display: inline-block;
}

/* ---------- feedback ---------- */

.feedback {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  animation: pop 0.4s cubic-bezier(0.3, 1.6, 0.4, 1);
}

.feedback-msg {
  font-size: 1.15rem;
  font-weight: 700;
  padding: 10px 22px;
  border-radius: 999px;
}
.feedback.good .feedback-msg { background: #dcfbe6; color: #2f9e63; }
.feedback.meh .feedback-msg  { background: #ffe4e9; color: #d95d77; }

[hidden] { display: none !important; }

@keyframes pop {
  from { transform: scale(0.85); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* ---------- confetti ---------- */

.confetti {
  position: fixed;
  top: -18px;
  width: 11px;
  height: 16px;
  z-index: 60;
  border-radius: 3px;
  animation: fall linear forwards;
}

@keyframes fall {
  to { transform: translateY(110vh) rotate(720deg); opacity: 0.85; }
}

/* ---------- error / loading ---------- */

.status-note {
  margin-top: 8px;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

@media (max-width: 420px) {
  .flashcard { height: 300px; }
  .big-text { font-size: 1.4rem; }
}
