.result-screen {
  --result-gold: #ffe16a;
  --result-cyan: #55e9ff;
  --result-violet: #8d5cff;
  --result-red: #ff5266;
  --result-green: #4be39c;
  height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  scroll-behavior: smooth;
  padding: max(10px, env(safe-area-inset-top)) 14px max(24px, env(safe-area-inset-bottom));
  position: relative;
  max-width: 480px;
  margin: 0 auto;
  box-sizing: border-box;
  background:
    radial-gradient(circle at 50% 18%, color-mix(in srgb, var(--diagnosis-accent, #8d5cff) 30%, transparent), transparent 36%),
    linear-gradient(180deg, #05081c 0%, #0d1246 45%, #050715 100%);
}

.result-screen::before {
  content: "";
  position: fixed;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  opacity: .18;
  background-image:
    linear-gradient(90deg, transparent 0 49%, rgba(95, 103, 255, .2) 50%, transparent 51%),
    linear-gradient(0deg, transparent 0 49%, rgba(95, 103, 255, .14) 50%, transparent 51%);
  background-size: 32px 32px;
  mask-image: linear-gradient(180deg, #000 0 50%, transparent 92%);
}

/* ========================================================= */
/* Header / Top Lockup                                       */
/* ========================================================= */
.result-top {
  position: relative;
  z-index: 2;
  display: grid;
  justify-items: center;
  gap: 1px;
  min-height: 64px;
  margin-bottom: 8px;
  text-align: center;
}

.result-top::before,
.result-top::after {
  content: "";
  position: absolute;
  top: 26px;
  width: 42px;
  height: 11px;
  border-top: 2px solid color-mix(in srgb, var(--diagnosis-accent, #8d5cff) 70%, #8d5cff);
  border-bottom: 1px solid rgba(85, 233, 255, .5);
  opacity: .75;
}

.result-top::before {
  left: 4px;
  border-left: 2px solid color-mix(in srgb, var(--diagnosis-accent, #8d5cff) 70%, #8d5cff);
  transform: skewX(-18deg);
}

.result-top::after {
  right: 4px;
  border-right: 2px solid color-mix(in srgb, var(--diagnosis-accent, #8d5cff) 70%, #8d5cff);
  transform: skewX(18deg);
}

.campaign-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #bd9cff;
  font-size: 8px;
  font-weight: 950;
  letter-spacing: .15em;
  text-transform: uppercase;
}

.campaign-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--result-cyan);
  box-shadow: 0 0 8px var(--result-cyan);
}

.result-brand-lockup {
  display: grid;
  justify-items: center;
  margin-top: -2px;
}

.result-brand-lockup img {
  display: block;
  width: 148px;
  height: 42px;
  object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(151, 69, 255, .7));
}

.result-brand-lockup span {
  display: none;
}

/* ========================================================= */
/* LAYER 1: Hero Diagnosis Certificate Card (.result-card)   */
/* ========================================================= */
.result-card {
  position: relative;
  z-index: 1;
  overflow: hidden;
  border: 2px solid color-mix(in srgb, var(--diagnosis-accent, #7e5eff) 75%, #ffe16a);
  border-radius: 20px;
  padding: 13px 12px 14px;
  text-align: center;
  background: linear-gradient(160deg, rgba(18, 22, 75, 0.98), rgba(5, 8, 32, 0.99));
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.55),
    0 0 32px color-mix(in srgb, var(--diagnosis-accent, #7e5eff) 25%, transparent),
    inset 0 1px 0 rgba(255, 231, 122, 0.25),
    inset 0 0 20px rgba(85, 233, 255, 0.08);
  clip-path: polygon(0 12px, 12px 0, calc(100% - 12px) 0, 100% 12px, 100% calc(100% - 12px), calc(100% - 12px) 100%, 12px 100%, 0 calc(100% - 12px));
}

.result-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .16;
  background-image:
    linear-gradient(135deg, transparent 44%, rgba(105, 90, 255, .5) 45% 55%, transparent 56%),
    linear-gradient(90deg, transparent 0 49%, rgba(85, 233, 255, .2) 50%, transparent 51%);
  background-size: 48px 48px, 24px 24px;
  mask-image: linear-gradient(180deg, #000, transparent 72%);
}

.result-card::after {
  content: "";
  position: absolute;
  top: 120px;
  left: 50%;
  width: 290px;
  height: 290px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--diagnosis-accent, #8d5cff) 24%, transparent), transparent 66%);
  pointer-events: none;
}

.result-card[data-diagnosis="smooth-speaker"],
.result-card[data-diagnosis="smooth-progress"],
.result-card.is-positive {
  border-color: rgba(255, 225, 106, .92);
  background: linear-gradient(155deg, rgba(32, 25, 84, .98), rgba(7, 15, 48, .99));
  box-shadow: 0 16px 42px rgba(0, 0, 0, .5), 0 0 36px rgba(255, 225, 106, .25);
}

.result-card.is-boss-cleared {
  border-color: rgba(255, 218, 91, .98);
  box-shadow: 0 18px 46px rgba(0, 0, 0, .56), 0 0 42px rgba(255, 205, 65, .3), inset 0 0 24px rgba(255, 224, 111, .08);
}

.result-card.is-boss-pending {
  border-color: color-mix(in srgb, var(--diagnosis-accent, #8d5cff) 82%, #d8cbff);
  box-shadow: 0 18px 46px rgba(0, 0, 0, .58), 0 0 34px rgba(116, 79, 220, .28), inset 0 0 24px rgba(157, 126, 255, .08);
}

.result-card-glow {
  position: absolute;
  z-index: 0;
  inset: auto -80px -120px;
  height: 240px;
  background: radial-gradient(ellipse, rgba(52, 213, 255, .16), transparent 65%);
  pointer-events: none;
}

.result-card-head {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 24px;
  padding: 0 2px 7px;
  border-bottom: 1px solid rgba(189, 156, 255, .26);
}

.result-card-label {
  color: #d2c4ec;
  font-size: 8.5px;
  font-weight: 900;
  letter-spacing: .15em;
}

.result-card-stamp {
  padding: 3px 8px;
  border: 1px solid rgba(85, 233, 255, .7);
  border-radius: 4px;
  color: #07153c;
  background: linear-gradient(135deg, var(--result-cyan), #a4f5ff);
  box-shadow: 0 0 12px rgba(85, 233, 255, .28);
  font-size: 8px;
  font-weight: 950;
}

/* Cinnabar Red Wooden Seal Stamp with 3D Slam-Down Animation */
.result-seal {
  position: absolute;
  z-index: 4;
  top: 42px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 66px;
  min-height: 66px;
  padding: 8px;
  transform: rotate(5deg);
  border: 2.5px solid #bd2833;
  border-radius: 50%;
  color: #9c1d27;
  background: #fff5df;
  box-shadow:
    0 4px 0 rgba(90, 15, 25, 0.65),
    0 0 18px rgba(255, 215, 0, 0.5),
    inset 0 0 0 1px rgba(189, 40, 51, 0.35);
  font-family: "Noto Serif TC", "Songti TC", serif;
  font-size: 14px;
  font-weight: 950;
  line-height: 1.15;
  letter-spacing: 0.04em;
  animation: sealStampSlam 620ms cubic-bezier(0.175, 0.885, 0.32, 1.28) forwards;
}

.result-seal::before {
  content: "✓";
  display: block;
  margin-bottom: 1px;
  font-family: system-ui, sans-serif;
  font-size: 17px;
  line-height: 1;
}

.result-seal.is-pending {
  animation: none;
  color: #e8ddff;
  border-style: dashed;
  border-color: rgba(190, 171, 255, .92);
  background: rgba(43, 28, 91, .94);
  box-shadow: 0 0 18px rgba(141, 92, 255, .34);
  transform: rotate(-4deg);
}

.result-seal.is-pending::before {
  content: "◇";
}

@keyframes sealStampSlam {
  0% {
    opacity: 0;
    transform: scale(3.2) rotate(-22deg);
    filter: blur(7px);
    box-shadow: 0 0 40px rgba(255, 215, 0, 0.9), 0 0 28px rgba(230, 40, 60, 0.8);
  }
  65% {
    opacity: 1;
    transform: scale(0.9) rotate(7deg);
    filter: blur(0);
    box-shadow: 0 4px 0 rgba(90, 15, 25, 0.8), 0 0 32px rgba(255, 215, 0, 0.85);
  }
  82% {
    transform: scale(1.05) rotate(4deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(5deg);
    box-shadow: 0 4px 0 rgba(90, 15, 25, 0.65), 0 0 18px rgba(255, 215, 0, 0.5);
  }
}

.result-hero {
  position: relative;
  z-index: 2;
  padding-top: 6px;
}

.result-label {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 2px 8px;
  border: 1px solid color-mix(in srgb, var(--diagnosis-accent, #8d5cff) 42%, transparent);
  border-radius: 999px;
  color: #d7cdff;
  background: color-mix(in srgb, var(--diagnosis-accent, #8d5cff) 15%, rgba(4, 8, 34, .72));
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .12em;
}

.result-card h3 {
  position: relative;
  z-index: 2;
  margin: 4px 36px 1px;
  color: #fff8df;
  font-size: clamp(28px, 8.2vw, 36px);
  line-height: 1.08;
  letter-spacing: .04em;
  text-shadow: 0 0 20px color-mix(in srgb, var(--diagnosis-accent, #8d5cff) 54%, transparent);
}

#result-ghost-title {
  position: relative;
  z-index: 2;
  margin: 0;
  color: var(--result-gold);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
}

.result-hero-stage {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  height: clamp(238px, 32vh, 282px);
  margin-top: 4px;
}

.result-ghost-icon {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: min(75vw, 278px);
  height: 100%;
  font-size: 0;
  background: radial-gradient(circle, color-mix(in srgb, var(--diagnosis-accent, #bd9cff) 34%, transparent), rgba(141, 92, 255, .05) 59%, transparent 70%);
}

.result-ghost-image {
  display: block;
  width: min(69vw, 258px);
  height: 108%;
  object-fit: contain;
  object-position: center bottom;
  padding: 0 0 4px;
  opacity: 1;
  transition: opacity 160ms ease-out;
  filter: drop-shadow(0 0 18px color-mix(in srgb, var(--diagnosis-accent, #7c54ff) 78%, transparent));
}

.result-ghost-image.is-loading {
  opacity: 0;
}

.result-ghost-icon.is-charm {
  width: min(70vw, 250px);
  background: radial-gradient(circle, rgba(255, 225, 106, .34), rgba(85, 233, 255, .09) 56%, transparent 72%);
}

.result-ghost-icon.is-charm .result-ghost-image {
  width: min(40vw, 148px);
  filter: drop-shadow(0 0 21px rgba(255, 225, 106, .9));
}

.result-hero-flame {
  display: none;
}

.result-index {
  position: relative;
  z-index: 3;
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 7px;
  min-width: 176px;
  margin-top: 8px;
  padding: 5px 13px 6px;
  border: 1px solid color-mix(in srgb, var(--diagnosis-accent, #8d5cff) 52%, transparent);
  border-radius: 6px;
  transform: skewX(-5deg);
  background: rgba(5, 9, 38, .9);
  box-shadow: 0 0 20px color-mix(in srgb, var(--diagnosis-accent, #8d5cff) 20%, transparent);
  backdrop-filter: blur(10px);
}

.result-index span {
  color: #d4c9e5;
  font-size: 9px;
  font-weight: 800;
}

.result-index > * {
  transform: skewX(5deg);
}

.result-index strong {
  color: var(--result-cyan);
  font-size: 18px;
  line-height: 1;
  text-shadow: 0 0 14px rgba(85, 233, 255, .35);
}

.result-index b {
  font-size: 30px;
}

.result-card.is-positive .result-index strong {
  color: var(--result-gold);
}

.result-description {
  position: relative;
  z-index: 2;
  max-width: 320px;
  min-height: 26px;
  margin: 6px auto 0 !important;
  color: #c8bdd2;
  font-size: 10.5px;
  line-height: 1.45;
}

.collective-evidence {
  position: relative;
  z-index: 2;
  margin: 12px 16px 0;
  padding: 10px 12px;
  border: 1px solid rgba(85, 233, 255, .28);
  border-radius: 12px;
  color: #dffbff;
  background: linear-gradient(135deg, rgba(85, 233, 255, .11), rgba(127, 89, 255, .12));
  font-size: 10.5px;
  font-weight: 850;
  line-height: 1.45;
  text-align: center;
}

/* 3 Core Stats Chips */
.result-stats {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 9px;
}

.result-story-block {
  margin: 12px 16px 0;
  padding: 10px 12px;
  border-left: 2px solid var(--result-gold);
  background: rgba(255, 216, 90, .07);
  text-align: left;
}

.result-story-block > span {
  display: block;
  margin-bottom: 3px;
  color: #8fefff;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .12em;
}

.result-story-review {
  margin: 0;
  padding: 0;
  color: #fff3c4;
  font-size: 12px;
  line-height: 1.55;
}

.result-stats .stat-chip,
.result-stats div {
  display: grid;
  gap: 1px;
  min-width: 0;
  padding: 8px 2px 7px;
  border: 1px solid rgba(118, 120, 255, .44);
  border-radius: 9px;
  background: linear-gradient(160deg, rgba(17, 22, 72, .82), rgba(4, 8, 32, .78));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 0 12px rgba(67, 68, 189, .1);
}

.result-stats strong {
  color: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 16px;
  line-height: 1.15;
}

.result-stats span {
  overflow: hidden;
  color: #d7cced;
  font-size: 8px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-stats small {
  color: #9187ae;
  font-size: 7px;
}

#result-score {
  font-size: clamp(17px, 5vw, 21px);
  letter-spacing: -.02em;
  white-space: nowrap;
}

/* ========================================================= */
/* LAYER 2: Primary Action Buttons (.result-actions)         */
/* ========================================================= */
.result-actions {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.result-search-cue {
  margin: 3px 4px 0;
  color: #b9afd5;
  font-size: clamp(10px, 3vw, 12px);
  font-weight: 750;
  line-height: 1.45;
  text-align: center;
}

@keyframes result-content-reveal {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-screen:not(.hidden) .result-hero-stage,
.result-screen:not(.hidden) .result-outcome-orb,
.result-screen:not(.hidden) #result-ghost-name,
.result-screen:not(.hidden) .result-description,
.result-screen:not(.hidden) .result-stats,
.result-screen:not(.hidden) .result-boss-summary,
.result-screen:not(.hidden) .collective-evidence,
.result-screen:not(.hidden) .retry-result-button,
.result-screen:not(.hidden) .result-actions,
.result-screen:not(.hidden) .result-search-cue {
  opacity: 0;
  animation: result-content-reveal .42s ease-out forwards;
}

.result-screen:not(.hidden) .result-outcome-orb { animation-delay: .08s; }
.result-screen:not(.hidden) #result-ghost-name { animation-delay: .16s; }
.result-screen:not(.hidden) .result-description { animation-delay: .24s; }
.result-screen:not(.hidden) .result-stats,
.result-screen:not(.hidden) .result-boss-summary { animation-delay: .36s; }
.result-screen:not(.hidden) .collective-evidence { animation-delay: .48s; }
.result-screen:not(.hidden) .retry-result-button { animation-delay: .56s; }
.result-screen:not(.hidden) .result-actions,
.result-screen:not(.hidden) .result-search-cue { animation-delay: .66s; }

.retry-result-button {
  min-height: 54px;
  border: 0;
  border-radius: 16px;
  display: grid;
  gap: 1px;
  place-items: center;
  color: #1a0c00;
  background: linear-gradient(135deg, #ffe16a 0%, #ffad28 50%, #ff8300 100%);
  box-shadow:
    0 8px 24px rgba(255, 160, 20, 0.42),
    0 0 18px rgba(255, 225, 106, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
  cursor: pointer;
  transition: transform .15s ease, filter .15s ease, box-shadow .15s ease;
}

.retry-result-button span {
  font-size: 24px;
  font-weight: 950;
  letter-spacing: .03em;
  color: #1c0f00;
}

.retry-result-button small {
  color: #4a2d04;
  font-size: 9.5px;
  font-weight: 750;
}

.retry-result-button:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
  box-shadow:
    0 12px 30px rgba(255, 160, 20, 0.55),
    0 0 24px rgba(255, 225, 106, 0.55);
}

.retry-result-button:active {
  transform: translateY(1px) scale(0.985);
  box-shadow: 0 4px 12px rgba(255, 160, 20, 0.35);
}

.retry-result-button:focus-visible {
  outline: 2px solid var(--result-cyan);
  outline-offset: 3px;
}

.button-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.share-result-button {
  min-height: 56px;
  padding: 0 8px;
  border: 1px solid rgba(141, 92, 255, 0.5);
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(135deg, rgba(120, 92, 255, 0.85), rgba(61, 92, 215, 0.85));
  box-shadow: 0 6px 16px rgba(90, 45, 168, 0.28);
  font-size: 18px;
  font-weight: 850;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform .15s ease, filter .15s ease, box-shadow .15s ease, background .15s ease;
}

.share-result-button span {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: .04em;
}

.share-result-button:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
  box-shadow: 0 8px 20px rgba(90, 45, 168, 0.4);
}

.share-result-button:active {
  transform: translateY(1px) scale(0.98);
}

.share-result-button:focus-visible {
  outline: 2px solid var(--result-cyan);
  outline-offset: 2px;
}

.text-button {
  min-height: 48px;
  border: 1px solid rgba(189, 156, 255, 0.28);
  border-radius: 13px;
  color: #ddd3e7;
  background: rgba(255, 255, 255, 0.06);
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s ease, border-color .15s ease, transform .15s ease, color .15s ease;
}

.text-button:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
  transform: translateY(-1px);
}

.text-button:active {
  transform: translateY(1px) scale(0.98);
  background: rgba(255, 255, 255, 0.08);
}

.text-button:focus-visible {
  outline: 2px solid var(--result-cyan);
  outline-offset: 2px;
}

/* ========================================================= */
/* LAYER 3: Immediate Mistake & Remedy Review Card           */
/* ========================================================= */
.result-mistakes-card {
  position: relative;
  z-index: 2;
  margin-top: 12px;
  padding: 13px 12px 14px;
  border: 1px solid rgba(138, 120, 255, 0.36);
  border-radius: 20px;
  background: linear-gradient(155deg, rgba(14, 18, 58, 0.94), rgba(5, 8, 30, 0.98));
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.4);
  scroll-margin-top: 10px;
}

.mistakes-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(189, 156, 255, 0.2);
}

.mistakes-title-wrap {
  display: grid;
  gap: 2px;
  text-align: left;
}

.mistakes-title {
  margin: 0;
  color: #fff8df;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: .02em;
}

.mistakes-completed-tag {
  flex-shrink: 0;
  color: #cfc5e5;
  font-size: 12px;
}

.mistakes-completed-tag b {
  color: var(--result-gold);
  font-size: 16px;
}

/* Compact result analysis */
.result-mistake-list {
  display: grid;
  margin-top: 12px;
}

.mistake-summary-overview {
  display: grid;
  gap: 11px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(8, 12, 42, 0.82);
  border: 1px solid rgba(189, 156, 255, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  text-align: left;
}

.mistake-summary-lead {
  margin: 0;
  color: #f8f3ff;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.55;
}

.mistake-summary-breakdown {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.mistake-summary-breakdown span {
  padding: 5px 8px;
  border: 1px solid rgba(255, 115, 139, .28);
  border-radius: 999px;
  color: #ffdce3;
  background: rgba(255, 78, 106, .1);
  font-size: 13px;
  font-weight: 750;
}

.mistake-summary-breakdown b {
  color: #ff8fa1;
}

.mistake-summary-example {
  display: grid;
  gap: 6px;
  padding: 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .035);
}

.mistake-summary-example small {
  color: #b9aee0;
  font-size: 11px;
  font-weight: 850;
}

.mistake-summary-example p {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 6px;
  margin: 0;
  color: #ffd8de;
  font-size: 14px;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.mistake-summary-example p span {
  color: #ff8595;
  font-size: 11px;
  font-weight: 900;
}

.mistake-summary-example p.is-correct {
  color: #dffffb;
  font-size: 16px;
  font-weight: 900;
}

.mistake-summary-example p.is-correct span {
  color: #79f1ff;
}

.mistake-summary-example em {
  padding-left: 8px;
  border-left: 3px solid rgba(255, 225, 106, .75);
  color: #efe8cf;
  font-size: 12px;
  font-style: normal;
  line-height: 1.5;
}

.mistake-summary-scope {
  margin: 0;
  color: #a9a0c2;
  font-size: 12px;
  line-height: 1.5;
}

.mistake-review-details {
  border-top: 1px solid rgba(158, 133, 232, .24);
  padding-top: 8px;
}

.mistake-review-details summary {
  min-height: 42px;
  display: grid;
  place-items: center;
  cursor: pointer;
  border: 1px solid rgba(85, 233, 255, .48);
  border-radius: 10px;
  color: #bff8ff;
  background: rgba(12, 43, 72, .58);
  font-size: 13px;
  font-weight: 900;
  list-style-position: inside;
}

.mistake-review-items {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.mistake-review-groups {
  display: grid;
  gap: 16px;
  margin-top: 10px;
}

.mistake-review-group {
  display: grid;
  gap: 9px;
}

.mistake-review-group h4 {
  margin: 0;
  color: #d7c7ff;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .02em;
}

.mistake-review-group .mistake-review-items { margin-top: 0; }

.mistake-review-item {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid rgba(142, 117, 225, .28);
  border-radius: 10px;
  background: rgba(5, 9, 34, .72);
}

.mistake-review-item small { color: #b9aee0; font-size: 11px; font-weight: 850; }
.mistake-review-item p { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 6px; margin: 0; color: #ffd8de; font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.mistake-review-item p span { color: #ff8595; font-size: 11px; font-weight: 900; }
.mistake-review-item p.is-correct { color: #dffffb; font-size: 15px; font-weight: 900; }
.mistake-review-item p.is-correct span { color: #79f1ff; }
.mistake-review-item em { padding-left: 8px; border-left: 3px solid rgba(255, 225, 106, .75); color: #efe8cf; font-size: 12px; font-style: normal; line-height: 1.5; }

/* Zero Mistakes Praise Card */
.result-zero-mistakes {
  display: grid;
  gap: 5px;
  place-items: center;
  padding: 16px 12px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(255, 225, 106, 0.14), rgba(85, 233, 255, 0.09));
  border: 1.5px solid rgba(255, 225, 106, 0.45);
  box-shadow: 0 0 24px rgba(255, 225, 106, 0.16);
  text-align: center;
}

.zero-mistakes-icon {
  font-size: 22px;
  color: var(--result-gold);
  text-shadow: 0 0 14px rgba(255, 225, 106, 0.8);
}

.zero-mistakes-title {
  color: #fff8df;
  font-size: 17px;
  font-weight: 950;
  letter-spacing: .02em;
}

.zero-mistakes-desc {
  margin: 0;
  color: #d6f6ff;
  font-size: 14px;
  line-height: 1.55;
  max-width: 330px;
}

@media (max-width: 420px) {
  .result-mistakes-card {
    padding: 14px 11px 16px;
  }

  .mistakes-card-head {
    align-items: flex-start;
  }

  .mistake-summary-overview {
    padding: 12px;
  }
}

/* Remedy Box (Next Round Goal) */
.remedy-box {
  margin-top: 10px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 231, 122, 0.25);
  border-radius: 12px;
  text-align: left;
  background: rgba(255, 231, 122, 0.07);
}

.remedy-head {
  display: flex;
  align-items: center;
  gap: 5px;
}

.remedy-icon {
  color: var(--result-gold);
  font-size: 11px;
}

.remedy-head strong {
  color: var(--result-gold);
  font-size: 12px;
  font-weight: 900;
}

.remedy-box p {
  margin: 3px 0 0;
  color: #f7edd2;
  font-size: 13px;
  line-height: 1.55;
}

/* Toast */
.toast {
  position: fixed;
  z-index: 99;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  padding: 10px 16px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 99px;
  color: #fff;
  background: rgba(20, 12, 31, .94);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
  transition: .22s;
  white-space: nowrap;
  font-size: 12px;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* During play, keep story and mission notices inside the visible battlefield
   rather than behind a mobile browser toolbar at the bottom of the viewport. */
body:has(.game-screen:not(.hidden)) .toast {
  top: auto;
  bottom: clamp(190px, 25dvh, 250px);
  left: auto;
  right: max(10px, calc((100vw - min(100vw, 480px)) / 2 + 10px));
  width: max-content;
  max-width: min(172px, calc(48vw - 14px));
  padding: 7px 10px;
  transform: translateY(-8px);
  border-radius: 11px;
  white-space: normal;
  color: #dffaff;
  border-color: rgba(85, 233, 255, .3);
  background: rgba(10, 25, 45, .92);
  font-size: 10px;
  font-weight: 850;
  line-height: 1.3;
  text-align: left;
}

body:has(.game-screen:not(.hidden)) .toast.show {
  transform: translateY(0);
}

body:has(.game-screen[data-boss-warning]) .toast,
body:has(.game-screen[data-boss-outro]) .toast {
  opacity: 0;
}

/* ========================================================= */
/* Result redesign v2 — image reference: cleared / pending   */
/* ========================================================= */
.result-screen {
  padding: max(10px, env(safe-area-inset-top)) 12px max(24px, env(safe-area-inset-bottom));
  background-color: #030616;
  background-image: url('/assets/campaign-v3/leaderboard-temple-bg-v1.webp');
  background-position: center top;
  background-size: cover;
}

.result-screen::before,
.result-top {
  display: none;
}

.result-card {
  isolation: isolate;
  overflow: hidden;
  padding: 12px 14px 16px;
  border: 2px solid #9176ff;
  border-radius: 24px;
  clip-path: none;
  background: rgba(5, 8, 30, .9);
  box-shadow: 0 20px 55px rgba(0, 0, 0, .72), 0 0 34px rgba(121, 86, 255, .35), inset 0 0 34px rgba(111, 76, 255, .12);
}

.result-card::before,
.result-card::after,
.result-card-glow {
  display: none;
}

.result-card.is-boss-cleared {
  border-color: #ffc936;
  box-shadow: 0 20px 55px rgba(0, 0, 0, .72), 0 0 38px rgba(255, 186, 36, .42), inset 0 0 34px rgba(255, 194, 45, .12);
}

.result-card.is-boss-pending {
  border-color: #916dff;
  box-shadow: 0 20px 55px rgba(0, 0, 0, .72), 0 0 38px rgba(112, 69, 255, .4), inset 0 0 34px rgba(111, 76, 255, .14);
}

.result-card-backdrop {
  position: absolute;
  z-index: -2;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  opacity: .34;
  pointer-events: none;
}

.result-card.is-boss-cleared .result-card-backdrop {
  opacity: .42;
  filter: sepia(.45) saturate(1.4) hue-rotate(345deg) brightness(1.1);
}

.result-card-head {
  display: grid;
  width: 100%;
  min-height: 124px;
  padding: 2px 12px 12px;
  justify-content: center;
  place-items: center;
  border-bottom: 1px solid rgba(189, 156, 255, .2);
}

.result-card-head img {
  width: min(82vw, 310px);
  max-width: 100%;
  height: auto;
  max-height: 92px;
  margin-inline: auto;
  justify-self: center;
  object-fit: contain;
  filter: drop-shadow(0 0 18px rgba(85, 233, 255, .58));
}

.result-hero {
  padding-top: 10px;
}

.result-hero-stage {
  height: clamp(238px, 33vh, 278px);
  margin-top: -2px;
  overflow: visible;
}

.result-ghost-icon {
  width: min(83vw, 312px);
  background: transparent;
}

.result-ghost-image {
  width: min(78vw, 296px);
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  padding: 4px 4px 10px;
  filter: drop-shadow(0 0 24px color-mix(in srgb, var(--diagnosis-accent, #7c54ff) 84%, transparent));
}

.result-outcome-orb {
  position: relative;
  z-index: 4;
  display: grid;
  width: 166px;
  height: 152px;
  margin: -82px auto -2px;
  place-items: center;
}

.result-outcome-orb > img {
  position: absolute;
  z-index: -1;
  inset: -10px;
  width: calc(100% + 20px);
  height: calc(100% + 20px);
  object-fit: contain;
  filter: drop-shadow(0 10px 22px rgba(255, 154, 16, .38));
}

.result-card.is-boss-pending .result-outcome-orb > img {
  filter: hue-rotate(205deg) saturate(1.2) brightness(.72) drop-shadow(0 10px 22px rgba(95, 61, 255, .5));
}

.result-seal,
.result-seal.is-pending {
  position: relative;
  top: auto;
  right: auto;
  display: block;
  width: auto;
  min-height: 0;
  padding: 0;
  transform: none;
  border: 0;
  border-radius: 0;
  color: #28113f;
  background: transparent;
  box-shadow: none;
  font-family: "Noto Serif TC", "Songti TC", serif;
  font-size: 32px;
  line-height: 1;
  letter-spacing: .04em;
  -webkit-text-stroke: 1px rgba(255, 241, 178, .95);
  paint-order: stroke fill;
  text-shadow:
    0 2px 0 rgba(255, 225, 117, .92),
    0 0 10px rgba(255, 198, 54, .72),
    0 3px 8px rgba(25, 5, 45, .48);
  animation: sealStampSlam 620ms cubic-bezier(.175, .885, .32, 1.28) forwards;
}

.result-seal::before,
.result-seal.is-pending::before {
  display: none;
}

.result-seal.is-pending {
  color: #efe7ff;
  -webkit-text-stroke: 0;
  text-shadow: 0 2px 0 #6f4cff, 0 0 14px rgba(178, 137, 255, .9);
  animation: none;
}

.result-outcome-orb > strong {
  position: absolute;
  bottom: 31px;
  color: #fff4cf;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .04em;
}

.result-card h3 {
  margin: 6px 22px 2px;
  color: #fff4c4;
  font-family: "Noto Serif TC", "Songti TC", serif;
  font-size: clamp(34px, 10vw, 42px);
  letter-spacing: .07em;
}

#result-ghost-title {
  color: #fff0b0;
  font-size: 16px;
  line-height: 1.4;
}

.result-description {
  max-width: 340px;
  margin-top: 7px !important;
  color: #f4eefc;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.6;
}

.result-stats {
  gap: 8px;
  margin-top: 15px;
}

.result-stats .stat-chip,
.result-stats div,
.result-index {
  min-width: 0;
  margin: 0;
  padding: 11px 4px 10px;
  transform: none;
  border: 1px solid rgba(149, 119, 255, .62);
  border-radius: 12px;
  background: rgba(4, 8, 31, .86);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 0 16px rgba(88, 52, 220, .14);
}

.result-card.is-boss-cleared .result-stats .stat-chip,
.result-card.is-boss-cleared .result-stats div {
  border-color: rgba(255, 200, 56, .58);
}

.result-index > * {
  transform: none;
}

.result-stats strong,
.result-index strong,
.result-index b {
  color: #fff;
  font-size: 22px;
  text-shadow: none;
}

.result-stats span,
.result-index span {
  color: #d9cff0;
  font-size: 12px;
  line-height: 1.25;
}

.result-stats small {
  color: #a89cbe;
  font-size: 11px;
  line-height: 1.25;
}

.result-boss-summary {
  display: none;
}

.result-story-block {
  margin: 12px 2px 0;
  padding: 9px 10px;
  border-left: 2px solid rgba(85, 233, 255, .56);
  background: rgba(10, 17, 54, .54);
}

.result-story-block > span {
  color: #8fefff;
  font-size: 11px;
}

.result-story-review {
  color: #dcd4e9;
  font-size: 12px;
  line-height: 1.55;
}

.collective-evidence {
  margin: 10px 2px 0;
  padding: 10px 12px;
  border-color: rgba(85, 233, 255, .62);
  background: rgba(3, 19, 48, .88);
  box-shadow: 0 0 16px rgba(85, 233, 255, .12);
  font-size: 13px;
  line-height: 1.5;
}

.result-primary-actions {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 2px 0;
}

.result-card .retry-result-button {
  width: 100%;
  min-height: 70px;
  margin: 0;
  border: 2px solid #fff0a9;
  border-radius: 18px;
}

.result-card.is-boss-pending .retry-result-button {
  color: #fff;
  border-color: #d9c5ff;
  background: linear-gradient(135deg, #9a5cff 0%, #6932dc 52%, #4022a9 100%);
  box-shadow: 0 8px 24px rgba(96, 53, 228, .42), 0 0 20px rgba(150, 104, 255, .42), inset 0 1px 0 rgba(255, 255, 255, .42);
}

.result-card.is-boss-pending .retry-result-button span,
.result-card.is-boss-pending .retry-result-button small {
  color: #fff;
}

.result-primary-actions .share-result-button {
  min-width: 0;
  min-height: 70px;
  border: 2px solid rgba(194, 174, 255, .82);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(137, 82, 255, .97), rgba(61, 92, 215, .97));
  box-shadow: 0 8px 24px rgba(59, 31, 142, .42), 0 0 18px rgba(126, 92, 255, .28);
}

.result-primary-actions .retry-result-button span,
.result-primary-actions .share-result-button span {
  color: #fff;
  font-size: 20px;
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: .03em;
}

.result-primary-actions .retry-result-button::after {
  display: none;
  content: none;
}

.result-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.result-actions .text-button {
  min-width: 0;
  padding-inline: 6px;
  font-size: clamp(10px, 2.7vw, 12px);
  white-space: nowrap;
}

.result-actions .button-pair {
  grid-column: 1 / -1;
}

@media (min-width: 700px) {
  body:has(.game-screen:not(.hidden)) .toast {
    top: auto;
    bottom: clamp(200px, 24dvh, 250px);
  }
}

/* ========================================================= */
/* Responsive & Accessibility Tweaks                         */
/* ========================================================= */
@media (max-width: 380px) {
  .result-screen {
    padding-inline: 10px;
  }
  .result-card {
    padding-inline: 10px;
    border-radius: 17px;
  }
  .result-card h3 {
    margin-inline: 18px;
    font-size: 34px;
  }
  .result-hero-stage {
    height: 210px;
  }
  .result-ghost-image {
    width: 218px;
  }
  .result-stats {
    gap: 4px;
  }
  .result-stats .stat-chip,
  .result-stats div {
    padding-inline: 2px;
  }
  .retry-result-button span {
    font-size: 19px;
  }
}

@media (max-height: 760px) {
  .result-top {
    min-height: 56px;
  }
  .result-brand-lockup img {
    height: 36px;
  }
  .result-hero-stage {
    height: 190px;
  }
  .result-ghost-image {
    width: 200px;
  }
  .result-description {
    min-height: 0;
  }
  .retry-result-button {
    min-height: 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .result-screen {
    scroll-behavior: auto;
  }
  .result-seal {
    animation: none;
    opacity: 1;
    transform: rotate(5deg);
  }
  .result-screen:not(.hidden) .result-hero-stage,
  .result-screen:not(.hidden) .result-outcome-orb,
  .result-screen:not(.hidden) #result-ghost-name,
  .result-screen:not(.hidden) .result-description,
  .result-screen:not(.hidden) .result-stats,
  .result-screen:not(.hidden) .result-boss-summary,
  .result-screen:not(.hidden) .collective-evidence,
  .result-screen:not(.hidden) .retry-result-button,
  .result-screen:not(.hidden) .result-actions,
  .result-screen:not(.hidden) .result-search-cue {
    opacity: 1;
    animation: none;
    transform: none;
  }
}
