:root {
  --mcrs-bg: #07111f;
  --mcrs-card: #0d192a;
  --mcrs-text: #eef6ff;
  --mcrs-muted: #93a7bd;
  --mcrs-border: #243650;
  --mcrs-blue: #43a5ff;
  --mcrs-green: #36a269;
  --mcrs-yellow: #d9a514;
  --mcrs-orange: #e77b22;
  --mcrs-red: #d94a4a;
  --mcrs-dark-red: #a93232;
  --mcrs-crisis: #6f1d2a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--mcrs-bg);
  color: var(--mcrs-text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.mcrs-page {
  max-width: 1500px;
  margin-left: 250px;
  padding: 42px 48px 56px;
}

.mcrs-header {
  display: flex;
  justify-content: space-between;
  gap: 40px;
  align-items: flex-start;
  margin-bottom: 28px;
}

.mcrs-eyebrow,
.mcrs-card-label {
  color: var(--mcrs-blue);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .09em;
}

.mcrs-header h1 {
  margin: 8px 0 8px;
  font-size: clamp(32px, 4vw, 48px);
  letter-spacing: -.035em;
}

.mcrs-subtitle {
  max-width: 780px;
  margin: 0;
  color: var(--mcrs-muted);
  font-size: 17px;
  line-height: 1.55;
}

.mcrs-freshness {
  min-width: 230px;
  color: var(--mcrs-muted);
  font-size: 13px;
  line-height: 1.8;
  text-align: right;
}

.mcrs-status {
  display: inline-flex;
  margin-bottom: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #142235;
  color: #a9b8c8;
  font-weight: 700;
}

.mcrs-status.ok {
  background: #102a24;
  color: #59d5a4;
}

.mcrs-status.stale,
.mcrs-status.failed {
  background: #321c1b;
  color: #ff9a72;
}

.mcrs-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, .75fr);
  gap: 20px;
}

.mcrs-score-card,
.mcrs-about-card,
.mcrs-component,
.mcrs-history-shell,
.mcrs-methodology {
  background: var(--mcrs-card);
  border: 1px solid var(--mcrs-border);
  border-radius: 18px;
  box-shadow: 0 7px 25px rgba(27, 39, 60, .045);
}

.mcrs-score-card {
  padding: 28px 30px 24px;
}

.mcrs-score-row {
  display: flex;
  align-items: baseline;
  margin-top: 5px;
}

.mcrs-score {
  font-size: 76px;
  font-weight: 780;
  letter-spacing: -.06em;
  line-height: 1;
}

.mcrs-score-max {
  margin-left: 8px;
  color: var(--mcrs-muted);
  font-size: 22px;
  font-weight: 600;
}

.mcrs-band {
  display: inline-flex;
  margin-top: 12px;
  padding: 7px 12px;
  border-radius: 9px;
  background: #332a12;
  color: #f4cf55;
  font-size: 15px;
  font-weight: 750;
}

.mcrs-weekly {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--mcrs-border);
  color: var(--mcrs-muted);
  font-size: 14px;
}

.mcrs-weekly strong {
  color: var(--mcrs-text);
}

.mcrs-risk-scale {
  display: grid;
  grid-template-columns: 24fr 15fr 15fr 15fr 15fr 16fr;
  overflow: hidden;
  margin-top: 26px;
  border-radius: 10px;
}

.risk-segment {
  min-height: 54px;
  padding: 8px 5px;
  color: white;
  text-align: center;
}

.risk-segment span,
.risk-segment b {
  display: block;
}

.risk-segment span {
  font-size: 10px;
  opacity: .9;
}

.risk-segment b {
  margin-top: 3px;
  font-size: 11px;
}

.risk-low { background: var(--mcrs-green); }
.risk-early { background: var(--mcrs-yellow); }
.risk-watch { background: var(--mcrs-orange); }
.risk-high { background: var(--mcrs-red); }
.risk-severe { background: var(--mcrs-dark-red); }
.risk-crisis { background: var(--mcrs-crisis); }

.mcrs-scale-marker-wrap {
  position: relative;
  height: 18px;
}

.mcrs-scale-marker {
  position: absolute;
  top: 1px;
  left: 0;
  width: 2px;
  height: 14px;
  background: #111827;
  transform: translateX(-1px);
  transition: left .35s ease;
}

.mcrs-scale-marker span {
  position: absolute;
  top: -4px;
  left: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #111827;
  transform: translateX(-50%);
}

.mcrs-about-card {
  padding: 28px;
}

.mcrs-about-card h2 {
  margin: 10px 0 14px;
  font-size: 22px;
  line-height: 1.25;
}

.mcrs-about-card p {
  color: var(--mcrs-muted);
  font-size: 14px;
  line-height: 1.65;
}

