:root {
  --bg-0: #03070e;
  --bg-1: #0a1422;
  --panel: #0e1a2c;
  --panel-border: #263d5e;
  --text: #e7edf9;
  --muted: #9fb2d0;
  --chip: #1c304d;
  --segment-off-0: #556072;
  --segment-off-1: #313949;
  --segment-on-0: #ff8b73;
  --segment-on-1: #ff3d2b;
  --danger: #ff5f49;
  --fab-anchor-top: 118px;
  --fab-pair-gap: 50px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  padding-bottom: 100px;
  color: var(--text);
  font-family: "DIN Alternate", "Bahnschrift", "Roboto Condensed", "Arial Narrow", sans-serif;
  background:
    radial-gradient(130% 90% at 8% 7%, #172842 0%, transparent 42%),
    radial-gradient(120% 90% at 91% 4%, #221724 0%, transparent 45%),
    linear-gradient(170deg, var(--bg-1) 0%, var(--bg-0) 68%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 130;
  background: rgba(2, 5, 10, 0.78);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

body.onboarding-active::before {
  opacity: 1;
  pointer-events: auto;
}

.app {
  width: min(1180px, calc(100vw - 30px));
  margin: 16px auto 36px;
  display: grid;
  gap: 14px;
}

.title-topbar {
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.title h1 {
  margin: 0 0 8px;
  font-size: clamp(1.35rem, 2.7vw, 2rem);
  letter-spacing: 0.02em;
}

.title p {
  margin: 0;
  color: var(--muted);
}

.eyebrow {
  margin: 0;
  color: #f2bcb2;
  font-size: 0.75rem;
  letter-spacing: 0.16em;
}

.help-link {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid #3f5f8c;
  background: linear-gradient(180deg, rgba(33, 53, 83, 0.9) 0%, rgba(19, 35, 56, 0.94) 100%);
  color: #eaf2ff;
  text-decoration: none;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  transition: border-color 120ms ease, filter 120ms ease, transform 120ms ease;
}

.help-link:hover {
  border-color: #7aa2d7;
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.manual-app {
  width: min(980px, calc(100vw - 30px));
}

.manual-panel h2 {
  margin: 0 0 8px;
  font-size: 1.02rem;
  letter-spacing: 0.02em;
  color: #ffe0d7;
}

.manual-panel p {
  color: #c6d6ee;
}

.manual-list {
  margin: 0;
  padding-left: 20px;
  color: #d9e6f8;
  display: grid;
  gap: 6px;
}

.abbr-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.abbr-grid div {
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid #30486a;
  background: rgba(14, 24, 38, 0.76);
  display: grid;
  gap: 4px;
}

.abbr-grid strong {
  color: #ffd6cb;
  letter-spacing: 0.03em;
}

.abbr-grid span {
  color: #c5d6ef;
  font-size: 0.9rem;
  line-height: 1.28;
}

.manual-note {
  margin-top: 8px;
  font-size: 0.9rem;
  color: #a8bfdc;
}

.results-fab {
  position: fixed;
  right: 18px;
  top: calc(var(--fab-anchor-top) + var(--fab-pair-gap));
  z-index: 48;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid #3d567b;
  background: linear-gradient(180deg, rgba(31, 48, 74, 0.92) 0%, rgba(17, 31, 50, 0.95) 100%);
  color: #eaf2ff;
  font-family: inherit;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
  cursor: pointer;
  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: top 0ms linear, transform 180ms ease, border-color 120ms ease, filter 120ms ease;
}

.launch-fab {
  position: fixed;
  right: 18px;
  top: var(--fab-anchor-top);
  z-index: 49;
  min-width: 106px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid #6b3e35;
  background: linear-gradient(180deg, rgba(93, 44, 40, 0.94) 0%, rgba(65, 31, 34, 0.96) 100%);
  color: #ffe8e3;
  font-family: inherit;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  white-space: nowrap;
  cursor: pointer;
  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: top 0ms linear, transform 180ms ease, border-color 120ms ease, filter 120ms ease;
}

body.fab-animate-up .launch-fab,
body.fab-animate-up .results-fab {
  transition: top 260ms cubic-bezier(0.22, 0.82, 0.23, 1), transform 180ms ease, border-color 120ms ease, filter 120ms ease;
}

.bug-fab {
  position: fixed;
  top: 58px;
  right: 16px;
  z-index: 52;
  min-width: 150px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid #3d5a82;
  background: linear-gradient(180deg, rgba(26, 45, 72, 0.94) 0%, rgba(18, 33, 52, 0.96) 100%);
  color: #e9f2ff;
  font-family: inherit;
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
  cursor: pointer;
  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: transform 120ms ease, border-color 120ms ease, filter 120ms ease;
}

.help-fab {
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: 53;
  min-width: 150px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid #42648f;
  background: linear-gradient(180deg, rgba(33, 54, 86, 0.94) 0%, rgba(21, 39, 62, 0.96) 100%);
  color: #ecf4ff;
  font-family: inherit;
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: transform 120ms ease, border-color 120ms ease, filter 120ms ease;
}

.help-fab:hover {
  transform: translateY(-1px);
  border-color: #88b0e0;
  filter: brightness(1.06);
}

.help-fab:focus-visible {
  outline: 2px solid rgba(145, 187, 242, 0.72);
  outline-offset: 2px;
}

.bug-fab:hover {
  transform: translateY(-1px);
  border-color: #77a1d6;
  filter: brightness(1.06);
}

.bug-fab:focus-visible {
  outline: 2px solid rgba(145, 187, 242, 0.72);
  outline-offset: 2px;
}

.launch-fab:hover {
  border-color: #a35b51;
  filter: brightness(1.06);
}

.launch-fab:focus-visible {
  outline: 2px solid rgba(255, 155, 135, 0.72);
  outline-offset: 2px;
}

.results-fab:hover {
  border-color: #6f95c8;
  filter: brightness(1.06);
}

.results-fab.timing {
  border-color: #5878a3;
  color: #f2f8ff;
}

.results-fab.done {
  border-color: #6a8fbe;
  color: #edf6ff;
}

.results-fab:focus-visible {
  outline: 2px solid rgba(132, 170, 235, 0.72);
  outline-offset: 2px;
}


.preset-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 10px;
  z-index: 46;
  pointer-events: none;
}

body.onboarding-active .preset-dock {
  z-index: 150;
}

.preset-dock-inner {
  width: min(1180px, calc(100vw - 20px));
  margin: 0 auto;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid #35557d;
  background: linear-gradient(180deg, rgba(16, 29, 47, 0.94) 0%, rgba(10, 19, 33, 0.96) 100%);
  box-shadow:
    0 10px 22px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  pointer-events: auto;
}

.preset-dock .preset-btn {
  min-height: 40px;
  padding: 8px 7px;
  font-size: 0.72rem;
  line-height: 1.15;
}

body.onboarding-active .preset-dock-inner {
  border-color: #ff8d73;
  box-shadow:
    0 12px 26px rgba(0, 0, 0, 0.42),
    0 0 0 1px rgba(255, 140, 114, 0.48) inset,
    0 0 18px rgba(255, 109, 84, 0.34);
}

.preset-onboarding-hint {
  position: fixed;
  left: 50%;
  bottom: 66px;
  z-index: 151;
  transform: translateX(-50%);
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid #ff8d73;
  background: linear-gradient(180deg, rgba(63, 28, 26, 0.96) 0%, rgba(38, 18, 18, 0.97) 100%);
  color: #ffe7e1;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

body.onboarding-active .preset-onboarding-hint {
  opacity: 1;
}

.panel {
  background: linear-gradient(155deg, #101c2f 0%, #0a1322 100%);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 14px;
  box-shadow:
    0 10px 34px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.cluster-panel.attention-focus-launch {
  border-color: #ff8666;
  box-shadow:
    0 10px 34px rgba(0, 0, 0, 0.35),
    inset 0 0 0 1px rgba(255, 155, 131, 0.34),
    0 0 18px rgba(255, 126, 98, 0.22);
}

.cluster-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  border: 1px solid #3c5680;
  color: #dae8ff;
  background: linear-gradient(180deg, #1f3351 0%, var(--chip) 100%);
}

.chip.running {
  border-color: #79a8d8;
  background: linear-gradient(180deg, #224669 0%, #1b3653 100%);
  color: #f2f8ff;
}

.summary {
  color: #ffd8d1;
  font-size: 1rem;
}

.cluster-stage {
  --road-shift: 0px;
  --hud-scale: 1;
  margin-top: 10px;
  position: relative;
  height: 500px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid #253852;
  background:
    radial-gradient(80% 56% at 50% 48%, rgba(65, 92, 130, 0.24) 0%, rgba(9, 19, 34, 0) 62%),
    radial-gradient(115% 85% at 50% -12%, rgba(255, 255, 255, 0.09) 0%, transparent 52%),
    linear-gradient(180deg, #050a12 0%, #060c18 40%, #04080f 100%);
}

.gauge {
  position: absolute;
  top: 34px;
  width: 380px;
  height: 380px;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0.55;
}

.gauge-left {
  left: -230px;
  background:
    radial-gradient(circle at 100% 50%, transparent 57%, rgba(180, 220, 255, 0.22) 59%, rgba(180, 220, 255, 0.05) 64%, transparent 68%),
    conic-gradient(from 260deg at 100% 50%, rgba(84, 194, 255, 0.4), rgba(84, 194, 255, 0.02) 26%, transparent 70%);
}

.gauge-right {
  right: -230px;
  background:
    radial-gradient(circle at 0 50%, transparent 57%, rgba(180, 220, 255, 0.22) 59%, rgba(180, 220, 255, 0.05) 64%, transparent 68%),
    conic-gradient(from -80deg at 0 50%, rgba(84, 194, 255, 0.4), rgba(84, 194, 255, 0.02) 26%, transparent 70%);
}

.road-grid {
  position: absolute;
  left: 50%;
  bottom: -60px;
  transform: translateX(-50%);
  width: min(840px, 92%);
  height: 360px;
  border-radius: 50% 50% 0 0;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(90, 126, 175, 0.22) 0,
      rgba(90, 126, 175, 0.22) 2px,
      transparent 2px,
      transparent 18px
    ),
    repeating-linear-gradient(
      90deg,
      rgba(70, 92, 126, 0.22) 0,
      rgba(70, 92, 126, 0.22) 1px,
      transparent 1px,
      transparent 26px
    );
  background-position:
    center calc(var(--road-shift) * -1),
    center calc(var(--road-shift) * -0.38);
  opacity: 0.48;
}

.cluster-gear {
  position: absolute;
  right: 88px;
  bottom: 54px;
  z-index: 4;
  min-width: 68px;
  text-align: center;
  color: #f1f5ff;
  font-size: 2.05rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-shadow:
    0 0 10px rgba(227, 236, 255, 0.25),
    0 0 24px rgba(132, 170, 235, 0.2);
}

.cluster-rpm {
  position: absolute;
  left: 50%;
  top: 20px;
  z-index: 5;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 5px 14px 6px;
  border-radius: 999px;
  border: 1px solid rgba(117, 150, 195, 0.45);
  background: linear-gradient(180deg, rgba(27, 41, 64, 0.72) 0%, rgba(14, 23, 37, 0.52) 100%);
  color: #f4f8ff;
  text-shadow: 0 0 8px rgba(206, 224, 255, 0.25);
}

.cluster-rpm-label {
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  color: #adc4e7;
}

.cluster-rpm-value {
  min-width: 58px;
  text-align: right;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #ffffff;
}

.cluster-rpm-unit {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: #cfdcf0;
}

.cluster-emc {
  position: absolute;
  left: 50%;
  top: 60px;
  z-index: 5;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  padding: 4px 12px 5px;
  border-radius: 999px;
  border: 1px solid rgba(109, 141, 184, 0.45);
  background: linear-gradient(180deg, rgba(23, 37, 58, 0.68) 0%, rgba(11, 19, 31, 0.5) 100%);
  color: #eff6ff;
  text-shadow: 0 0 8px rgba(206, 224, 255, 0.2);
}

.cluster-emc-label {
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  color: #9db8de;
}

.cluster-emc-value {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #ffffff;
}

.cluster-emc-duty {
  font-size: 0.64rem;
  letter-spacing: 0.08em;
  color: #d9e7fb;
}

.torque-hud {
  position: absolute;
  left: 50%;
  top: 54%;
  transform: translate(-50%, -50%) scale(var(--hud-scale));
  transform-origin: 50% 50%;
  width: 640px;
  height: 380px;
}

.torque-stack {
  position: absolute;
  width: 86px;
  height: 168px;
  display: flex;
  flex-direction: column-reverse;
  gap: 6px;
  padding: 4px;
  border-radius: 10px;
  background: rgba(11, 18, 28, 0.58);
  border: 1px solid rgba(92, 110, 140, 0.35);
  transition: border-color 120ms ease;
}

.torque-stack.fl {
  left: 20px;
  top: 18px;
}

.torque-stack.fr {
  right: 20px;
  top: 18px;
}

.torque-stack.rl {
  left: 20px;
  bottom: 18px;
}

.torque-stack.rr {
  right: 20px;
  bottom: 18px;
}

.seg {
  height: 15px;
  border-radius: 4px;
  border: 1px solid #5b687d;
  background: linear-gradient(180deg, var(--segment-off-0) 0%, var(--segment-off-1) 100%);
  opacity: 0.88;
  transform-origin: 50% 50%;
  transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease, opacity 90ms linear, transform 90ms linear;
}

.seg.active {
  border-color: #ff8f7c;
  background: linear-gradient(180deg, var(--segment-on-0) 0%, var(--segment-on-1) 100%);
  box-shadow:
    0 0 8px rgba(255, 102, 83, 0.58),
    inset 0 0 10px rgba(255, 206, 194, 0.28);
}

.torque-stack.slipping {
  border-color: rgba(255, 186, 102, 0.95);
}

.torque-stack.slipping .seg.active {
  animation: stackPulse 140ms linear infinite alternate;
}

@keyframes stackPulse {
  from {
    filter: saturate(1);
  }

  to {
    filter: saturate(1.38) brightness(1.15);
  }
}

.wheel-tag {
  position: absolute;
  color: #c9d9f3;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
}

.abbr {
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.metric-tag.abbr,
.wheel-tag.abbr,
.assist.abbr {
  text-decoration: underline dotted rgba(250, 191, 174, 0.5);
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}

.abbr-active {
  filter: brightness(1.14);
}

.tag-fl {
  left: 58px;
  top: 8px;
}

.tag-fr {
  right: 56px;
  top: 8px;
}

.tag-rl {
  left: 58px;
  bottom: 8px;
}

.tag-rr {
  right: 56px;
  bottom: 8px;
}

.assist-cell {
  position: absolute;
  display: flex;
  gap: 4px;
  pointer-events: auto;
}

.assist-fl {
  left: 118px;
  top: 10px;
}

.assist-fr {
  right: 118px;
  top: 10px;
}

.assist-rl {
  left: 118px;
  bottom: 10px;
}

.assist-rr {
  right: 118px;
  bottom: 10px;
}

.assist {
  min-width: 30px;
  padding: 1px 4px;
  border-radius: 6px;
  border: 1px solid #5d6b80;
  background: rgba(28, 35, 48, 0.74);
  color: #8595ae;
  font-size: 0.56rem;
  letter-spacing: 0.06em;
  text-align: center;
  opacity: 0.33;
}

.abbr-popover {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 120;
  width: min(260px, calc(100vw - 18px));
  padding: 8px 10px 9px;
  border-radius: 11px;
  border: 1px solid #43608a;
  background: linear-gradient(180deg, rgba(19, 31, 49, 0.97) 0%, rgba(10, 17, 29, 0.97) 100%);
  box-shadow:
    0 8px 18px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  color: #ebf2ff;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -6px) scale(0.985);
  transition: opacity 130ms ease, transform 130ms ease;
}

.abbr-popover.open {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.abbr-popover::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 10px;
  height: 10px;
  border-right: 1px solid #43608a;
  border-bottom: 1px solid #43608a;
  background: #0e1828;
  transform: translateX(-50%) rotate(45deg);
}

.abbr-popover.below::after {
  top: -6px;
  bottom: auto;
  border-right: none;
  border-bottom: none;
  border-left: 1px solid #43608a;
  border-top: 1px solid #43608a;
}

.abbr-popover-title {
  margin: 0 0 3px;
  color: #ffd4c8;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 0.73rem;
  text-transform: uppercase;
}

.abbr-popover-body {
  margin: 0;
  color: #d6e5fa;
  line-height: 1.28;
  font-size: 0.72rem;
}

.stack-comment-popover {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 121;
  width: min(300px, calc(100vw - 18px));
  padding: 9px 11px 10px;
  border-radius: 11px;
  border: 1px solid #7a4c43;
  background: linear-gradient(180deg, rgba(43, 24, 24, 0.97) 0%, rgba(20, 12, 16, 0.97) 100%);
  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color: #ffeceb;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -6px) scale(0.986);
  transition: opacity 130ms ease, transform 130ms ease;
}

.stack-comment-popover.open {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.stack-comment-popover::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 10px;
  height: 10px;
  border-right: 1px solid #7a4c43;
  border-bottom: 1px solid #7a4c43;
  background: #2c171b;
  transform: translateX(-50%) rotate(45deg);
}

.stack-comment-popover.below::after {
  top: -6px;
  bottom: auto;
  border-right: none;
  border-bottom: none;
  border-left: 1px solid #7a4c43;
  border-top: 1px solid #7a4c43;
}

.stack-comment-title {
  margin: 0 0 4px;
  color: #ffd3c9;
  font-weight: 700;
  letter-spacing: 0.03em;
  font-size: 0.74rem;
  text-transform: uppercase;
}

.stack-comment-body {
  margin: 0;
  color: #ffe7e0;
  line-height: 1.35;
  font-size: 0.72rem;
}

.torque-stack.comment-active {
  border-color: rgba(255, 158, 134, 0.68);
  box-shadow: 0 0 10px rgba(255, 106, 79, 0.28);
}

.assist.on {
  opacity: 1;
  animation: assistBlink 170ms linear infinite alternate;
}

.assist.abs.on {
  border-color: #ffd87c;
  color: #fff1c8;
  background: rgba(160, 120, 34, 0.48);
}

.assist.esp.on {
  border-color: #ffbb75;
  color: #ffe5c9;
  background: rgba(154, 84, 33, 0.48);
}

.assist.tcs.on {
  border-color: #ff7f6e;
  color: #ffe1dc;
  background: rgba(166, 53, 44, 0.5);
}

.assist.elsd.on {
  border-color: #ff95dd;
  color: #ffe3fb;
  background: rgba(128, 44, 111, 0.48);
}

@keyframes assistBlink {
  from {
    filter: brightness(0.78);
  }

  to {
    filter: brightness(1.22);
  }
}

.car-top {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 176px;
  height: 304px;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.35));
  transition: transform 80ms ease;
}

.car-shell {
  position: absolute;
  inset: 6px 20px;
  border-radius: 36px 36px 34px 34px;
  border: 1px solid rgba(205, 224, 240, 0.6);
  background:
    radial-gradient(85% 40% at 50% 8%, rgba(240, 249, 255, 0.46) 0%, rgba(240, 249, 255, 0) 72%),
    linear-gradient(180deg, rgba(205, 219, 230, 0.65) 0%, rgba(170, 186, 202, 0.38) 31%, rgba(117, 132, 149, 0.38) 65%, rgba(48, 57, 72, 0.68) 100%);
  box-shadow:
    inset 0 -1px 8px rgba(18, 26, 40, 0.55),
    inset 0 1px 6px rgba(255, 255, 255, 0.26),
    0 8px 14px rgba(0, 0, 0, 0.26);
  overflow: hidden;
}

.car-shell::before {
  content: "";
  position: absolute;
  left: 11px;
  right: 11px;
  top: 14px;
  height: 52px;
  border-radius: 20px 20px 16px 16px;
  border: 1px solid rgba(223, 239, 255, 0.36);
  background: linear-gradient(180deg, rgba(220, 233, 246, 0.16) 0%, rgba(111, 129, 148, 0.08) 100%);
}

.car-shell::after {
  content: "";
  position: absolute;
  left: 9px;
  right: 9px;
  bottom: 9px;
  height: 48px;
  border-radius: 12px 12px 22px 22px;
  border: 1px solid rgba(218, 231, 246, 0.3);
  background: linear-gradient(180deg, rgba(186, 201, 219, 0.16) 0%, rgba(76, 90, 106, 0.2) 100%);
}

.car-highlight {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 50%;
  pointer-events: none;
}

.car-highlight-a {
  top: 12px;
  width: 76px;
  height: 126px;
  background: radial-gradient(circle at 50% 20%, rgba(245, 252, 255, 0.55) 0%, rgba(245, 252, 255, 0) 75%);
}

.car-highlight-b {
  bottom: 24px;
  width: 62px;
  height: 86px;
  background: radial-gradient(circle at 50% 36%, rgba(230, 240, 253, 0.26) 0%, rgba(230, 240, 253, 0) 76%);
}

.car-window-pack {
  position: absolute;
  left: 50%;
  top: 32px;
  transform: translateX(-50%);
  width: 102px;
  height: 188px;
  border-radius: 24px;
  border: 1px solid rgba(219, 233, 248, 0.6);
  background:
    linear-gradient(180deg, rgba(224, 241, 255, 0.62) 0%, rgba(190, 210, 232, 0.35) 38%, rgba(104, 122, 142, 0.3) 100%);
  box-shadow:
    inset 0 1px 4px rgba(255, 255, 255, 0.32),
    inset 0 -1px 5px rgba(9, 15, 24, 0.3);
  overflow: hidden;
}

.car-windshield,
.car-roof,
.car-rear-glass {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 82%;
  border: 1px solid rgba(222, 238, 255, 0.42);
  background: linear-gradient(180deg, rgba(238, 248, 255, 0.45) 0%, rgba(116, 134, 153, 0.16) 100%);
}

.car-windshield {
  top: 8px;
  height: 46px;
  border-radius: 13px 13px 9px 9px;
}

.car-roof {
  top: 58px;
  height: 58px;
  border-radius: 8px;
}

.car-rear-glass {
  top: 121px;
  height: 50px;
  border-radius: 9px 9px 12px 12px;
}

.car-spine {
  position: absolute;
  left: 50%;
  top: 8px;
  transform: translateX(-50%);
  width: 2px;
  height: calc(100% - 16px);
  background: linear-gradient(180deg, rgba(232, 246, 255, 0.65) 0%, rgba(232, 246, 255, 0.08) 100%);
}

.car-hood-detail,
.car-tail-detail {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 74%;
  border: 1px solid rgba(222, 236, 249, 0.34);
  background: linear-gradient(180deg, rgba(214, 227, 240, 0.11) 0%, rgba(88, 106, 125, 0.07) 100%);
}

.car-hood-detail {
  top: 84px;
  height: 36px;
  border-radius: 13px;
}

.car-tail-detail {
  bottom: 48px;
  height: 34px;
  border-radius: 11px 11px 15px 15px;
}

.car-headlamps,
.car-taillamps {
  position: absolute;
  left: 50%;
  width: 90%;
  transform: translateX(-50%);
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.car-headlamps {
  top: 15px;
}

.car-taillamps {
  bottom: 14px;
}

.car-headlamps::before,
.car-headlamps::after,
.car-taillamps::before,
.car-taillamps::after {
  content: "";
  width: 13px;
  height: 6px;
  border-radius: 5px;
}

.car-headlamps::before,
.car-headlamps::after {
  background: linear-gradient(180deg, rgba(255, 247, 210, 0.85) 0%, rgba(255, 213, 128, 0.58) 100%);
  box-shadow: 0 0 6px rgba(255, 229, 163, 0.38);
}

.car-taillamps::before,
.car-taillamps::after {
  background: linear-gradient(180deg, rgba(255, 123, 104, 0.86) 0%, rgba(192, 36, 34, 0.76) 100%);
  box-shadow: 0 0 8px rgba(255, 84, 63, 0.54);
}

.car-arch {
  position: absolute;
  width: 27px;
  height: 68px;
  border-radius: 15px;
  border: 1px solid rgba(219, 235, 255, 0.58);
  background:
    radial-gradient(80% 46% at 50% 20%, rgba(232, 244, 255, 0.6) 0%, rgba(232, 244, 255, 0) 70%),
    linear-gradient(180deg, rgba(180, 200, 223, 0.78) 0%, rgba(114, 133, 158, 0.48) 66%, rgba(66, 79, 96, 0.6) 100%);
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.32),
    inset 0 -1px 3px rgba(18, 24, 35, 0.5),
    0 0 10px rgba(170, 204, 255, 0.14);
}

.arch-fl {
  left: 0;
  top: 67px;
}

.arch-fr {
  right: 0;
  top: 67px;
}

.arch-rl {
  left: 0;
  bottom: 67px;
}

.arch-rr {
  right: 0;
  bottom: 67px;
}

.wheel-readout {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  scroll-margin-bottom: 110px;
}

.wheel-readout.attention-focus {
  border: 1px solid rgba(255, 128, 102, 0.9);
  border-radius: 12px;
  padding: 8px;
  background: linear-gradient(180deg, rgba(35, 23, 23, 0.3) 0%, rgba(17, 23, 36, 0.06) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 163, 138, 0.25),
    0 0 16px rgba(255, 119, 92, 0.24);
}

.wheel-readout .wheel-card {
  padding: 8px;
  border-radius: 10px;
  border: 1px solid #304665;
  background: rgba(17, 28, 43, 0.82);
  font-size: 0.88rem;
}

.wheel-head {
  margin-bottom: 4px;
  color: #ffd1c6;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.wheel-line {
  display: grid;
  grid-template-columns: 24px minmax(74px, 1fr) 24px minmax(64px, 1fr);
  align-items: baseline;
  column-gap: 6px;
  color: #d9e6f8;
}

.wheel-line + .wheel-line {
  margin-top: 2px;
}

.wheel-bars {
  margin-top: 6px;
  display: grid;
  gap: 4px;
}

.bar-track {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(53, 73, 98, 0.78);
  overflow: hidden;
}

.bar {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 999px;
  transition: width 90ms linear;
}

.bar.in {
  background: linear-gradient(90deg, #ffae85 0%, #ff7d52 100%);
}

.bar.out {
  background: linear-gradient(90deg, #ffd18f 0%, #ff6c3f 100%);
}

.wheel-meta {
  margin-top: 6px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 34px minmax(0, 1fr);
  align-items: baseline;
  column-gap: 6px;
}

.metric-tag {
  color: #f3b6a8;
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.metric-value {
  color: #f7c9bf;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.wheel-line .metric-value {
  font-size: 0.78rem;
}

.wheel-meta .metric-value {
  font-size: 0.76rem;
}

@keyframes slipPulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.76;
    text-shadow: 0 0 0 rgba(255, 107, 73, 0);
  }
  22% {
    transform: scale(1.09);
    opacity: 1;
    text-shadow: 0 0 14px rgba(255, 92, 55, 0.82);
  }
  42% {
    transform: scale(1.03);
    opacity: 0.62;
    text-shadow: 0 0 2px rgba(255, 92, 55, 0.25);
  }
  64% {
    transform: scale(1.08);
    opacity: 1;
    text-shadow: 0 0 12px rgba(255, 116, 86, 0.72);
  }
}

.wheel-meta .metric-tag.slip-pulse,
.wheel-meta .metric-value.slip-pulse {
  color: #ffc4b4;
  animation: slipPulse 0.9s cubic-bezier(0.34, 0.03, 0.35, 1) infinite;
  transform-origin: 50% 60%;
  will-change: transform, opacity, text-shadow;
}

@media (prefers-reduced-motion: reduce) {
  .wheel-meta .metric-tag.slip-pulse,
  .wheel-meta .metric-value.slip-pulse {
    animation: none;
    text-shadow: 0 0 6px rgba(255, 107, 73, 0.45);
  }
}

.section-title {
  margin-bottom: 8px;
  color: #f8c6bc;
  letter-spacing: 0.04em;
  font-size: 0.84rem;
  text-transform: uppercase;
}

.controls-panel .section-title {
  margin-top: 14px;
  margin-bottom: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #35537b;
  background: linear-gradient(180deg, rgba(29, 45, 70, 0.82) 0%, rgba(20, 33, 52, 0.68) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 4px 12px rgba(0, 0, 0, 0.18);
}

.controls-panel .section-title:first-of-type {
  margin-top: 0;
}

.controls-panel .mode-grid,
.controls-panel .tire-grid,
.controls-panel .wheel-grid,
.controls-panel .suspension-grid,
.controls-panel .sim-controls,
.controls-panel .slider-grid,
.controls-panel .load-grid,
.controls-panel .grip-grid,
.controls-panel .pressure-grid,
.controls-panel .wear-grid,
.controls-panel .preset-grid {
  padding: 10px;
  border: 1px solid #304c71;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(17, 30, 47, 0.84) 0%, rgba(13, 23, 38, 0.8) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 5px 14px rgba(0, 0, 0, 0.2);
}

.mode-grid,
.preset-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.suspension-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 4px;
}

.wheel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 4px;
}

.tire-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 4px;
}

button {
  cursor: pointer;
  font-family: inherit;
}

.mode-btn,
.preset-btn,
.lock-btn,
.esc-btn,
.sim-btn,
.tire-btn,
.susp-btn,
.wheel-btn {
  border: 1px solid #3c5478;
  background: linear-gradient(180deg, #1f2d44 0%, #17253b 100%);
  color: #dbe8ff;
  border-radius: 10px;
  padding: 10px 8px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.mode-btn.terrain {
  border-color: #5a4b77;
}

.mode-btn.active {
  border-color: #ff856f;
  color: #ffe8e3;
  background: linear-gradient(180deg, #5d2c28 0%, #411f22 100%);
  box-shadow: 0 0 0 1px rgba(255, 110, 89, 0.35) inset;
}

.tire-btn.active {
  border-color: #ff856f;
  color: #ffe8e3;
  background: linear-gradient(180deg, #5d2c28 0%, #411f22 100%);
  box-shadow: 0 0 0 1px rgba(255, 110, 89, 0.35) inset;
}

.susp-btn.active {
  border-color: #ff856f;
  color: #ffe8e3;
  background: linear-gradient(180deg, #5d2c28 0%, #411f22 100%);
  box-shadow: 0 0 0 1px rgba(255, 110, 89, 0.35) inset;
}

.wheel-btn.active {
  border-color: #ff856f;
  color: #ffe8e3;
  background: linear-gradient(180deg, #5d2c28 0%, #411f22 100%);
  box-shadow: 0 0 0 1px rgba(255, 110, 89, 0.35) inset;
}

.console {
  margin-top: 12px;
  padding: 10px;
  border: 1px solid #324a6a;
  border-radius: 12px;
  background: rgba(17, 29, 45, 0.76);
}

.console-title {
  font-size: 0.78rem;
  color: #9cb5d8;
  margin-bottom: 8px;
}

.lock-btn {
  width: 100%;
  border-color: #8d5b50;
}

.esc-btn {
  width: 100%;
  margin-top: 8px;
  border-color: #806a4d;
}

.lock-btn.locked {
  border-color: #ff7d68;
  color: #fff2ee;
  background: linear-gradient(180deg, #6a2b25 0%, #522a24 100%);
  box-shadow: 0 0 0 1px rgba(255, 106, 86, 0.5) inset;
}

.esc-btn.level-1 {
  border-color: #ffd37a;
  color: #fff4dc;
  background: linear-gradient(180deg, #5e4927 0%, #4a3a21 100%);
}

.esc-btn.level-2 {
  border-color: #ff7d68;
  color: #fff1ed;
  background: linear-gradient(180deg, #6a2b25 0%, #4f2320 100%);
  box-shadow: 0 0 0 1px rgba(255, 112, 92, 0.42) inset;
}

.chip.warn {
  border-color: #8f7a56;
  color: #ffefcf;
  background: linear-gradient(180deg, #4f4129 0%, #3c3324 100%);
}

.chip.off {
  border-color: #a8574b;
  color: #ffe2dc;
  background: linear-gradient(180deg, #5f2d29 0%, #482624 100%);
}

.lock-note {
  margin: 8px 0 0;
  font-size: 0.88rem;
  color: #acbfdc;
}

.controls-panel .lock-note {
  margin: 8px 0 12px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(70, 95, 130, 0.6);
  background: rgba(14, 24, 38, 0.72);
}

.sim-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.sim-btn.active {
  border-color: #79a8d8;
  color: #f3f9ff;
  background: linear-gradient(180deg, #214467 0%, #1a3552 100%);
}

.sim-btn.launch {
  border-color: #ad704e;
  background: linear-gradient(180deg, #4e2f1f 0%, #3b2618 100%);
}

.slider-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.slider-grid label,
.grip-grid label,
.load-grid label,
.pressure-grid label,
.wear-grid label {
  display: grid;
  gap: 6px;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid #2f4667;
  background: rgba(18, 31, 49, 0.66);
  font-size: 0.92rem;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--danger);
}

.grip-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.pressure-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.wear-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.load-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.preset-grid {
  margin-top: 6px;
}

.diag-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.diag-grid div {
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #2f4667;
  background: rgba(16, 28, 43, 0.72);
  font-size: 0.9rem;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.diag-grid div.session-active {
  border-color: #ff7f5f;
  background: rgba(52, 29, 22, 0.78);
  box-shadow: inset 0 0 0 1px rgba(255, 168, 132, 0.28), 0 0 12px rgba(255, 124, 84, 0.22);
}

.diagnostics.attention-focus {
  border-color: #ff835f;
  box-shadow:
    0 10px 34px rgba(0, 0, 0, 0.35),
    inset 0 0 0 1px rgba(255, 156, 131, 0.34),
    0 0 18px rgba(255, 121, 93, 0.26);
}

.diag-grid div.attention-pulse {
  animation: diagPulse 700ms ease-in-out infinite alternate;
}

@keyframes diagPulse {
  from {
    box-shadow: inset 0 0 0 1px rgba(255, 162, 138, 0.26), 0 0 8px rgba(255, 118, 91, 0.2);
    filter: brightness(1);
  }

  to {
    box-shadow: inset 0 0 0 1px rgba(255, 182, 162, 0.36), 0 0 15px rgba(255, 124, 92, 0.34);
    filter: brightness(1.08);
  }
}

@media (max-width: 1040px) {
  .diag-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wheel-readout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 780px) {
  .cluster-stage {
    --hud-scale: 0.8;
    height: 420px;
  }

  .cluster-gear {
    right: 52px;
    bottom: 42px;
    min-width: 56px;
    font-size: 1.72rem;
  }

  .cluster-rpm {
    top: 16px;
    padding: 4px 11px 5px;
    gap: 6px;
  }

  .cluster-rpm-value {
    min-width: 50px;
    font-size: 1.02rem;
  }

  .cluster-emc {
    top: 52px;
    padding: 4px 10px 5px;
    gap: 6px;
  }

  .cluster-emc-value {
    font-size: 0.68rem;
  }

}

@media (max-width: 640px) {
  .app {
    width: min(1180px, calc(100vw - 16px));
  }

  .panel {
    padding: 10px;
  }

  .title-topbar {
    flex-wrap: wrap;
    gap: 8px;
  }

  .help-link {
    padding: 5px 10px;
    font-size: 0.72rem;
  }

  .abbr-grid {
    grid-template-columns: 1fr;
  }

  .results-fab {
    right: 12px;
    padding: 9px 12px;
    font-size: 0.74rem;
  }

  .launch-fab {
    right: 12px;
    min-width: 94px;
    padding: 8px 11px;
    font-size: 0.72rem;
  }

  .bug-fab {
    top: 48px;
    right: 10px;
    min-width: 136px;
    padding: 8px 11px;
    font-size: 0.68rem;
  }

  .help-fab {
    top: 10px;
    right: 10px;
    min-width: 136px;
    padding: 8px 11px;
    font-size: 0.68rem;
  }


  .preset-dock {
    bottom: 8px;
  }

  .preset-dock-inner {
    width: calc(100vw - 12px);
    padding: 7px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    border-radius: 12px;
  }

  .preset-dock .preset-btn {
    min-height: 36px;
    padding: 7px 6px;
    font-size: 0.66rem;
    letter-spacing: 0.02em;
  }

  .preset-onboarding-hint {
    bottom: 90px;
    font-size: 0.68rem;
    padding: 7px 10px;
  }

  .wheel-readout .wheel-card {
    padding: 7px;
  }

  .wheel-line {
    grid-template-columns: 20px minmax(60px, 1fr) 20px minmax(52px, 1fr);
    column-gap: 5px;
  }

  .wheel-line .metric-value {
    font-size: 0.74rem;
  }

  .wheel-line-spin {
    grid-template-columns: 18px minmax(56px, 1fr) 18px minmax(50px, 1fr);
  }

  .wheel-line-spin .metric-value {
    font-size: 0.7rem;
    letter-spacing: -0.01em;
  }

  .wheel-meta {
    grid-template-columns: 20px minmax(0, 1fr) 30px minmax(0, 1fr);
    column-gap: 5px;
  }

  .wheel-meta .metric-value {
    font-size: 0.72rem;
  }

  .metric-tag {
    font-size: 0.64rem;
  }

  .abbr-popover {
    width: min(236px, calc(100vw - 14px));
    padding: 7px 9px 8px;
  }

  .abbr-popover-title {
    font-size: 0.68rem;
  }

  .abbr-popover-body {
    font-size: 0.68rem;
    line-height: 1.24;
  }

  .mode-grid,
  .tire-grid,
  .wheel-grid,
  .suspension-grid,
  .preset-grid,
  .sim-controls,
  .slider-grid,
  .load-grid,
  .grip-grid,
  .pressure-grid,
  .wear-grid,
  .wheel-readout,
  .diag-grid {
    grid-template-columns: 1fr;
  }

  .cluster-stage {
    --hud-scale: 0.66;
    height: 380px;
  }

  .cluster-gear {
    right: 36px;
    bottom: 34px;
    min-width: 48px;
    font-size: 1.48rem;
  }

  .cluster-rpm {
    top: 14px;
  }

  .cluster-emc {
    top: 48px;
    padding: 3px 9px 4px;
    gap: 5px;
  }

  .cluster-rpm-label,
  .cluster-rpm-unit,
  .cluster-emc-label,
  .cluster-emc-duty {
    font-size: 0.62rem;
  }

  .cluster-rpm-value {
    min-width: 44px;
    font-size: 0.92rem;
  }

  .cluster-emc-value {
    font-size: 0.64rem;
  }

  .assist {
    min-width: 24px;
    padding: 1px 3px;
    font-size: 0.48rem;
  }
}

@media (max-width: 460px) {
  .wheel-line-spin {
    grid-template-columns: 16px minmax(52px, 1fr) 16px minmax(46px, 1fr);
    column-gap: 4px;
  }

  .wheel-line-spin .metric-value {
    font-size: 0.66rem;
  }

  .abbr-popover {
    width: min(220px, calc(100vw - 12px));
  }

  .cluster-stage {
    --hud-scale: 0.58;
    height: 346px;
  }

  .cluster-gear {
    right: 26px;
    bottom: 28px;
    min-width: 44px;
    font-size: 1.3rem;
  }

  .summary {
    font-size: 0.9rem;
  }
}

@media (max-width: 390px) {
  .cluster-stage {
    --hud-scale: 0.53;
    height: 322px;
  }
}
