/* Proving Ground: an instrument panel. */
.pg { padding: 1.2rem var(--gutter) 2rem; max-width: 1500px; margin-inline: auto; display: flex; flex-direction: column; gap: 1rem; }
.pg-head { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1.5rem 3rem; align-items: end; }
.pg-head h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
.pg-lede { color: var(--ink-2); font-size: 0.98rem; margin-top: 0.4rem; max-width: 48rem; }
.pg-preset { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.88rem; }
.pg-preset label { color: var(--muted); }
.pg-preset select { width: 100%; }
.pg-preset select, .pg select, .pg input[type="number"], .pg input[type="text"] { font: inherit; font-family: var(--sans); font-size: 0.9rem; padding: 0.4rem 0.5rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); color: var(--ink); max-width: 100%; }
.pg-note { font-size: 0.8rem; color: var(--muted); line-height: 1.45; }
.pg-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(300px, 3fr); gap: 1rem; align-items: start; }
@media (max-width: 980px) { .pg-head, .pg-grid { grid-template-columns: minmax(0, 1fr); } }

/* stage */
.pg-stage { display: flex; flex-direction: column; gap: 0.6rem; min-width: 0; }
.pg-views { position: relative; background: var(--bg-2); border-radius: var(--radius); overflow: hidden; display: grid; }
.pg-views[data-view="3d"] { grid-template-rows: minmax(0, 1fr); }
.pg-views[data-view="3d"] #v2d { display: none; }
.pg-views[data-view="side"] #v3d { display: none; }
.pg-views[data-view="both"] { grid-template-rows: minmax(0, 3fr) minmax(0, 2fr); }
#v3d, #v2d { width: 100%; height: 100%; min-height: 0; min-width: 0; display: block; }
.pg-views { aspect-ratio: 16 / 10; }
@media (max-width: 600px) { .pg-views { aspect-ratio: 4 / 4.2; } }
#v3d { cursor: grab; touch-action: none; }
#v2d { background: var(--bg-2); }
.pg-viewctl { position: absolute; left: 0.6rem; top: 0.6rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.pg-viewctl .seg { background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(6px); }
.pg-busy { position: absolute; right: 0.7rem; top: 0.7rem; font-family: var(--sans); font-size: 0.8rem; background: var(--ink); color: var(--bg); padding: 0.3rem 0.6rem; border-radius: var(--radius); display: flex; align-items: center; gap: 0.5rem; }
.pg-busy span { width: 0.6rem; height: 0.6rem; border-radius: 50%; border: 2px solid var(--bg); border-top-color: transparent; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.pg-transport { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; font-size: 0.85rem; }
.pg-transport input[type="range"] { flex: 1 1 160px; }
.pg-transport .num { min-width: 4.5rem; text-align: right; }
.pg-readouts { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 0.4rem; font-size: 0.78rem; color: var(--muted); }
.pg-readouts div { background: var(--bg-2); border-radius: var(--radius); padding: 0.45rem 0.6rem; min-width: 0; }
.pg-readouts b { display: block; font-size: 1.15rem; color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.pg-readouts div.src { cursor: pointer; text-decoration: none; }
.pg-readouts div.src:hover b { color: var(--accent); }
.pg-readouts div.warn b { color: var(--fcw); }
.pg-status { font-size: 0.85rem; color: var(--ink-2); min-height: 1.2em; }
.pg-status.bad { color: var(--fcw); }

/* panel */
.pg-panel { display: flex; flex-direction: column; gap: 0.8rem; background: var(--bg-2); border-radius: var(--radius); padding: 0.9rem; min-width: 0; }
.pg-modeseg { width: 100%; }
.pg-modeseg button { flex: 1; }
.pg-simple { display: flex; flex-direction: column; gap: 0.8rem; font-size: 0.86rem; }
.ctl { display: flex; flex-direction: column; gap: 0.15rem; }
.ctl .ctl-h { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.ctl .ctl-h span { color: var(--ink-2); }
.ctl .ctl-h b { font-variant-numeric: tabular-nums; font-weight: 600; }
.ctl .ctl-sub { color: var(--muted); font-size: 0.76rem; }
.ctl input[type="range"] { margin: 0.1rem 0; }
.pg-simple .row { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.pg-simple .chk { display: flex; align-items: center; gap: 0.5rem; }
.pg-simple .chk input { accent-color: var(--accent); }
.pg-engineer { display: flex; flex-direction: column; gap: 0.5rem; font-size: 0.82rem; }
.pg-engineer details { border-top: 1px solid var(--line); }
.pg-engineer summary { cursor: pointer; padding: 0.5rem 0; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 0.5rem; }
.pg-engineer summary::-webkit-details-marker { display: none; }
.pg-engineer summary::before { content: ""; width: 0.45rem; height: 0.45rem; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); }
.pg-engineer details[open] summary::before { transform: rotate(45deg); }
.pg-engineer .grp { display: grid; grid-template-columns: 1fr 5.6rem; gap: 0.3rem 0.5rem; align-items: center; padding-bottom: 0.6rem; }
.pg-engineer .grp label { color: var(--ink-2); display: flex; flex-direction: column; }
.pg-engineer .grp label small { color: var(--muted); font-size: 0.72rem; }
.pg-engineer .grp input, .pg-engineer .grp select { width: 100%; padding: 0.25rem 0.35rem; font-size: 0.82rem; }
.pg-engineer .grp select { grid-column: 1 / -1; }
.pg-engineer .grp label:has(+ select) { grid-column: 1 / -1; }
.pg-engineer .grp .full { grid-column: 1 / -1; }
.pg-engineer .sw { display: flex; gap: 0.5rem; align-items: center; grid-column: 1 / -1; }
.pg-engineer .sw input { accent-color: var(--accent); }
.pg-challenge { display: flex; flex-direction: column; gap: 0.7rem; font-size: 0.88rem; }
.chal { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.7rem 0.8rem; display: flex; flex-direction: column; gap: 0.35rem; background: var(--bg); }
.chal h4 { font-family: var(--sans); font-size: 0.95rem; }
.chal .chal-s { font-size: 0.8rem; color: var(--muted); }
.chal.done { border-color: var(--whcw); }
.chal.done .chal-s { color: var(--whcw); font-weight: 600; }
.chal .row { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* analysis */
.pg-analysis { display: flex; flex-direction: column; gap: 0.8rem; }
.pg-tabs { padding-inline: 0; overflow-x: auto; }
.pg-tab { min-width: 0; }
.pg-tab canvas { width: 100%; height: 360px; display: block; background: var(--bg-2); border-radius: var(--radius); }
.pg-sweepctl, .pg-cmpctl { display: flex; gap: 0.8rem; align-items: center; flex-wrap: wrap; font-size: 0.85rem; margin-bottom: 0.6rem; }
.pg-sweepctl label { display: flex; gap: 0.4rem; align-items: center; }
.pg-sweepctl input[type="number"] { width: 6.5rem; }
#cmp-table th, #cmp-table td { font-size: 0.85rem; }
.pg-about { max-width: 48rem; display: flex; flex-direction: column; gap: 0.7rem; }
