/* ══════════════════════════════════════════════════════════════
   Results V6 — Skora Design System
   Mobile-first · Light/Dark via CSS vars · Area-colored accents
   Unified with variables.css tokens · No custom color overrides
   ══════════════════════════════════════════════════════════════ */

/* ── Page ─────────────────────────────────────────────────── */
.res-page {
  min-height: 100dvh;
  background:
    radial-gradient(ellipse at 20% 0%, color-mix(in srgb, var(--hub-color, var(--violet)) 8%, transparent), transparent 50%),
    radial-gradient(ellipse at 80% 0%, color-mix(in srgb, var(--violet) 5%, transparent), transparent 40%),
    var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-family);
  position: relative;
  overflow-x: hidden;
}

/* ── Fold (hero, full viewport) ──────────────────────────── */
.res-fold {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 var(--sp-lg) env(safe-area-inset-bottom, 16px);
}

/* ── Header ──────────────────────────────────────────────── */
.res-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: var(--sp-md) 0;
  flex-shrink: 0;
}

.res-header-back {
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  color: var(--text-secondary);
  background: var(--bg-white);
  border: 1px solid var(--border);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--duration) var(--ease);
  flex-shrink: 0;
}
.res-header-back:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.res-header-copy {
  min-width: 0;
}

.res-header-kicker,
.res-eyebrow {
  margin: 0 0 2px;
  color: var(--hub-color, var(--violet));
  font-size: 0.72rem;
  font-weight: var(--fw-bold);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.res-header-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.res-header-pill {
  margin-left: auto;
  padding: 8px 16px;
  border-radius: var(--r-full);
  background: var(--bg-white);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: var(--fw-semi);
  white-space: nowrap;
}

.res-header-spacer {
  width: 44px;
  flex-shrink: 0;
}

/* ── Frame (card grid) ───────────────────────────────────── */
.res-frame {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--sp-lg);
  padding-bottom: var(--sp-lg);
}

/* ── Shared Card Chrome ──────────────────────────────────── */
.res-score-card,
.res-action-card {
  position: relative;
  overflow: hidden;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--r-2xl);
  box-shadow: var(--shadow-lg);
}

/* Top accent stripe — area color */
.res-score-card::before,
.res-action-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(
    90deg,
    var(--hub-color, var(--violet)),
    color-mix(in srgb, var(--hub-color, var(--violet)) 50%, var(--violet))
  );
}

/* ── Score Card ──────────────────────────────────────────── */
.res-score-card {
  padding: var(--sp-xl) var(--sp-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-md);
}

.res-score-copy {
  text-align: center;
}

.res-score-copy p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-weight: var(--fw-medium);
  line-height: 1.5;
  max-width: 340px;
}

/* ── Score Ring ──────────────────────────────────────────── */
.res-ring-container {
  position: relative;
  width: clamp(160px, 36vw, 200px);
  aspect-ratio: 1;
  margin: auto 0;
  flex-shrink: 0;
  filter: drop-shadow(0 14px 28px color-mix(in srgb, var(--hub-color, var(--violet)) 20%, transparent));
}

.res-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.res-ring-track {
  fill: none;
  stroke: var(--border);
  stroke-width: 10;
}

.res-ring-fill {
  fill: none;
  stroke: var(--hub-color, var(--violet));
  stroke-width: 10;
  stroke-linecap: round;
  /* circumference = 2 × π × 70 ≈ 439.82 */
  stroke-dasharray: 439.82;
  stroke-dashoffset: 439.82;
  transition: stroke-dashoffset 1.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.res-ring-inner {
  position: absolute;
  inset: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-white);
  box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.05);
}

.res-ring-number {
  font-size: clamp(3rem, 8vw, 4.2rem);
  font-weight: var(--fw-extra);
  line-height: 1;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.res-ring-unit {
  font-size: clamp(1rem, 3vw, 1.3rem);
  font-weight: var(--fw-bold);
  color: var(--text-secondary);
  margin-left: 2px;
}

/* ── Score Bottom (fraction + badge) ─────────────────────── */
.res-score-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-sm);
}

.res-fraction {
  margin: 0;
  font-size: 1rem;
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  text-align: center;
}

/* ── Adaptive Badge ──────────────────────────────────────── */
.res-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--r-full);
  font-size: 0.82rem;
  font-weight: var(--fw-bold);
  letter-spacing: 0.3px;
  transition: all var(--duration) var(--ease);
}

