.marketstate-shell{
  background:linear-gradient(180deg,rgba(16,29,48,.98),rgba(19,35,58,.98));
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:26px;
  min-width:0;
  max-width:100%
}
.marketstate-head{display:flex;justify-content:space-between;gap:24px;align-items:flex-start}
.marketstate-score-wrap{display:flex;align-items:baseline;gap:10px;flex-wrap:wrap}
.marketstate-score{font-size:clamp(2.8rem,7vw,5.2rem);font-weight:900;line-height:.9;letter-spacing:-.055em}
.marketstate-denom{font-size:1.25rem;color:var(--muted);font-weight:700}
.marketstate-label{display:inline-flex;align-items:center;align-self:center;padding:7px 11px;border-radius:999px;border:1px solid #3e5774;background:#17263a;color:#d8e3ef;font-size:.78rem;font-weight:900;letter-spacing:.08em}
.marketstate-summary{max-width:800px;color:#c4d0dc;line-height:1.7;margin:16px 0 0}
.marketstate-meta{text-align:right;color:var(--muted);font-size:.82rem;line-height:1.55}
.marketstate-bar{height:10px;border-radius:999px;background:linear-gradient(90deg,#ff7a8a 0%,#ffb36d 25%,#9aabbf 50%,#7cb7ff 75%,#66e3c4 100%);margin:24px 0 10px;position:relative}
.marketstate-marker{position:absolute;top:50%;left:57%;width:18px;height:18px;border:3px solid #08111f;border-radius:50%;background:#eef4fb;transform:translate(-50%,-50%);box-shadow:0 0 0 2px rgba(255,255,255,.25)}
.marketstate-scale{display:flex;justify-content:space-between;gap:10px;color:var(--muted);font-size:.72rem}
.marketstate-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin-top:24px;min-width:0}
.marketstate-item{padding:16px;border:1px solid rgba(255,255,255,.07);border-radius:14px;background:rgba(255,255,255,.025);min-width:0}
.marketstate-item-head{display:flex;justify-content:space-between;gap:12px;align-items:center}
.marketstate-name{font-weight:800}
.marketstate-signal{font-size:.72rem;font-weight:900;letter-spacing:.06em;text-transform:uppercase}
.marketstate-signal.supportive{color:var(--accent)}
.marketstate-signal.mixed{color:#d7c58a}
.marketstate-signal.restrictive{color:var(--danger)}
.marketstate-value{font-size:1.35rem;font-weight:850;margin:10px 0 4px}
.marketstate-change{color:#b8c5d3;font-size:.82rem;line-height:1.45}
.marketstate-note{color:var(--muted);font-size:.78rem;line-height:1.5;margin-top:9px}
.marketstate-bottom{display:grid;grid-template-columns:minmax(0,.72fr) minmax(0,1.28fr);gap:14px;margin-top:16px;min-width:0}
.marketstate-bottom>*{min-width:0}
.marketstate-context,.marketstate-history{padding:16px;border:1px solid rgba(255,255,255,.07);border-radius:14px;background:rgba(255,255,255,.02);min-width:0}
.marketstate-bottom h3{font-size:1rem;margin:0 0 10px}
.marketstate-context p,.marketstate-history p{margin:6px 0;color:#b8c5d3;font-size:.84rem;line-height:1.5}
.marketstate-history-head{display:flex;justify-content:space-between;gap:16px;align-items:flex-start;min-width:0}
.marketstate-history-head h3{margin-bottom:2px}
.marketstate-history-head p{margin:0}
.marketstate-history-current{white-space:nowrap;font-size:.78rem;font-weight:900;letter-spacing:.04em;padding:6px 9px;border:1px solid rgba(255,255,255,.09);border-radius:999px;background:rgba(255,255,255,.035);color:#dfe8f2}
.marketstate-history-chart{width:100%;max-width:100%;min-width:0;margin-top:10px;overflow-x:auto;overflow-y:hidden;padding-bottom:2px;-webkit-overflow-scrolling:touch}
.marketstate-history-chart svg{display:block;width:100%;min-width:560px;height:auto}
.ms-zone{opacity:.16}
.ms-zone-strong-on{fill:#66e3c4}
.ms-zone-on{fill:#7cb7ff}
.ms-zone-neutral{fill:#9aabbf}
.ms-zone-off{fill:#ffb36d}
.ms-zone-strong-off{fill:#ff7a8a}
.ms-grid line{stroke:rgba(255,255,255,.12);stroke-width:1}
.ms-ylabels text,.ms-xlabels text{fill:#8fa0b3;font-size:12px;font-weight:700}
.ms-ylabels text{text-anchor:end}
.ms-xlabels text{text-anchor:middle}
.ms-line{fill:none;stroke:#dfe8f2;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round}
.ms-points circle{fill:#17263a;stroke:#dfe8f2;stroke-width:3}
.ms-points circle.current{fill:#eef4fb;stroke:#08111f;stroke-width:4}
.ms-values text{fill:#dfe8f2;font-size:13px;font-weight:900;text-anchor:middle}
.ms-values text.current{font-size:15px}
.marketstate-history-stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin-top:8px;min-width:0}
.marketstate-history-stats>div{padding:10px 11px;border:1px solid rgba(255,255,255,.06);border-radius:10px;background:rgba(255,255,255,.02);min-width:0}
.marketstate-history-stats span{display:block;color:var(--muted);font-size:.72rem;margin-bottom:3px}
.marketstate-history-stats strong{font-size:1rem}
.marketstate-history-stats strong.down{color:#ff9aaa}
.marketstate-disclaimer{margin-top:14px;color:var(--muted);font-size:.75rem;line-height:1.5}
.marketstate-full-link{display:inline-flex;align-items:center;gap:7px;margin-top:18px;color:var(--accent-2);font-weight:800;font-size:.92rem}
.marketstate-full-link:hover{text-decoration:underline}

/* Homepage keeps MarketState intentionally compact. The full dashboard lives at /marketstate/. */
body:not(.marketstate-page) .panel-head .eyebrow{margin-bottom:0}
body:not(.marketstate-page) #marketstate .marketstate-grid,
body:not(.marketstate-page) #marketstate .marketstate-bottom,
body:not(.marketstate-page) #marketstate .marketstate-shell > .source-row,
body:not(.marketstate-page) #marketstate .marketstate-disclaimer,
body:not(.marketstate-page) #marketstate .marketstate-scale{display:none}
body:not(.marketstate-page) #marketstate .marketstate-shell{padding:22px 24px}
body:not(.marketstate-page) #marketstate .marketstate-bar{margin-bottom:0}
body:not(.marketstate-page) #marketstate .marketstate-score{font-size:clamp(2.5rem,6vw,4.2rem)}
body:not(.marketstate-page) #marketstate .marketstate-summary{max-width:900px}

.marketstate-page .marketstate-page-head{padding:74px 0 18px}
.marketstate-page .marketstate-page-head h1{font-size:clamp(2.7rem,7vw,5.4rem);line-height:1;letter-spacing:-.045em;margin:10px 0 16px}
.marketstate-page .marketstate-page-head p{max-width:820px;color:#bdcad8;font-size:1.08rem;line-height:1.7;margin:0}
.marketstate-page .marketstate-page-actions{display:flex;gap:16px;flex-wrap:wrap;margin-top:18px}

@media (max-width:900px){
  .marketstate-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .marketstate-head{display:block}
  .marketstate-meta{text-align:left;margin-top:12px}
  .marketstate-bottom{grid-template-columns:minmax(0,1fr)}
}
@media (max-width:680px){
  .marketstate-grid,.marketstate-bottom{grid-template-columns:minmax(0,1fr)}
  .marketstate-shell{padding:20px}
  .marketstate-scale span:nth-child(2),.marketstate-scale span:nth-child(4){display:none}
  body:not(.marketstate-page) #marketstate .marketstate-shell{padding:18px}
  .marketstate-item-head{flex-wrap:wrap}
  .marketstate-history-head{display:block}
  .marketstate-history-current{display:inline-flex;margin-top:8px}
  .marketstate-history-stats{grid-template-columns:repeat(3,minmax(92px,1fr));overflow-x:auto}
}
