@import url('/uniform-theme.css');
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg:       #f8f9fb;
  --surface:  #ffffff;
  --surface2: #f1f3f7;
  --border:   #e2e6ed;
  --border2:  #eaecf1;
  --text:     #1a2234;
  --text2:    #4a5568;
  --text3:    #94a3b8;
  --blue:     #2563eb;
  --blue-a:   rgba(37,99,235,0.08);
  --green:    #059669;
  --green-a:  rgba(5,150,105,0.09);
  --amber:    #d97706;
  --amber-a:  rgba(217,119,6,0.09);
  --red:      #dc2626;
  --red-a:    rgba(220,38,38,0.08);
  --series-total:        #1a2234;
  --series-total-manual: rgba(37,99,235,0.8);
  --series-aero-line:    #2563eb;
  --series-roll-line:    #059669;
  --series-acc-line:     #d97706;
  --series-aero-fill:    rgba(37,99,235,0.09);
  --series-roll-fill:    rgba(5,150,105,0.09);
  --series-acc-fill:     rgba(217,119,6,0.08);
  --chart-grid:          rgba(226,230,237,1);
  --chart-tick:          #94a3b8;
  --chart-shift:         rgba(0,0,0,0.07);
  --chart-shift-label:   rgba(148,163,184,0.9);
  --chart-ref-line:      rgba(217,119,6,0.42);
  --chart-ref-text:      rgba(217,119,6,0.75);
  --chart-opt-dot:       #059669;
  --chart-opt-text:      rgba(5,150,105,0.82);
  --chart-cursor:        rgba(37,99,235,0.4);
  --tooltip-bg:          rgba(255,255,255,0.98);
  --tooltip-border:      rgba(226,230,237,1);
  --tooltip-title:       #1a2234;
  --tooltip-body:        #4a5568;
  --theme-btn-bg:        rgba(26,34,52,0.06);
  --theme-btn-border:    rgba(148,163,184,0.35);
  --theme-btn-color:     rgba(26,34,52,0.7);
  --theme-btn-hover-bg:  rgba(37,99,235,0.12);
  --theme-btn-hover-brd: rgba(37,99,235,0.38);
  --theme-btn-hover-col: #2563eb;
  --scroll-track:         rgba(148,163,184,0.16);
  --scroll-thumb:         rgba(37,99,235,0.45);
  --scroll-thumb-hover:   rgba(37,99,235,0.65);
  --select-scheme:        light;
  --mono: 'DM Mono', monospace;
  --sans: 'DM Sans', sans-serif;
  --fh: 'Syne', sans-serif;
}
[data-theme="dark"] {
  --bg:       #07101c;
  --surface:  #0c1927;
  --surface2: #112338;
  --border:   rgba(201,168,76,0.22);
  --border2:  rgba(201,168,76,0.12);
  --text:     #ede7db;
  --text2:    rgba(237,231,219,0.72);
  --text3:    rgba(237,231,219,0.42);
  --blue:     #3d7ab5;
  --blue-a:   rgba(61,122,181,0.18);
  --green:    #3aaf7e;
  --green-a:  rgba(58,175,126,0.2);
  --amber:    #d4a84c;
  --amber-a:  rgba(212,168,76,0.2);
  --red:      #e07070;
  --red-a:    rgba(224,112,112,0.16);
  --series-total:        #ede7db;
  --series-total-manual: rgba(61,122,181,0.92);
  --series-aero-line:    #3d7ab5;
  --series-roll-line:    #3aaf7e;
  --series-acc-line:     #d4a84c;
  --series-aero-fill:    rgba(61,122,181,0.22);
  --series-roll-fill:    rgba(58,175,126,0.22);
  --series-acc-fill:     rgba(212,168,76,0.18);
  --chart-grid:          rgba(201,168,76,0.18);
  --chart-tick:          rgba(237,231,219,0.5);
  --chart-shift:         rgba(237,231,219,0.14);
  --chart-shift-label:   rgba(232,201,122,0.62);
  --chart-ref-line:      rgba(212,168,76,0.45);
  --chart-ref-text:      rgba(232,201,122,0.86);
  --chart-opt-dot:       #3aaf7e;
  --chart-opt-text:      rgba(142,241,199,0.88);
  --chart-cursor:        rgba(61,122,181,0.55);
  --tooltip-bg:          rgba(8,15,26,0.96);
  --tooltip-border:      rgba(201,168,76,0.26);
  --tooltip-title:       #ede7db;
  --tooltip-body:        rgba(237,231,219,0.74);
  --theme-btn-bg:        rgba(255,255,255,0.04);
  --theme-btn-border:    rgba(201,168,76,0.28);
  --theme-btn-color:     rgba(232,201,122,0.7);
  --theme-btn-hover-bg:  rgba(201,168,76,0.14);
  --theme-btn-hover-brd: rgba(201,168,76,0.45);
  --theme-btn-hover-col: #e8c97a;
  --scroll-track:         rgba(232,201,122,0.08);
  --scroll-thumb:         rgba(201,168,76,0.40);
  --scroll-thumb-hover:   rgba(232,201,122,0.58);
  --select-scheme:        dark;
}
html, body { height: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}
body, header, .sidebar, .s-block, .stat, .gear-btn, .car-select, .theme-btn {
  transition: background-color 0.22s ease, border-color 0.22s ease, color 0.22s ease, box-shadow 0.22s ease;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 58px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 14px;
}
.h-title { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.h-title h1 {
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.h-title span {
  font-family: var(--mono);
  font-size: 0.66rem;
  color: var(--text3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.h-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.h-pills { display: flex; gap: 8px; flex-shrink: 0; }
.pill {
  font-family: var(--mono);
  font-size: 0.60rem;
  padding: 3px 9px;
  border-radius: 3px;
  letter-spacing: 0.04em;
}
.pill-b { background: var(--blue-a); color: var(--blue); border: 1px solid rgba(37,99,235,0.18); }
.pill-g { background: var(--green-a); color: var(--green); border: 1px solid rgba(5,150,105,0.2); }
.pill-a { background: var(--amber-a); color: var(--amber); border: 1px solid rgba(217,119,6,0.2); }
.theme-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--theme-btn-border);
  background: var(--theme-btn-bg);
  color: var(--theme-btn-color);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.theme-btn:hover {
  transform: rotate(18deg);
  background: var(--theme-btn-hover-bg);
  border-color: var(--theme-btn-hover-brd);
  color: var(--theme-btn-hover-col);
}
.theme-btn:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
.ico-moon { display: block; }
.ico-sun  { display: none; }
[data-theme="dark"] .ico-moon { display: none; }
[data-theme="dark"] .ico-sun  { display: block; }

.home-btn {
  height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text2);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: .04em;
  text-decoration: none;
  display: inline-flex; align-items: center;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.home-btn:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-a); }

.lang-btn {
  height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text2);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  display: inline-flex; align-items: center;
}
.lang-btn:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-a); }

