/* Statistical Visual Reasoning Studio — additive module for Data Visualization Lab */
.statistical-studio{
  max-width:1380px;
  margin:0 auto 64px;
  padding:0 clamp(14px,3vw,28px);
}
.statistical-studio__shell{
  overflow:hidden;
  border:1px solid #cbd8df;
  border-radius:24px;
  background:#fff;
  box-shadow:0 22px 58px rgba(16,40,61,.10);
}
.statistical-studio__hero{
  display:grid;
  grid-template-columns:minmax(0,1.4fr) minmax(260px,.6fr);
  gap:26px;
  align-items:end;
  padding:34px 36px 30px;
  border-bottom:1px solid #d7e1e7;
  background:
    radial-gradient(circle at 88% 18%,rgba(241,139,85,.12),transparent 18rem),
    radial-gradient(circle at 74% 0%,rgba(91,198,200,.14),transparent 21rem),
    linear-gradient(180deg,#fff,#fbfcfd);
}
.statistical-studio__hero .eyebrow{color:#1260cf}
.statistical-studio__hero h2{
  margin:9px 0 0;
  color:#10283d;
  font:500 clamp(38px,4.4vw,60px)/.94 Georgia,"Times New Roman",serif;
  letter-spacing:-.04em;
}
.statistical-studio__hero p{
  margin:14px 0 0;
  max-width:780px;
  color:#63798b;
  font-size:13px;
  line-height:1.65;
}
.stats-inference-chain{
  display:flex;
  flex-wrap:wrap;
  justify-content:flex-end;
  gap:7px;
}
.stats-inference-chain span{
  padding:8px 10px;
  border:1px solid #d4e0e6;
  border-radius:999px;
  background:rgba(255,255,255,.92);
  color:#526d80;
  font-size:9px;
  font-weight:850;
  letter-spacing:.06em;
  text-transform:uppercase;
}
.stats-inference-chain b{align-self:center;color:#f18b55;font-size:13px}

.stats-topic-nav{
  display:grid;
  grid-template-columns:repeat(9,minmax(0,1fr));
  border-bottom:1px solid #d7e1e7;
  background:#f8fbfc;
}
.stats-topic-button{
  min-width:0;
  display:grid;
  gap:5px;
  justify-items:center;
  padding:13px 6px 11px;
  border:0;
  border-right:1px solid #e3eaee;
  border-bottom:3px solid transparent;
  background:transparent;
  color:#718697;
}
.stats-topic-button:last-child{border-right:0}
.stats-topic-button span{
  display:grid;
  place-items:center;
  width:26px;
  height:26px;
  border:1px solid #cdd9df;
  border-radius:50%;
  background:#fff;
  font-size:9px;
  font-weight:850;
}
.stats-topic-button strong{
  max-width:100%;
  overflow:hidden;
  font-size:9px;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.stats-topic-button:hover{color:#10283d;background:#fff}
.stats-topic-button.active{
  border-bottom-color:#f18b55;
  background:#fff;
  color:#10283d;
}
.stats-topic-button.active span{
  border-color:#1260cf;
  background:#1260cf;
  color:#fff;
}

.stats-stage{
  display:grid;
  grid-template-columns:minmax(0,1.7fr) minmax(310px,.8fr);
  min-height:730px;
}
.stats-main{
  min-width:0;
  padding:30px 30px 28px;
  border-right:1px solid #d7e1e7;
}
.stats-main__header{display:grid;gap:8px}
.stats-main__header #stats-kicker{
  color:#1260cf;
  font-size:9px;
  font-weight:850;
  letter-spacing:.16em;
  text-transform:uppercase;
}
.stats-main__header h3{
  margin:0;
  max-width:820px;
  color:#10283d;
  font:500 clamp(30px,3vw,44px)/1 Georgia,"Times New Roman",serif;
  letter-spacing:-.035em;
}
.stats-question{
  margin:4px 0 0;
  max-width:860px;
  color:#5f7688;
  font-size:13px;
  line-height:1.65;
}
.stats-controls{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:10px;
  margin:22px 0 15px;
}
.stats-control{
  display:grid;
  gap:9px;
  min-width:0;
  padding:12px 13px;
  border:1px solid #d9e3e8;
  border-radius:14px;
  background:#fbfcfd;
}
.stats-control__top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.stats-control__label{
  color:#607689;
  font-size:9px;
  font-weight:850;
  letter-spacing:.08em;
  text-transform:uppercase;
}
.stats-control__value{
  color:#1260cf;
  font-size:10px;
  font-weight:850;
  white-space:nowrap;
}
.stats-control input[type="range"]{width:100%;accent-color:#1260cf}
.stats-control select{
  width:100%;
  min-width:0;
  padding:8px 10px;
  border:1px solid #cbd7de;
  border-radius:9px;
  background:#fff;
  color:#183047;
  font-size:11px;
}
.stats-visual-stage{
  display:grid;
  place-items:center;
  min-height:430px;
  overflow:hidden;
  border:1px solid #d9e3e8;
  border-radius:18px;
  background:
    radial-gradient(circle at 20% 12%,rgba(169,215,238,.16),transparent 17rem),
    radial-gradient(circle at 88% 8%,rgba(241,139,85,.10),transparent 14rem),
    linear-gradient(180deg,#fcfefd,#fff);
}
#stats-canvas{display:block;width:100%;height:auto;min-height:430px}
.stats-main__caption{
  display:grid;
  grid-template-columns:120px minmax(0,1fr);
  gap:16px;
  margin-top:14px;
  padding:15px 16px;
  border-left:3px solid #5bc6c8;
  background:#f4fbfb;
}
.stats-main__caption span{
  color:#1d8f92;
  font-size:9px;
  font-weight:850;
  letter-spacing:.13em;
  text-transform:uppercase;
}
.stats-main__caption p{margin:0;color:#5d7385;font-size:11.5px;line-height:1.6}

.stats-side{
  display:flex;
  flex-direction:column;
  background:#fbfcfd;
}
.stats-side__block{
  padding:22px 24px;
  border-bottom:1px solid #dfe7eb;
}
.stats-side__block:last-child{border-bottom:0}
.stats-side__block .small-label{color:#1260cf}
.stats-side__block p{
  margin:9px 0 0;
  color:#607689;
  font-size:11.5px;
  line-height:1.7;
}
.stats-side__block--boundary{background:#fff8ef}
.stats-side__block--boundary .small-label{color:#cf6d3f}
.stats-formula-stack{
  display:grid;
  gap:8px;
  margin-top:12px;
}
.stats-formula{
  padding:10px 12px;
  border:1px solid #d7e1e7;
  border-radius:10px;
  background:#fff;
  color:#10283d;
  font:600 11px/1.45 ui-monospace,SFMono-Regular,Menlo,monospace;
}
.stats-formula em{color:#1260cf;font-style:normal}

.stats-code{
  margin-top:auto;
  border-top:1px solid #24425c;
  background:#10283d;
  color:#dcecf7;
}
.stats-code__header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:15px 18px;
  border-bottom:1px solid rgba(255,255,255,.11);
}
.stats-code__header span{
  color:#8bc8ff;
  font-size:9px;
  font-weight:850;
  letter-spacing:.14em;
  text-transform:uppercase;
}
.stats-code pre{
  margin:0;
  max-height:270px;
  overflow:auto;
  padding:18px;
  color:#dcecf7;
  font:500 11px/1.62 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  white-space:pre-wrap;
}

.stats-deeper-map{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:0;
  border-top:1px solid #d7e1e7;
  background:#fff;
}
.stats-deeper-card{
  min-height:160px;
  padding:22px;
  border-right:1px solid #e2e9ed;
}
.stats-deeper-card:last-child{border-right:0}
.stats-deeper-card span{
  color:#1260cf;
  font-size:9px;
  font-weight:850;
  letter-spacing:.12em;
  text-transform:uppercase;
}
.stats-deeper-card h4{
  margin:13px 0 8px;
  color:#10283d;
  font:500 20px/1.08 Georgia,"Times New Roman",serif;
}
.stats-deeper-card p{margin:0;color:#657a8d;font-size:11px;line-height:1.6}

/* SVG visual vocabulary */
.stats-axis{stroke:#c8d6de;stroke-width:1}
.stats-grid{stroke:#e7eef2;stroke-width:1}
.stats-reference{stroke:#5bc6c8;stroke-width:2;stroke-dasharray:5 5}
.stats-critical{stroke:#f18b55;stroke-width:2;stroke-dasharray:4 5}
.stats-observed{stroke:#10283d;stroke-width:3}
.stats-arrow{stroke:#93a9b8;stroke-width:2;marker-end:url(#stats-arrowhead)}
.stats-fill-blue{fill:#1260cf}
.stats-fill-orange{fill:#f18b55}
.stats-fill-teal{fill:#5bc6c8}
.stats-area-blue{fill:rgba(169,215,238,.50);stroke:none}
.stats-area-orange{fill:rgba(241,139,85,.42);stroke:none}
.stats-area-teal{fill:rgba(91,198,200,.30);stroke:none}
.stats-curve-blue{fill:none;stroke:#1260cf;stroke-width:3;stroke-linecap:round;stroke-linejoin:round}
.stats-curve-teal{fill:none;stroke:#188f93;stroke-width:3;stroke-linecap:round;stroke-linejoin:round}
.stats-panel{fill:#f8fbfc;stroke:#d9e3e8;stroke-width:1}
.stats-card{fill:#fff;stroke:#d3dfe5;stroke-width:1}
.stats-card-accent{fill:#eef6ff;stroke:#bcd4f2;stroke-width:1}
.stats-callout{fill:#fff8ef;stroke:#f2d5bf;stroke-width:1}
.stats-badge-good{fill:#e5f5ef;stroke:#b9ded2;stroke-width:1}
.stats-badge-warn{fill:#fff1e8;stroke:#f0c4a9;stroke-width:1}
.stats-ci-hit{stroke:#1260cf;stroke-width:2.5;stroke-linecap:round}
.stats-ci-miss{stroke:#f18b55;stroke-width:2.5;stroke-linecap:round}
.stats-svg-kicker{fill:#718697;font:800 9px Inter,system-ui,sans-serif;letter-spacing:.12em}
.stats-svg-title{fill:#10283d;font:500 23px Georgia,serif}
.stats-svg-title-small{fill:#10283d;font:500 18px Georgia,serif}
.stats-svg-label{fill:#4f687b;font:650 11px Inter,system-ui,sans-serif}
.stats-svg-note{fill:#728694;font:600 9.5px Inter,system-ui,sans-serif}

@media(max-width:1180px){
  .stats-topic-nav{grid-template-columns:repeat(5,minmax(0,1fr))}
  .stats-topic-button:nth-child(5){border-right:0}
  .stats-stage{grid-template-columns:1fr}
  .stats-main{border-right:0;border-bottom:1px solid #d7e1e7}
  .stats-side{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}
  .stats-code{grid-column:1/-1}
  .stats-deeper-map{grid-template-columns:repeat(2,minmax(0,1fr))}
  .stats-deeper-card:nth-child(2){border-right:0}
  .stats-deeper-card:nth-child(-n+2){border-bottom:1px solid #e2e9ed}
}
@media(max-width:760px){
  .statistical-studio{padding:0 14px;margin-bottom:44px}
  .statistical-studio__shell{border-radius:18px}
  .statistical-studio__hero{grid-template-columns:1fr;padding:26px 22px}
  .stats-inference-chain{justify-content:flex-start}
  .stats-topic-nav{grid-template-columns:repeat(3,minmax(0,1fr))}
  .stats-topic-button:nth-child(3n){border-right:0}
  .stats-main{padding:22px 18px 20px}
  .stats-controls{grid-template-columns:1fr}
  .stats-visual-stage{min-height:340px}
  #stats-canvas{min-height:340px}
  .stats-main__caption{grid-template-columns:1fr}
  .stats-side{grid-template-columns:1fr}
  .stats-deeper-map{grid-template-columns:1fr}
  .stats-deeper-card{border-right:0;border-bottom:1px solid #e2e9ed}
  .stats-deeper-card:last-child{border-bottom:0}
}


/* Visible interaction feedback: controls must never appear inert. */
.stats-topic-button,
.stats-control select,
.stats-control input[type="range"]{
  cursor:pointer;
}
.stats-control input[type="range"]:active{cursor:grabbing}
.stats-topic-button:focus-visible,
.stats-control select:focus-visible,
.stats-control input[type="range"]:focus-visible{
  outline:3px solid #f0ad36;
  outline-offset:3px;
}
.stats-live-summary{
  margin:14px 0 0;
  min-height:46px;
  padding:11px 13px;
  border-left:4px solid #1f7d91;
  border-radius:0 10px 10px 0;
  background:#eef8fa;
  color:#173b4d;
  font-size:13px;
  line-height:1.45;
}
.stats-visual--updated{
  animation:stats-output-confirm .34s ease-out;
}
@keyframes stats-output-confirm{
  0%{box-shadow:0 0 0 0 rgba(31,125,145,.30)}
  100%{box-shadow:0 0 0 9px rgba(31,125,145,0)}
}
@media (prefers-reduced-motion:reduce){
  .stats-visual--updated{animation:none}
}
