/* Shared results dashboard for the public test (dark) and the signed-in panel
   (light). Structure is identical on both surfaces; only the palette changes,
   driven by [data-rd-theme]. Motion is opt-in and disabled under
   prefers-reduced-motion; print strips the interactive chrome. */
.rd-dash {
  --rd-gold: #c9a84c;
  --rd-gold-soft: #e6d49e;
  display: block;
  margin-top: 20px;
}
.rd-dash[data-rd-theme='dark'] {
  --rd-surface: rgba(255, 255, 255, .06);
  --rd-surface-strong: rgba(255, 255, 255, .1);
  --rd-rule: rgba(255, 255, 255, .16);
  --rd-rule-strong: #7a30a8;
  --rd-ink: #ffffff;
  --rd-muted: #d9c8ea;
  --rd-faint: #a98fc6;
  --rd-track: #35106a;
  /* Text-safe gold: on the night background the base gold already passes. */
  --rd-gold-ink: #e6d49e;
}
.rd-dash[data-rd-theme='light'] {
  --rd-surface: #ffffff;
  --rd-surface-strong: #f8f5fb;
  --rd-rule: #e8daf2;
  --rd-rule-strong: #d4b8e8;
  --rd-ink: #1f053c;
  --rd-muted: #5f6570;
  --rd-faint: #7a30a8;
  --rd-track: #ede3f6;
  /* Base gold is ~2.2:1 on white, so text uses a darkened tone instead. */
  --rd-gold-ink: #7c5e27;
}