.body { display: flex; flex: 1; min-height: 0; }

.sidebar {
  width: 276px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) var(--scroll-track);
}
.sidebar::-webkit-scrollbar { width: 10px; }
.sidebar::-webkit-scrollbar-track { background: var(--scroll-track); }
.sidebar::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--scroll-thumb-hover);
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.s-block { padding: 14px 17px; border-bottom: 1px solid var(--border2); }
.s-label {
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.13em;
  color: var(--text3);
  text-transform: uppercase;
  margin-bottom: 11px;
}
.s-label.s-mt { margin-top: 12px; }

.car-select {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 4px;
  padding: 8px 9px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.67rem;
  color-scheme: var(--select-scheme);
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) var(--scroll-track);
}
.car-select::-webkit-scrollbar {
  width: 10px;
}
.car-select::-webkit-scrollbar-track {
  background: var(--scroll-track);
}
.car-select::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.car-select::-webkit-scrollbar-thumb:hover {
  background: var(--scroll-thumb-hover);
}
.car-select option,
.car-select optgroup {
  background: var(--surface);
  color: var(--text);
}
.car-hint {
  margin-top: 8px;
  color: var(--text3);
  font-family: var(--mono);
  font-size: 0.56rem;
  line-height: 1.45;
}

.speed-num {
  font-family: var(--mono);
  font-size: 2.5rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1;
  text-align: center;
  margin-bottom: 2px;
}
.speed-unit {
  font-family: var(--mono);
  font-size: 0.63rem;
  color: var(--text3);
  text-align: center;
  margin-bottom: 13px;
}
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 2px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  background: var(--blue);
  border-radius: 50%;
  cursor: pointer;
}
.slider-labels {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 0.57rem;
  color: var(--text3);
  margin-top: 5px;
}

.gear-row {
  display: flex;
  gap: 4px;
  margin-top: 2px;
  flex-wrap: wrap;
}
.gear-btn {
  min-width: 30px;
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text2);
  font-family: var(--mono);
  font-size: 0.68rem;
  padding: 5px 0;
  cursor: pointer;
  transition: all 0.12s;
  text-align: center;
  user-select: none;
}
.gear-btn:hover { border-color: var(--blue); color: var(--blue); }
.gear-btn.active { background: var(--blue-a); border-color: var(--blue); color: var(--blue); }
.gear-btn[data-gear="auto"].active {
  background: var(--surface2);
  border-color: var(--border);
  color: var(--text2);
  font-weight: 500;
}
.gear-warn {
  font-family: var(--mono);
  font-size: 0.59rem;
  color: var(--amber);
  margin-top: 8px;
  min-height: 15px;
  text-align: center;
}

