/* Playground widgets (Agent A). Every rule is scoped with the .demo- prefix and uses tokens only. */

.demo-title { margin-top: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.demo-title .badge-sim { font-size: .66rem; }
.demo-desc { margin: 0 0 14px; color: var(--text-secondary); font-size: .95rem; max-width: 70ch; }
.demo-note { font-size: .8rem; color: var(--text-muted); margin: 12px 0 0; line-height: 1.5; }
.demo-note b { color: var(--text-secondary); font-weight: 650; }
.demo-sub { font-size: .86rem; font-weight: 650; color: var(--text-primary); margin: 0 0 8px; }
.demo-sub .muted { font-weight: 500; }
.demo-num { font-variant-numeric: tabular-nums; }
.demo-controls { margin-bottom: 16px; }
.demo-controls .demo-ctl { display: inline-flex; align-items: center; gap: 4px; }
.demo-ctl-range { display: inline-flex; align-items: center; gap: 10px; min-width: 220px; flex: 1 1 260px; max-width: 470px; }
.demo-ctl-wide { max-width: 640px; flex-basis: 360px; }
.demo-controls-top { margin-bottom: 8px; }
.demo-root sub { font-size: .74em; line-height: 0; vertical-align: -.28em; }
.demo-ctl-range .slider { flex: 1; min-width: 90px; }
.demo-out { font-size: .84rem; color: var(--text-secondary); font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 4.2em; }
.demo-spacer { flex: 1 1 0; min-width: 0; }
.demo-btns { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.demo-btn-play { display: inline-flex; align-items: center; gap: 6px; }
.demo-btn-play svg { width: 12px; height: 12px; fill: currentColor; }
.demo-tables { margin-top: 14px; display: grid; gap: 6px; }
.demo-tcap { font-size: .84rem; font-weight: 650; color: var(--text-secondary); margin-top: 8px; }
.demo-tables[hidden] { display: none; }
.demo-tables .table-wrap { max-height: 340px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.demo-tables .demo-tok-cell { font-family: var(--font-mono); color: var(--text-muted); font-size: .8rem; margin-right: 6px; }

/* ---------------- confidence widget ---------------- */
.demo-prompt { display: flex; gap: 12px; align-items: baseline; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 9px 14px; margin-bottom: 12px; }
.demo-prompt .k { font-size: .74rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); flex: none; }
.demo-prompt .v { font-family: var(--font-mono); font-size: .92rem; color: var(--text-primary); }
.demo-resp-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.demo-resp-head .demo-sub { margin: 0; }
.demo-chips { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; }
.demo-chip { font: inherit; color: var(--text-primary); background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 7px 6px; display: flex; flex-direction: column; align-items: stretch; gap: 4px; cursor: pointer; min-width: 0;
  transition: border-color .12s ease, box-shadow .12s ease; }
.demo-chip:hover { border-color: var(--axis); }
.demo-chip[aria-pressed="true"] { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.demo-dist { display: flex; align-items: flex-end; justify-content: center; gap: 2px; height: 34px; border-bottom: 1px solid var(--axis); }
.demo-dist i { display: block; flex: 1 1 0; max-width: 14px; min-height: 1px; background: var(--series-muted); border-radius: 2px 2px 0 0; }
.demo-dist i.on { background: var(--series-accent); }
.demo-tok { font-family: var(--font-mono); font-size: .86rem; font-weight: 600; text-align: center; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; line-height: 1.3; }
.demo-h { font-size: .74rem; color: var(--text-muted); text-align: center; font-variant-numeric: tabular-nums; line-height: 1.2; }
.demo-editor { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; min-height: 40px; margin: 10px 0 4px;
  font-size: .86rem; color: var(--text-secondary); }
.demo-editor b { color: var(--text-primary); font-weight: 650; }
.demo-editor code { font-size: .86rem; color: var(--text-primary); }

.demo-conf-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; margin-top: 10px; align-items: stretch; }
.demo-panel { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; background: var(--surface-1); min-width: 0; }
.demo-rows { display: grid; gap: 4px; }
.demo-row { font: inherit; color: var(--text-secondary); background: transparent; border: 1px solid transparent; border-radius: 8px;
  display: grid; grid-template-columns: 30px minmax(48px, 92px) minmax(0, 1fr) 42px; gap: 10px; align-items: center;
  padding: 5px 8px; text-align: left; cursor: pointer; width: 100%; }
.demo-row:hover { background: var(--surface-2); }
.demo-row[aria-pressed="true"] { background: var(--surface-2); border-color: var(--border); color: var(--text-primary); }
.demo-row .lab { font-weight: 650; font-size: .9rem; }
.demo-row .val, .demo-urow .val { font-size: .86rem; text-align: right; font-variant-numeric: tabular-nums; color: var(--text-primary); }
.demo-prof { display: flex; align-items: flex-end; gap: 2px; height: 20px; border-bottom: 1px solid var(--axis); }
.demo-prof i { display: block; flex: 1 1 0; max-width: 9px; min-height: 1px; background: var(--series-muted); border-radius: 1.5px 1.5px 0 0; }
.demo-row[aria-pressed="true"] .demo-prof i { background: var(--series-accent); }
.demo-track { height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--series-accent) 16%, var(--surface-2)); overflow: hidden; }
.demo-track > span { display: block; height: 100%; border-radius: 4px; background: var(--series-accent); }
.demo-urow { display: grid; grid-template-columns: 30px minmax(48px, 92px) minmax(0, 1fr) 42px; gap: 10px; align-items: center;
  padding: 9px 9px 2px; margin-top: 6px; border-top: 1px solid var(--border); }
