* {
  box-sizing: border-box;
}

html,
body,
#viewer {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background: #050505;
  color: #f7f7f2;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

#viewer,
#map-shell,
gmp-map-3d,
.environment-vignette {
  position: fixed;
  inset: 0;
}

gmp-map-3d {
  display: block;
  width: 100%;
  height: 100%;
}

#gesture-capture {
  position: fixed;
  inset: 0;
  z-index: 2;
  cursor: grab;
  outline: none;
  touch-action: none;
}

.environment-vignette {
  z-index: 1;
  background: rgb(255 255 255 / 0%);
  mix-blend-mode: color;
  pointer-events: none;
  transition: background 180ms ease, opacity 180ms ease;
}

#gesture-capture:active {
  cursor: grabbing;
}

.panel-tabs {
  position: fixed;
  right: 12px;
  top: 12px;
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: min(560px, calc(100vw - 24px));
  gap: 6px;
}

.tool-panel {
  position: fixed;
  right: 12px;
  top: 58px;
  z-index: 4;
  display: grid;
  width: min(460px, calc(100vw - 24px));
  max-height: calc(100vh - 70px);
  gap: 8px;
  padding: 10px;
  overflow: auto;
  border: 1px solid rgb(255 255 255 / 18%);
  border-radius: 6px;
  background: rgb(6 7 8 / 76%);
  box-shadow: 0 12px 28px rgb(0 0 0 / 28%);
  backdrop-filter: blur(10px);
}

.tool-panel[hidden],
#waypoint-camera-editor[hidden] {
  display: none;
}

.segmented,
.button-row,
.save-row,
.model-row,
.duration-row {
  display: grid;
  gap: 6px;
}

.segmented,
.button-row {
  grid-template-columns: 1fr 1fr;
}

.segmented.three {
  grid-template-columns: 1fr 1fr 1.24fr;
}

.save-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.model-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.nudge-panel {
  display: grid;
  gap: 6px;
}

.nudge-panel[hidden] {
  display: none;
}

.nudge-pad,
.nudge-grid {
  display: grid;
  gap: 6px;
}

.nudge-pad {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.nudge-pad span {
  min-height: 34px;
}

.panel-block {
  display: grid;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid rgb(255 255 255 / 14%);
}

.panel-title {
  color: rgb(255 255 255 / 74%);
  font: 11px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

.field-grid label,
.duration-row label,
.toggle-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 6px;
}

.field-grid span,
.duration-row span,
.toggle-row span {
  min-width: 34px;
  color: rgb(255 255 255 / 68%);
  font: 11px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.toggle-row input {
  justify-self: end;
  width: 34px;
  min-height: 24px;
  accent-color: rgb(97 210 255);
}

.slider-stack {
  display: grid;
  gap: 7px;
}

.range-field {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) 92px;
  align-items: center;
  gap: 7px;
}

.range-field span {
  color: rgb(255 255 255 / 68%);
  font: 11px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

button,
input,
select {
  width: 100%;
  min-height: 34px;
  border: 1px solid rgb(255 255 255 / 20%);
  border-radius: 6px;
  background: rgb(255 255 255 / 8%);
  color: rgb(255 255 255 / 92%);
  font: 13px/1.2 inherit;
  letter-spacing: 0;
}

button {
  padding: 0 10px;
  cursor: pointer;
}

button:hover {
  background: rgb(255 255 255 / 14%);
}

button.active {
  border-color: rgb(97 210 255 / 76%);
  background: rgb(31 135 184 / 52%);
}

button:disabled {
  cursor: default;
  opacity: 0.62;
}

input {
  padding: 0 10px;
  outline: none;
}

input[type="range"] {
  min-height: 28px;
  padding: 0;
  accent-color: rgb(97 210 255);
}

input[type="number"] {
  font-variant-numeric: tabular-nums;
}

select {
  padding: 0 8px;
  outline: none;
}

input:focus,
select:focus,
button:focus-visible {
  border-color: rgb(123 220 255 / 86%);
}

.point-list,
.waypoint-list {
  display: grid;
  gap: 6px;
  max-height: min(34vh, 260px);
  overflow: auto;
}

.point-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 32px;
  align-items: center;
  gap: 6px;
  min-height: 34px;
}

.waypoint-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 30px 30px 30px;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  border-radius: 4px;
  cursor: grab;
}

.waypoint-row.dragging {
  opacity: 0.55;
}

.waypoint-row.drag-over {
  outline: 1px solid rgb(123 220 255 / 72%);
  outline-offset: 2px;
}

.waypoint-row.active .waypoint-load {
  border-color: rgb(97 210 255 / 76%);
  background: rgb(31 135 184 / 52%);
}

.point-load,
.waypoint-load {
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.point-meta,
.empty-row,
.message {
  color: rgb(255 255 255 / 70%);
  font: 11px/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  letter-spacing: 0;
}

.empty-row,
.message {
  min-height: 16px;
}

.global-message {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 4;
  max-width: min(460px, calc(100vw - 24px));
  padding: 8px 10px;
  border: 1px solid rgb(255 255 255 / 14%);
  border-radius: 6px;
  background: rgb(5 5 5 / 64%);
  pointer-events: none;
}

.global-message:empty {
  display: none;
}

.icon-button {
  min-height: 32px;
  padding: 0;
}

.waypoint-index {
  color: rgb(255 255 255 / 58%);
  font: 11px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  text-align: center;
}

.readout {
  position: fixed;
  bottom: 12px;
  left: 12px;
  z-index: 3;
  min-width: 220px;
  padding: 10px 12px;
  border: 1px solid rgb(255 255 255 / 18%);
  border-radius: 6px;
  background: rgb(5 5 5 / 68%);
  color: rgb(255 255 255 / 92%);
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  pointer-events: none;
  white-space: pre;
}

.status {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 5;
  transform: translate(-50%, -50%);
  padding: 10px 12px;
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: 6px;
  background: rgb(5 5 5 / 72%);
  color: rgb(255 255 255 / 86%);
  font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  letter-spacing: 0;
  pointer-events: none;
}

#viewer.ready .status {
  display: none;
}

#viewer.capturing-shot .panel-tabs,
#viewer.capturing-shot .tool-panel,
#viewer.capturing-shot .global-message,
#viewer.capturing-shot .readout {
  opacity: 0;
}

#viewer.error .status {
  max-width: min(420px, calc(100vw - 32px));
  white-space: normal;
}

@media (max-width: 720px) {
  .panel-tabs {
    right: 8px;
    top: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: calc(100vw - 16px);
  }

  .tool-panel {
    right: 8px;
    top: auto;
    bottom: 8px;
    width: calc(100vw - 16px);
    max-height: calc(100vh - 68px);
  }

  .readout {
    display: none;
  }
}
