/* NFSU2 Performance Lab - Underground 2-inspired dark UI: neon green highlights, cyan data, metallic panels. */
:root {
  --bg: #05080b; --panel: #0d141b; --panel-hi: #131e28; --line: #24323e; --grid: #1a2733;
  --text: #e6eef3; --dim: #a1b1bd; --lime: #b9f43c; --lime-d: #77a51a; --cyan: #2fe4ee; --orange: #ff9a2e; --stock: #6f8291;
  --pos: #b9f43c; --neg: #ff6b6b; --red: #b8202c;
  --purple: #b98cff;
  /* setup identity (C4): A cyan, B orange, C purple, stock gray */
  --slot-A: var(--cyan); --slot-B: var(--orange); --slot-C: var(--purple);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; color: var(--text); font: 13px/1.4 "Segoe UI", system-ui, sans-serif; min-height: 100vh;
  background: radial-gradient(1100px 420px at 75% -12%, #16233a 0%, transparent 60%), radial-gradient(800px 360px at 0% 110%, #0c2610 0%, transparent 60%), var(--bg); }
button, select, input, textarea { font: inherit; color: var(--text); }
button, select { background: linear-gradient(#162230, #0b1118); border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; }
button:hover:not(:disabled), select:hover, select:focus { border-color: var(--lime); outline: none; box-shadow: 0 0 8px #b9f43c33; }
button:disabled { opacity: .45; cursor: not-allowed; }
input[type=checkbox], input[type=range] { accent-color: var(--lime); }
.muted { color: var(--dim); } .small { font-size: 12px; } .sub { color: var(--dim); font-size: 12px; font-style: normal; font-weight: 400; text-transform: none; letter-spacing: 0; }

/* header */
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; padding: 10px 18px; background: linear-gradient(#0d151d, #070b10); border-bottom: 1px solid #b9f43c44; }
.brand { font-style: italic; font-weight: 900; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.brand .b1 { font-size: 26px; color: #fff; text-shadow: 0 0 10px #2fe4ee55, 2px 2px 0 #183a46; }
.brand .b2 { font-size: 20px; color: #fff; text-transform: none; }
.ctrl { display: flex; align-items: center; gap: 8px; }
.ctrl.grow select { min-width: 220px; }
.lbl { color: var(--dim); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; background: #0a1016; padding: 6px 14px; font-style: italic; }
.seg button.on { background: linear-gradient(#cdff5c, #8cc21e); color: #0b1400; font-weight: 800; box-shadow: inset 0 0 0 1px var(--lime); }
.seg.small button { padding: 4px 10px; font-size: 12px; }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--lime); outline-offset: 1px; }

/* header setup controls (C3): setup selector, the active setup's car, Copy / Reset / Show menus */
.slotseg button { min-width: 30px; padding: 5px 9px; font-size: 13px; font-weight: 800; }
/* one header row from 1366 px: tighter spacing once the setup controls are in (the pre-C3 header used 22 px gaps) */
.top { gap: 10px 12px; padding: 10px 14px; } .top .cfg { padding: 5px 9px; } .ctrl.menus { gap: 4px; } .ctrl.grow.carctl select { min-width: 200px; }
/* two header rows (game-save sprint, approved): brand / scope / drop zone / save status, then the working-setup row */
.top { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 8px; }
.hrow1, .hrow2 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; min-width: 0; }
.hrow2 { border: 1px solid #b9f43c55; border-radius: 8px; padding: 6px 10px; background: #070b10cc; }
.vehinfo { margin-left: auto; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.dropzone { flex: 1 1 360px; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px 12px; border: 1.5px dashed #b9f43c99; border-radius: 8px; background: #0a1016; }
.dropzone .dzicon { font-size: 20px; color: var(--lime); }
.dropzone .dztext { display: flex; flex-direction: column; flex: 1; min-width: 0; text-align: center; }
.dropzone .dztext b { font-size: 14px; } .dropzone .dzsub { font-size: 11px; color: var(--dim); }
.dropzone.drag { border-color: var(--lime); border-style: solid; background: #b9f43c1a; box-shadow: 0 0 12px #b9f43c44; }
.dropzone.busy { border-color: var(--orange); }
.slottag { display: inline-block; min-width: 18px; margin-left: 3px; padding: 0 5px; border-radius: 4px; text-align: center;
  background: linear-gradient(#cdff5c, #8cc21e); color: #0b1400; font-weight: 800; font-style: italic; font-size: 12px; line-height: 18px; }
.menu { position: relative; }
.menubtn .caret { font-size: 10px; margin-left: 3px; color: var(--dim); }
.menubtn[aria-expanded="true"] { border-color: var(--lime); box-shadow: 0 0 8px #b9f43c33; }
.menupanel { position: absolute; top: calc(100% + 6px); left: 0; z-index: 50; min-width: 290px; max-width: min(360px, calc(100vw - 24px));
  display: flex; flex-direction: column; gap: 2px; padding: 6px; border: 1px solid var(--line); border-radius: 8px;
  background: linear-gradient(160deg, var(--panel-hi), var(--panel)); box-shadow: 0 12px 30px #000d; }
.mhead { padding: 6px 8px 2px; font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .05em; }
.mitem { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; text-align: left; background: transparent; border: 1px solid transparent; padding: 6px 8px; }
.mitem b { font-style: italic; font-weight: 700; }
.mitem span { font-size: 11.5px; color: var(--dim); }
.mitem:hover, .mitem:focus { background: #b9f43c14; border-color: var(--lime); outline: none; box-shadow: none; }
.mchk { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 6px; cursor: pointer; }
.mchk.sub { padding-left: 28px; } .mchk:has(input:disabled) { color: var(--dim); cursor: default; }
.mchk:focus-within { background: #b9f43c14; }
/* save status + backup (C6): a small status button; full text from 1440 px, short text below */
.savebtn { display: inline-flex; align-items: center; gap: 6px; }
.savebtn .sdot { width: 8px; height: 8px; border-radius: 50%; background: var(--stock); flex: none; }
.savebtn.st-saved .sdot { background: var(--lime); } .savebtn.st-pending .sdot { background: var(--orange); }
.savebtn.st-failed .sdot { background: var(--neg); } .savebtn.st-locked .sdot { background: var(--orange); }
.savebtn.st-failed, .savebtn.st-locked { border-color: #ff9a2e88; }
.savebtn .sshort { display: none; }
@media (max-width: 1100px) { .savebtn .slong { display: none; } .savebtn .sshort { display: inline; } }
.menupanel.savepanel { min-width: 320px; }
.sline { padding: 2px 8px 6px; font-size: 12px; }
.notice { margin: 10px 18px 0; padding: 8px 12px; border: 1px solid #ff9a2e66; border-radius: 8px; background: #2a1a0a88; color: #ffd8a8; font-size: 12px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.notice.err { border-color: #ff6b6b88; background: #2a0a0e88; color: #ffc9c9; }
.notice.ok { border-color: #b9f43c66; background: #12200a88; color: #dff7b0; }
.notice b { color: #fff; }
.notice button { padding: 3px 10px; font-size: 12px; }
/* game save tab (G1/G2) */
.gs-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; }
.gs-tools .gs-copynote { flex: 1 1 220px; }
.gs-dl { overflow-wrap: anywhere; }
.gs-edit { margin: 10px 0; padding: 10px 14px; border: 1px solid var(--slot-color, #39d0ff55); border-radius: 10px; background: #0b1a2244; }
.gs-edit h3 { margin: 0 0 6px; font-size: 14px; } .gs-edit .gs-pv { margin: 6px 0; } .gs-edit .gs-raw { margin: 6px 0; font-size: 12px; }
.gs-edit .gs-pv dd { overflow-wrap: anywhere; }
.gs-xsel { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 6px 0; font-size: 13px; }
.gs-xsel select { max-width: 100%; min-width: 0; }
.gs-xsel .lbl { min-width: 40px; color: var(--dim); font-size: 12px; } .gs-xr { display: inline-flex; align-items: center; gap: 4px; }
.gs-xt td:first-child { white-space: nowrap; }
/* Game save: Load into Lab / Export to game (cleaned-up layout) */
.gs-modes { display: inline-flex; margin: 10px 0 8px; border: 1px solid var(--line, #2a3540); border-radius: 10px; overflow: hidden; }
.gs-modes button { border: 0; border-radius: 0; padding: 7px 16px; background: transparent; color: var(--dim); font-weight: 600; }
.gs-modes button.on { background: var(--lime); color: #0b1205; } .gs-modes button:disabled { opacity: .45; cursor: not-allowed; }
.gs-fdet { margin: 4px 0; font-size: 12px; } .gs-fdet > summary { color: var(--dim); cursor: pointer; }
.gs-mdet { display: inline; } .gs-mdet > summary { display: inline; cursor: pointer; text-decoration: underline; opacity: .85; }
.gs-xhead { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 6px; } .gs-xhead h3 { margin: 0; }
.gs-xevs { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 6px 14px; margin: 6px 0; }
.gs-xev { display: flex; align-items: center; gap: 8px; font-size: 13px; } .gs-xev .lbl { min-width: 62px; color: var(--dim); font-size: 12px; } .gs-xev select { flex: 1; min-width: 0; }
.gs-review { margin: 8px 0; padding: 8px 10px; border-radius: 8px; background: #0f1a2266; }
.gs-xpred { display: grid; gap: 2px; margin: 6px 0; } .gs-xpred .lbl { color: var(--dim); }
.gs-xwarn { color: #ffd8a8; margin: 4px 0; } .gs-restore { margin: 8px 0; }
.gs-xdets { margin: 6px 0; }
.gs-file { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 6px 0 8px; font-size: 12px; color: var(--dim); }
.gs-file b { color: var(--text); font-weight: 600; } .gs-file .okc { color: var(--lime); } .gs-file .badc { color: var(--neg); }
.gs-warn { margin: 8px 0; padding: 8px 12px; border: 1px solid #ff9a2e66; border-radius: 8px; background: #2a1a0a88; color: #ffd8a8; font-size: 12px; }
.gs-warn.err { border-color: #ff6b6b88; background: #2a0a0e88; color: #ffc9c9; } .gs-warn.ok { border-color: #b9f43c66; background: #12200a88; color: #dff7b0; }
.gs-warn b { color: #fff; }
.gs-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.gs-head h2 { margin: 0; }
.gs-ro { padding: 3px 10px; border: 1px solid #b9f43c88; border-radius: 999px; color: var(--lime); font-size: 12px; white-space: nowrap; }
.gs-about summary, .gs-more summary { cursor: pointer; color: var(--dim); font-size: 12px; padding: 4px 0; }
.gs-grid { display: grid; grid-template-columns: minmax(200px, 270px) minmax(0, 1fr); gap: 12px; margin-top: 8px; align-items: start; }
.gs-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 8px; padding: 4px; }
.gs-lh { padding: 4px 8px 6px; }
.gs-item { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 6px 8px; border: 0; border-radius: 6px; background: transparent; color: var(--text); font-style: normal; font-size: 13px; }
.gs-item:hover:not(:disabled) { background: #ffffff0d; }
.gs-item.sel { background: var(--lime); color: #0b1218; font-weight: 700; }
.gs-item:disabled { color: var(--dim); cursor: default; }
.gs-n { min-width: 18px; text-align: right; opacity: .8; }
.gs-car { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gs-tag { font-size: 10px; padding: 0 5px; border: 1px solid currentColor; border-radius: 4px; opacity: .75; white-space: nowrap; font-weight: 400; }
.gs-tag.on { opacity: 1; } .gs-tag.warn { color: var(--orange); }
.gs-item.sel .gs-tag.warn { color: #6a3a00; }
.gs-detail { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; min-width: 0; }
.gs-detail h3 { margin: 0; font-size: 16px; font-style: italic; color: var(--text); }
.gs-sum { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 6px 12px; margin: 10px 0; font-size: 13px; }
.gs-sum dt { color: var(--dim); } .gs-sum dd { margin: 0; }
.gs-cats { list-style: none; margin: 4px 0 0; padding: 0; font-size: 12px; }
.gs-cats li { padding: 2px 0; } .gs-cats li span { display: inline-block; min-width: 110px; color: var(--dim); }
.gs-more { border-top: 1px solid var(--line); padding: 2px 0; }
.gs-tech { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 3px 12px; margin: 4px 0 8px; } .gs-tech dt { color: var(--dim); } .gs-tech dd { margin: 0; overflow-wrap: anywhere; }
.gs-ev span { display: inline-block; margin-right: 10px; color: var(--dim); white-space: nowrap; } .gs-ev span.chg { color: var(--text); font-weight: 600; }
.gs-load { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.gs-load > p, .gs-load > .gs-warn { flex-basis: 100%; margin: 2px 0; }
.gs-load label { color: var(--dim); }
.gs-dest { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; } .gs-dest .lbl { color: var(--dim); font-size: 12px; margin-right: 2px; }
.gs-db { display: flex; align-items: center; gap: 8px; padding: 4px 10px; font-style: normal; border: 1px solid var(--line); text-align: left; }
.gs-db b { font-size: 15px; } .gs-db span { font-size: 11px; color: var(--dim); line-height: 1.2; }
.gs-db.on span { color: var(--text); }
.gs-db.slot-A b { color: var(--slot-A); } .gs-db.slot-B b { color: var(--slot-B); } .gs-db.slot-C b { color: var(--slot-C); }
.gs-db.on.slot-A { border-color: var(--slot-A); background: #2fe4ee1c; } .gs-db.on.slot-B { border-color: var(--slot-B); background: #ff9a2e1c; } .gs-db.on.slot-C { border-color: var(--slot-C); background: #b98cff1c; }
#gsLoad:not(:disabled) { background: var(--lime); color: #0b1218; border-color: var(--lime); font-weight: 700; }
.gs-foot { margin-top: 8px; }
.gs-cats.two { columns: 2; column-gap: 28px; max-width: 640px; } .gs-cats.two li { break-inside: avoid; }
.gs-preview { flex-basis: 100%; margin-top: 4px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: #ffffff06; font-size: 13px; }
.gs-pv { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 4px 12px; margin: 6px 0; } .gs-pv dt { color: var(--dim); } .gs-pv dd { margin: 0; }
.gs-preview .slotc-A { color: var(--slot-A); } .gs-preview .slotc-B { color: var(--slot-B); } .gs-preview .slotc-C { color: var(--slot-C); }
.gs-keep { margin: 4px 0; color: var(--lime); }
table.t.gs-diff { width: 100%; margin: 4px 0; } table.t.gs-diff td, table.t.gs-diff th { text-align: left; white-space: normal; }
table.t.gs-diff tr.same td { color: var(--dim); } table.t.gs-diff tr:not(.same) td:last-child { color: var(--text); font-weight: 600; }
@media (max-width: 760px) {
  .gs-grid { grid-template-columns: 1fr; }
  .gs-list { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; } .gs-lh { grid-column: 1 / -1; }
  .gs-sum, .gs-tech, .gs-pv { grid-template-columns: 90px minmax(0, 1fr); }
  .gs-cats.two { columns: 1; }
  .gs-cats li { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px; } .gs-cats li span { min-width: 0; }
}
@media (max-width: 420px) { .gs-list { grid-template-columns: 1fr; } }
/* units menu (C5) */
.menupanel.unitspanel { min-width: 310px; gap: 4px; }
.urow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 2px 8px; }
.ulbl { color: var(--dim); font-size: 12px; }
.useg .ubtn { padding: 3px 10px; font-style: normal; font-size: 12px; min-width: 44px; }
.useg .ubtn:focus-visible, .upreset .ubtn:focus-visible { outline: 2px solid var(--lime); outline-offset: -2px; }
.upreset { display: flex; gap: 4px; } .upreset .ubtn { padding: 3px 10px; font-size: 12px; }
.unote { padding: 0 8px 4px; font-size: 11px; color: var(--lime); }
.menubtn #unitsSum { font-variant-numeric: tabular-nums; }
.mnote { margin-top: 4px; padding: 6px 8px 2px; border-top: 1px solid var(--line); font-size: 11px; color: var(--dim); }
/* narrow screens: brand + scope, then setup selector + menus, then the car (full width), then units */
@media (max-width: 760px) {
  .top { gap: 8px 10px; padding: 10px 12px; }
  .brand .b1 { font-size: 22px; } .brand .b2 { font-size: 17px; }
  .carctl { order: 5; flex: 1 1 100%; } .carctl select { flex: 1; min-width: 0; width: 100%; }
  .unitsctl { order: 6; flex: 1 1 100%; } .unitsctl select { flex: 1; }
  .dropzone { order: 3; flex: 1 1 100%; } .savectl { order: 2; margin-left: auto; }
  .vehinfo { order: 7; flex: 1 1 100%; margin-left: 0; }
  .dropzone .dztext { text-align: left; }
}

/* tabs */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 18px 0; }
.tabs button { flex: 1 1 140px; transform: skewX(-12deg); padding: 9px 12px; font-size: 16px; font-weight: 600; background: linear-gradient(#18232e, #0a1016); }
.tabs button small { font-size: 10px; color: var(--dim); }
.tabs button.on { background: linear-gradient(#cdff5c, #8cc21e); color: #0b1400; border-color: var(--lime); box-shadow: 0 0 16px #b9f43c55; font-weight: 800; }
.banner { margin: 10px 18px 0; padding: 8px 12px; border: 1px solid #ff9a2e66; border-radius: 8px; background: #2a1a0a88; color: #ffd8a8; font-size: 12px; }
.banner:empty { display: none; }

main { padding: 12px 18px; display: flex; flex-direction: column; gap: 12px; }
.tab { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.panel { background: linear-gradient(160deg, var(--panel-hi) 0%, var(--panel) 60%); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; min-width: 0;
  box-shadow: inset 0 1px 0 #ffffff0c, 0 4px 18px #0009; }
.panel h2 { margin: 0 0 10px; font-size: 19px; font-style: italic; font-weight: 800; letter-spacing: .01em; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 12px; }

/* tuning workspace: sidebar | editor | summary + dyno; the performance overview runs full width underneath.
   .ov-inline (set by ui.js when the editor is much shorter than its neighbours) puts the overview under the editor
   instead, so a short category leaves no empty band above a full-width overview. */
.sidecol { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.tuning-grid { display: grid; grid-template-columns: minmax(180px, 220px) minmax(0, 1fr) minmax(340px, 440px); grid-template-areas: "cats editor side" "over over over"; gap: 12px; align-items: start; }
.tuning-grid.ov-inline { grid-template-areas: "cats editor side" "cats over side"; grid-template-rows: auto 1fr; }
.tuning-grid.ov-beside { grid-template-areas: "cats editor side" "over over side"; grid-template-rows: auto 1fr; }
.catcol { grid-area: cats; display: flex; flex-direction: column; gap: 12px; min-width: 0; } .catlist { min-width: 0; }
/* event tune (E2): above the category list; the centre editor and right column keep their top alignment */
.evpanel { padding: 10px 12px; }
.evlbl { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--dim); margin-bottom: 4px; }
#eventSel { width: 100%; }
.evstate { margin-top: 6px; font-size: 11px; line-height: 1.35; padding: 4px 6px; border-radius: 6px; }
.evstate.set { color: var(--text); background: #b9f43c12; border: 1px solid #b9f43c44; } .evstate.set b { color: var(--lime); }
.evstate.unset { color: var(--dim); border: 1px dashed var(--line); }
.evcopy { margin-top: 8px; font-size: 12px; } .evcopy select { max-width: 100%; } .evcopy button { padding: 2px 10px; }
.evcopy #copyTunePrev { margin-top: 3px; font-size: 11px; }
.evtag { font-size: 11px; color: var(--dim); font-weight: 400; margin-left: 4px; white-space: nowrap; }
.notice.mig { display: block; } .notice.mig > button { margin-left: 8px; }
.notice.mig .migrows { display: flex; flex-direction: column; gap: 3px; margin: 6px 0; } .notice.mig .migrow select { margin-left: 4px; } .editor { grid-area: editor; } .sidecol { grid-area: side; } .ovpanel { grid-area: over; }
@media (max-width: 1250px) {
  .tuning-grid { grid-template-columns: minmax(170px, 210px) minmax(0, 1fr); grid-template-areas: "cats editor" "over over" "side side"; }
  .tuning-grid.ov-inline { grid-template-areas: "cats editor" "cats over" "side side"; grid-template-rows: auto 1fr auto; }
}
@media (max-width: 760px) { .tuning-grid, .tuning-grid.ov-inline { grid-template-columns: 1fr; grid-template-areas: "cats" "editor" "over" "side"; grid-template-rows: none; } }
.centercol { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ovpanel .kpis { grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 6px; }
.ovpanel .kpi { padding: 6px 2px; }
.ovpanel .kpi .v { font-size: 18px; }
.catlist h2 { font-size: 24px; }
.catbtn { display: flex; align-items: center; justify-content: space-between; width: 100%; margin-bottom: 6px; padding: 9px 12px; font-size: 15px; font-style: italic; text-align: left; gap: 8px; }
.catbtn.on { background: linear-gradient(#cdff5c, #8cc21e); color: #0b1400; border-color: var(--lime); font-weight: 800; box-shadow: 0 0 12px #b9f43c55; }
.catbtn .n { font-size: 11px; font-style: normal; opacity: .8; white-space: nowrap; }
.chk { display: flex; gap: 6px; align-items: center; color: var(--dim); }

.editor h2 .cat { color: var(--lime); }
.editor-head { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.editor-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.locked { padding: 18px; border: 1px dashed var(--line); border-radius: 8px; color: var(--dim); }
.graphwrap { position: relative; width: 100%; }
.graphwrap svg { width: 100%; height: auto; display: block; touch-action: none; user-select: none; }
/* nitrous graph (NOS-MAP-001) */
.nosbox { margin: 10px 0 4px; } .nosgraph { width: 100%; max-width: 560px; height: auto; display: block; }
.nosrow { display: flex; align-items: center; gap: 18px; } .nosrow .nosgraph { flex: 1 1 auto; min-width: 0; }
.nosread { flex: 0 0 170px; margin: 0; display: grid; gap: 2px; padding: 10px 14px; border-left: 3px solid var(--slot-color, #39d0ff); background: var(--slot-tint, #0b1a2244); border-radius: 0 8px 8px 0; }
.nosread dt { color: var(--dim); font-size: 12px; margin-top: 6px; } .nosread dt:first-child { margin-top: 0; }
.nosread dd { margin: 0; font-size: 20px; font-weight: 700; color: var(--slot-color, #39d0ff); font-variant-numeric: tabular-nums; } .nosread dd.nosrange { font-size: 11px; font-weight: 400; margin-top: 8px; }
@media (max-width: 700px) { .nosrow { flex-direction: column; align-items: stretch; } .nosread { flex: none; border-left: 0; border-top: 3px solid var(--slot-color, #39d0ff); border-radius: 0 0 8px 8px; grid-template-columns: auto 1fr; column-gap: 12px; } .nosread dt { margin-top: 0; align-self: center; } .nosread dd.nosrange { grid-column: 1 / -1; } }
.nosgraph .nax { stroke: var(--dim); stroke-width: 1.2; } .nosgraph .ngrid { stroke: var(--line, #2a3540); stroke-width: 1; stroke-dasharray: 3 4; }
.nosgraph .ntk { fill: var(--dim); font-size: 11px; } .nosgraph .ntt { fill: var(--text); font-size: 11px; }
.nosgraph .nrange { stroke: var(--slot-color, #39d0ff); stroke-width: 3; stroke-linecap: round; opacity: .85; }
.nosgraph .nhair { stroke: var(--slot-color, #39d0ff); stroke-width: 1; stroke-dasharray: 4 3; opacity: .6; } .nosgraph .nmark { fill: #f2f6f8; stroke: var(--slot-color, #39d0ff); stroke-width: 3; }
.graph-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--dim); margin-top: 4px; }
.graph-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 2px; margin-right: 5px; vertical-align: -2px; }
.ptable { margin-top: 8px; }

.srow { display: grid; grid-template-columns: minmax(130px, max-content) minmax(140px, 1fr) minmax(90px, max-content) auto; gap: 6px 12px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); }
.srow .name { font-weight: 600; white-space: nowrap; }
.srow .val { font-variant-numeric: tabular-nums; color: var(--lime); text-align: right; white-space: nowrap; }
.srow .meta { grid-column: 1 / -1; font-size: 12px; color: var(--dim); margin-top: -2px; }
.srow input[type=range] { width: 100%; }
.srow.off { opacity: .5; }
.srow .rst { padding: 2px 8px; font-size: 11px; }

/* ECU / turbo graph (original-game style) */
.gtools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-bottom: 6px; }
.gsel { font-size: 13px; }
.gbtns { display: inline-flex; gap: 4px; }
.gbtns button { min-width: 38px; font-size: 14px; padding: 4px 10px; }
.gleg { margin-left: auto; display: inline-flex; align-items: center; gap: 4px 6px; color: var(--dim); font-size: 12px; }
.gleg i { display: inline-block; width: 12px; height: 12px; margin-left: 6px; border-radius: 2px; }
.gleg .lmax { background: #9b1c27; } .gleg .lmin { background: #1b6e75; } .gleg .lset { background: #2bb5bd; }
details.ginfo { margin-top: 6px; color: var(--dim); font-size: 12px; }
details.ginfo summary { cursor: pointer; color: var(--text); display: flex; gap: 8px; align-items: center; }
details.ginfo p { margin: 6px 0; }

/* transmission view: one ordered list (final drive, gears) with controls, shown value, stored ratio and a speed bar vs stock */
.glist { margin: 4px 0 8px; }
.gearrow { display: grid; grid-template-columns: 92px minmax(220px, 1fr) 118px; gap: 4px 12px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.gearrow.ghead { padding: 2px 0 4px; color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.gearrow .r { text-align: right; }
.gearrow .name { font-weight: 600; white-space: nowrap; }
.gearrow .val { font-variant-numeric: tabular-nums; color: var(--lime); text-align: right; white-space: nowrap; }
.gearrow .val.big { font-size: 18px; font-weight: 700; font-style: italic; }
.gearrow .ratio { font-variant-numeric: tabular-nums; text-align: right; color: var(--text); }
.gearrow .stockv { font-size: 12px; color: var(--dim); white-space: nowrap; }
.gearrow.off .val { color: var(--text); }
.gearrow .tctl { display: flex; align-items: center; gap: 6px; }
.gearrow .tctl input[type=range] { flex: 1; min-width: 80px; }
.gearrow .tbtn { min-width: 34px; padding: 3px 8px; font-size: 13px; }
.gearrow .tbtn:disabled { opacity: .35; cursor: default; }
.lockctl { color: var(--dim); font-size: 12px; font-style: italic; }
@media (max-width: 700px) {
  .gearrow { grid-template-columns: 1fr auto; }
  .gearrow .tctl { grid-column: 1 / -1; grid-row: 2; }
  .gearrow .stockv { grid-column: 1 / -1; }
  .gearrow.ghead { display: none; }
}
.guide { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; padding: 6px 10px; margin: 2px 0 6px; border-left: 3px solid var(--lime-d); background: #0a1016; border-radius: 0 6px 6px 0; font-size: 13px; }
.guide.dirs { border-left-color: var(--line); gap: 4px 22px; color: var(--dim); }
.guide.dirs b { color: var(--text); font-weight: 600; }
.locked.slim { padding: 8px 12px; margin: 4px 0; }
/* transmission sliders: whole game presses */
.srow.trow { grid-template-columns: 130px minmax(160px, 1fr) minmax(96px, max-content) minmax(120px, max-content); }
.srow.trow .meta { grid-column: auto; margin-top: 0; }
@media (max-width: 900px) { .srow.trow { grid-template-columns: 120px minmax(140px, 1fr) minmax(90px, max-content); } .srow.trow .meta { grid-column: 1 / -1; } }
.trow .tctl { display: flex; align-items: center; gap: 6px; }
.trow .tctl input[type=range] { flex: 1; min-width: 80px; }
.trow .tbtn { min-width: 34px; padding: 3px 8px; font-size: 13px; }
.trow .tbtn:disabled { opacity: .35; cursor: default; }
.trow .val.big { font-size: 18px; font-weight: 700; font-style: italic; }
.trow .tdir { color: var(--text); opacity: .8; }
@media (max-width: 560px) { .srow.trow { grid-template-columns: 1fr auto; } .trow .tctl { grid-column: 1 / -1; grid-row: 2; } }
/* parts detail */
.exp { padding: 0 6px; font-size: 11px; margin-right: 4px; }
tr.sub > td { padding: 0 0 8px 24px; background: #0a1016; }
table.t.inner th, table.t.inner td { font-size: 12px; padding: 4px 8px; }
table.t.inner th:nth-child(2), table.t.inner td:nth-child(2), table.t.uq th:nth-child(2), table.t.uq td:nth-child(2) { text-align: left; }
table.t.compact { width: auto; min-width: min(100%, 560px); }
table.t.compact td, table.t.compact th { padding-left: 18px; }

/* summary / dyno */
.kv { width: 100%; border-collapse: collapse; }
.kv th { text-align: left; color: var(--dim); font-weight: 400; padding: 4px 10px 4px 0; white-space: nowrap; vertical-align: top; }
.kv td { padding: 4px 0; text-align: right; font-variant-numeric: tabular-nums; }
.kv tr + tr th, .kv tr + tr td { border-top: 1px solid var(--line); }
.vs-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: baseline; margin-bottom: 6px; }
.vs-head .model { font-size: 20px; font-weight: 800; font-style: italic; }
.vs-head .mf { color: var(--lime); letter-spacing: .15em; font-size: 11px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.chip { font-size: 12px; padding: 1px 6px; border-radius: 10px; border: 1px solid var(--line); color: var(--dim); white-space: nowrap; }
.chip.on { border-color: var(--lime-d); color: var(--lime); }
canvas { width: 100%; height: 260px; display: block; }
.legend { color: var(--dim); font-size: 11px; display: flex; flex-wrap: wrap; gap: 4px 12px; justify-content: center; margin-top: 4px; }
.legend i { display: inline-block; width: 16px; height: 3px; margin-right: 4px; vertical-align: middle; }
.peaks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
.peaks div { background: #0a1016; border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; }
.peaks b { display: block; font-size: 15px; font-variant-numeric: tabular-nums; }
.peaks span { color: var(--dim); font-size: 11px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.kpi { text-align: center; padding: 8px 6px; border-right: 1px solid var(--line); }
.kpi:last-child { border-right: 0; }
.kpi .t { color: var(--dim); font-size: 12px; display: flex; gap: 6px; justify-content: center; align-items: center; flex-wrap: wrap; }
.kpi .v { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi .d { font-size: 12px; }
.kpi .b { font-size: 12px; color: var(--orange); }

/* tables */
.tablewrap { overflow-x: auto; max-width: 100%; }
table.t { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
table.t th, table.t td { padding: 5px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
table.t th:first-child, table.t td:first-child { text-align: left; }
table.t thead th { color: var(--dim); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; position: sticky; top: 0; background: var(--panel); }
table.t td.wrap { white-space: normal; text-align: left; color: var(--dim); min-width: 200px; }
table.t tr:hover td { background: #ffffff05; }
.stagepick { display: inline-flex; gap: 3px; }
.stagepick button { padding: 3px 9px; font-size: 12px; }
.stagepick button.on { background: linear-gradient(#cdff5c, #8cc21e); color: #0b1400; border-color: var(--lime); font-weight: 800; }
.ac { color: var(--cyan); } .bc { color: var(--orange); } .cc { color: var(--purple); } .sc { color: var(--stock); }
/* setup tag: letter on the setup's colour (text label + colour) */
.stag { display: inline-block; min-width: 17px; padding: 0 4px; border-radius: 4px; text-align: center; font-weight: 800; font-style: italic; font-size: 11px; line-height: 16px; color: #071016; }
.peaks span.stag, .lgd span.stag { color: #071016; font-size: 11px; }
.stag.A { background: var(--slot-A); } .stag.B { background: var(--slot-B); } .stag.C { background: var(--slot-C); } .stag.S { background: var(--stock); }
/* chart legends with line-style samples */
.lgd { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; margin-top: 6px; font-size: 11px; color: var(--dim); max-width: 100%; min-width: 0; }
/* items wrap inside the panel: an item may break between words, a long car name anywhere */
.lgd .it { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px 5px; min-width: 0; max-width: 100%; }
.lgd .it b { color: var(--text); font-weight: 600; overflow-wrap: anywhere; }
.lgd svg { flex: none; }
.lgd .key { width: 100%; display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 14px; }
/* performance overview: other setups' values */
.kpi .cmpv { font-size: 12px; display: flex; justify-content: center; flex-wrap: wrap; gap: 0 5px; font-variant-numeric: tabular-nums; }
.kpi .cmpv .sep { color: var(--dim); }
.kpi .cmpv .B { color: var(--slot-B); } .kpi .cmpv .A { color: var(--slot-A); } .kpi .cmpv .C { color: var(--slot-C); }
/* compare page */
.cmphead { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin-bottom: 10px; }
.cmphead .cmpcar { display: flex; align-items: center; gap: 6px; }
.cmphead select { max-width: 230px; }
td.mv .dl { display: block; font-size: 11px; }
th.base, td.base { box-shadow: inset 0 -2px 0 #ffffff22; }
/* narrow: all three setup columns stay on screen (names and metric labels wrap) */
@media (max-width: 600px) {
  table.t.cmpt th, table.t.cmpt td { padding: 4px 5px; white-space: normal; }
  table.t.cmpt td:first-child { font-size: 12px; }
  table.t.cmpt thead th { font-size: 10px; letter-spacing: 0; }
  .cmphead select { max-width: none; flex: 1; } .cmphead .cmpcar { flex: 1 1 100%; }
}
th .basetag { display: block; font-size: 10px; font-weight: 400; color: var(--dim); font-style: normal; }
.dpos { color: var(--pos); } .dneg { color: var(--neg); } .d0 { color: var(--dim); }
.uniq { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.uniq label { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: #0a1016; }

/* confidence badges */
.badge { display: inline-block; font-size: 10px; text-transform: uppercase; letter-spacing: .05em; padding: 1px 5px; border-radius: 3px; border: 1px solid; font-weight: 700; cursor: help; vertical-align: middle; font-style: normal; white-space: nowrap; }
.conf-verified { color: #b9f43c; border-color: #b9f43c; } .conf-reference { color: #2fe4ee; border-color: #2fe4ee; }
.conf-named { color: #a5b4fc; border-color: #a5b4fc; } .conf-experimental { color: #ff9a2e; border-color: #ff9a2e; }
.conf-predicted { color: #f472b6; border-color: #f472b6; } .conf-unresolved { color: #8597a5; border-color: #8597a5; }
footer { padding: 8px 18px 20px; color: var(--dim); font-size: 12px; border-top: 1px solid var(--line); }
code { color: var(--cyan); }

/* ---- UI cleanup: configuration label, sidebar lock, expandable details, notes ---- */
.cfg { font-style: italic; font-weight: 700; color: var(--lime); padding: 5px 12px; border: 1px solid #b9f43c55; border-radius: 6px; background: #0a1016; white-space: nowrap; }
.catbtn.catlock:not(.on) { color: var(--dim); }
.catbtn .n.lock { border: 1px dashed currentColor; border-radius: 9px; padding: 0 6px; text-transform: uppercase; letter-spacing: .05em; font-size: 10px; }
.note { color: var(--dim); font-size: 12px; margin: 8px 0 4px; }
details.det { margin-top: 8px; border: 1px solid var(--line); border-radius: 6px; background: #0a101688; }
details.det > summary { cursor: pointer; padding: 6px 10px; color: var(--text); font-size: 13px; font-weight: 600; list-style: none; display: flex; gap: 8px; align-items: center; }
details.det > summary::-webkit-details-marker { display: none; }
details.det > summary::before { content: '▸'; color: var(--lime); width: 10px; }
details.det[open] > summary::before { content: '▾'; }
details.det > summary:hover { color: var(--lime); }
details.det .detbody { padding: 0 10px 8px; color: var(--dim); font-size: 12px; }
details.det .detbody p { margin: 6px 0; }
details.det .detbody table.t td { color: var(--text); }
details.det.ginfo { margin-top: 6px; }

/* vehicle summary */
.vsdet .kv td { text-align: left; padding-left: 8px; color: var(--text); }
.vsdet .kv th { padding-right: 4px; }
#vehicleSummary .chips { margin-top: 6px; justify-content: flex-start; }
#vehicleSummary .kv th, #vehicleSummary .kv td { padding-top: 3px; padding-bottom: 3px; }

/* parts */
.actgroup { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px 10px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 8px; background: #0a1016; }
.actgroup .lbl { margin-right: 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
table.t.parts { width: 100%; }
table.t.parts th, table.t.parts td { text-align: left; }
table.t.parts td.inst, table.t.parts td.cost, table.t.parts th:nth-child(3), table.t.parts th:nth-child(4) { text-align: right; }
table.t.parts > tbody > tr.catrow > td:first-child { width: 1%; }
table.t.parts td.wrap { min-width: 240px; }
.exp { display: inline-flex; align-items: center; gap: 8px; min-width: 190px; padding: 5px 10px; margin: 0; font-size: 14px; font-style: italic; font-weight: 700; text-align: left; cursor: pointer; }
.exp .caret { color: var(--lime); font-style: normal; width: 10px; }
.exp .exphint { margin-left: auto; font-size: 11px; font-weight: 400; font-style: normal; color: var(--dim); }
tr.catrow.open .exp { border-color: var(--lime-d); }
.catinfo { padding: 6px 8px; font-size: 12px; white-space: normal; }
table.t.uq tr.base td { color: var(--text); font-weight: 700; background: #0a1016; border-bottom: 2px solid var(--line); }
table.t.uq tr.base td.wrap { font-weight: 400; color: var(--dim); }
table.t.uq tr.on td:nth-child(2) { color: var(--lime); }
.uqv { color: var(--dim); font-size: 12px; margin-left: 4px; }

/* compare / data: grouped value tables */
.fhead { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; margin-bottom: 8px; }
.diffchk { color: var(--text); }
.fgroups { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 10px 16px; align-items: start; }
.fgroup h3 { margin: 0 0 4px; font-size: 14px; font-style: italic; font-weight: 800; color: var(--lime); }
.fgroup table.t.compact { width: 100%; min-width: 0; }
.fgroup table.t.compact td, .fgroup table.t.compact th { padding-left: 10px; }
table.t tr.dif td:first-child { box-shadow: inset 3px 0 0 #8fb3c7; }
table.t tr.dif td { background: #ffffff07; }
.dneu { color: #c9d6df; }

/* transmission rows (layout concept): final drive first with its own hint, then a heading row for the gears */

.gearrow .c { text-align: center; text-transform: none; letter-spacing: 0; font-size: 12px; }
.gearrow.ghead { text-transform: none; letter-spacing: 0; font-size: 12px; padding-top: 8px; }
.gearrow.fdrow { border-bottom: 1px solid #3a4a58; }
.gearrow .fdval { font-weight: 700; color: var(--lime); }
.gearrow .fdhint { grid-column: span 2; color: var(--dim); font-size: 12px; }
.gearrow .val { color: var(--text); font-weight: 600; }
.trsub { color: var(--dim); font-size: 12px; margin: -2px 0 4px; }
.trsub b { color: var(--text); }
@media (max-width: 700px) { .gearrow .fdhint { grid-column: 1 / -1; } }

/* compact vehicle summary card (layout concept): identity + one spec line | upgrades box */
.vs-card { display: flex; gap: 10px; align-items: stretch; justify-content: space-between; flex-wrap: wrap; }
.vs-main { flex: 1 1 150px; min-width: 0; }
.vs-main .vs-head { margin-bottom: 0; align-items: center; }
.vs-main .model { font-size: 20px; font-weight: 800; font-style: italic; line-height: 1.1; }
.vs-spec { margin-top: 4px; color: var(--text); font-variant-numeric: tabular-nums; }
.vs-spec i { color: var(--dim); font-style: normal; margin: 0 7px; }
.vs-spec span { white-space: nowrap; }
.vs-up { flex: 0 1 170px; display: flex; flex-direction: column; gap: 2px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: #0a1016; font-size: 12px; color: var(--dim); }
.vs-up b { color: var(--text); font-style: italic; font-size: 14px; }
.vs-up .jk { margin-top: 2px; }
.vs-up .jk.on { color: var(--lime); font-weight: 600; }
#vehicleSummary details.det { margin-top: 8px; }
.gearrow.ghead span { white-space: nowrap; }

/* the game's gear range bands (FUN_00550580): scale = absolute display range, band = current adjustment range
   (green: room for ◄, red: room for ►), white marker = current setting, grey tick = stock (Lab reference) */
.gb-lo, .gb-hi { position: absolute; top: 2px; bottom: 2px; }
.gb-lo { background: linear-gradient(90deg, #5f8f14, var(--lime)); border-radius: 2px 0 0 2px; }
.gb-hi { background: linear-gradient(90deg, #c0262f, #8e1820); border-radius: 0 2px 2px 0; }
.gb-stock { position: absolute; top: -5px; height: 5px; width: 0; margin-left: -4px; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid #c9d6df; z-index: 1; }
.gb-cap { display: flex; justify-content: space-between; font-size: 11px; color: var(--dim); margin-top: 2px; }
.gblegend { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 6px 0 2px; font-size: 12px; color: var(--dim); }
.gblegend i { display: inline-block; vertical-align: -1px; margin-right: 5px; }
.gblegend .lg-mark { width: 4px; height: 12px; background: #fff; border-radius: 2px; }
.gblegend .lg-lo { width: 14px; height: 8px; background: var(--lime); margin-right: 0; border-radius: 2px 0 0 2px; }
.gblegend .lg-hi { width: 14px; height: 8px; background: #c0262f; border-radius: 0 2px 2px 0; }
.gblegend .lg-stock { width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 6px solid #c9d6df; }
/* combined transmission control: the track IS the game's bar (absolute display scale); band, marker and stock tick
   share its coordinates; the marker is the draggable handle */
.gtrk { position: relative; display: block; flex: 1; min-width: 120px; height: 14px; background: #141e28; border: 1px solid #2a3a48; border-radius: 4px; cursor: pointer; touch-action: none; }
.gtrk.locked { cursor: default; opacity: .7; }
.gtrk:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; }
.gtrk .gb-lo, .gtrk .gb-hi { top: 2px; bottom: 2px; }
.gb-mark { position: absolute; top: -6px; bottom: -6px; width: 10px; margin-left: -5px; background: #f2f6f8; border: 1px solid #05080b; border-radius: 3px; box-shadow: 0 0 6px #ffffff66; z-index: 2; pointer-events: none; }
.gtrk:hover .gb-mark, .gtrk.dragging .gb-mark { box-shadow: 0 0 0 2px var(--lime), 0 0 8px #b9f43c88; }
.gtrk.locked .gb-mark { background: var(--dim); box-shadow: none; }
.gtwrap { flex: 1; display: flex; flex-direction: column; min-width: 120px; padding-top: 2px; }
.gtwrap .gb-cap { margin-top: 5px; }
.tbtn-ph { display: inline-block; width: 34px; flex: none; }
.gb-stock { pointer-events: none; }
.gtwrap .gtrk { flex: none; }
/* drag preview: its own small label above the control, so the speed readout is never replaced */
.gearrow .tctl { position: relative; }
.tprev { position: absolute; left: 50%; top: -15px; transform: translateX(-50%); padding: 0 6px; border-radius: 8px; font-size: 11px; line-height: 14px;
  background: #0a1016; border: 1px solid var(--lime-d); color: var(--lime); white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .1s; z-index: 3; }
.tprev.on { opacity: 1; }
/* ECU / turbo editor: buttons and arrow keys only */
#graph:focus { outline: none; } #graph:focus-visible { outline: 2px solid var(--slot-color, var(--lime)); outline-offset: 2px; border-radius: 6px; }
.gkeys { margin: 4px 0 0; } .gpad button { min-width: 34px; }
/* Setup colours (checkpoint 3): A cyan, B orange, C purple, stock gray. --slot-color follows the active setup
   (body[data-slot]) for setup-specific accents only; navigation stays lime, deltas green/red, limits/stock/disabled
   keep their meanings, and the transmission's red/green bands are unchanged. */
body { --slot-color: var(--lime); --slot-tint: #b9f43c14; }
body[data-slot="A"] { --slot-color: var(--slot-A); --slot-tint: #2fe4ee1a; }
body[data-slot="B"] { --slot-color: var(--slot-B); --slot-tint: #ff9a2e1a; }
body[data-slot="C"] { --slot-color: var(--slot-C); --slot-tint: #b98cff1a; }
#setupSeg button.on, #cmpBase button.on { color: #071016; font-weight: 800; }
#setupSeg button[data-setup="A"].on, #cmpBase button[data-base="A"].on { background: var(--slot-A); box-shadow: inset 0 0 0 1px var(--slot-A), 0 0 10px #2fe4ee55; }
#setupSeg button[data-setup="B"].on, #cmpBase button[data-base="B"].on { background: var(--slot-B); box-shadow: inset 0 0 0 1px var(--slot-B), 0 0 10px #ff9a2e55; }
#setupSeg button[data-setup="C"].on, #cmpBase button[data-base="C"].on { background: var(--slot-C); box-shadow: inset 0 0 0 1px var(--slot-C), 0 0 10px #b98cff55; }
.editor h2 .cat { color: var(--slot-color); }
.srow .val, .gearrow .val, .gearrow .fdval { color: var(--slot-color); }
.srow input[type=range] { accent-color: var(--slot-color); }
.gtrk:focus-visible { outline-color: var(--slot-color); }
.gtrk:hover .gb-mark, .gtrk.dragging .gb-mark { box-shadow: 0 0 0 2px var(--slot-color), 0 0 8px var(--slot-tint); }
.tprev { border-color: var(--slot-color); color: var(--slot-color); }
.evstate.set { background: var(--slot-tint); border-color: var(--slot-color); } .evstate.set b { color: var(--slot-color); }
.gpad button:focus-visible, #ptReset:focus-visible { outline-color: var(--slot-color); }
/* E3 game-save import: mode and per-event outcome */
.gs-mode { display: flex; flex-wrap: wrap; gap: 4px 14px; flex-basis: 100%; } .gs-mode label { color: var(--text); }
table.t.gs-evt { width: 100%; margin: 6px 0 2px; } table.t.gs-evt td, table.t.gs-evt th { text-align: left; white-space: normal; }
table.t.gs-evt tr.out td { color: var(--dim); }

/* export: aero resolution */
.gs-aero { display: block; } .gs-aero button { margin: 6px 6px 0 0; } .gs-xaero { margin: 4px 0; color: var(--dim); } .gs-xfix { margin: 6px 0; display: grid; gap: 6px; }
.gs-xfix .gs-xev { flex-wrap: wrap; } .gs-xfix select { flex: 1 1 220px; }
.linkish { background: none; border: 0; padding: 0; color: var(--slot-color, #39d0ff); text-decoration: underline; cursor: pointer; }
/* Garage */
.gqpanel h2 { margin-bottom: 4px; } .gq-state { margin: 2px 0 8px; } .gq-ch { color: #ffd8a8; }
.gq-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; } .gq-btns button { flex: 1 1 auto; }
.gv-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; } .gv-head h2 { margin: 0; }
.gv-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 10px 0; } .gv-tools .lbl { color: var(--dim); font-size: 12px; }
.gv-tools input[type=search] { flex: 1 1 200px; min-width: 0; }
.gv-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; }
.gv-card { border: 1px solid var(--line, #2a3540); border-radius: 10px; padding: 10px 12px; background: #0b141b88; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.gv-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; } .gv-name { font-size: 15px; overflow-wrap: anywhere; } .gv-car { color: var(--dim); font-size: 12px; }
.gv-notes { white-space: pre-wrap; overflow-wrap: anywhere; margin: 2px 0; } .gv-notes-ed { width: 100%; box-sizing: border-box; }
.gv-act { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; } .gv-act .lbl { color: var(--dim); font-size: 12px; }
.gv-act button.danger { margin-left: auto; color: #ffc9c9; border-color: #ff6b6b66; } .gv-empty { margin: 14px 0; }
@media (max-width: 560px) { .gv-list { grid-template-columns: 1fr; } }

/* Parts: "Keep other parts" choice on its own line below the stage buttons */
.keepparts { display: block; flex-basis: 100%; margin: 4px 0 10px; color: var(--dim); }
.keepparts input { vertical-align: -2px; margin-right: 6px; }
