/* ConfigureX Controller Lab (Controller/controller-lab.js) */
.cl-backdrop { position: fixed; inset: 0; z-index: 60; background: #05070acc; -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: cl-fade .18s ease; }
.cl-backdrop[hidden], .cl-panel[hidden] { display: none; }
.cl-panel {
  position: fixed; z-index: 61; top: 0; right: 0; bottom: 0; width: min(440px, 100vw); display: flex; flex-direction: column;
  border-left: 1px solid #2c3036; background: linear-gradient(180deg, #1a1d21, #141619); color: #e3e8ee; box-shadow: -24px 0 60px #0009;
  overflow-y: auto; overscroll-behavior: contain; animation: cl-slide .26s cubic-bezier(.2, .8, .25, 1);
}
@keyframes cl-slide { from { transform: translateX(24px); opacity: 0; } }
@keyframes cl-fade { from { opacity: 0; } }
.cl-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 18px 12px; background: #1a1d21f2; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border-bottom: 1px solid #262a2f; }
.cl-kicker { margin: 0 0 4px; color: var(--lime, #2e8bff); font-size: 10px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.cl-title { margin: 0; font-family: var(--teko, "Teko", sans-serif); font-size: 30px; font-weight: 600; line-height: 1; }
.cl-sub { margin: 6px 0 0; color: #8d97a3; font-size: 12px; line-height: 1.4; }
.cl-close { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 34px; padding: 0; border: 1px solid #30353b; border-radius: 9px; background: #1f2226; color: #c9d0d8; cursor: pointer; }
.cl-close svg { width: 16px; height: 16px; }
.cl-close:hover { border-color: #4a5058; color: #fff; }

.cl-readout { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 8px; margin: 14px 18px 0; }
.cl-readout div { display: grid; gap: 2px; padding: 9px 10px; border: 1px solid #2a2e33; border-radius: 10px; background: #121417; }
.cl-readout span { color: #7f8995; font-size: 9.5px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.cl-readout b { font-family: var(--teko, "Teko", sans-serif); font-size: 22px; font-weight: 600; line-height: 1; color: #fff; }
.cl-readout b.cl-small { font-family: inherit; font-size: 12px; font-weight: 700; line-height: 1.3; color: #8fc0ff; }

.cl-modes { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; margin: 14px 18px 0; padding: 4px; border: 1px solid #2a2e33; border-radius: 12px; background: #121417; }
.cl-mode { display: grid; gap: 2px; padding: 8px 6px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: #aab3bd; font: inherit; cursor: pointer; text-align: center; }
.cl-mode b { font-size: 13px; font-weight: 800; }
.cl-mode span { color: #6f7883; font-size: 10px; font-weight: 700; letter-spacing: .04em; }
.cl-mode:hover { background: #1c1f23; color: #e3e8ee; }
.cl-mode.is-edit { border-color: #2a62a6; background: #16243a; color: #fff; }
.cl-mode.is-active span { color: #7dffb0; }
.cl-mode.is-active b::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #4dff9a; box-shadow: 0 0 8px #4dff9a; vertical-align: 1px; }
.cl-use { margin: 8px 18px 0; height: 34px; border: 1px dashed #2a62a6; border-radius: 9px; background: transparent; color: #8fc0ff; font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.cl-use:hover { background: #16243a; }
.cl-note { margin: 14px 18px; color: #aab3bd; font-size: 13px; line-height: 1.5; }

.cl-body { display: grid; gap: 8px; padding: 14px 18px 8px; }
.cl-group { border: 1px solid #2a2e33; border-radius: 12px; background: #17191c; overflow: hidden; }
.cl-group.is-open { border-color: #34404f; }
.cl-group-head { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 14px; border: 0; background: transparent; color: #eef2f6; font: inherit; cursor: pointer; text-align: left; }
.cl-group-head span { font-family: var(--teko, "Teko", sans-serif); font-size: 21px; font-weight: 600; letter-spacing: .02em; line-height: 1; }
.cl-group-head em { margin-left: auto; color: #7f8995; font-size: 10.5px; font-style: normal; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.cl-group-head svg { width: 16px; height: 16px; color: #7f8995; transition: transform .2s ease; }
.cl-group.is-open .cl-group-head svg { transform: rotate(180deg); }
.cl-group-head:hover em, .cl-group-head:hover svg { color: #c9d0d8; }
.cl-rows { display: grid; gap: 14px; padding: 4px 14px 16px; border-top: 1px solid #23272c; padding-top: 14px; }
.cl-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px 12px; }
.cl-row.is-sub { margin-left: 12px; padding-left: 12px; border-left: 2px solid #2a62a6; }
.cl-label { color: #dfe5eb; font-size: 13px; font-weight: 700; cursor: help; }
.cl-help { grid-column: 1 / -1; margin: -2px 0 0; color: #7f8995; font-size: 11.5px; line-height: 1.4; }
.cl-range-line { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 74px; align-items: center; gap: 10px; }
.cl-row:has(.cl-range-line) .cl-label { grid-column: 1 / -1; }
.cl-val { justify-self: end; padding: 3px 8px; border: 1px solid #2a2e33; border-radius: 7px; background: #111316; color: #fff; font-size: 12.5px; font-weight: 800; font-variant-numeric: tabular-nums; }
.cl-range { --fill: 50%; width: 100%; height: 6px; margin: 0; -webkit-appearance: none; appearance: none; border-radius: 99px; background: linear-gradient(90deg, var(--lime, #2e8bff) var(--fill), #2a2e33 var(--fill)); cursor: pointer; }
.cl-range::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border: 3px solid #141619; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1px var(--lime, #2e8bff); }
.cl-range::-moz-range-thumb { width: 12px; height: 12px; border: 3px solid #141619; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1px var(--lime, #2e8bff); }
.cl-range:focus-visible { outline: 2px solid var(--lime, #2e8bff); outline-offset: 4px; }
.cl-select-wrap { display: flex; align-items: center; gap: 8px; }
.cl-select { height: 32px; padding: 0 28px 0 10px; border: 1px solid #30353b; border-radius: 8px; background: #111316 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%238d97a3' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 9px center; color: #fff; font: inherit; font-size: 12.5px; font-weight: 700; -webkit-appearance: none; appearance: none; cursor: pointer; }
.cl-curve { width: 54px; height: 36px; padding: 2px; border: 1px solid #2a2e33; border-radius: 7px; background: #111316; }
.cl-curve polyline { fill: none; stroke: var(--lime, #2e8bff); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.cl-curve .cl-axis { fill: none; stroke: #3a3f46; stroke-width: 1.2; }
.cl-toggle { position: relative; width: 44px; height: 26px; padding: 0; border: 1px solid #353a41; border-radius: 99px; background: #23272b; cursor: pointer; transition: background .18s ease, border-color .18s ease; }
.cl-toggle i { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #9aa4af; transition: transform .2s cubic-bezier(.2, .8, .3, 1), background .18s; }
.cl-toggle[aria-checked="true"] { border-color: var(--lime, #2e8bff); background: #16345e; }
.cl-toggle[aria-checked="true"] i { transform: translateX(18px); background: #fff; }
.cl-toggle:focus-visible { outline: 2px solid var(--lime, #2e8bff); outline-offset: 2px; }
.cl-foot { margin-top: auto; display: grid; gap: 8px; padding: 12px 18px 18px; }
.cl-reset { height: 34px; border: 1px solid #30353b; border-radius: 9px; background: #1f2226; color: #c9d0d8; font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.cl-reset:hover { border-color: #4a5058; color: #fff; }
.cl-fine { margin: 0; color: #6f7883; font-size: 11px; line-height: 1.4; text-align: center; }
body.cl-open { overflow: hidden; }

/* light theme */
html[data-theme="light"] .cl-panel { border-color: #d6dade; background: linear-gradient(180deg, #ffffff, #f5f7f9); color: #16202c; box-shadow: -24px 0 60px #0e21382e; }
html[data-theme="light"] .cl-head { background: #fffffff2; border-color: #e1e4e8; }
html[data-theme="light"] :is(.cl-readout div, .cl-modes, .cl-group, .cl-val, .cl-select, .cl-curve) { border-color: #dde1e5; background-color: #ffffff; }
html[data-theme="light"] :is(.cl-readout b, .cl-group-head, .cl-label, .cl-val, .cl-select) { color: #16202c; }
html[data-theme="light"] .cl-mode { color: #4b5560; }
html[data-theme="light"] .cl-mode.is-edit { border-color: #9cc2ef; background: #eef5fd; color: #0b2a52; }
html[data-theme="light"] .cl-rows { border-color: #e6e9ec; }
html[data-theme="light"] .cl-range { background: linear-gradient(90deg, var(--lime, #0b66e4) var(--fill), #dfe3e8 var(--fill)); }
html[data-theme="light"] .cl-range::-webkit-slider-thumb { border-color: #fff; }
html[data-theme="light"] :is(.cl-close, .cl-reset, .cl-toggle) { border-color: #d0d5db; background: #f4f6f8; color: #2b323a; }
html[data-theme="light"] .cl-toggle[aria-checked="true"] { background: #cfe2fb; }

@media (max-width: 760px) {
  .cl-panel { top: auto; left: 0; width: 100%; height: calc(100dvh - 40px - env(safe-area-inset-top)); border-left: 0; border-top: 1px solid #2c3036; border-radius: 20px 20px 0 0; padding-bottom: env(safe-area-inset-bottom); animation-name: cl-rise; }
  @keyframes cl-rise { from { transform: translateY(30px); opacity: 0; } }
  .cl-head { border-radius: 20px 20px 0 0; }
  .cl-readout { grid-template-columns: 1fr 1fr; } .cl-readout div:last-child { grid-column: 1 / -1; }
  .cl-range { height: 8px; } .cl-range::-webkit-slider-thumb { width: 22px; height: 22px; }
  .cl-select { font-size: 16px; height: 38px; }
}
@media (prefers-reduced-motion: reduce) { .cl-panel, .cl-backdrop { animation: none; } }

/* ---- in the parts panel (like the Suspension Lab) ---- */
.sidebar .cl-panel { position: static; z-index: auto; width: auto; height: auto; display: block; border: 0; border-radius: 0; background: none; box-shadow: none; overflow: visible; padding: 0; color: inherit; }
.sidebar.cl-mode.lab-show-parts > .cl-panel > :not(.cl-headwrap) { display: none; }
.cl-headwrap .cl-title { margin: 4px 0 0; }
.cl-headwrap .cl-sub { padding-bottom: 14px; }
.sidebar .cl-panel .cl-readout { margin: 14px 20px 0; }
.sidebar .cl-panel .cl-modes { margin: 12px 20px 0; }
.sidebar .cl-panel .cl-use { width: calc(100% - 40px); margin: 8px 20px 0; }
.sidebar .cl-panel .cl-note { margin: 14px 20px; }
.sidebar .cl-panel .cl-body { padding: 14px 20px 8px; }
.sidebar .cl-panel .cl-foot { padding: 8px 20px 20px; }
.sidebar .cl-panel .cl-readout { grid-template-columns: 1fr 1fr; }
.sidebar .cl-panel .cl-readout div:last-child { grid-column: 1 / -1; }
@media (max-width: 760px) { .sidebar .cl-panel { height: auto; animation: none; } }
.sidebar .cl-panel, .sidebar .cl-panel .lab-head, .sidebar .cl-panel .lab-sub { text-align: left; }
.sidebar .cl-panel .cl-readout b { font-size: 22px; }
.sidebar .cl-panel .cl-readout b.cl-small { font-size: 12.5px; }
.sidebar .cl-panel .cl-readout span, .sidebar .cl-panel .cl-mode, .sidebar .cl-panel .cl-row, .sidebar .cl-panel .cl-help { text-align: left; }
.sidebar .cl-panel .cl-mode { text-align: center; }
/* phones: while a lab is open the heading only needs the title row */
@media (max-width: 760px) { .sidebar.cl-mode .side-heading { display: none !important; } }

/* ---- graphs (Controller/controller-graphs.js) ---- */
.cl-graphs { margin: 12px 20px 0; }
.cg-card { --cg-surface: #121417; padding: 10px 10px 8px; border: 1px solid #2a2e33; border-radius: 12px; background: var(--cg-surface); }
.cg-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-bottom: 6px; padding: 3px; border-radius: 9px; background: #1a1d21; }
.cg-tabs button { height: 28px; border: 0; border-radius: 7px; background: transparent; color: #8d97a3; font: inherit; font-size: 11.5px; font-weight: 800; letter-spacing: .04em; cursor: pointer; }
.cg-tabs button[aria-selected="true"] { background: #16243a; color: #e8f1fb; box-shadow: inset 0 0 0 1px #2a62a6; }
.cg-plot { position: relative; }
.cg-svg { display: block; width: 100%; height: auto; overflow: visible; }
.cg-grid line { stroke: #23272c; stroke-width: 1; }
.cg-ticks text, .cg-unit { fill: #7f8995; font-size: 9.5px; font-variant-numeric: tabular-nums; }
.cg-unit { font-weight: 700; }
.cg-end { fill: #c9d0d8; font-size: 9.5px; font-weight: 700; }
.cg-cross { stroke: #8d97a3; stroke-width: 1; stroke-dasharray: 3 3; }
.cg-tip { position: absolute; top: 6px; z-index: 2; display: grid; gap: 3px; min-width: 120px; padding: 7px 9px; border: 1px solid #30353b; border-radius: 9px; background: #1a1d21f2; color: #e3e8ee; font-size: 11px; pointer-events: none; box-shadow: 0 8px 20px #0008; }
.cg-tip[hidden] { display: none; }
.cg-tip b { font-size: 11px; color: #fff; }
.cg-tip span, .cg-legend span { display: flex; align-items: center; gap: 6px; }
.cg-tip em { margin-left: auto; font-style: normal; font-weight: 800; font-variant-numeric: tabular-nums; }
.cg-tip i, .cg-legend i { width: 10px; height: 3px; border-radius: 2px; flex: 0 0 10px; }
.cg-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; color: #aab3bd; font-size: 10.5px; font-weight: 700; }
html[data-theme="light"] .cg-card { --cg-surface: #ffffff; border-color: #dde1e5; }
html[data-theme="light"] .cg-tabs { background: #f1f3f5; }
html[data-theme="light"] .cg-tabs button[aria-selected="true"] { background: #eef5fd; color: #0b2a52; box-shadow: inset 0 0 0 1px #9cc2ef; }
html[data-theme="light"] .cg-grid line { stroke: #eceff2; }
html[data-theme="light"] .cg-end, html[data-theme="light"] .cg-legend { fill: #3b4450; color: #3b4450; }
html[data-theme="light"] .cg-tip { background: #fffffff2; border-color: #dde1e5; color: #16202c; }
html[data-theme="light"] .cg-tip b { color: #16202c; }
