#explore {
  background: #f0f1f3;
  border-block: 1px solid var(--line);
}
#study-explorer {
  background: #fff;
  border: 1px solid #d7dade;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 14px 44px -32px #17191b66;
}
.explorer-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 30px;
  background: #17191b;
  color: #fafafa;
}
.explorer-header .eyebrow {
  color: #ef929b;
  margin-bottom: 12px;
}
.explorer-header h3 {
  font-size: 32px;
}
.cohort-tag {
  font: 11px/1.6 var(--font-mono);
  max-width: 210px;
  color: #c8cad0;
  border-left: 1px solid #555;
  padding-left: 18px;
}
.explorer-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--line);
}
.explorer-tabs button {
  border: 0;
  background: #f6f6f7;
  padding: 20px 12px;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  text-align: left;
}
.explorer-tabs button span {
  display: block;
  font: 11px var(--font-mono);
  margin-bottom: 6px;
  opacity: 0.7;
}
.explorer-tabs button[aria-pressed="true"] {
  color: var(--red);
  background: white;
  border-bottom-color: var(--red);
}
.explorer-tabs button:hover {
  background: #fff;
  color: var(--ink);
}
.explorer-controls {
  padding: 0 30px;
  margin: 24px 0;
}
.explorer-controls [hidden] {
  display: none;
}
.explorer-controls label {
  min-width: 0;
  max-width: 100%;
  grid-template-columns: minmax(0, 1fr);
}
.explorer-controls select {
  min-width: 0;
}
#explorer-content {
  padding: 0 30px 25px;
}
.chart-intro {
  font-size: 16px;
  max-width: 850px;
  color: var(--muted);
  margin-bottom: 24px;
}
.explorer-legend {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin: 12px 0;
  font-size: 13px;
}
.explorer-legend i {
  display: inline-block;
  width: 26px;
  height: 3px;
  vertical-align: middle;
  margin-right: 8px;
}
.series-base {
  --series: #636e7a;
}
.series-arm {
  --series: #bf1e30;
}
i.series-base,
i.series-arm {
  background: var(--series);
}
.chart-canvas svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.chart-canvas text {
  font: 13px var(--font);
  fill: #515b65;
}
.plot-grid {
  stroke: #e1e3e6;
  stroke-width: 1;
}
.curve {
  fill: none;
  stroke: var(--series);
  stroke-width: 3;
  stroke-linejoin: round;
}
.curve.series-base {
  stroke-dasharray: 7 4;
}

.radar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}
.radar-ring {
  fill: none;
  stroke: #e1e3e6;
}
.radar-shape {
  fill: var(--series);
  fill-opacity: 0.07;
  stroke: var(--series);
  stroke-width: 2.5;
}
.radar-shape.series-base {
  stroke-dasharray: 6 4;
}
.radar-point,
.run-point {
  fill: var(--series);
  stroke: #fff;
  stroke-width: 2;
}
.run-point {
  cursor: pointer;
  fill-opacity: 0.8;
}
.run-point:hover,
.run-point:focus-visible,
.run-point[aria-pressed="true"] {
  fill-opacity: 1;
  stroke: #17191b;
  stroke-width: 3;
}
.rank-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.rank-head,
.rank-list li {
  display: grid;
  grid-template-columns: 1fr 1.15fr 1fr;
  gap: 24px;
  align-items: center;
}
.rank-head {
  font: 11px var(--font-mono);
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding: 20px 0;
}
.rank-list li {
  padding: 20px 0;
  border-bottom: 1px solid #eceef0;
  font-size: 14px;
}
.rank-list a {
  color: var(--ink);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 12px;
}
.rank-list b {
  color: #8a9099;
  font: 12px var(--font-mono);
}
.rank-list small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 5px;
}
.rank-track {
  position: relative;
  height: 38px;
  background: #f5f6f7;
  border-radius: 3px;
}
.rank-zero {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  border-left: 1px solid #949ba3;
}
.rank-bar {
  position: absolute;
  top: 3px;
  bottom: 3px;
  background: #bf1e3029;
}
.rank-bar.negative {
  background: #256b6030;
}
.rank-track strong {
  position: absolute;
  inset: 0;
  text-align: center;
  line-height: 38px;
  color: #17191b;
  font-size: 12px;
  font-weight: 500;
}
.explorer-foot {
  padding: 20px 30px;
  border-top: 1px solid var(--line);
  margin: 0 !important;
  background: #f8f9fa;
}
@media (max-width: 780px) {
  .explorer-header {
    padding: 24px 18px;
    display: block;
  }
  .cohort-tag {
    display: block;
    border: 0;
    padding: 0;
    margin-top: 16px;
    max-width: none;
  }
  .explorer-tabs {
    grid-template-columns: repeat(2, 1fr);
  }
  .explorer-tabs button {
    padding: 14px;
  }
  .explorer-controls {
    padding: 0 18px;
  }
  #explorer-content {
    padding: 0 18px 20px;
  }
  .chart-canvas {
    overflow-x: auto;
  }
  .chart-canvas svg {
    min-width: 510px;
  }
  .radar-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .radar-layout .chart-canvas svg {
    min-width: 0;
  }

  .rank-head {
    display: none;
  }
  .rank-list li {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .explorer-foot {
    padding: 18px;
  }
}
.explorer-foot {
  max-width: none;
}

.explorer-header { padding: 22px 26px; }
.explorer-header h3 { font-size: 28px; }
.explorer-header .eyebrow { margin-bottom: 7px; }
.explorer-tabs { grid-template-columns: repeat(5,1fr); }
.explorer-tabs button { padding: 12px; font-size: 13px; }
.explorer-tabs button span { display: inline; margin-right: 7px; font-size: 10px; }
.explorer-controls { display: grid; gap: 7px; padding: 0 24px; margin: 12px 0; }
.explorer-controls[hidden] { display: none; }
#explorer-content { padding: 0 24px 20px; }
.chart-intro { font-size: 14px; margin-bottom: 14px; }
.explorer-legend { margin: 10px 0; }

@media(max-width: 780px) {
  .explorer-tabs { grid-template-columns: repeat(3,1fr); }
  .explorer-tabs button { padding: 10px 8px; font-size: 12px; }
  .explorer-tabs button span { display: none; }
  .explorer-controls, #explorer-content { padding-left: 14px; padding-right: 14px; }
}

/* Keep every scenario visible without leaving the combined option on its own row. */
#explorer-arm-label .choice-group {
  display: grid;
  grid-template-columns: repeat(10, minmax(min-content, 1fr));
  flex: 1;
  min-width: 0;
}
#explorer-arm-label .choice-group button {
  min-width: 0;
  padding: 5px 4px;
}
@media (max-width: 1100px) {
  #explorer-arm-label .choice-group { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  #explorer-arm-label .choice-group { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.run-plot { position: relative; }
.run-tooltip {
  position: absolute;
  z-index: 2;
  width: max-content;
  max-width: min(310px, 100%);
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #17191b;
  color: #fff;
  box-shadow: 0 4px 16px #17191b33;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-line;
}
.run-tooltip[hidden] { display: none; }
.matrix-value { font-weight: 600; white-space: nowrap; }
.matrix-baseline td, .matrix-baseline th { background: #eef1f4; }
.matrix td { min-width: 115px; }
.matrix sup { margin-left: 4px; }
.matrix-counts { margin-top: 12px; font-size: 13px; color: var(--muted); }
.matrix-counts li { margin: 4px 0; }