.mcrs-model {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--mcrs-border);
  color: var(--mcrs-muted);
  font-size: 13px;
}

.mcrs-section {
  margin-top: 26px;
}

.mcrs-section-heading {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: end;
  margin-bottom: 14px;
}

.mcrs-section-heading h2 {
  margin: 5px 0 0;
  font-size: 25px;
}

.mcrs-section-heading p {
  margin: 0;
  color: var(--mcrs-muted);
  font-size: 13px;
}

.mcrs-components {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.mcrs-component {
  padding: 18px;
}

.component-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.component-top span {
  font-size: 13px;
  font-weight: 700;
}

.component-top strong {
  font-size: 23px;
}

.component-bar {
  height: 6px;
  margin: 14px 0 13px;
  overflow: hidden;
  border-radius: 999px;
  background: #1b2b40;
}

.component-bar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--mcrs-blue);
  transition: width .4s ease;
}

.component-detail {
  min-height: 40px;
  color: var(--mcrs-muted);
  font-size: 12px;
  line-height: 1.45;
}

.mcrs-component small {
  display: block;
  margin-top: 11px;
  color: #71869b;
  font-size: 11px;
}

.mcrs-history-shell {
  padding: 24px;
}

.mcrs-range-controls {
  display: flex;
  gap: 6px;
}

.mcrs-range-controls button {
  padding: 7px 11px;
  border: 1px solid var(--mcrs-border);
  border-radius: 8px;
  background: #0d192a;
  color: var(--mcrs-muted);
  cursor: pointer;
  font-weight: 650;
}

.mcrs-range-controls button.active {
  border-color: var(--mcrs-blue);
  background: #0a2036;
  color: var(--mcrs-blue);
}

.mcrs-history-placeholder {
  min-height: 260px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  border: 1px dashed #31506b;
  border-radius: 13px;
  background: #0a1622;
  color: var(--mcrs-muted);
  text-align: center;
}

.mcrs-history-placeholder strong {
  margin-bottom: 8px;
  color: var(--mcrs-text);
  font-size: 18px;
}

.mcrs-history-placeholder span {
  max-width: 520px;
  line-height: 1.55;
}

.mcrs-methodology {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin-top: 26px;
  padding: 24px;
}

.mcrs-methodology > div {
  padding: 0 24px;
  border-right: 1px solid var(--mcrs-border);
}

.mcrs-methodology > div:first-child {
  padding-left: 0;
}

.mcrs-methodology > div:last-child {
  padding-right: 0;
  border-right: 0;
}

.mcrs-methodology h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.mcrs-methodology p {
  margin: 0;
  color: var(--mcrs-muted);
  font-size: 12px;
  line-height: 1.6;
}

.mcrs-footer {
  padding-top: 25px;
  color: #71869b;
  font-size: 11px;
  text-align: center;
}

@media (max-width: 1180px) {
  .mcrs-components {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .mcrs-page {
    margin-left: 0;
    padding: 28px 20px 45px;
  }

  .mcrs-header,
  .mcrs-section-heading {
    flex-direction: column;
    align-items: flex-start;
  }

  .mcrs-freshness {
    text-align: left;
  }

  .mcrs-hero,
  .mcrs-methodology {
    grid-template-columns: 1fr;
  }

  .mcrs-methodology > div {
    padding: 16px 0;
    border-right: 0;
    border-bottom: 1px solid var(--mcrs-border);
  }

  .mcrs-methodology > div:last-child {
    border-bottom: 0;
  }
}

@media (max-width: 600px) {
  .mcrs-components {
    grid-template-columns: 1fr;
  }

  .mcrs-score {
    font-size: 62px;
  }

  .risk-segment b {
    font-size: 9px;
  }
}

/* Reconstructed historical MCRS chart */

.mcrs-history-note {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 14px 0 18px;
  color: #a9b8c8;
  font-size: 0.88rem;
  line-height: 1.5;
}

.mcrs-history-note strong {
  color: #263548;
  font-size: 0.92rem;
}

.mcrs-history-chart {
  width: 100%;
  min-width: 0;
}

.mcrs-chart-meta,
.mcrs-chart-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  color: #6b7787;
  font-size: 0.8rem;
}

.mcrs-chart-meta {
  margin-bottom: 8px;
}

.mcrs-chart-legend {
  margin-top: 8px;
}

.mcrs-chart-stage {
  position: relative;
  width: 100%;
}

.mcrs-chart-svg {
  display: block;
  width: 100%;
  height: 430px;
  overflow: visible;
}

.mcrs-chart-grid {
  stroke: #203448;
  stroke-width: 1;
}

.mcrs-chart-axis,
.mcrs-chart-axis-tick {
  stroke: #526b82;
  stroke-width: 1;
}

