.btn {
  min-height: 52px;
  padding: 13px 22px;
  border: 0;
  border-radius: 18px;
  color: var(--ink);
  font-weight: 1000;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.14), 0 8px 0 rgba(38, 50, 56, 0.12);
  transition: transform 150ms ease, box-shadow 150ms ease, filter 150ms ease;
}

.btn:hover, .btn:focus-visible, .icon-button:hover, .sound-toggle:hover {
  transform: translateY(-2px);
  filter: saturate(1.08);
}

.btn:active {
  transform: translateY(4px);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.14), 0 2px 0 rgba(38, 50, 56, 0.12);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.btn-primary { background: var(--orange); color: white; }
.btn-secondary { background: var(--blue); color: white; }
.btn-ghost { background: white; }

.category-card {
  position: relative;
  min-height: 166px;
  padding: 18px;
  border: var(--border);
  border-radius: 26px;
  overflow: hidden;
  text-align: left;
  color: var(--ink);
  background: white;
  box-shadow: 0 10px 0 rgba(38, 50, 56, 0.1);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.category-card:hover, .category-card:focus-visible {
  transform: translateY(-6px) rotate(-1deg);
  box-shadow: 0 16px 0 rgba(38, 50, 56, 0.1);
}

.category-card .icon {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  margin-bottom: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
  font-size: 1.8rem;
}

.category-card h3 {
  margin-bottom: 8px;
  font-size: 1.35rem;
}

.category-card p {
  margin: 0;
  font-weight: 800;
}

.category-card::after {
  content: "";
  position: absolute;
  right: -22px;
  bottom: -22px;
  width: 90px;
  height: 90px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.35);
  transform: rotate(18deg);
}

.answer-area {
  display: grid;
  gap: 12px;
}

.answer-button {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 62px;
  padding: 13px 16px;
  border: 3px solid rgba(38, 50, 56, 0.1);
  border-radius: 20px;
  background: white;
  color: var(--ink);
  text-align: left;
  font-weight: 900;
  box-shadow: 0 6px 0 rgba(38, 50, 56, 0.08);
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.answer-button:hover, .answer-button:focus-visible {
  transform: translateX(4px);
  border-color: rgba(32, 164, 243, 0.55);
  background: #f0faff;
}

.answer-button.is-selected {
  border-color: var(--blue);
  background: #e9f7ff;
}

.answer-button.is-correct {
  border-color: var(--mint);
  background: #eafff3;
}

.answer-button.is-wrong {
  border-color: var(--red);
  background: #fff0f1;
  animation: shake 220ms ease;
}

.answer-key {
  display: grid;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 12px;
  background: var(--yellow);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.12);
}

.order-list, .matching-grid {
  display: grid;
  gap: 10px;
}

.order-item {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 12px;
  border-radius: 18px;
  background: white;
  border: 3px solid rgba(38, 50, 56, 0.1);
}

.order-item select {
  min-width: 66px;
  padding: 8px;
  border: 2px solid rgba(38, 50, 56, 0.16);
  border-radius: 12px;
  font-weight: 900;
}

.match-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 0.8fr);
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-radius: 18px;
  background: white;
  border: 3px solid rgba(38, 50, 56, 0.1);
  font-weight: 900;
}

.match-row select {
  width: 100%;
  padding: 10px;
  border: 2px solid rgba(38, 50, 56, 0.16);
  border-radius: 12px;
  font-weight: 900;
}

.feedback-panel {
  margin-top: 18px;
  padding: 16px;
  border-radius: 22px;
  border: 3px solid rgba(38, 50, 56, 0.1);
  background: #fff7c7;
  font-weight: 850;
}

.feedback-panel strong {
  display: block;
  margin-bottom: 8px;
  font-family: "Baloo 2", system-ui, sans-serif;
  font-size: 1.45rem;
}

