:root {
  color-scheme: dark;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-size: 15px;
  background: #101114;
  color: #f2f3f0;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background: #101114;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.imu-tooltip {
  position: fixed;
  z-index: 4;
  min-width: 168px;
  max-width: min(240px, calc(100vw - 24px));
  padding: 9px 10px;
  border: 1px solid rgba(91, 230, 181, 0.42);
  border-radius: 6px;
  background: rgba(12, 14, 16, 0.92);
  color: #f2f3f0;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.42);
  pointer-events: none;
  font-size: 0.82rem;
  line-height: 1.35;
}

.imu-tooltip[hidden] {
  display: none;
}

.imu-tooltip strong {
  display: block;
  margin-bottom: 4px;
  color: #83f0c8;
  font-weight: 650;
}

.imu-tooltip span {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}

.imu-tooltip b {
  color: #a9afa8;
  font-weight: 500;
}

.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  background: rgba(8, 10, 12, 0.62);
  border: 2px dashed rgba(91, 230, 181, 0.72);
  pointer-events: none;
}

.drop-overlay[hidden] {
  display: none;
}

.drop-overlay div {
  padding: 18px 24px;
  border: 1px solid rgba(91, 230, 181, 0.46);
  border-radius: 8px;
  background: rgba(18, 19, 22, 0.9);
  color: #83f0c8;
  font-size: 1.05rem;
  font-weight: 650;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
}