.rd-dash .rd-head { margin: 30px 0 14px; }
.rd-dash .rd-head:first-child { margin-top: 22px; }
.rd-dash .rd-eyebrow {
  margin: 0 0 6px;
  color: var(--rd-faint);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.rd-dash .rd-h {
  margin: 0;
  color: var(--rd-ink);
  font-family: Merriweather, Georgia, serif;
  font-size: clamp(20px, 4.2vw, 26px);
  line-height: 1.25;
}
.rd-dash .rd-intro { margin: 8px 0 0; color: var(--rd-muted); line-height: 1.6; font-size: 14px; }
.rd-dash .rd-note { margin: 12px 0 0; color: var(--rd-faint); font-size: 12px; line-height: 1.55; }
.rd-dash .rd-panel {
  border: 1px solid var(--rd-rule);
  border-radius: 18px;
  background: var(--rd-surface);
  padding: 18px;
}

/* Stat strip */
.rd-dash .rd-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--rd-rule);
  border-radius: 16px;
  overflow: hidden;
  background: var(--rd-rule);
}
.rd-dash .rd-stat { min-width: 0; background: var(--rd-surface-strong); padding: 12px 6px; text-align: center; }
.rd-dash .rd-stat.is-top { background: rgba(201, 168, 76, .16); }
.rd-dash .rd-stat-label {
  margin: 0 0 4px;
  color: var(--rd-faint);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rd-dash .rd-stat-value {
  margin: 0;
  color: var(--rd-ink);
  font-family: Merriweather, Georgia, serif;
  font-size: clamp(24px, 6vw, 34px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.rd-dash .rd-stat.is-top .rd-stat-value { color: var(--rd-gold-ink); }
.rd-dash .rd-stat-scale { margin: 4px 0 0; color: var(--rd-faint); font-size: 11px; }

/* Radar */
.rd-dash .rd-radar-panel { margin-top: 14px; text-align: center; }
.rd-dash .rd-radar { width: 100%; max-width: 340px; height: auto; }
.rd-dash .rd-radar-note { text-align: left; }
.rd-dash .rd-radar-grid { fill: none; stroke: var(--rd-rule-strong); stroke-width: .9; opacity: .75; }
.rd-dash .rd-radar-shape { fill: rgba(201, 168, 76, .22); stroke: var(--rd-gold); stroke-width: 1.8; }
.rd-dash .rd-radar-dot { fill: var(--rd-gold); }
.rd-dash .rd-radar-label { fill: var(--rd-muted); font-size: 9px; letter-spacing: .1em; }
.rd-dash .rd-radar-value { fill: var(--rd-gold-ink); font-size: 11px; font-weight: 700; }

/* Ranked bars */
.rd-dash .rd-bars { list-style: none; margin: 14px 0 0; padding: 18px; display: grid; gap: 14px; }
.rd-dash .rd-bar-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.rd-dash .rd-bar-name { color: var(--rd-ink); font-weight: 700; font-size: 14px; }
.rd-dash .rd-bar-track { margin-top: 8px; height: 10px; border-radius: 999px; background: var(--rd-track); overflow: hidden; }
.rd-dash .rd-bar-fill { display: block; height: 100%; border-radius: 999px; background: var(--rd-gold); }
.rd-dash .rd-bar-l0 { background: var(--rd-rule-strong); }
.rd-dash .rd-bar-l1 { background: var(--rd-gold-soft); }
.rd-dash .rd-bar-scale { margin: 6px 0 0; color: var(--rd-faint); font-size: 12px; }

/* Level pill */
.rd-dash .rd-pill {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  background: #f2e8c8;
  color: #5e451e;
}
.rd-dash .rd-pill-l0 { background: var(--rd-surface-strong); color: var(--rd-muted); border: 1px solid var(--rd-rule); }

/* Area cards */
.rd-dash .rd-cards { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 14px; }
.rd-dash .rd-card {
  min-width: 0;
  border: 1px solid var(--rd-rule);
  border-radius: 16px;
  background: var(--rd-surface);
  padding: 16px;
}
.rd-dash .rd-card-title {
  margin: 10px 0 0;
  color: var(--rd-ink);
  font-family: Merriweather, Georgia, serif;
  font-size: 17px;
  line-height: 1.3;
}
.rd-dash .rd-card-text { margin: 8px 0 0; color: var(--rd-muted); font-size: 14px; line-height: 1.6; }
.rd-dash .rd-defs { margin: 12px 0 0; padding: 12px 0 0; border-top: 1px solid var(--rd-rule); }
.rd-dash .rd-defs dt {
  color: var(--rd-faint);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.rd-dash .rd-defs dd { margin: 4px 0 10px; color: var(--rd-muted); font-size: 13px; line-height: 1.55; }
.rd-dash .rd-defs dd:last-child { margin-bottom: 0; }

/* Discernment gauge + profile */
.rd-dash .rd-duo { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 14px; }
.rd-dash .rd-gauge-panel { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; }
.rd-dash .rd-gauge { width: 132px; height: 132px; flex: 0 0 auto; }
.rd-dash .rd-gauge-track { fill: none; stroke: var(--rd-track); stroke-width: 12; }
.rd-dash .rd-gauge-arc { fill: none; stroke: var(--rd-gold); stroke-width: 12; stroke-linecap: round; }
.rd-dash .rd-gauge-value { fill: var(--rd-ink); font-family: Merriweather, Georgia, serif; font-size: 34px; }
.rd-dash .rd-gauge-scale { fill: var(--rd-faint); font-size: 12px; }
.rd-dash .rd-gauge-copy { flex: 1 1 220px; min-width: 0; }
.rd-dash .rd-profile-title {
  margin: 6px 0 0;
  color: var(--rd-ink);
  font-family: Merriweather, Georgia, serif;
  font-size: 19px;
  line-height: 1.3;
}
.rd-dash .rd-profile-focus {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--rd-rule);
}
.rd-dash .rd-profile-focus span { color: var(--rd-faint); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.rd-dash .rd-profile-focus strong { color: var(--rd-ink); font-size: 15px; line-height: 1.35; }

/* Study route */
.rd-dash .rd-routes { list-style: none; display: grid; grid-template-columns: 1fr; gap: 12px; margin: 14px 0 0; padding: 0; }
.rd-dash .rd-route {
  display: block;
  height: 100%;
  min-height: 44px;
  border: 1px solid var(--rd-rule);
  border-radius: 16px;
  background: var(--rd-surface);
  padding: 16px;
  text-decoration: none;
}
.rd-dash .rd-route:hover { border-color: var(--rd-gold); }
.rd-dash .rd-step {
  display: inline-block;
  border-radius: 999px;
  background: #f2e8c8;
  color: #5e451e;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}
.rd-dash .rd-route-title { display: block; margin-top: 10px; color: var(--rd-ink); font-size: 15px; line-height: 1.35; }
.rd-dash .rd-route-text { display: block; margin-top: 6px; color: var(--rd-muted); font-size: 13px; line-height: 1.55; }

/* Actions */
.rd-dash .rd-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 22px; }
.rd-dash .rd-action {
  min-height: 46px;
  border: 1px solid var(--rd-rule-strong);
  border-radius: 12px;
  background: transparent;
  color: var(--rd-ink);
  padding: 11px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.rd-dash .rd-action:hover { border-color: var(--rd-gold); }
.rd-dash .rd-action-status { color: var(--rd-faint); font-size: 13px; }

@media (min-width: 560px) {
  .rd-dash .rd-strip { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
@media (min-width: 760px) {
  .rd-dash .rd-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rd-dash .rd-duo { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rd-dash .rd-routes { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rd-dash .rd-radar-panel { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); align-items: center; gap: 20px; }
  .rd-dash .rd-radar-note { margin-top: 0; }
}
@media (min-width: 1080px) {
  .rd-dash .rd-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: no-preference) {
  .rd-dash.rd-anim .rd-reveal { opacity: 0; transform: translateY(12px); }
  .rd-dash.rd-anim .rd-reveal.is-in { opacity: 1; transform: none; transition: opacity .45s ease, transform .45s cubic-bezier(.2, .7, .2, 1); }
  .rd-dash.rd-anim .rd-bar-fill { transform: scaleX(0); transform-origin: left; transition: transform .8s cubic-bezier(.2, .7, .2, 1); }
  .rd-dash.rd-anim .rd-reveal.is-in .rd-bar-fill { transform: scaleX(1); }
  .rd-dash.rd-anim .rd-fade { opacity: 0; transition: opacity .7s ease .2s; }
  .rd-dash.rd-anim .rd-reveal.is-in .rd-fade { opacity: 1; }
  .rd-dash.rd-anim .rd-gauge-arc { stroke-dashoffset: var(--dash); }
  .rd-dash.rd-anim .rd-reveal.is-in .rd-gauge-arc { transition: stroke-dashoffset 1.1s cubic-bezier(.2, .7, .2, 1) .15s; stroke-dashoffset: var(--off, 0); }
}

@media print {
  .rd-noprint { display: none !important; }
  .rd-dash { --rd-surface: #fff; --rd-surface-strong: #fff; --rd-rule: #ccc; --rd-rule-strong: #999; --rd-ink: #1a1a1a; --rd-muted: #333; --rd-faint: #555; --rd-track: #e5e5e5; --rd-gold-ink: #6b5121; }
  .rd-dash .rd-panel, .rd-dash .rd-card, .rd-dash .rd-route, .rd-dash .rd-strip { break-inside: avoid; background: #fff !important; }
  .rd-dash .rd-reveal { opacity: 1 !important; transform: none !important; }
  .rd-dash .rd-bar-fill { transform: none !important; }
  .rd-dash .rd-fade { opacity: 1 !important; }
  .rd-dash .rd-gauge-arc { stroke-dashoffset: var(--off, 0) !important; }
}
