.wgnx-panel {
  --wgnx-ink: #321c18;
  --wgnx-muted: #80655e;
  --wgnx-red: #e8334a;
  --wgnx-red-deep: #a90f24;
  --wgnx-cream: #fff8e8;
  --wgnx-gold: #ffc84a;
  box-sizing: border-box;
  width: 100%;
  margin: 6px 0 2px;
  color: var(--wgnx-ink);
  font-family: "Pretendard", "Noto Sans KR", sans-serif;
}

/* 위 모달이 이미 "최종 점수·스테이지"를 보여주므로 중복 요약줄은 숨겨 폰 높이 절약 */
.wgnx-summary { display: none; }

.wgnx-panel *,
.wgnx-panel *::before,
.wgnx-panel *::after {
  box-sizing: border-box;
}

.wgnx-grade {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 64px;
  margin-bottom: 6px;
  padding: 6px 11px 6px 7px;
  border: 2px solid #321c18;
  border-radius: 17px;
  background: linear-gradient(135deg, #fffaf0, #ffe2e7);
  box-shadow: 3px 3px 0 rgba(50, 28, 24, .18);
  isolation: isolate;
}

.wgnx-grade::after {
  content: "";
  position: absolute;
  z-index: -1;
  top: -70%;
  left: -35%;
  width: 28%;
  height: 240%;
  transform: rotate(24deg);
  background: rgba(255, 255, 255, .55);
  animation: wgnxGradeShine 2.1s ease-in-out infinite;
}

.wgnx-grade-badge {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 3px solid #321c18;
  border-radius: 16px;
  color: #fff;
  font-family: "Jua", "Pretendard", sans-serif;
  font-size: 38px;
  line-height: 1;
  text-shadow: 0 2px 0 rgba(50, 28, 24, .4);
  box-shadow: 3px 3px 0 rgba(50, 28, 24, .24);
  animation: wgnxGradePulse .9s ease-in-out infinite alternate;
}

.wgnx-grade-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
}

.wgnx-grade-label {
  color: var(--wgnx-muted);
  font-size: 11px;
  font-weight: 800;
}

.wgnx-grade-message {
  color: var(--wgnx-red-deep);
  font-family: "Jua", "Pretendard", sans-serif;
  font-size: 19px;
  line-height: 1.2;
}

.wgnx-grade--s { background: linear-gradient(135deg, #fff8c7, #ffd45a); }
.wgnx-grade--s .wgnx-grade-badge { background: linear-gradient(145deg, #ffcb25, #ef7f16); }
.wgnx-grade--a .wgnx-grade-badge { background: linear-gradient(145deg, #ff7043, #d91f42); }
.wgnx-grade--b .wgnx-grade-badge { background: linear-gradient(145deg, #9b6df3, #6540b8); }
.wgnx-grade--c .wgnx-grade-badge { background: linear-gradient(145deg, #38b9bd, #167b89); }
.wgnx-grade--d .wgnx-grade-badge { background: linear-gradient(145deg, #a48c84, #68544d); }

@keyframes wgnxGradePulse {
  from { transform: rotate(-2deg) scale(1); }
  to { transform: rotate(2deg) scale(1.045); }
}

@keyframes wgnxGradeShine {
  0%, 38% { left: -35%; }
  72%, 100% { left: 118%; }
}

.wgnx-summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 0 3px 9px;
}

.wgnx-eyebrow,
.wgnx-goal-label {
  color: var(--wgnx-muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: -.01em;
}

.wgnx-score {
  color: var(--wgnx-red-deep);
  font-family: "Jua", "Pretendard", sans-serif;
  font-size: 18px;
  font-weight: 800;
}

.wgnx-comparisons {
  overflow: hidden;
  margin: 0;
  padding: 0;
  list-style: none;
  border: 2px solid rgba(50, 28, 24, .9);
  border-radius: 16px;
  background: #fff;
  box-shadow: 3px 3px 0 rgba(50, 28, 24, .16);
}

.wgnx-compare-row {
  display: grid;
  grid-template-columns: minmax(92px, .8fr) minmax(0, 1.35fr);
  align-items: center;
  gap: 12px;
  min-height: 30px;
  padding: 4px 12px;
}

.wgnx-compare-row + .wgnx-compare-row {
  border-top: 1px dashed rgba(50, 28, 24, .2);
}

.wgnx-compare-label {
  color: var(--wgnx-muted);
  font-size: 12px;
  font-weight: 800;
}

.wgnx-compare-value {
  min-width: 0;
  color: var(--wgnx-ink);
  font-size: 14px;
  font-weight: 900;
  line-height: 1.35;
  text-align: right;
}

.wgnx-near-miss {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 6px;
  padding: 7px 11px;
  border-radius: 14px;
  background: #fff0f2;
  color: var(--wgnx-red-deep);
}

.wgnx-mode-note {
  margin: 5px 0 0;
  color: var(--wgnx-red-deep);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.3;
  text-align: center;
}

.wgnx-panel--timed30 .wgnx-grade {
  min-height: 74px;
  grid-template-columns: 70px minmax(0, 1fr);
}

.wgnx-panel--timed30 .wgnx-grade-badge {
  width: 62px;
  height: 62px;
  font-size: 45px;
}

.wgnx-panel--timed30 .wgnx-grade-message {
  font-size: 21px;
}

.wgnx-near-badge {
  flex: 0 0 auto;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--wgnx-red);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
}

.wgnx-near-copy {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}

.wgnx-next-goal {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
  padding: 9px 13px;
  border: 2px solid var(--wgnx-red-deep);
  border-radius: 15px;
  background: linear-gradient(135deg, var(--wgnx-cream), #fff1b8);
  box-shadow: 3px 3px 0 rgba(169, 15, 36, .17);
}

.wgnx-next-goal::after {
  content: "";
  position: absolute;
  right: -14px;
  bottom: -22px;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: rgba(255, 200, 74, .3);
}

.wgnx-goal-value {
  position: relative;
  z-index: 1;
  color: var(--wgnx-red-deep);
  font-family: "Jua", "Pretendard", sans-serif;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.25;
  text-align: right;
}

@media (max-width: 380px) {
  .wgnx-summary,
  .wgnx-next-goal {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .wgnx-score,
  .wgnx-goal-value {
    text-align: left;
  }

  .wgnx-compare-row {
    grid-template-columns: 86px minmax(0, 1fr);
    gap: 8px;
    padding-inline: 10px;
  }

  .wgnx-grade {
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 8px;
  }

  .wgnx-grade-badge {
    width: 50px;
    height: 50px;
    font-size: 35px;
  }

  .wgnx-grade-message { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  .wgnx-panel *,
  .wgnx-panel *::before,
  .wgnx-panel *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }

  .wgnx-grade::after { display: none; }
}