.rpm-display {
  font-family: var(--mono);
  font-size: 1.35rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 7px;
  line-height: 1;
}
.rpm-unit { font-size: 0.63rem; color: var(--text3); font-weight: 400; }
.rpm-track { height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; margin-bottom: 4px; }
.rpm-fill { height: 100%; border-radius: 3px; transition: width 0.18s, background 0.18s; }
.rpm-labels {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 0.55rem;
  color: var(--text3);
}

.bsfc-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.bsfc-val { font-family: var(--mono); font-size: 1.05rem; font-weight: 500; color: var(--text); }
.bsfc-tag { font-family: var(--mono); font-size: 0.6rem; padding: 3px 8px; border-radius: 2px; }
.bz-opt { background: var(--green-a); color: var(--green); border: 1px solid rgba(5,150,105,0.25); }
.bz-bon { background: var(--blue-a);  color: var(--blue);  border: 1px solid rgba(37,99,235,0.25); }
.bz-moy { background: var(--amber-a); color: var(--amber); border: 1px solid rgba(217,119,6,0.25); }
.bz-pau { background: var(--red-a);   color: var(--red);   border: 1px solid rgba(220,38,38,0.25); }
.bsfc-sub { font-family: var(--mono); font-size: 0.57rem; color: var(--text3); margin-bottom: 7px; }
.bsfc-ptr-row { position: relative; height: 11px; margin-bottom: 2px; }
.bsfc-ptr {
  position: absolute;
  width: 2px;
  height: 8px;
  background: var(--text);
  top: 0;
  transform: translateX(-50%);
  border-radius: 1px;
  transition: left 0.22s;
}
.bsfc-scale { display: flex; height: 4px; border-radius: 2px; overflow: hidden; margin-bottom: 4px; }
.bsfc-scale div { flex: 1; }
.bsfc-scale-lbl {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 0.55rem;
  color: var(--text3);
}

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.stat { background: var(--bg); border: 1px solid var(--border); border-radius: 3px; padding: 8px 10px; }
.stat-lbl { font-family: var(--mono); font-size: 0.55rem; color: var(--text3); letter-spacing: 0.07em; margin-bottom: 3px; }
.stat-val { font-family: var(--mono); font-size: 0.88rem; font-weight: 500; color: var(--text); }
.stat-val.cl-green { color: var(--green); }
.stat-val.cl-blue  { color: var(--blue); }
.stat-val.cl-amber { color: var(--amber); }
.stat-val.cl-red   { color: var(--red); }

.pt { width: 100%; border-collapse: collapse; }
.pt tr { border-bottom: 1px solid var(--border2); }
.pt tr:last-child { border-bottom: none; }
.pt td { padding: 5px 0; font-family: var(--mono); font-size: 0.63rem; }
.pt td:first-child { color: var(--text3); width: 55%; }
.pt td:last-child  { color: var(--text);  text-align: right; }

.chart-area { flex: 1; display: flex; flex-direction: column; min-width: 0; padding: 18px 22px 14px; }
.chart-hdr { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; gap: 12px; }
.chart-title { font-size: 0.77rem; font-weight: 500; color: var(--text2); letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 3px; }
.chart-sub { font-family: var(--mono); font-size: 0.59rem; color: var(--text3); }
.chart-legend { display: flex; flex-direction: column; gap: 5px; align-items: flex-end; flex-shrink: 0; }
.legend-item { display: flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: 0.61rem; color: var(--text2); }
.legend-line { width: 20px; height: 2px; border-radius: 1px; flex-shrink: 0; }
.chart-wrap { flex: 1; position: relative; min-height: 0; }

@media (max-width: 860px) {
  header { padding: 0 14px; height: 54px; }
  .h-pills { display: none; }
  .h-title span { display: none; }
  .theme-btn { width: 32px; height: 32px; }
  .body { flex-direction: column; }
  .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); }
  .s-block.hide-mobile { display: none; }
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .chart-area { padding: 14px; min-height: 320px; }
  .chart-hdr { flex-direction: column; gap: 10px; }
  .chart-legend { align-items: flex-start; flex-direction: row; flex-wrap: wrap; gap: 8px; }
  .chart-wrap { min-height: 260px; }
}
