.rewards-panel {
  --reward-bg: #111f39;
  --reward-line: #34486a;
  --reward-mint: #48e8df;
  margin-top: clamp(36px, 5vw, 72px);
  padding: clamp(17px, 3vw, 38px);
  border: 1px solid var(--reward-line);
  border-radius: 22px;
  background:
    radial-gradient(ellipse at 10% 0%, #36275c 0%, transparent 59%),
    var(--reward-bg);
}

.rewards-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
  margin-bottom: 15px;
}

.rewards-head h2 {
  margin: 0;
  font-size: clamp(25px, 4vw, 46px);
  line-height: 1.06;
}

.rewards-head p,
.rewards-progress p {
  margin: 0;
  color: var(--muted);
}

.rewards-head strong {
  color: var(--reward-mint);
  font-variant-numeric: tabular-nums;
}

.rewards-progress {
  margin-bottom: 17px;
}

progress.rewards-progress,
.rewards-progress progress {
  appearance: none;
  display: block;
  width: 100%;
  height: 10px;
  overflow: hidden;
  border: 0;
  border-radius: 9px;
  background: #09142a;
  color: var(--reward-mint);
  accent-color: var(--reward-mint);
}

progress.rewards-progress::-webkit-progress-bar,
.rewards-progress progress::-webkit-progress-bar {
  border-radius: 9px;
  background: #09142a;
}