.res-badge--fail {
  background: var(--red-light);
  color: var(--red);
  border: 1px solid color-mix(in srgb, var(--red) 20%, transparent);
}
.res-badge--low {
  background: rgba(249, 115, 22, 0.1);
  color: #F97316;
  border: 1px solid rgba(249, 115, 22, 0.2);
}
.res-badge--pass {
  background: rgba(234, 179, 8, 0.1);
  color: #CA8A04;
  border: 1px solid rgba(234, 179, 8, 0.2);
}
.res-badge--good {
  background: var(--green-light);
  color: var(--green);
  border: 1px solid color-mix(in srgb, var(--green) 20%, transparent);
}
.res-badge--perfect {
  background: var(--violet-light);
  color: var(--violet);
  border: 1px solid color-mix(in srgb, var(--violet) 20%, transparent);
}

/* ── Action Card ─────────────────────────────────────────── */
.res-action-card {
  padding: var(--sp-xl) var(--sp-lg);
  display: flex;
  flex-direction: column;
  gap: var(--sp-lg);
}

.res-action-header {
  display: flex;
  gap: var(--sp-md);
  align-items: flex-start;
}

.res-action-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--r-xl);
  display: grid;
  place-items: center;
  color: white;
  font-size: 28px;
  flex-shrink: 0;
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--hub-color, var(--violet)) 80%, #fff),
    var(--hub-color, var(--violet))
  );
  box-shadow: 0 8px 20px color-mix(in srgb, var(--hub-color, var(--violet)) 30%, transparent);
}

.res-action-title {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: var(--fw-extra);
  color: var(--text-primary);
  line-height: 1.1;
}

.res-action-message {
  margin: 6px 0 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: var(--fw-medium);
  line-height: 1.5;
  max-width: 520px;
}

/* ── Insight Grid ────────────────────────────────────────── */
.res-insight-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-sm);
}

.res-insight {
  min-height: 100px;
  padding: var(--sp-md);
  border-radius: var(--r-xl);
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
  transition: transform var(--duration) var(--ease),
              box-shadow var(--duration) var(--ease);
}
.res-insight:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.res-insight .material-symbols-outlined {
  font-size: 22px;
  color: var(--hub-color, var(--violet));
}

.res-insight strong {
  font-size: 1.5rem;
  font-weight: var(--fw-extra);
  color: var(--text-primary);
  line-height: 1;
}

.res-insight small {
  font-size: 0.72rem;
  font-weight: var(--fw-bold);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* ── Micro-stat Chips ────────────────────────────────────── */
.res-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-sm);
}

.res-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 14px;
  border-radius: var(--r-full);
  background: var(--bg-white);
  border: 1px solid var(--border);
  font-size: 0.82rem;
  font-weight: var(--fw-semi);
  color: var(--text-secondary);
  white-space: nowrap;
}

.res-chip-icon {
  font-size: 16px;
  color: var(--text-secondary);
}

.res-chip--delta {
  color: var(--green);
  border-color: color-mix(in srgb, var(--green) 25%, transparent);
  background: var(--green-light);
}
.res-chip--delta .res-chip-icon {
  color: var(--green);
}

.res-chip--delta-negative {
  color: var(--red);
  border-color: color-mix(in srgb, var(--red) 25%, transparent);
  background: var(--red-light);
}
.res-chip--delta-negative .res-chip-icon {
  color: var(--red);
}

/* ── Streak Badge ────────────────────────────────────────── */
.res-streak {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--r-full);
  background: rgba(249, 115, 22, 0.08);
  border: 1px solid rgba(249, 115, 22, 0.18);
  font-size: 0.85rem;
  font-weight: var(--fw-bold);
  color: #EA580C;
  animation: res-streak-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  animation-delay: 1.4s;
}

.res-streak .material-symbols-outlined {
  font-size: 19px;
}

