[hidden] {
  display: none !important;
}

:root {
  --ink: #cfd8e3;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  background: radial-gradient(circle at 50% 36%, #4a5361 0%, #343c48 42%, #252b35 100%);
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.hud {
  padding: 14px 18px 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.hud-speed-main {
  display: grid;
  line-height: 0.92;
}

.hud-speed-value {
  font-size: clamp(2.7rem, 7vw, 4rem);
  font-weight: 500;
  letter-spacing: -0.02em;
}

.hud-speed-unit {
  margin-top: 4px;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.hud-speed-meta {
  display: grid;
  justify-items: end;
  line-height: 1;
  margin-top: 6px;
}

.hud-speed-max-value {
  font-size: 1.9rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.hud-speed-max-label {
  margin-top: 2px;
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}

body[data-sky-mode="day"] .hud {
  color: #121a24;
  text-shadow: none;
}

body:not([data-sky-mode="day"]) .hud {
  color: #e9f0fa;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.space {
  width: min(1220px, 100%);
  margin: 0 auto;
  display: grid;
  place-items: center;
  padding: 0 10px;
}

.tesla {
  position: relative;
  width: min(1100px, 100%);
}

.car-viewer {
  width: 100%;
  aspect-ratio: 16 / 9;
  position: relative;
}

#carCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.viewer-msg {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-weight: 700;
  color: #d3d9e2;
}

.controls {
  padding: 18px;
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.chunk-btn {
  border: 0;
  border-radius: 14px;
  padding: 16px 24px;
  font-weight: 900;
  font-size: 1.08rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(180deg, #ff7a34, #ce3a0a);
  box-shadow: 0 6px 0 #8f2400, 0 10px 14px #7e2e1763, inset 0 2px 4px #ffffff70;
  transform: translateY(0);
  transition: transform 80ms ease, box-shadow 80ms ease;
}

.chunk-btn:active,
.chunk-btn.active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #8f2400, 0 6px 10px #7e2e1757, inset 0 2px 4px #ffffff70;
}

.settings-shell {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 12;
  display: grid;
  justify-items: end;
  gap: 10px;
}

.settings-toggle {
  border: 1px solid #9fb0c0;
  background: linear-gradient(180deg, #e8edf3, #c7d1dd);
  color: #1d2632;
  border-radius: 11px;
  padding: 10px 15px;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.settings-panel {
  width: min(340px, calc(100vw - 24px));
  background: rgba(17, 23, 31, 0.94);
  border: 1px solid #4b5a6d;
  border-radius: 14px;
  padding: 12px;
  display: grid;
  gap: 12px;
  color: #e6edf6;
  backdrop-filter: blur(3px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.3);
}

.settings-section {
  display: grid;
  gap: 8px;
}

.settings-label,
.settings-section label {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #c8d5e5;
}

.settings-panel select {
  width: 100%;
  border: 1px solid #7f8fa2;
  border-radius: 8px;
  background: #dbe4ee;
  color: #1a2330;
  font: inherit;
  font-weight: 700;
  padding: 7px 9px;
}

.model-quick-pick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.model-quick-btn {
  border: 1px solid #7f8fa2;
  border-radius: 7px;
  background: #ccd5df;
  color: #253242;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 6px 9px;
  cursor: pointer;
}

.model-quick-btn.active {
  background: #39495e;
  border-color: #93a6bc;
  color: #f1f6ff;
}

.color-swatch-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.color-swatch {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.55);
  box-shadow: inset 0 2px 5px rgba(255, 255, 255, 0.3), 0 2px 5px rgba(0, 0, 0, 0.3);
  cursor: pointer;
}

.color-swatch.active {
  border-color: #f9fcff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2), inset 0 2px 5px rgba(255, 255, 255, 0.3), 0 2px 7px rgba(0, 0, 0, 0.35);
}

.color-caption {
  display: grid;
  gap: 3px;
  text-align: center;
}

.color-included {
  font-size: 0.78rem;
  color: #d8e5f4;
}

.color-name {
  font-size: 1.04rem;
  font-weight: 800;
  color: #ffffff;
}

.unit-toggle {
  display: inline-flex;
  border: 1px solid #7f8fa2;
  border-radius: 8px;
  overflow: hidden;
  width: fit-content;
}

.unit-btn {
  border: 0;
  background: #ccd5df;
  color: #253242;
  font: inherit;
  font-weight: 800;
  padding: 8px 14px;
  cursor: pointer;
}

.unit-btn + .unit-btn {
  border-left: 1px solid #8e9eaf;
}

.unit-btn.active {
  background: #39495e;
  color: #f1f6ff;
}

.unit-btn:disabled {
  opacity: 0.48;
  cursor: default;
}

.settings-check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  font-weight: 700;
  color: #d9e3f0;
}

.settings-check-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #7fa4ce;
}

.settings-support {
  border-top: 1px solid rgba(156, 178, 201, 0.35);
  padding-top: 10px;
}

.support-toggle {
  border: 1px solid #90a6bf;
  border-radius: 8px;
  background: #e4ecf7;
  color: #1c2b3c;
  font: inherit;
  font-weight: 700;
  font-size: 0.84rem;
  text-align: left;
  padding: 8px 10px;
  cursor: pointer;
}

.support-popup {
  position: fixed;
  right: 16px;
  bottom: 86px;
  z-index: 13;
  width: min(270px, calc(100vw - 24px));
  border-radius: 12px;
  border: 1px solid #556273;
  background: rgba(14, 20, 27, 0.95);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.34);
  padding: 10px 10px 12px;
  color: #e9f1fc;
  display: grid;
  gap: 8px;
}

.support-close {
  justify-self: end;
  border: 1px solid #8ea0b5;
  background: #dce5ef;
  color: #1f2f41;
  border-radius: 7px;
  width: 24px;
  height: 24px;
  line-height: 1;
  padding: 0;
  font-weight: 800;
  cursor: pointer;
}

.support-copy {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.34;
}

.support-qr {
  width: 140px;
  height: 140px;
  justify-self: center;
  border-radius: 8px;
  background: #fff;
  padding: 5px;
}

@media (max-width: 760px) {
  .settings-shell {
    right: 10px;
    bottom: 10px;
  }

  .settings-panel {
    width: min(320px, calc(100vw - 16px));
  }

  .support-popup {
    right: 10px;
    bottom: 78px;
    width: min(250px, calc(100vw - 16px));
  }
}