.feedback-panel.correct { background: #eafff3; }
.feedback-panel.wrong { background: #fff0f1; }

.result-card {
  max-width: 920px;
  margin: 0 auto;
  padding: clamp(22px, 5vw, 42px);
  border-radius: 34px;
  text-align: center;
}

.score-ring {
  display: grid;
  width: 178px;
  height: 178px;
  place-items: center;
  margin: 24px auto;
  border: 16px solid var(--yellow);
  border-radius: 50%;
  background: white;
  box-shadow: inset 0 0 0 10px #e9f7ff, 0 12px 0 rgba(38, 50, 56, 0.1);
  font-family: "Baloo 2", system-ui, sans-serif;
  font-size: 2rem;
  font-weight: 900;
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 24px 0;
  text-align: left;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.badge-unlocks {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.badge-toast {
  padding: 14px;
  border-radius: 18px;
  background: #fff1a6;
  font-weight: 1000;
  animation: bounceIn 500ms ease both;
}

.profile-panel {
  grid-row: span 2;
  padding: 24px;
  border-radius: 26px;
}

.avatar-badge {
  display: grid;
  width: 74px;
  height: 74px;
  place-items: center;
  margin-bottom: 14px;
  border-radius: 24px;
  background: var(--blue);
  font-size: 2.2rem;
  box-shadow: inset 0 -8px 0 rgba(0, 0, 0, 0.13);
}

.avatar-badge img {
  width: 66px;
  height: 66px;
  display: block;
}

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

.panel {
  padding: 22px;
  border-radius: 26px;
}

.panel:first-child {
  grid-row: span 2;
}

.category-progress {
  display: grid;
  gap: 12px;
}

.progress-row {
  display: grid;
  grid-template-columns: minmax(180px, 0.5fr) minmax(0, 1fr) 56px;
  gap: 10px;
  align-items: center;
  font-weight: 900;
}

.progress-topic, .recommendation-topic {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.topic-icon {
  display: inline-grid;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 12px;
  background: #fff1a6;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.1);
}

.progress-mini {
  height: 14px;
  border-radius: 999px;
  background: #edf1f3;
  overflow: hidden;
}

.progress-mini span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--orange), var(--mint));
}

.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}

.badge {
  min-height: 112px;
  padding: 12px;
  border-radius: 20px;
  background: #f2f5f7;
  text-align: center;
  font-weight: 1000;
  filter: grayscale(1);
  opacity: 0.6;
}

.badge.is-earned {
  background: linear-gradient(145deg, #fff1a6, #e9f7ff);
  filter: none;
  opacity: 1;
  animation: badgePulse 2.4s ease-in-out infinite;
}

.badge-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  margin: 0 auto 8px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  font-size: 1.8rem;
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.08);
}

.recommendations {
  display: grid;
  gap: 10px;
}

.recommendation {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 18px;
  background: #f5fbff;
  font-weight: 900;
}

.mini-chart {
  display: flex;
  align-items: end;
  gap: 8px;
  min-height: 140px;
  padding: 18px;
}

.candle {
  width: 28px;
  border-radius: 8px;
  background: var(--mint);
  position: relative;
}

.candle.red { background: var(--red); }
.candle::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -22px;
  bottom: -22px;
  width: 4px;
  border-radius: 999px;
  background: inherit;
  transform: translateX(-50%);
}

.confetti {
  position: absolute;
  top: -20px;
  width: 12px;
  height: 18px;
  border-radius: 4px;
  animation: confettiFall 950ms ease-in forwards;
}

@media (max-width: 760px) {
  .learning-layout, .insight-grid { grid-template-columns: 1fr; }
  .panel:first-child { grid-row: auto; }
  .match-row { grid-template-columns: 1fr; }
  .progress-row { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .answer-area {
    gap: 8px;
  }

  .answer-button {
    gap: 9px;
    min-height: 46px;
    padding: 8px 10px;
    border-width: 2px;
    border-radius: 15px;
    font-size: 0.88rem;
    line-height: 1.18;
    box-shadow: 0 4px 0 rgba(38, 50, 56, 0.08);
  }

  .answer-key {
    width: 28px;
    height: 28px;
    border-radius: 9px;
    font-size: 0.82rem;
  }

  .feedback-panel {
    margin-top: 10px;
    padding: 10px 12px;
    border-width: 2px;
    border-radius: 16px;
    font-size: 0.86rem;
    line-height: 1.32;
  }

  .feedback-panel strong {
    margin-bottom: 4px;
    font-size: 1.08rem;
  }

  .quiz-controls .btn {
    min-height: 42px;
    padding: 9px 8px;
    border-radius: 14px;
    font-size: 0.82rem;
  }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  35% { transform: translateX(-6px); }
  70% { transform: translateX(6px); }
}

@keyframes bounceIn {
  0% { opacity: 0; transform: scale(0.85); }
  70% { transform: scale(1.04); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes badgePulse {
  50% { transform: translateY(-3px) rotate(1deg); }
}

@keyframes confettiFall {
  to { transform: translateY(105vh) rotate(680deg); opacity: 0; }
}