@keyframes res-streak-in {
  from { opacity: 0; transform: scale(0.85) translateY(6px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── CTAs ─────────────────────────────────────────────────── */
.res-ctas {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  margin-top: auto;
  padding-top: var(--sp-md);
  padding-bottom: var(--sp-md);
  flex-shrink: 0;
}

.res-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 14px 20px;
  border-radius: var(--r-xl);
  font-size: 0.95rem;
  font-weight: var(--fw-bold);
  text-decoration: none;
  cursor: pointer;
  border: none;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: transform 120ms var(--ease),
              box-shadow var(--duration) var(--ease),
              background var(--duration) var(--ease);
}
.res-cta:active {
  transform: scale(0.97);
}

.res-cta-icon {
  font-size: 20px;
}

/* Primary: area-colored with depth */
.res-cta--primary {
  background: var(--hub-color, var(--violet));
  color: #FFFFFF;
  box-shadow:
    0 6px 20px color-mix(in srgb, var(--hub-color, var(--violet)) 32%, transparent),
    0 2px 0 color-mix(in srgb, var(--hub-color, var(--violet)) 70%, #000);
}
.res-cta--primary:hover {
  transform: translateY(-1px);
  box-shadow:
    0 10px 28px color-mix(in srgb, var(--hub-color, var(--violet)) 38%, transparent),
    0 2px 0 color-mix(in srgb, var(--hub-color, var(--violet)) 70%, #000);
}

/* Secondary: outline */
.res-cta--secondary {
  background: var(--bg-white);
  color: var(--text-primary);
  border: 1.5px solid var(--border);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}
.res-cta--secondary:hover {
  border-color: var(--hub-color, var(--violet));
  color: var(--hub-color, var(--violet));
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

/* Ghost: text only */
.res-cta--ghost {
  background: transparent;
  color: var(--text-secondary);
  font-weight: var(--fw-medium);
  font-size: 0.88rem;
  padding: 10px 20px;
  min-height: 40px;
  box-shadow: none;
}
.res-cta--ghost:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}


/* ══════════════════════════════════════════════════════════════
   Explained Answers (inline accordion view)
   ══════════════════════════════════════════════════════════════ */

.res-explained {
  min-height: 100dvh;
  background: var(--bg-primary);
  padding: 0 var(--sp-md) var(--sp-2xl);
  animation: res-slide-in 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes res-slide-in {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Explained Header ────────────────────────────────────── */
.res-explained-header {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  padding: var(--sp-lg) 0;
  position: sticky;
  top: 0;
  background: var(--bg-primary);
  z-index: 10;
}

.res-explained-back {
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  background: var(--bg-white);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  flex-shrink: 0;
}
.res-explained-back:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.res-explained-title {
  font-size: 1.15rem;
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  margin: 0;
}

.res-explained-subtitle {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin: 2px 0 0;
}

/* ── Filter Pills ────────────────────────────────────────── */
.res-explained-filters {
  display: flex;
  gap: var(--sp-xs);
  padding-bottom: var(--sp-md);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.res-explained-filters::-webkit-scrollbar { display: none; }

.res-filter {
  padding: 7px 14px;
  border-radius: var(--r-full);
  font-size: 0.8rem;
  font-weight: var(--fw-semi);
  border: 1px solid var(--border);
  background: var(--bg-white);
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--duration) var(--ease);
}
.res-filter:hover {
  border-color: var(--hub-color, var(--violet));
  color: var(--hub-color, var(--violet));
}
.res-filter--active {
  background: var(--hub-color, var(--violet));
  color: #FFFFFF;
  border-color: var(--hub-color, var(--violet));
}

/* ── Explained List ──────────────────────────────────────── */
.res-explained-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}

/* ── Explained Question Card ─────────────────────────────── */
.res-eq-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: border-color var(--duration) var(--ease);
}

.res-eq-card--correct  { border-left: 3px solid var(--green); }
.res-eq-card--incorrect { border-left: 3px solid var(--red); }
.res-eq-card--skipped  { border-left: 3px solid #F59E0B; }

/* Card header (always visible) */
.res-eq-header {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: var(--sp-md);
  cursor: pointer;
  transition: background var(--duration) var(--ease);
  user-select: none;
}
.res-eq-header:hover {
  background: var(--bg-hover);
}

.res-eq-icon {
  font-size: 20px;
  flex-shrink: 0;
}
.res-eq-card--correct .res-eq-icon  { color: var(--green); }
.res-eq-card--incorrect .res-eq-icon { color: var(--red); }
.res-eq-card--skipped .res-eq-icon  { color: #F59E0B; }

.res-eq-num {
  font-size: 0.78rem;
  font-weight: var(--fw-bold);
  color: var(--text-secondary);
  flex-shrink: 0;
  min-width: 20px;
}

.res-eq-stem {
  flex: 1;
  font-size: 0.88rem;
  font-weight: var(--fw-medium);
  color: var(--text-primary);
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.res-eq-chevron {
  font-size: 20px;
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: transform 0.25s var(--ease);
}
.res-eq-card[open] .res-eq-chevron {
  transform: rotate(180deg);
}

/* Card body (expanded) */
.res-eq-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s var(--ease);
}
.res-eq-card[open] .res-eq-body {
  max-height: 600px;
}

.res-eq-body-inner {
  padding: 0 var(--sp-md) var(--sp-md);
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}

/* Answer rows */
.res-eq-answer {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-sm);
  padding: var(--sp-sm) var(--sp-md);
  border-radius: var(--r-md);
  font-size: 0.85rem;
  line-height: 1.5;
}

.res-eq-answer--wrong {
  background: var(--red-light);
  color: var(--red);
}

.res-eq-answer--right {
  background: var(--green-light);
  color: var(--green);
}

.res-eq-answer-icon {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.res-eq-answer-label {
  font-weight: var(--fw-semi);
  flex-shrink: 0;
}

/* Explanation */
.res-eq-explanation {
  background: var(--bg-primary);
  border-left: 3px solid var(--hub-color, var(--violet));
  padding: var(--sp-md);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.res-eq-explanation strong {
  color: var(--text-primary);
  font-weight: var(--fw-semi);
}

/* Time per question inside card */
.res-eq-time {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  padding-top: var(--sp-xs);
}
.res-eq-time .material-symbols-outlined {
  font-size: 14px;
}


/* ── Sparkline Section ───────────────────────────────────── */
.res-sparkline-section {
  margin-top: var(--sp-xl);
  padding: var(--sp-lg);
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}

.res-sparkline-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  margin: 0 0 var(--sp-md);
}
.res-sparkline-title .material-symbols-outlined {
  font-size: 20px;
  color: var(--hub-color, var(--violet));
}

.res-sparkline {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 64px;
  padding-top: var(--sp-sm);
}

.res-spark-bar {
  flex: 1;
  border-radius: 3px 3px 0 0;
  min-height: 4px;
  transition: height 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  cursor: default;
}

.res-spark-bar--correct   { background: var(--green); opacity: 0.7; }
.res-spark-bar--incorrect { background: var(--red);   opacity: 0.7; }
.res-spark-bar--skipped   { background: #F59E0B;      opacity: 0.5; }

/* Tooltip on hover */
.res-spark-bar::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: 3px 8px;
  border-radius: var(--r-sm);
  background: var(--text-primary);
  color: var(--bg-primary);
  font-size: 0.68rem;
  font-weight: var(--fw-semi);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s var(--ease);
}
.res-spark-bar:hover::after {
  opacity: 1;
}


/* ── Confetti Canvas ─────────────────────────────────────── */
.res-confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 999;
}


/* ══════════════════════════════════════════════════════════════
   Entrance Animations
   ══════════════════════════════════════════════════════════════ */

@keyframes res-fade-up {
  0%   { opacity: 0; transform: translateY(14px) scale(0.97); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.res-score-card,
.res-action-card {
  opacity: 0;
  animation: res-fade-up 500ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.res-score-card { animation-delay: 80ms; }
.res-action-card { animation-delay: 200ms; }

.res-ring-container,
.res-fraction,
.res-badge,
.res-chips,
.res-ctas {
  opacity: 0;
  animation: res-fade-up 400ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: calc(var(--stagger, 0) * 60ms + 300ms);
}

.res-ring-container { --stagger: 0; }
.res-fraction       { --stagger: 1; }
.res-badge          { --stagger: 2; }
.res-chips          { --stagger: 3; }
.res-ctas           { --stagger: 4; }


/* ══════════════════════════════════════════════════════════════
   Desktop — Two-column premium frame
   ══════════════════════════════════════════════════════════════ */

@media (min-width: 1024px) {
  .res-fold {
    width: min(1200px, calc(100vw - 80px));
    max-width: none;
    margin: 0 auto;
    padding: var(--sp-lg) 0 var(--sp-xl);
    gap: var(--sp-lg);
  }

  .res-header {
    height: 64px;
  }

  .res-header-back {
    width: 48px;
    height: 48px;
    border-radius: var(--r-lg);
  }

  .res-header-title {
    font-size: clamp(1.2rem, 1.6vw, 1.5rem);
    font-weight: var(--fw-bold);
  }

  .res-header-pill {
    padding: 10px 18px;
    font-size: 0.82rem;
    font-weight: var(--fw-bold);
  }

  .res-header-spacer {
    display: none;
  }

  .res-frame {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(340px, 0.9fr) minmax(480px, 1.1fr);
    gap: var(--sp-lg);
    align-items: stretch;
  }

  .res-score-card,
  .res-action-card {
    border-radius: var(--r-2xl);
    box-shadow:
      0 1px 3px rgba(0, 0, 0, 0.04),
      0 12px 32px rgba(0, 0, 0, 0.06);
  }

  .res-score-card {
    padding: var(--sp-xl) var(--sp-xl);
    display: grid;
    grid-template-rows: auto 1fr auto;
    justify-items: center;
    gap: var(--sp-lg);
  }

  .res-ring-container {
    width: min(240px, 32vh);
  }

  .res-ring-number {
    font-size: clamp(3.5rem, 5vw, 5rem);
  }

  .res-ring-unit {
    font-size: 1.3rem;
    margin-left: 3px;
  }

  .res-fraction {
    font-size: 1.1rem;
  }

  .res-badge {
    padding: 10px 22px;
    font-size: 0.88rem;
  }

  .res-action-card {
    padding: var(--sp-xl);
    gap: var(--sp-lg);
  }

  .res-action-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--r-xl);
    font-size: 30px;
  }

  .res-action-title {
    font-size: clamp(1.8rem, 2.4vw, 2.4rem);
  }

  .res-action-message {
    font-size: 1rem;
    margin-top: 10px;
  }

  .res-insight {
    min-height: 110px;
    padding: var(--sp-lg) var(--sp-md);
    border-radius: var(--r-xl);
  }

  .res-insight strong {
    font-size: 1.8rem;
  }

  .res-ctas {
    max-width: none;
    display: grid;
    gap: var(--sp-sm);
    padding: 0;
    margin-top: auto;
  }

  .res-cta {
    min-height: 56px;
    border-radius: var(--r-xl);
    font-size: 1rem;
    padding: 16px 24px;
  }

  .res-explained {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 var(--sp-xl) var(--sp-2xl);
  }

  .res-sparkline {
    height: 80px;
  }
}


/* ══════════════════════════════════════════════════════════════
   Tablet
   ══════════════════════════════════════════════════════════════ */

@media (min-width: 768px) and (max-width: 1023px) {
  .res-fold {
    padding: 0 var(--sp-2xl) var(--sp-lg);
  }

  .res-ring-container {
    width: 220px;
  }

  .res-ctas {
    max-width: 440px;
  }

  .res-explained {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 var(--sp-xl) var(--sp-2xl);
  }

  .res-sparkline {
    height: 80px;
  }
}


/* ══════════════════════════════════════════════════════════════
   Short Screens (iPhone SE, landscape)
   ══════════════════════════════════════════════════════════════ */

@media (max-height: 700px) {
  .res-ring-container {
    width: clamp(120px, 28vw, 150px);
  }

  .res-fold {
    padding-top: 0;
    gap: 4px;
  }

  .res-badge {
    margin-top: var(--sp-sm);
  }

  .res-chips {
    margin-top: var(--sp-sm);
  }

  .res-ctas {
    padding-bottom: var(--sp-sm);
  }
}

/* Desktop short screens */
@media (max-height: 780px) and (min-width: 1024px) {
  .res-fold {
    padding-top: var(--sp-md);
    padding-bottom: var(--sp-md);
    gap: var(--sp-sm);
  }

  .res-header {
    height: 56px;
  }

  .res-score-card,
  .res-action-card {
    padding: var(--sp-lg);
  }

  .res-ring-container {
    width: min(200px, 30vh);
  }

  .res-action-title {
    font-size: clamp(1.5rem, 2.2vw, 2rem);
  }

  .res-insight {
    min-height: 90px;
    padding: var(--sp-md) var(--sp-sm);
  }

  .res-cta {
    min-height: 50px;
  }
}


/* ══════════════════════════════════════════════════════════════
   Mobile-specific fixes
   ══════════════════════════════════════════════════════════════ */

@media (max-width: 480px) {
  .res-chip {
    font-size: 0.75rem;
    padding: 5px 10px;
    gap: 4px;
  }

  .res-cta {
    padding: 14px 16px;
    font-size: 0.9rem;
  }

  .res-insight {
    padding: var(--sp-sm);
    min-height: 80px;
  }

  .res-insight strong {
    font-size: 1.2rem;
  }
}

/* Stacked frame on medium screens */
@media (max-width: 1023px) {
  .res-frame {
    display: flex;
    flex-direction: column;
    gap: var(--sp-lg);
  }
}


/* ══════════════════════════════════════════════════════════════
   Reduced Motion
   ══════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
  .res-ring-fill {
    transition: stroke-dashoffset 0.01s;
  }

  .res-streak {
    animation-duration: 0.01s;
    animation-delay: 0s;
  }

  .res-score-card,
  .res-action-card,
  .res-ring-container,
  .res-fraction,
  .res-badge,
  .res-chips,
  .res-ctas {
    animation: res-fade-up-reduced 200ms ease forwards;
    animation-delay: calc(var(--stagger, 0) * 30ms);
  }

  @keyframes res-fade-up-reduced {
    to { opacity: 1; transform: none; }
  }

  .res-eq-body {
    transition-duration: 0.01s;
  }

  .res-explained {
    animation-duration: 0.01s;
  }

  .res-spark-bar {
    transition-duration: 0.01s;
  }
}