.empty-state {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.empty-state[hidden] {
  display: none;
}

.empty-state div {
  max-width: min(520px, calc(100vw - 48px));
  padding: 18px 24px;
  border: 1px solid rgba(91, 230, 181, 0.32);
  border-radius: 8px;
  background: rgba(18, 19, 22, 0.72);
  color: #f2f3f0;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
  font-size: 1.05rem;
  font-weight: 650;
  text-align: center;
  backdrop-filter: blur(16px);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 7;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(8, 10, 12, 0.68);
}

.modal-overlay[hidden] {
  display: none;
}

.modal {
  width: min(440px, 100%);
  padding: 14px;
  border: 1px solid rgba(244, 211, 94, 0.42);
  border-radius: 8px;
  background: rgba(18, 19, 22, 0.96);
  color: #f2f3f0;
  box-shadow: 0 20px 58px rgba(0, 0, 0, 0.48);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.modal h2 {
  margin: 0;
  color: #f4d35e;
  font-size: 1rem;
  font-weight: 700;
}

.modal p {
  margin: 0;
  color: #d9ddd7;
  font-size: 0.9rem;
  line-height: 1.42;
}

.modal-close {
  width: auto;
  min-height: 28px;
  padding: 0 10px;
  font-size: 0.82rem;
}

.panel {
  position: fixed;
  z-index: 2;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(18, 19, 22, 0.82);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(16px);
}

.panel-left {
  top: 18px;
  left: 18px;
  width: min(300px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 12px;
}

.panel-right {
  right: 18px;
  bottom: 58px;
  width: min(330px, calc(100vw - 36px));
  padding: 14px;
}

#app.has-video-panel .panel-right {
  right: calc(33.333vw + 18px);
}

.video-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  width: 33.333vw;
  height: 100vh;
  min-width: 0;
  padding: 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(18, 19, 22, 0.84);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(16px);
}

.video-panel[hidden] {
  display: none;
}

.video-stack {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.video-view {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  margin: 0;
}

.video-view video {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 6px;
  background: #050607;
  object-fit: contain;
}

.video-view figcaption {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 3px 7px;
  border-radius: 5px;
  background: rgba(5, 6, 7, 0.72);
  color: #f2f3f0;
  font-size: 0.78rem;
  line-height: 1.25;
}

.video-scrubber {
  display: block;
  margin-top: 10px;
}

.video-scrubber input {
  display: block;
  width: 100%;
}

.video-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.video-controls button {
  width: auto;
  min-width: 76px;
  padding: 0 12px;
}

.video-controls span,
.video-name {
  min-width: 0;
  color: #cbd0ca;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.video-name {
  margin-top: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

h1 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 650;
  letter-spacing: 0;
}

.status {
  min-width: 72px;
  padding: 3px 7px;
  border: 1px solid rgba(242, 243, 240, 0.16);
  border-radius: 999px;
  color: #cbd0ca;
  font-size: 0.76rem;
  text-align: center;
}

.status.ready {
  border-color: rgba(91, 230, 181, 0.45);
  color: #83f0c8;
}

.status.error {
  border-color: rgba(255, 107, 107, 0.55);
  color: #ffb4ad;
}

.control-section {
  padding-top: 9px;
  margin-top: 9px;
  border-top: 1px solid rgba(242, 243, 240, 0.11);
}

.control-section:first-of-type {
  padding-top: 0;
  margin-top: 0;
  border-top: 0;
}

.control-section h2 {
  margin: 0 0 6px;
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.check,
.field {
  color: #d9ddd7;
}

.check {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 5px 7px;
  border: 1px solid rgba(242, 243, 240, 0.12);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.84rem;
}

input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: #5be6b5;
}

.field {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 8px;
  align-items: center;
  margin-top: 8px;
  font-size: 0.82rem;
}

.field:first-of-type {
  margin-top: 0;
}

.field input[type="range"],
.field select {
  grid-column: 1 / -1;
}

.field output {
  color: #9fd8ff;
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
    margin-left: 10px;
  accent-color: #59c7ff;
}

select,
button {
  width: 100%;
  min-height: 30px;
  border: 1px solid rgba(242, 243, 240, 0.18);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.08);
  color: #f2f3f0;
  font: inherit;
}

select {
  padding: 0 8px;
}

button {
  cursor: pointer;
}

button:hover,
select:hover,
.check:hover {
  border-color: rgba(91, 230, 181, 0.48);
}

.actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.explainer {
  margin-top: 10px;
  border: 1px solid rgba(242, 243, 240, 0.12);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  color: #d9ddd7;
}

.explainer summary {
  cursor: pointer;
  padding: 7px 8px;
  color: #f2f3f0;
  font-size: 0.84rem;
  font-weight: 650;
}

.explainer section {
  padding: 0 8px 8px;
}

.explainer h2 {
  margin: 5px 0 2px;
  color: #9fd8ff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.explainer p {
  margin: 0;
  color: #cbd0ca;
  font-size: 0.78rem;
  line-height: 1.32;
}

.company-footer {
  position: fixed;
  left: 50%;
  bottom: 10px;
  z-index: 2;
  width: min(760px, calc(100vw - 36px));
  padding: 6px 10px;
  transform: translateX(-50%);
  border: 1px solid rgba(242, 243, 240, 0.12);
  border-radius: 6px;
  background: rgba(18, 19, 22, 0.82);
  color: #cbd0ca;
  font-size: 0.78rem;
  line-height: 1.35;
  text-align: center;
  backdrop-filter: blur(16px);
}

.company-footer p {
  margin: 0;
}

.company-footer a {
  color: #9fd8ff;
  text-decoration: none;
}

.company-footer a:hover {
  color: #83f0c8;
  text-decoration: underline;
}

.stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 0 0 12px;
}

.stats div {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 8px;
  align-items: baseline;
}

.stats dt {
  color: #a9afa8;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.stats dd {
  margin: 0;
  color: #f2f3f0;
  font-variant-numeric: tabular-nums;
}

.legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  color: #cbd0ca;
  font-size: 0.84rem;
}

.legend span {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.swatch {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.swatch.track {
  background: #59c7ff;
}

.swatch.imu {
  background: #30f08f;
}

.swatch.start {
  background: #f4d35e;
}

.swatch.end {
  background: #ff5d73;
}

@media (max-width: 720px) {
  .panel-left {
    top: 10px;
    left: 10px;
    width: calc(100vw - 20px);
    max-height: calc(100vh - 88px);
    padding: 10px;
  }

  .panel-right {
    right: 10px;
    bottom: 58px;
    width: calc(100vw - 20px);
  }

  #app.has-video-panel .panel-right {
    display: none;
  }

  .video-panel {
    width: 100vw;
    min-width: 0;
  }

  .control-grid,
  .legend,
  .actions {
    grid-template-columns: 1fr;
  }
}
