/* ==========================================================================
   PETROLHEAD TECHNICA — transmission lab shell
   ========================================================================== */
:root {
  --tc-bg: #0b1216; --tc-panel: #111a20; --tc-panel-2: #152229;
  --tc-line: #29383d; --tc-line-2: #344854;
  --tc-text: #e4edef; --tc-muted: #91a4ad; --tc-dim: #6f8b97;
  --tc-mint: #74edc9; --tc-amber: #f6bd68;
  --tc-mono: 'JetBrains Mono', Consolas, ui-monospace, monospace;
}
* { box-sizing: border-box; }
body.technica {
  margin: 0; background: var(--tc-bg); color: var(--tc-text);
  font-family: 'Inter', 'Segoe UI', Arial, sans-serif; font-size: 16px;
  -webkit-font-smoothing: antialiased;
}
body.technica a { color: inherit; text-decoration: none; }
button { cursor: pointer; font: inherit; transition: background .16s, color .16s, border-color .16s; }
button:hover { color: #fff; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--tc-mint); outline-offset: 4px; }
svg { flex-shrink: 0; }
.eyebrow { font-size: 12px; letter-spacing: 1.7px; font-weight: 650; color: #81aba9; }

.lab { max-width: 2100px; margin: auto; min-height: 100svh; }

/* ---- top bar ---- */
.topbar {
  height: 82px; padding: 0 30px; display: flex; align-items: center;
  justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--tc-line);
}
.brand { display: flex; align-items: center; gap: 12px; letter-spacing: 2px; font-size: 14px; font-weight: 650; }
.brand-symbol {
  width: 41px; height: 41px; display: grid; place-items: center;
  border: 1px solid #4b616c; border-radius: 50%; color: #c8d7df; font-family: var(--tc-mono); font-size: 12px;
}
.brand-sub { display: block; font: 10px/1.8 var(--tc-mono); letter-spacing: 2.7px; color: #93a5ad; }
.car-nav { display: flex; gap: 4px; background: #111d23; border: 1px solid #27373f; border-radius: 6px; padding: 4px; flex-shrink: 0; }
.car-nav a { padding: 10px 22px; border-radius: 3px; font-size: 14px; font-weight: 600; color: #a2b4bd; white-space: nowrap; }
.car-nav a span { font-size: 12px; font-weight: 400; margin-left: 9px; color: #899ba6; }
.car-nav a:hover { color: #fff; }
.car-nav a.active { background: #2b3d45; color: #fff; box-shadow: 0 2px 7px #0003; }
.top-right { display: flex; align-items: center; gap: 12px; }
.live-tag { font-size: 12px; letter-spacing: 1.6px; color: #93adaf; display: flex; align-items: center; gap: 8px; }
.live-tag i, .model-tag i { width: 5px; height: 5px; border-radius: 50%; background: var(--tc-mint); box-shadow: 0 0 10px #74edc944; }
.lang-toggle {
  background: none; border: 1px solid var(--tc-line-2); border-radius: 5px; padding: 7px 9px;
  font-family: var(--tc-mono); font-size: 11px; letter-spacing: 1px; color: #8fa5ae;
}
.lang-toggle .active { color: var(--tc-mint); }
.lang-sep { opacity: .45; margin: 0 3px; }
.exit-link { font-family: var(--tc-mono); font-size: 11px; letter-spacing: 1.2px; color: #8fa5ae; white-space: nowrap; }
.exit-link:hover { color: var(--tc-mint); }

/* ---- context bar ---- */
.contextbar {
  height: 49px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; font-size: 12px; letter-spacing: 1.4px; color: #98aeb9;
  border-bottom: 1px solid #1d282d;
}
.contextbar > span:first-child { display: flex; align-items: center; gap: 10px; }
.architecture { color: #d1dfe3; }
.architecture span { color: #769099; margin-left: 16px; }

/* ---- workspace ---- */
.workspace {
  display: grid; grid-template-columns: 238px minmax(0, 1fr) 300px;
  margin: 0 18px; border: 1px solid var(--tc-line); border-radius: 5px;
  overflow: hidden; min-height: 580px; height: calc(100svh - 340px);
}
.panel { background: var(--tc-panel); overflow: auto; scrollbar-width: thin; scrollbar-color: #3d515c transparent; }
.components { border-right: 1px solid #2a373e; display: flex; flex-direction: column; }
.panel-heading {
  padding: 18px; display: flex; align-items: center; justify-content: space-between;
  font-size: 14px; font-weight: 600; border-bottom: 1px solid #25343a; color: #d4e0e4;
}
.count { font-size: 12px; color: #8096a1; font-weight: 400; }
.side-hint { font-size: 12px; color: #8298a2; margin: 18px 18px 12px; }
.part-list { padding: 0 9px; }
.part {
  display: flex; align-items: center; gap: 9px; width: 100%; background: none;
  border: 1px solid transparent; text-align: left; color: #a1b3bc; border-radius: 4px;
  margin-bottom: 3px; padding: 10px 9px; font-size: 14px; min-height: 44px; line-height: 1.3;
}
.part:hover { background: #1b2a30; }
.part.selected { background: #173930; border-color: #2c574c; color: #b5f2df; }
.part small { font: 10px var(--tc-mono); margin-left: auto; opacity: .65; }
.part-dot { width: 6px; height: 6px; flex-shrink: 0; border-radius: 2px; }
.side-bottom { padding: 20px 18px 18px; margin-top: auto; border-top: 1px solid #25343a; }
.side-bottom label { display: flex; align-items: center; justify-content: space-between; font-size: 14px; color: #a3b7be; margin-top: 17px; }

/* switch */
.sw { position: relative; width: 36px; height: 20px; flex: none; }
.sw input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.sw i { position: absolute; inset: 0; background: #26373e; border-radius: 20px; transition: background .18s; pointer-events: none; display: block; }
.sw i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #8ba0a9; transition: transform .18s, background .18s; }
.sw input:checked + i { background: #1c4b40; }
.sw input:checked + i::after { transform: translateX(16px); background: var(--tc-mint); }

/* ---- viewer ---- */
.viewer { position: relative; min-width: 0; overflow: hidden;
  background: radial-gradient(ellipse at 50% 43%, #243439 0%, #121e22 55%, #10191d 85%); }
.canvas-host { position: absolute; inset: 0; }
.canvas-host canvas { display: block; width: 100%; height: 100%; outline: 0; touch-action: none; }
.viewer-heading { position: absolute; top: 26px; left: 28px; right: 25px; display: flex;
  align-items: flex-start; justify-content: space-between; pointer-events: none; z-index: 2; }
.viewer-heading h1 { font-size: 36px; letter-spacing: -1.5px; line-height: 1.1; margin: 10px 0 12px; font-weight: 500; }
.viewer-heading p { font-size: 14px; color: #93aab3; margin: 0; }
.viewer-heading p span { margin: 0 7px; color: #526d78; }
.model-tag { display: flex; align-items: center; gap: 8px; font: 11px var(--tc-mono); color: #a9bfc7;
  border: 1px solid #345058; border-radius: 3px; padding: 7px; white-space: nowrap; }
.view-tabs { position: absolute; top: 168px; left: 26px; z-index: 3; display: flex; gap: 2px;
  background: #0a151ae6; border: 1px solid #2c424a; padding: 3px; border-radius: 5px; }
.view-tabs button { border: 0; background: none; color: #9eb4bd; font-size: 13px; padding: 5px 11px; border-radius: 3px; }
.view-tabs button.on { background: #2b4149; color: #ebf5f6; }
.camera-tools { position: absolute; right: 18px; bottom: 79px; display: flex; flex-direction: column;
  background: #102127; border: 1px solid #344850; border-radius: 4px; overflow: hidden; z-index: 3; }
.camera-tools button { background: none; border: 0; color: #a7bac4; width: 34px; height: 35px; display: grid; place-items: center; font-size: 15px; }
.camera-tools button + button { border-top: 1px solid #31414a; }
.camera-tools button:hover { background: #2f444d; }
.scene-caption { position: absolute; bottom: 19px; left: 26px; right: 20px; color: #8ea3ac; font-size: 12px; pointer-events: none; }
.scene-caption small { display: block; margin-top: 8px; font-size: 12px; color: #829da8; }
.legend { position: absolute; left: 26px; bottom: 76px; display: flex; gap: 14px; font: 12px var(--tc-mono); color: #9bb4be; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 6px; height: 6px; border-radius: 50%; }
.mint { background: var(--tc-mint); } .amber { background: var(--tc-amber); }
.model-loading, .model-error { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: flex; align-items: center; gap: 12px; font-size: 14px; color: #adc4cb; z-index: 4; }
.model-error { width: 80%; line-height: 1.6; padding: 25px; background: #172c35; border: 1px solid #395563; }
.loading-gear { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #2f4a52;
  border-top-color: var(--tc-mint); animation: turn 1s linear infinite; }
@keyframes turn { to { transform: rotate(360deg); } }

/* ---- inspector ---- */
.inspector { border-left: 1px solid #2a373e; display: flex; flex-direction: column; }
.inspector-main { padding: 24px 20px; }
.inspector h2 { font-size: 22px; font-weight: 500; line-height: 1.2; margin: 12px 0 15px; letter-spacing: -.4px; }
.inspector p { font-size: 16px; line-height: 1.65; color: #91a8b2; margin: 0 0 14px; }
.inspector p.lead { color: #d1dfe3; }
.outline-action { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  padding: 10px 8px; color: #c6dadf; font-size: 14px; background: #192930; border: 1px solid #344b56; border-radius: 4px; margin-top: 20px; }
.outline-action:hover { background: #284139; }
.separator { height: 1px; background: #2b3b43; margin: 26px 0; }
.inspector h3 { font-size: 18px; line-height: 1.3; font-weight: 500; margin: 12px 0 20px; letter-spacing: -.4px; }
.power-path { list-style: none; padding: 0; margin: 0; }
.power-path li { font-size: 14px; color: #627780; padding: 0 0 17px 20px; position: relative;
  border-left: 1px solid #314a48; margin-left: 3px; }
.power-path li:last-child { border-left-color: transparent; padding-bottom: 0; }
.power-path li::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #344b55;
  position: absolute; left: -4px; top: 5px; }
.power-path li.lit { color: #adc9c5; }
.power-path li.lit::before { background: var(--tc-mint); box-shadow: 0 0 10px #74edc922; }
.fact-note { margin-top: 24px; font-size: 14px; line-height: 1.6; color: #92a9b3; border-left: 2px solid #b39861; padding-left: 12px; }
.ratio-detail { display: grid; grid-template-columns: 1fr auto; gap: 8px 10px; margin-top: 24px; padding: 14px 0;
  border-top: 1px solid var(--tc-line-2); border-bottom: 1px solid var(--tc-line-2); font-size: 14px; color: #b1c7d3; }
.ratio-detail strong { color: #b8f0dd; font: 16px var(--tc-mono); }
.ratio-detail small { grid-column: 1 / -1; color: #8ca6b7; font-size: 12px; line-height: 1.6; }
.inspector-bottom { display: flex; gap: 9px; padding: 18px 20px; border-top: 1px solid #2b3b43;
  margin-top: auto; color: #738d98; font-size: 12px; line-height: 1.5; }

/* ---- controls ---- */
.controls { display: grid; grid-template-columns: 176px minmax(190px, 1.2fr) minmax(250px, 1fr) 118px 176px;
  align-items: center; gap: 22px; padding: 23px 30px 18px; }
.drive-buttons, .gear-buttons { display: flex; gap: 5px; margin-top: 13px; }
.drive-buttons button, .gear-buttons button { background: var(--tc-panel-2); color: #8fa9b5;
  border: 1px solid #31444c; border-radius: 4px; font: 15px var(--tc-mono); width: 35px; height: 34px; }
.drive-buttons button.on, .gear-buttons button.on { background: var(--tc-mint); color: #102c24;
  border-color: #91f4d6; box-shadow: 0 0 12px #74edc91a; }
.control-label { font-size: 12px; letter-spacing: 1.1px; color: #839fa9; display: flex;
  align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 17px; }
.control-label output { font: 18px var(--tc-mono); color: #cddce1; letter-spacing: 0; }
.control-label small { font-size: 12px; color: #859ea8; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 4px;
  background: #26373e; border-radius: 3px; outline: none; margin: 0 0 13px; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 15px; height: 15px;
  border-radius: 50%; background: var(--tc-mint); border: none; cursor: pointer; }
input[type=range]::-moz-range-thumb { width: 15px; height: 15px; border-radius: 50%;
  background: var(--tc-mint); border: none; cursor: pointer; }
.range-ticks { display: flex; justify-content: space-between; font: 10px var(--tc-mono); color: #566f7a; }
.auto-switch { display: flex; align-items: center; gap: 8px; text-transform: none; letter-spacing: 0; font-size: 12px; white-space: nowrap; }
.gear-control .control-label { margin-bottom: 12px; letter-spacing: 0; }
.gear-buttons { margin-top: 0; gap: 6px; }
.gear-buttons button { height: 31px; width: 31px; font-size: 13px; }
.gear-readout { border-left: 1px solid #2c3e47; padding-left: 23px; display: flex; flex-direction: column; align-items: flex-start; }
.gear-readout strong { font: 38px/1.2 var(--tc-mono); color: var(--tc-mint); }
.gear-readout small { font: 10px var(--tc-mono); color: #83a49f; letter-spacing: 1px; }
.play-button { border: 1px solid #335548; background: #1b392f; color: #bcebd7; display: flex;
  align-items: center; justify-content: center; gap: 8px; width: 100%; border-radius: 4px; padding: 9px; font-size: 14px; }
.playback-speed { display: flex; gap: 4px; margin-top: 7px; }
.playback-speed button { flex: 1; background: #111e24; color: #74929e; border: 1px solid #273d47;
  border-radius: 3px; font-size: 12px; padding: 5px; }
.playback-speed button.on { color: #badbd3; background: #203b34; border-color: #365348; }

/* ---- lower strip + notes ---- */
.lower-strip { border-top: 1px solid #24363f; border-bottom: 1px solid #24363f; padding: 15px 29px;
  display: flex; justify-content: space-between; align-items: center; gap: 20px; background: #101b21; }
.explode-control { display: flex; align-items: center; gap: 12px; color: #a9c1c9; font-size: 14px; }
.explode-control input[type=range] { width: 180px; margin: 0 5px; }
.explode-control output { font: 12px var(--tc-mono); color: #79bead; min-width: 34px; }
.simulation-note { font-size: 12px; color: var(--tc-dim); }
.notes { padding: 16px 29px 26px; display: flex; justify-content: space-between; align-items: flex-start;
  gap: 25px; font-size: 12px; color: var(--tc-dim); }
.notes > span { font-size: 10px; letter-spacing: 1.5px; white-space: nowrap; padding-top: 2px; }
.notes summary { cursor: pointer; display: flex; align-items: center; gap: 9px; color: #8ca8b4; list-style: none; }
.notes-content { padding: 12px 0; max-width: 950px; font-size: 14px; line-height: 1.8; color: #90a9b4; }
.notes-content a { display: block; color: #8bd4be; text-underline-offset: 3px; margin: 6px 0; }
.notes-content a:hover { text-decoration: underline; }
.notes-content p { margin: 8px 0 16px; }

/* ---- responsive ---- */
@media (min-width: 1600px) {
  .workspace { grid-template-columns: 270px minmax(0, 1fr) 340px; }
  .viewer-heading h1 { font-size: 43px; }
}
@media (max-width: 1180px) {
  .topbar { padding: 0 20px; gap: 15px; }
  .live-tag { display: none; }
  .workspace { grid-template-columns: 220px minmax(0, 1fr) 270px; margin: 0 12px; }
  .part small { display: none; }
  .viewer-heading { left: 20px; top: 24px; }
  .viewer-heading h1 { font-size: 29px; }
  .model-tag { display: none; }
  .view-tabs { left: 18px; top: 175px; }
  .controls { grid-template-columns: 157px minmax(150px, 1fr) 235px 90px 145px; gap: 15px; padding: 23px 22px 18px; }
  .notes > span { display: none; }
}
@media (max-width: 980px) {
  .workspace { grid-template-columns: 220px minmax(0, 1fr); height: auto; min-height: 0; }
  .viewer { height: 600px; }
  .inspector { grid-column: 1 / -1; border-left: 0; border-top: 1px solid #2a373e; }
  .controls { grid-template-columns: 170px 1fr 176px; gap: 22px; }
  .gear-readout { display: none; }
  .playback { grid-column: 3; grid-row: 1; }
  .gear-control { grid-column: 1 / 3; grid-row: 2; }
}
@media (max-width: 640px) {
  .topbar { height: auto; flex-direction: column; align-items: stretch; padding: 17px 15px 12px; gap: 14px; }
  .car-nav { width: 100%; } .car-nav a { flex: 1; text-align: center; padding: 10px 8px; }
  .car-nav a span { display: block; margin: 4px 0 0; }
  .top-right { justify-content: space-between; }
  .contextbar { padding: 0 17px; height: 42px; font-size: 10px; }
  .architecture { display: none; }
  .workspace { margin: 0 10px; display: flex; flex-direction: column; }
  .viewer { height: 560px; order: 0; }
  .components { order: 1; border-right: 0; border-top: 1px solid #293b45; }
  .inspector { order: 2; }
  .part-list { display: grid; grid-template-columns: 1fr 1fr; padding: 0 9px 12px; gap: 3px; }
  .part { margin: 0; }
  .view-tabs { top: 165px; left: 16px; }
  .legend { bottom: 96px; left: 18px; }
  .camera-tools { bottom: 143px; right: 15px; }
  .scene-caption { left: 18px; bottom: 17px; }
  .controls { grid-template-columns: 145px minmax(0, 1fr); gap: 24px 17px; padding: 24px 17px; }
  .rpm-control { grid-column: 2; } .playback { grid-column: 2; grid-row: 2; }
  .gear-control { grid-column: 1; grid-row: 2; }
  .gear-buttons { flex-wrap: wrap; margin-top: 10px; }
  .lower-strip { padding: 17px; display: block; }
  .explode-control { flex-wrap: wrap; }
  .explode-control input[type=range] { flex: 1; min-width: 90px; width: auto; }
  .simulation-note { display: block; margin-top: 15px; }
  .notes { padding: 18px; }
}
@media (prefers-reduced-motion: reduce) { .loading-gear { animation: none; } }

/* ---- BMW variant ------------------------------------------------------- */
body.technica[data-car="bmw"] {
  --tc-mint: #83bfff;
}
body.technica[data-car="bmw"] .viewer {
  background: radial-gradient(ellipse at 50% 43%, #263c49 0%, #14232e 55%, #101920 85%);
}
body.technica[data-car="bmw"] .part.selected { background: #1a354b; border-color: #375a7e; color: #c0dfff; }
body.technica[data-car="bmw"] .eyebrow { color: #8db9d9; }
body.technica[data-car="bmw"] .drive-buttons button.on,
body.technica[data-car="bmw"] .gear-buttons button.on { background: #83bfff; border-color: #a4d0ff; color: #102a46; }
body.technica[data-car="bmw"] .power-path li.lit::before { background: #83bfff; }
body.technica[data-car="bmw"] .gear-readout strong { color: #83bfff; }
body.technica[data-car="bmw"] .play-button { background: #1c3650; border-color: #375b7e; color: #c1dfff; }
body.technica[data-car="bmw"] .playback-speed button.on { background: #1d354a; border-color: #365674; color: #c1dfff; }
body.technica[data-car="bmw"] .notes-content a { color: #91c9ff; }
body.technica[data-car="bmw"] .ratio-detail strong { color: #b8dfff; }
body.technica[data-car="bmw"] .gear-buttons { gap: 4px; flex-wrap: wrap; }
body.technica[data-car="bmw"] .gear-buttons button { min-width: 29px; width: 29px; }
.blue { background: #83bfff; }

/* shift-element matrix */
.element-section { margin-top: 25px; }
.element-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; margin-top: 12px; }
.element {
  padding: 10px 2px 8px; border-radius: 4px; background: #15202a; border: 1px solid #334652;
  display: flex; flex-direction: column; align-items: center; gap: 6px; color: #829aaa;
}
.element b { font: 20px var(--tc-mono); font-weight: 400; }
.element span, .element small { font-size: 12px; }
.element.applied { background: #203f58; border-color: #527fa2; color: #b7dfff; }
.element.applied:nth-child(-n+2) { background: #443828; border-color: #987342; color: #ffd998; }
.element-caption { font-size: 12px; color: #8ea8b7; margin: 12px 0 0; }
@media (max-width: 640px) { .element-grid { gap: 8px; } .element { min-height: 85px; } }

@media (max-width: 1320px) { .car-nav a { padding: 10px 14px; } }
@media (max-width: 1180px) { .car-nav a { padding: 9px 10px; font-size: 13px; } .car-nav a span { margin-left: 6px; } }
@media (max-width: 760px) { .car-nav a span { display: none; } }
@media (max-width: 640px) {
  .car-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; }
  .car-nav a { padding: 10px 5px; }
  .car-nav a span { display: block; margin: 4px 0 0; font-size: 11px; }
}
