/* ==========================================================================
   PORTFOLIO GRADE PANEL v2.1
   Bar length = weight (importance), Bar color = score (performance)
   ========================================================================== */

.pg-section {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.98));
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 12px;
  padding: 12px;
  margin: 16px 0;
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Header */
.pg-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.pg-title {
  font-size: 0.7rem;
  font-weight: 600;
  color: #94a3b8;
  letter-spacing: 0.08em;
}

/* Grade ring color classes (used by V2) */
.pg-ring-exceptional, .pg-ring-excellent { color: #34d399; }
.pg-ring-good { color: #4ade80; }
.pg-ring-average { color: #facc15; }
.pg-ring-below-avg { color: #fb923c; }
.pg-ring-poor { color: #f87171; }

/* Breakdown Container */
.pg-breakdown {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: rgba(71, 85, 105, 0.12);
  border-radius: 8px;
  overflow: hidden;
}

/* Category */
.pg-cat { background: rgba(30, 41, 59, 0.6); }

/* Category Row - Main header with prominent bar */
.pg-cat-row {
  display: grid;
  /* Removed toggle column - icon, name, weight, bar, score */
  grid-template-columns: 18px 88px 36px 1fr 32px;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.pg-cat-row:hover { background: rgba(51, 65, 85, 0.4); }

/* Hide toggle - no longer needed */
.pg-cat-toggle {
  display: none;
}

.pg-cat-icon {
  width: 16px;
  height: 16px;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pg-cat-icon svg { width: 14px; height: 14px; }

.pg-cat-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: #e2e8f0;
}

.pg-cat-weight {
  font-size: 0.6rem;
  color: #64748b;
  text-align: right;
}

/* Category Bar Area - Container for the variable-width track */
.pg-cat-area {
  display: flex;
  align-items: center;
  height: 8px;
}

/* Category Bar - Track width = weight (importance), scales when switching scenarios */
.pg-cat-track {
  height: 8px;
  background: rgba(30, 41, 59, 0.8);
  border-radius: 4px;
  overflow: hidden;
  width: 0%; /* Initial state for animation */
  transition: width 0.4s ease-out;
}

.pg-cat-fill {
  height: 100%;
  border-radius: 4px;
  width: 0%;
}

.pg-cat-score {
  font-size: 0.85rem;
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Category Details */
.pg-cat-details {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease-out;
  background: rgba(15, 23, 42, 0.3);
}

.pg-cat.expanded .pg-cat-details { max-height: 1000px; }

/* Metrics Container */
.pg-metrics {
  display: flex;
  flex-direction: column;
  padding: 4px 0 6px 0;
}

/* Metric Row - Match category grid for alignment + chevron */
.pg-metric {
  display: grid;
  /* Match category: icon, name, weight, bar, score, chevron */
  grid-template-columns: 18px 88px 36px 1fr 32px 16px;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 3px;
  transition: background 0.1s ease;
}

.pg-metric:hover { background: rgba(51, 65, 85, 0.25); }

.pg-metric-name {
  grid-column: 1 / 4; /* Span icon + name + weight columns */
  font-size: 0.68rem;
  font-weight: 500;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-left: 24px; /* Indent to align text with category name */
}

/* Metric Bar Area - Container for the variable-length track */
.pg-metric-area {
  display: flex;
  align-items: center;
  height: 8px;
}

/* Metric Track - Background bar, LENGTH = weight (importance) */
.pg-metric-track {
  height: 5px;
  border-radius: 3px;
  background: rgba(71, 85, 105, 0.4);
  overflow: hidden;
  transition: width 0.3s ease-out;
}

/* Metric Fill - Colored fill inside track, WIDTH = score (performance) */
.pg-metric-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease-out 0.1s;
}

.pg-metric-fill.excellent { background: rgba(52, 211, 153, 0.7); }  /* #34d399 at 70% opacity */
.pg-metric-fill.good { background: rgba(74, 222, 128, 0.7); }       /* #4ade80 at 70% opacity */
.pg-metric-fill.average { background: rgba(250, 204, 21, 0.7); }    /* #facc15 at 70% opacity */
.pg-metric-fill.below-avg { background: rgba(251, 146, 60, 0.7); }  /* #fb923c at 70% opacity */
.pg-metric-fill.poor { background: rgba(248, 113, 113, 0.7); }      /* #f87171 at 70% opacity */
.pg-metric-fill.na { background: #475569; }

.pg-metric-score {
  font-size: 0.7rem;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.pg-metric-score.excellent { color: #34d399; }
.pg-metric-score.good { color: #4ade80; }
.pg-metric-score.average { color: #facc15; }
.pg-metric-score.below-avg { color: #fb923c; }
.pg-metric-score.poor { color: #f87171; }
.pg-metric-score.na { color: #64748b; }

/* ─────────────────────────────────────────────────────────────────────────
   EXPANDABLE METRIC DETAILS - Modern 4-Column Grid
   ───────────────────────────────────────────────────────────────────────── */

/* Make metric row clickable */
.pg-metric {
  cursor: pointer;
}

/* Chevron indicator */
.pg-metric-chevron {
  font-size: 0.5rem;
  color: #64748b;
  transition: transform 0.2s ease;
}

.pg-metric.expanded .pg-metric-chevron {
  transform: rotate(180deg);
  color: #94a3b8;
}

/* Expandable details panel */
.pg-metric-details {
  grid-column: 1 / -1;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
  margin: 0 10px;
  border-top: 1px solid transparent;
}

.pg-metric.expanded .pg-metric-details {
  max-height: 200px;
  padding: 8px 0;
  border-top: 1px solid rgba(148, 163, 184, 0.08);
}

/* 5-Column Grid Layout */
.pg-detail-grid {
  display: grid;
  grid-template-columns: 140px 1fr 1fr 80px 90px;
  gap: 12px;
  align-items: stretch;
}

/* Card base - subtle separators only */
.pg-detail-card {
  padding-right: 12px;
  border-right: 1px solid rgba(148, 163, 184, 0.08);
}

.pg-detail-card:last-child {
  border-right: none;
  padding-right: 0;
}

/* Card header */
.pg-detail-card-label {
  font-size: 0.5rem;
  font-weight: 500;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

/* Stats card (Your Value + Score) */
.pg-detail-stats {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pg-detail-stat-sub {
  font-size: 0.55rem;
  color: #94a3b8;
}

/* Large value display for metric result card */
.pg-detail-stat-value-large {
  font-size: 1.1rem;
  font-weight: 700;
  color: #f1f5f9;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

/* Scale indicator showing raw value range */
.pg-detail-scale {
  font-size: 0.55rem;
  color: #64748b;
  margin: 2px 0;
  font-variant-numeric: tabular-nums;
}

/* Rating card - centered vertically */
.pg-detail-card-rating {
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: none !important;
}

/* Large rating badge */
.pg-detail-rating-large {
  display: block;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: center;
}

.pg-detail-rating-large.excellent { background: rgba(52, 211, 153, 0.15); color: #34d399; }
.pg-detail-rating-large.good { background: rgba(74, 222, 128, 0.15); color: #4ade80; }
.pg-detail-rating-large.average { background: rgba(250, 204, 21, 0.15); color: #facc15; }
.pg-detail-rating-large.below-avg { background: rgba(251, 146, 60, 0.15); color: #fb923c; }
.pg-detail-rating-large.poor { background: rgba(248, 113, 113, 0.15); color: #f87171; }
.pg-detail-rating-large.na { background: rgba(100, 116, 139, 0.15); color: #64748b; }

/* ELI5 card */
.pg-detail-eli5-text {
  font-size: 0.62rem;
  line-height: 1.45;
  color: #e2e8f0;
}

/* Weight card */
.pg-detail-weight-pct {
  font-size: 0.8rem;
  font-weight: 600;
  color: #f1f5f9;
  margin-bottom: 2px;
}

.pg-detail-weight-text {
  font-size: 0.58rem;
  line-height: 1.4;
  color: #cbd5e1;
}

/* Tip card */
.pg-detail-tip-text {
  font-size: 0.6rem;
  line-height: 1.4;
  color: #e2e8f0;
}

/* Methodology Explainer */
.pg-methodology {
  margin-top: 20px;
  padding: 16px 24px;
  text-align: center;
  border-top: 1px solid rgba(148, 163, 184, 0.1);
}

.pg-methodology-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  margin-bottom: 8px;
}

.pg-methodology-text {
  font-size: 0.65rem;
  line-height: 1.7;
  color: #78859b;
  max-width: 1300px;
  margin: 0 auto;
}

/* Light theme methodology */
.metrics-panel:not(.mp-theme-dark) .pg-methodology {
  border-top-color: rgba(148, 163, 184, 0.15);
}

.metrics-panel:not(.mp-theme-dark) .pg-methodology-title {
  color: #475569;
}

.metrics-panel:not(.mp-theme-dark) .pg-methodology-text {
  color: #64748b;
}

/* ==========================================================================
   PORTFOLIO GRADE v2.0 — REDESIGNED HERO LAYOUT
   Premium, engaging design with centered scenario selector
   ========================================================================== */

/* V2 Section Container */
.pg-section-v2 {
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.98), rgba(30, 41, 59, 0.95));
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 16px;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

/* Subtle background pattern */
.pg-section-v2::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 200px;
  background: radial-gradient(ellipse at 50% 0%, rgba(59, 130, 246, 0.08) 0%, transparent 70%);
  pointer-events: none;
}

/* V2 Header */
.pg-header-v2 {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin-bottom: 20px;
  position: relative;
}

.pg-header-v2 .pg-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #94a3b8;
  letter-spacing: 0.12em;
}

.pg-header-v2 .pg-title sup {
  font-size: 0.5em;
  vertical-align: super;
  opacity: 0.7;
}

/* Info Button - positioned next to portfolio name */
.pg-info-btn {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(30, 41, 59, 0.5);
  color: #64748b;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: 8px;
}

.pg-info-btn svg {
  width: 14px;
  height: 14px;
}

.pg-info-btn:hover {
  color: #3b82f6;
  border-color: rgba(59, 130, 246, 0.4);
  background: rgba(59, 130, 246, 0.1);
  transform: scale(1.1);
}

/* ==========================================================================
   SCENARIO SELECTOR — Centered, Prominent Tabs
   ========================================================================== */

.pg-scenario-selector {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px; /* Reduced - closer to hero section */
  flex-wrap: wrap;
  padding-bottom: 8px; /* Room for the dot */
}

.pg-scenario-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 50px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(30, 41, 59, 0.6);
  color: #94a3b8;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.pg-scenario-tab:hover {
  border-color: rgba(59, 130, 246, 0.4);
  color: #e2e8f0;
  transform: translateY(-2px);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(59, 130, 246, 0.1);
  background: rgba(59, 130, 246, 0.1);
}

.pg-scenario-tab:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.pg-scenario-tab.active {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  border-color: transparent;
  color: white;
  box-shadow:
    0 4px 12px rgba(59, 130, 246, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

/* Active indicator dot below selected tab */
.pg-scenario-tab.active::after {
  content: '';
  position: absolute;
  bottom: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  background: #3b82f6;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.6);
  animation: dotPulse 2s ease-in-out infinite;
}

@keyframes dotPulse {
  0%, 100% { opacity: 1; transform: translateX(-50%) scale(1); }
  50% { opacity: 0.7; transform: translateX(-50%) scale(1.2); }
}

.pg-scenario-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pg-scenario-icon svg {
  width: 20px;
  height: 20px;
  transition: transform 0.2s ease;
}

.pg-scenario-tab:hover .pg-scenario-icon svg {
  transform: scale(1.1);
}

.pg-scenario-tab.active .pg-scenario-icon svg {
  filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.5));
}

.pg-scenario-label {
  position: relative;
  z-index: 1;
  white-space: nowrap;
}

/* ==========================================================================
   HERO GRADE DISPLAY v2
   ========================================================================== */

.pg-hero-v2 {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 24px;
  background: rgba(15, 23, 42, 0.6);
  border-radius: 12px;
  margin-bottom: 16px;
  border: 1px solid rgba(148, 163, 184, 0.08);
  position: relative;
}

.pg-grade-ring-left {
  flex-shrink: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Large Scenario Icon Backdrop - behind grade ring */
.pg-grade-backdrop {
  position: absolute;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  opacity: 0.25;
  z-index: 0;
  pointer-events: none;
}

.pg-grade-backdrop svg {
  width: 100%;
  height: 100%;
}

/* 3D Flip Card Container */
.pg-grade-flip {
  width: 90px;
  height: 90px;
  position: relative;
  z-index: 1;
}

/* Back Face - Loading Spinner */
.pg-grade-back {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(30, 41, 59, 0.8);
  border-radius: 50%;
  border: 4px solid rgba(148, 163, 184, 0.3);
}

.pg-spinner {
  width: 32px;
  height: 32px;
  border: 4px solid rgba(148, 163, 184, 0.3);
  border-top-color: #64748b;
  border-radius: 50%;
  animation: pgSpin 0.8s linear infinite;
}

@keyframes pgSpin {
  to { transform: rotate(360deg); }
}

/* Large Grade Ring with Glow - 3D ring effect */
.pg-ring-v2 {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 6px solid currentColor;
  background: transparent;
  flex-shrink: 0;
  position: absolute;
  inset: 0;
  box-shadow:
    /* Outer shadow - bottom right (lighter) */
    1px 1px 2px rgba(0, 0, 0, 0.25),
    2px 2px 4px rgba(0, 0, 0, 0.15),
    3px 3px 6px rgba(0, 0, 0, 0.1),
    /* Inner shadow - top left inside edge (3D ring depth) */
    inset 2px 2px 4px rgba(0, 0, 0, 0.3),
    inset 1px 1px 2px rgba(0, 0, 0, 0.2),
    /* Subtle color glow */
    0 0 12px color-mix(in srgb, var(--grade-color, #94a3b8) 15%, transparent);
}

.pg-ring-v2::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: linear-gradient(
    135deg,
    transparent 40%,
    rgba(255, 255, 255, 0.15) 50%,
    transparent 60%
  );
  animation: ringShimmer 4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes ringShimmer {
  0%, 100% { transform: rotate(0deg); opacity: 0; }
  25% { opacity: 1; }
  50% { transform: rotate(180deg); opacity: 1; }
  75% { opacity: 0; }
}

.pg-letter-v2 {
  font-size: 2.4rem;
  font-weight: 800;
  color: inherit;
  text-shadow:
    1px 1px 1px rgba(0, 0, 0, 0.4),
    2px 2px 3px rgba(0, 0, 0, 0.25),
    3px 3px 5px rgba(0, 0, 0, 0.15);
  position: relative;
  z-index: 1;
}

/* Score display on the right side */
.pg-score-right {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 90px;
  text-align: center;
}

/* Score 3D Flip Container */
.pg-score-flip {
  position: relative;
}

.pg-score-front {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.pg-score-back {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(30, 41, 59, 0.8);
  border-radius: 8px;
  padding: 16px;
}

.metrics-panel:not(.mp-theme-dark) .pg-score-back {
  background: #f1f5f9;
}

.pg-score-value-large {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  transition: color 0.3s ease;
  text-shadow: 0 0 20px currentColor;
}

.pg-score-value-large .pg-score-unit {
  font-size: 1.25rem;
  font-weight: 600;
  opacity: 0.85;
}

.pg-grade-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 4px 12px;
  border-radius: 4px;
  margin-top: 8px;
  transition: all 0.3s ease;
}

.pg-grade-label-exceptional,
.pg-grade-label-excellent { background: rgba(52, 211, 153, 0.15); color: #34d399; }
.pg-grade-label-good { background: rgba(74, 222, 128, 0.15); color: #4ade80; }
.pg-grade-label-average { background: rgba(250, 204, 21, 0.15); color: #facc15; }
.pg-grade-label-below-avg { background: rgba(251, 146, 60, 0.15); color: #fb923c; }
.pg-grade-label-poor { background: rgba(248, 113, 113, 0.15); color: #f87171; }

/* ==========================================================================
   PERSONALITY / PHILOSOPHY TEXT
   ========================================================================== */

.pg-personality {
  flex: 1;
  min-width: 0;
}

/* Header with name (icon now in backdrop behind grade ring) */
.pg-personality-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.pg-personality-name {
  font-size: 1.5rem;
  font-weight: 800;
  color: #e2e8f0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-shadow:
    0 0 20px rgba(255, 255, 255, 0.2),
    0 2px 4px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-wrap: wrap;
}

/* Individual letter spans for wave animation */
.pg-title-letter {
  color: inherit;
  text-shadow: inherit;
}

.pg-personality-tagline {
  font-size: 0.95rem;
  color: #b0bac9;
  font-style: italic;
  margin-bottom: 12px;
}

/* Individual word spans for staggered animation */
.pg-tagline-word {
  color: inherit;
}

.pg-personality-philosophy {
  font-size: 0.72rem;
  line-height: 1.6;
  color: #78859b;
  font-weight: 400;
}

/* ==========================================================================
   TOOLTIP
   ========================================================================== */

.pg-tooltip {
  position: absolute;
  top: 50px;
  left: 50%;
  transform: translateX(-50%) scale(0.95);
  width: min(400px, calc(100% - 32px));
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.98), rgba(15, 23, 42, 0.98));
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
}

.pg-tooltip.visible {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) scale(1);
}

.pg-tooltip-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.pg-tooltip-title {
  font-size: 1rem;
  font-weight: 600;
  color: #f1f5f9;
}

.pg-tooltip-close {
  width: 24px;
  height: 24px;
  border: none;
  background: rgba(100, 116, 139, 0.2);
  color: #94a3b8;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.pg-tooltip-close:hover {
  background: rgba(100, 116, 139, 0.35);
  color: #e2e8f0;
}

.pg-tooltip-body {
  font-size: 0.8rem;
  line-height: 1.6;
  color: #cbd5e1;
  margin-bottom: 12px;
  white-space: pre-line;
}

.pg-tooltip-footer {
  padding-top: 12px;
  border-top: 1px solid rgba(148, 163, 184, 0.1);
}

.pg-tooltip-best-for-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: #3b82f6;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pg-tooltip-best-for {
  font-size: 0.75rem;
  color: #94a3b8;
  font-style: italic;
  margin-left: 6px;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 640px) {
  .pg-section { padding: 10px; }

  .pg-cat-row {
    /* Removed toggle - icon, name, weight, bar, score */
    grid-template-columns: 16px 72px 30px 1fr 28px;
    gap: 4px;
    padding: 6px 8px;
  }

  .pg-cat-name { font-size: 0.7rem; }
  .pg-cat-area { height: 6px; }
  .pg-cat-track { height: 6px; }
  .pg-cat-score { font-size: 0.75rem; }

  .pg-metric {
    /* Match category - icon, name, weight, bar, score, chevron */
    grid-template-columns: 16px 72px 30px 1fr 28px 14px;
    gap: 4px;
    padding: 3px 8px;
  }

  .pg-metric-name { font-size: 0.6rem; padding-left: 20px; }
  .pg-metric-area { height: 6px; }
  .pg-metric-track { height: 4px; }
  .pg-metric-fill { height: 100%; }
  .pg-metric-score { font-size: 0.6rem; }

  /* Metric details responsive - stack vertically on mobile */
  .pg-metric-details { margin: 0 8px; }
  .pg-metric.expanded .pg-metric-details { padding: 6px 0; }
  .pg-detail-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .pg-detail-card { padding-right: 8px; }
  .pg-detail-stat-value-large { font-size: 0.9rem; }
  .pg-detail-scale { font-size: 0.5rem; }
  .pg-detail-rating-large { font-size: 0.5rem; padding: 2px 6px; }
  .pg-detail-eli5-text { font-size: 0.55rem; }
  .pg-detail-weight-pct { font-size: 0.7rem; }
  .pg-detail-weight-text { font-size: 0.5rem; }
  .pg-detail-tip-text { font-size: 0.55rem; }

  /* ─────────────────────────────────────────────────────────────────────────
     V2 RESPONSIVE — Mobile adjustments for redesigned layout
     ───────────────────────────────────────────────────────────────────────── */

  .pg-section-v2 { padding: 16px 12px; }

  .pg-scenario-selector { gap: 6px; margin-bottom: 16px; }

  .pg-scenario-tab {
    padding: 8px 10px;
    font-size: 0.7rem;
    gap: 5px;
  }

  .pg-scenario-icon { width: 18px; height: 18px; }
  .pg-scenario-icon svg { width: 16px; height: 16px; }

  .pg-hero-v2 {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 16px;
    gap: 16px;
  }

  .pg-grade-ring-left {
    order: 1;
  }

  .pg-personality {
    order: 2;
  }

  .pg-score-right {
    order: 3;
    flex-direction: row;
    gap: 12px;
    min-width: auto;
  }

  .pg-ring-v2 { width: 70px; height: 70px; }
  .pg-grade-backdrop { width: 90px; height: 90px; }
  .pg-letter-v2 { font-size: 1.8rem; }
  .pg-score-value-large { font-size: 1.8rem; }
  .pg-score-value-large .pg-score-unit { font-size: 1rem; }
  .pg-grade-label { margin-top: 0; }

  .pg-personality-header { justify-content: center; gap: 8px; }
  .pg-personality-name { font-size: 1.1rem; }
  .pg-personality-tagline { font-size: 0.8rem; margin-bottom: 8px; text-align: center; }
  .pg-personality-philosophy { font-size: 0.65rem; line-height: 1.5; text-align: center; }

  .pg-tooltip { width: calc(100% - 24px); top: 40px; }
  .pg-tooltip-title { font-size: 0.9rem; }
  .pg-tooltip-body { font-size: 0.75rem; }
}

/* Extra small screens */
@media (max-width: 400px) {
  .pg-scenario-tab {
    padding: 6px 10px;
    font-size: 0.7rem;
  }

  .pg-scenario-label {
    display: none; /* Show only icons on very small screens */
  }

  .pg-scenario-tab.active .pg-scenario-label {
    display: inline; /* But show label for active tab */
  }
}

/* ==========================================================================
   LIGHT THEME
   ========================================================================== */
.metrics-panel:not(.mp-theme-dark) .pg-section { background: linear-gradient(135deg, #f8fafc, #f1f5f9); border-color: #e2e8f0; }
.metrics-panel:not(.mp-theme-dark) .pg-title { color: #64748b; }
.metrics-panel:not(.mp-theme-dark) .pg-breakdown { background: #e2e8f0; }
.metrics-panel:not(.mp-theme-dark) .pg-cat { background: white; }
.metrics-panel:not(.mp-theme-dark) .pg-cat-row:hover { background: #f1f5f9; }
.metrics-panel:not(.mp-theme-dark) .pg-cat-name { color: #1e293b; }
.metrics-panel:not(.mp-theme-dark) .pg-cat-details { background: #f8fafc; }
.metrics-panel:not(.mp-theme-dark) .pg-metric:hover { background: #f1f5f9; }
.metrics-panel:not(.mp-theme-dark) .pg-metric-name { color: #475569; }
.metrics-panel:not(.mp-theme-dark) .pg-metric-track { background: rgba(148, 163, 184, 0.3); }
.metrics-panel:not(.mp-theme-dark) .pg-metric-details { border-color: #e2e8f0; }
.metrics-panel:not(.mp-theme-dark) .pg-detail-card { border-color: #e2e8f0; }
.metrics-panel:not(.mp-theme-dark) .pg-detail-eli5-text { color: #475569; }
.metrics-panel:not(.mp-theme-dark) .pg-detail-weight-pct { color: #1e293b; }
.metrics-panel:not(.mp-theme-dark) .pg-detail-weight-text { color: #64748b; }
.metrics-panel:not(.mp-theme-dark) .pg-detail-tip-text { color: #64748b; }
.metrics-panel:not(.mp-theme-dark) .pg-detail-stat-value-large { color: #1e293b; }
.metrics-panel:not(.mp-theme-dark) .pg-detail-scale { color: #64748b; }

/* V2 Light Theme */
.metrics-panel:not(.mp-theme-dark) .pg-section-v2 {
  background: linear-gradient(145deg, #f8fafc, #ffffff);
  border-color: #e2e8f0;
}

.metrics-panel:not(.mp-theme-dark) .pg-section-v2::before {
  background: radial-gradient(ellipse at 50% 0%, rgba(59, 130, 246, 0.06) 0%, transparent 70%);
}

.metrics-panel:not(.mp-theme-dark) .pg-scenario-tab {
  background: white;
  border-color: #e2e8f0;
  color: #64748b;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.metrics-panel:not(.mp-theme-dark) .pg-scenario-tab:hover {
  border-color: rgba(59, 130, 246, 0.4);
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.04);
  box-shadow:
    0 4px 12px rgba(59, 130, 246, 0.12),
    0 0 0 1px rgba(59, 130, 246, 0.08);
}

.metrics-panel:not(.mp-theme-dark) .pg-scenario-tab:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

.metrics-panel:not(.mp-theme-dark) .pg-scenario-tab.active {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  border-color: transparent;
  color: white;
  box-shadow:
    0 4px 12px rgba(59, 130, 246, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.metrics-panel:not(.mp-theme-dark) .pg-hero-v2 {
  background: white;
  border-color: #e2e8f0;
}

.metrics-panel:not(.mp-theme-dark) .pg-ring-v2 { background: transparent; }
.metrics-panel:not(.mp-theme-dark) .pg-grade-backdrop { color: #94a3b8; }
.metrics-panel:not(.mp-theme-dark) .pg-grade-back {
  background: #f1f5f9;
  border-color: #e2e8f0;
}
.metrics-panel:not(.mp-theme-dark) .pg-spinner {
  border-color: #e2e8f0;
  border-top-color: #94a3b8;
}
.metrics-panel:not(.mp-theme-dark) .pg-letter-v2 {
  text-shadow:
    1px 1px 1px rgba(0, 0, 0, 0.35),
    2px 2px 3px rgba(0, 0, 0, 0.2),
    3px 3px 5px rgba(0, 0, 0, 0.1);
}
.metrics-panel:not(.mp-theme-dark) .pg-personality-name {
  color: #1e293b;
  text-shadow: none;
}
.metrics-panel:not(.mp-theme-dark) .pg-personality-tagline { color: #444444; }
.metrics-panel:not(.mp-theme-dark) .pg-personality-philosophy { color: #888888; }
.metrics-panel:not(.mp-theme-dark) .pg-score-value-large { text-shadow: none; }

.metrics-panel:not(.mp-theme-dark) .pg-tooltip {
  background: linear-gradient(145deg, #ffffff, #f8fafc);
  border-color: #e2e8f0;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
}

.metrics-panel:not(.mp-theme-dark) .pg-tooltip-title { color: #1e293b; }
.metrics-panel:not(.mp-theme-dark) .pg-tooltip-body { color: #475569; }
.metrics-panel:not(.mp-theme-dark) .pg-tooltip-close { background: rgba(100, 116, 139, 0.1); }
.metrics-panel:not(.mp-theme-dark) .pg-tooltip-close:hover { background: rgba(100, 116, 139, 0.2); }
.metrics-panel:not(.mp-theme-dark) .pg-info-btn { background: rgba(241, 245, 249, 0.8); border-color: #e2e8f0; }
.metrics-panel:not(.mp-theme-dark) .pg-info-btn:hover { background: rgba(59, 130, 246, 0.1); }

/* ==========================================================================
   SHARE BUTTON — In Grade Panel Header
   ========================================================================== */
.pg-share-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(59, 130, 246, 0.06));
  color: #3b82f6;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: all 0.2s ease;
  white-space: nowrap;
  margin-left: auto;
}

.pg-share-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.pg-share-btn:hover {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(59, 130, 246, 0.12));
  border-color: rgba(59, 130, 246, 0.4);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.pg-share-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.15);
}

/* Light theme */
.metrics-panel:not(.mp-theme-dark) .pg-share-btn {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(59, 130, 246, 0.04));
  border-color: rgba(59, 130, 246, 0.2);
}

.metrics-panel:not(.mp-theme-dark) .pg-share-btn:hover {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(59, 130, 246, 0.08));
}

/* Mobile: icon only */
@media (max-width: 640px) {
  .pg-share-btn span { display: none; }
  .pg-share-btn { padding: 6px 8px; }
}

/* ==========================================================================
   SHARE MODAL OVERLAY
   ========================================================================== */
.share-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.share-modal-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.share-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.share-modal-container {
  position: relative;
  z-index: 1;
  background: linear-gradient(145deg, #1a1f2e, #0f1219);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 16px;
  overflow: hidden;
  padding: 24px;
  max-width: min(680px, 95vw);
  max-height: 95vh;
  overflow-y: auto;
  box-shadow:
    0 24px 48px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  transform: scale(0.95) translateY(10px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.share-modal-overlay.visible .share-modal-container {
  transform: scale(1) translateY(0);
}

.share-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.share-modal-title {
  font-size: 1rem;
  font-weight: 600;
  color: #e2e8f0;
  letter-spacing: 0.01em;
}

.share-modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(100, 116, 139, 0.15);
  color: #94a3b8;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.share-modal-close:hover {
  background: rgba(100, 116, 139, 0.3);
  color: #e2e8f0;
}

.share-modal-preview {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.08);
}

.share-modal-canvas {
  display: block;
  width: 100%;
  max-width: 600px;
  height: auto !important;
  border-radius: 10px;
  aspect-ratio: 1200 / 630;
}

.share-modal-controls {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.share-modal-theme-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(30, 41, 59, 0.5);
  color: #94a3b8;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.75rem;
  transition: all 0.2s ease;
}

.share-modal-theme-toggle:hover {
  border-color: rgba(148, 163, 184, 0.4);
  color: #e2e8f0;
  background: rgba(51, 65, 85, 0.5);
}

.share-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.share-action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.share-action-btn svg {
  flex-shrink: 0;
}

.share-action-download {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.share-action-download:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.share-action-copy {
  background: rgba(51, 65, 85, 0.6);
  border-color: rgba(148, 163, 184, 0.2);
  color: #e2e8f0;
}

.share-action-copy:hover {
  background: rgba(71, 85, 105, 0.6);
  border-color: rgba(148, 163, 184, 0.3);
  transform: translateY(-2px);
}

.share-action-share {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.3);
  color: #10b981;
}

.share-action-share:hover {
  background: rgba(16, 185, 129, 0.25);
  transform: translateY(-2px);
}

.share-modal-status {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 500;
  margin-top: 12px;
  height: 20px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.share-modal-status.success { color: #10b981; }
.share-modal-status.error { color: #f87171; }
.share-modal-status.info { color: #94a3b8; }

/* Mobile modal */
@media (max-width: 640px) {
  .share-modal-container {
    padding: 16px;
    margin: 8px;
    max-height: 90vh;
    overflow-y: auto;
  }
  .share-modal-preview {
    padding: 8px;
    overflow: hidden;
  }
  .share-modal-canvas {
    max-width: 100%;
  }
  .share-modal-actions { flex-direction: column; }
  .share-action-btn { justify-content: center; }
}