progress.rewards-progress::-webkit-progress-value,
.rewards-progress progress::-webkit-progress-value {
  border-radius: 9px;
  background: linear-gradient(90deg, #b594fa, #48e8df);
  transition: width .3s ease;
}

progress.rewards-progress::-moz-progress-bar,
.rewards-progress progress::-moz-progress-bar {
  border-radius: 9px;
  background: linear-gradient(90deg, #b594fa, #48e8df);
}

.badge-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(9px, 1.4vw, 20px);
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.badge-card {
  --medal-light: #abfff2;
  --medal-accent: #4fe7cf;
  --medal-edge: #198882;
  --medal-ink: #12413f;
  --medal-halo: #44e9bf30;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 6px;
  min-width: 0;
  padding: clamp(13px, 2.3vw, 25px) clamp(7px, 1.5vw, 18px);
  border: 1px solid #34466a;
  border-radius: 16px;
  background: #0d1931;
  text-align: center;
}

.badge-card:nth-child(2) {
  --medal-light: #f0deff;
  --medal-accent: #c5a3ff;
  --medal-edge: #7452a8;
  --medal-ink: #452968;
  --medal-halo: #b993ff38;
}

.badge-card:nth-child(3) {
  --medal-light: #fff0b8;
  --medal-accent: #ffd17c;
  --medal-edge: #b57030;
  --medal-ink: #633509;
  --medal-halo: #ffd17c35;
}

.badge-card.is-unlocked {
  border-color: var(--medal-edge);
  background: radial-gradient(ellipse at 50% 10%, var(--medal-halo), transparent 80%), #0d1931;
}

.badge-medal {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  width: clamp(49px, 8vw, 92px);
  aspect-ratio: 1;
  margin: 3px 0 clamp(12px, 1.6vw, 20px);
  color: var(--medal-ink);
}

.badge-medal::before,
.badge-medal::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.badge-medal::before {
  z-index: -2;
  inset: 67% 7% -36%;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 73% 76%, 51% 100%, 50% 55%, 49% 100%, 27% 76%, 0 100%);
  background: linear-gradient(90deg, var(--medal-edge), var(--medal-accent), var(--medal-edge));
}

.badge-medal::after {
  z-index: -1;
  inset: 0;
  border: 2px solid var(--medal-light);
  border-radius: 50%;
  background: radial-gradient(circle at 32% 20%, var(--medal-light), var(--medal-accent) 57%, var(--medal-edge));
  box-shadow: inset 0 0 0 3px var(--medal-edge), inset 0 0 0 5px #fff4, 0 5px 14px #030b1866;
}

.badge-medal span {
  font-family: "Noto Music", "Apple Symbols", "Segoe UI Symbol", system-ui, sans-serif;
  font-size: clamp(21px, 4.5vw, 51px);
  font-weight: 800;
  line-height: 1;
}

.badge-card:not(.is-unlocked) .badge-medal {
  --medal-light: #7d8db0;
  --medal-accent: #56688f;
  --medal-edge: #34476c;
  --medal-ink: #101e35;
}

.badge-name {
  font-size: clamp(.81rem, 1.6vw, 1.22rem);
  line-height: 1.22;
  overflow-wrap: anywhere;
}

.badge-threshold {
  color: var(--muted);
  font-size: clamp(.72rem, 1.1vw, .92rem);
  line-height: 1.2;
}

.is-unlocked .badge-threshold {
  color: var(--medal-light);
}

.success-card {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 11px clamp(13px, 2.4vw, 27px);
  width: min(100%, 860px);
  margin: 19px auto 0;
  padding: clamp(13px, 2.3vw, 24px);
  overflow: hidden;
  border: 1px solid #57cbb9;
  border-radius: 18px;
  background: radial-gradient(ellipse at 0% 0%, #24555c, transparent 67%), #13243c;
  color: var(--white);
  text-align: left;
}

.success-card::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background:
    radial-gradient(circle at 17% 16%, #bc9cff 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 25% 85%, #6eebd8 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 57% 12%, #ffd894 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 77% 82%, #bc9cff 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 92% 21%, #6eebd8 0 2.5px, transparent 3.5px);
  pointer-events: none;
}

.success-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: clamp(43px, 7vw, 64px);
  aspect-ratio: 1;
  border: 2px solid #a3fff1;
  border-radius: 15px;
  background: linear-gradient(145deg, #c2fff6, #44dfcc);
  color: #0b3e3b;
  font: 800 clamp(23px, 4vw, 36px)/1 system-ui, sans-serif;
  box-shadow: 0 4px 0 #23847e;
}

.success-copy {
  flex: 1 1 140px;
  min-width: 0;
}

.success-copy :is(h2, h3, strong) {
  display: block;
  margin: 0;
  font-size: clamp(21px, 3.2vw, 32px);
  line-height: 1.15;
}

.success-copy p {
  margin: 3px 0 0;
}

.success-points,
.success-badge {
  display: inline-block;
  width: fit-content;
  max-width: 100%;
  padding: 3px 9px;
  border-radius: 7px;
  font-size: .87rem;
  font-weight: 760;
}

.success-points {
  color: #a6fff0;
  background: #123c3e;
  font-variant-numeric: tabular-nums;
}

.success-badge {
  color: #f1e4ff;
  background: #432b65;
}

.feedback .success-card :is(button, .primary) {
  margin: 0;
}

@keyframes badge-success-in {
  0% { opacity: .68; transform: translateY(5px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes badge-success-pop {
  0% { transform: scale(.86) rotate(-9deg); }
  60% { transform: scale(1.08) rotate(3deg); }
  100% { transform: scale(1) rotate(0); }
}

.success-card.is-celebrating {
  animation: badge-success-in .38s ease-out both;
}

.success-card.is-celebrating .success-icon {
  animation: badge-success-pop .48s cubic-bezier(.22,.75,.31,1) both;
}

@media (max-width: 380px) {
  .rewards-panel { padding-inline: 11px; }
  .badge-grid { gap: 6px; }
  .badge-card { padding-inline: 4px; }
  .success-card > :is(button, .primary) { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .success-card.is-celebrating,
  .success-card.is-celebrating .success-icon {
    animation: none;
  }

  progress.rewards-progress::-webkit-progress-value,
  .rewards-progress progress::-webkit-progress-value {
    transition: none;
  }
}

button.score {
  gap: 7px;
  padding: 8px 10px;
  white-space: nowrap;
}
button.score > span:first-child { color: #ffd894; }
.score-label {
  padding-left: 7px;
  border-left: 1px solid #425776;
  color: var(--white);
}
dialog.rewards-panel {
  width: min(760px, calc(100% - 24px));
  max-height: 92dvh;
  margin: auto;
  color: var(--white);
}
dialog.rewards-panel::backdrop { background: #030915d9; }
#rewards-total {
  margin-top: 6px;
  color: var(--reward-mint);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
#rewards-next { margin-bottom: 8px; }
.success-copy { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 7px; }
.success-copy strong { flex-basis: 100%; }
@media (max-width: 520px) {
  .score-label { display: none; }
}
.badge-name { margin-top: 7px; }