.demo-urow .lab { font-weight: 750; font-size: .9rem; color: var(--text-primary); grid-column: 1 / span 2; }
.demo-urow .val { font-weight: 750; }
.demo-gauge { display: flex; flex-direction: column; justify-content: center; }
.demo-gauge .k { font-size: .86rem; font-weight: 650; color: var(--text-primary); }
.demo-gauge .big { font-size: 2.6rem; font-weight: 750; letter-spacing: -.02em; line-height: 1.1; margin: 6px 0 10px; color: var(--text-primary); }
.demo-gauge .big small { font-size: .95rem; font-weight: 600; color: var(--text-secondary); margin-left: 8px; letter-spacing: 0; }
.demo-meter { height: 12px; border-radius: 6px; background: color-mix(in srgb, var(--series-accent) 16%, var(--surface-2)); position: relative; }
.demo-meter > span { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; background: var(--series-accent); }
.demo-scale { display: flex; justify-content: space-between; font-size: .74rem; color: var(--text-muted); margin-top: 4px; font-variant-numeric: tabular-nums; }
.demo-gauge .eq { font-size: .84rem; color: var(--text-secondary); margin-top: 12px; line-height: 1.5; }

@media (max-width: 760px) {
  .demo-chips { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .demo-chip { padding: 7px 4px 5px; }
  .demo-tok { font-size: .8rem; }
  .demo-conf-grid { grid-template-columns: 1fr; }
}

/* ---------------- curriculum widget ---------------- */
.demo-strip { margin-bottom: 18px; }
.demo-cur-grid { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr); gap: 26px; align-items: start; }
.demo-dir { margin-top: 18px; }
.demo-plot-wrap { min-width: 0; }
.demo-read { min-width: 0; display: grid; gap: 16px; }
.demo-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.demo-tile { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 12px 10px; background: var(--surface-1); min-width: 0; }
.demo-tile .lab { font-size: .76rem; font-weight: 600; color: var(--text-secondary); line-height: 1.3; }
.demo-tile .val { font-size: 1.45rem; font-weight: 700; color: var(--text-primary); line-height: 1.2; margin: 3px 0 6px; }
.demo-tile .val small { font-size: .8rem; font-weight: 600; color: var(--text-muted); margin-left: 3px; }
.demo-tile .demo-track { height: 4px; border-radius: 2px; }
.demo-tile .demo-track > span { border-radius: 2px; }
.demo-tile .demo-track.neutral { background: var(--surface-2); }
.demo-tile .demo-track.neutral > span { background: var(--series-muted); }
.demo-tile .note { font-size: .74rem; color: var(--text-muted); margin-top: 5px; line-height: 1.3; }
.demo-caption { font-size: .84rem; color: var(--text-secondary); line-height: 1.5; margin-top: 6px; }
.demo-caption b { color: var(--text-primary); font-weight: 650; }
.demo-legend { margin-top: 8px; gap: 6px 14px; font-size: .8rem; }
.demo-legend .lk { display: inline-block; width: 16px; height: 0; border-top: 2px solid var(--text-primary); margin-right: 6px; vertical-align: 3px; }
.demo-legend .lk.thin { border-top: 1px solid var(--series-accent); }
.demo-legend .lk.dash { border-top: 2px dashed var(--text-muted); }
.demo-legend .lk.bold { border-top-width: 3px; }
.demo-legend .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }

svg.demo-svg { display: block; overflow: visible; }
svg.demo-svg text { font-family: var(--font-sans); font-size: 11px; fill: var(--text-muted); }
svg.demo-svg text.t-2 { fill: var(--text-secondary); font-size: 12px; }
svg.demo-svg text.t-1 { fill: var(--text-primary); font-size: 12px; font-weight: 650; }
svg.demo-svg text.t-val { fill: var(--text-primary); font-size: 12px; font-variant-numeric: tabular-nums; }
svg.demo-svg text.halo { paint-order: stroke; stroke: var(--surface-1); stroke-width: 4px; stroke-linejoin: round; }
.demo-gridline { stroke: var(--grid); stroke-width: 1; }
.demo-axisline { stroke: var(--axis); stroke-width: 1; }
.demo-fill-kept { fill: var(--series-accent); }
.demo-fill-drop { fill: var(--series-faint); }
.demo-fill-muted { fill: var(--series-muted); }
.demo-fill-ink { fill: var(--text-primary); }
.demo-stroke-ink { stroke: var(--text-primary); }
.demo-respline { stroke: var(--series-accent); stroke-opacity: .32; stroke-width: 1; }
.demo-resptip { fill: var(--series-accent); fill-opacity: .5; }
.demo-ring { stroke: var(--surface-1); stroke-width: 2; }
.demo-ref { stroke: var(--text-muted); stroke-width: 1.5; stroke-dasharray: 5 4; fill: none; }
.demo-thresh { stroke: var(--text-primary); stroke-width: 1.5; }
.demo-seg-a { fill: var(--cat-2); }
.demo-seg-p { fill: var(--cat-7); }
.demo-seg-m { fill: var(--cat-3); }
.demo-rowband { fill: var(--surface-2); }
.demo-hov { opacity: .78; }
.demo-hit { fill: transparent; cursor: default; }

@media (max-width: 860px) {
  .demo-cur-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .demo-tiles { gap: 8px; }
  .demo-tile { padding: 8px 9px; }
  .demo-tile .val { font-size: 1.2rem; }
  .demo-ctl-range { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  .demo-chip { transition: none; }
}