.mcrs-chart-axis-label {
  fill: #93a7bd;
  font-size: 12px;
  font-family: inherit;
}

.mcrs-chart-threshold {
  stroke: #806b43;
  stroke-width: 1.2;
  stroke-dasharray: 6 6;
  opacity: 0.8;
}

.mcrs-chart-threshold-label {
  fill: #c8a85d;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
}

.mcrs-chart-line {
  fill: none;
  stroke: #43a5ff;
  stroke-width: 3;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.mcrs-chart-current {
  fill: #43a5ff;
  stroke: #eef6ff;
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
}

.mcrs-chart-hit {
  fill: transparent;
  stroke: transparent;
  cursor: crosshair;
}

.mcrs-chart-tooltip {
  position: absolute;
  z-index: 5;
  width: 230px;
  padding: 12px 14px;
  border: 1px solid #d8e0e9;
  border-radius: 10px;
  background: rgba(10, 22, 38, 0.97);
  box-shadow: 0 8px 24px rgba(24, 39, 58, 0.14);
  color: #c8d8e8;
  font-size: 0.78rem;
  line-height: 1.45;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 12px));
}

.mcrs-chart-tooltip strong {
  display: block;
  margin-bottom: 5px;
  color: #eef6ff;
  font-size: 0.82rem;
}

.mcrs-tooltip-score {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
  color: #eef6ff;
  font-weight: 700;
}

.mcrs-tooltip-score span {
  color: #93a7bd;
  font-size: 0.7rem;
  font-weight: 600;
}

.mcrs-tooltip-components {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 10px;
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid #e5eaf0;
}

.mcrs-legend-line {
  display: inline-block;
  width: 24px;
  height: 3px;
  margin-right: 6px;
  border-radius: 3px;
  background: #43a5ff;
  vertical-align: middle;
}

@media (max-width: 720px) {
  .mcrs-chart-svg {
    height: 330px;
  }

  .mcrs-chart-tooltip {
    width: 205px;
  }

  .mcrs-chart-meta,
  .mcrs-chart-legend {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
}

/* Never reserve space for the historical fallback when it is hidden. */
#mcrs-history-placeholder[hidden] {
  display: none !important;
}

/* Objective S&P 500 >=15% crash episodes */

.mcrs-crash-window {
  fill: #c58a24;
  opacity: 0.18;
  pointer-events: none;
}

.mcrs-crash-marker {
  fill: #c93434;
  stroke: #eef6ff;
  stroke-width: 2.5;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
}

.mcrs-crash-marker:focus {
  outline: none;
  stroke: #7f1d1d;
  stroke-width: 4;
}

.mcrs-legend-crash {
  display: inline-block;
  width: 11px;
  height: 11px;
  margin-right: 7px;
  background: #c93434;
  transform: rotate(45deg);
  vertical-align: -1px;
}

/* Where today's score fits historically */

.mcrs-historical-position {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 24px;
  margin: 20px 0 24px;
  padding: 22px 24px;
  border: 1px solid var(--mcrs-border);
  border-radius: 14px;
  background: #0a1622;
}

.mcrs-historical-position[hidden] {
  display: none !important;
}

.mcrs-historical-position-main {
  min-width: 0;
}

.mcrs-historical-position-label {
  margin-bottom: 8px;
  color: #93a7bd;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.mcrs-historical-percentile {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}

.mcrs-historical-percentile strong {
  color: #65baff;
  font-size: 2rem;
  line-height: 1;
}

.mcrs-historical-percentile span {
  color: #a9b8c8;
  font-size: 0.9rem;
  font-weight: 700;
}

.mcrs-historical-position-main p {
  max-width: 660px;
  margin: 0;
  color: #c8d8e8;
  font-size: 0.92rem;
  line-height: 1.55;
}

.mcrs-historical-position-caveat {
  margin-top: 10px;
  color: #93a7bd;
  font-size: 0.78rem;
  line-height: 1.45;
}

.mcrs-historical-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.mcrs-historical-stats > div {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 76px;
  padding: 12px 14px;
  border: 1px solid var(--mcrs-border);
  border-radius: 10px;
  background: #0d192a;
}

.mcrs-historical-stats span {
  color: #93a7bd;
  font-size: 0.72rem;
  font-weight: 700;
}

.mcrs-historical-stats strong {
  margin-top: 3px;
  color: #eef6ff;
  font-size: 1.25rem;
}

.mcrs-historical-stats small {
  margin-top: 2px;
  color: #93a7bd;
  font-size: 0.7rem;
}

@media (max-width: 760px) {
  .mcrs-historical-position {
    grid-template-columns: 1fr;
  }

  .mcrs-historical-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
