html,
body {
  margin: 0;
  height: 100%;
  font-family: sans-serif;
}

.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: 100vh;
}

.panel {
  box-sizing: border-box;
  padding: 20px;
  border-right: 1px solid #d4d4d8;
  background: #fafafa;
}

.panel h1 {
  margin: 0 0 12px;
  font-size: 20px;
}

.panel p {
  margin: 0 0 8px;
  color: #334155;
}

.field {
  display: grid;
  gap: 6px;
  margin-top: 16px;
  color: #334155;
  font-size: 14px;
}

.field select {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #0f172a;
  border-radius: 8px;
  padding: 10px 12px;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
}

.camera-open {
  margin-top: 12px;
  width: 100%;
  border: 1px solid #1d4ed8;
  background: #2563eb;
  color: #eff6ff;
  border-radius: 8px;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
}

.video-panel {
  position: relative;
  margin-top: 12px;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background: #0f172a;
}

.video-panel video,
.video-panel canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.video-panel video {
  object-fit: contain;
  background: #020617;
}

.video-panel canvas {
  pointer-events: none;
}

.video-panel canvas.is-manual-projection {
  pointer-events: auto;
  cursor: crosshair;
  touch-action: none;
}

.basemap-switcher {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.basemap-switcher button {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #0f172a;
  border-radius: 8px;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
}

.basemap-switcher button.is-active {
  border-color: #2563eb;
  background: #dbeafe;
}

#map {
  position: relative;
  width: 100%;
  height: 100%;
}

.camera-window {
  position: absolute;
  top: 24px;
  left: 24px;
  width: min(720px, calc(100% - 48px));
  background: rgba(248, 250, 252, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.8);
  border-radius: 14px;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.24);
  overflow: hidden;
  z-index: 20;
  min-width: 320px;
  min-height: 240px;
  touch-action: none;
}

.camera-window.is-hidden {
  display: none;
}

.camera-window__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.94);
  color: #e2e8f0;
  cursor: move;
  user-select: none;
  touch-action: none;
}

.camera-window__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.camera-window__header strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manual-projection__label,
.manual-projection__toggle,
.manual-projection__clear {
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(30, 41, 59, 0.96);
  color: #e2e8f0;
  border-radius: 8px;
  padding: 6px 9px;
}

.manual-projection__toggle {
  cursor: pointer;
}

.manual-projection__clear {
  cursor: pointer;
}

.manual-projection__toggle.is-active {
  border-color: #f87171;
  background: #b91c1c;
  color: #fff7ed;
}

.manual-projection__toggle.is-pending {
  cursor: wait;
  opacity: 0.75;
}

.manual-projection__toggle:disabled {
  cursor: wait;
}

.camera-window__close {
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(30, 41, 59, 0.96);
  color: #e2e8f0;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
}

.camera-window__body {
  padding: 12px;
}

.camera-window__resize {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 20px;
  height: 20px;
  cursor: nwse-resize;
}

.camera-window__resize::before {
  content: '';
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 10px;
  height: 10px;
  border-right: 2px solid rgba(148, 163, 184, 0.95);
  border-bottom: 2px solid rgba(148, 163, 184, 0.95);
}
