:root {
  --bg: #07090d;
  --panel: rgba(10, 14, 20, 0.72);
  --line: rgba(255, 255, 255, 0.12);
  --text: #f2f5f8;
  --muted: #9aa6b2;
  --accent: #2fd67b;
  --danger: #ff5c5c;
  --font: "SF Pro Display", "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  overflow: hidden;
}

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

#c {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}

#c.dragging {
  cursor: grabbing;
}

#hud {
  position: absolute;
  top: 18px;
  left: 18px;
  right: 18px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

#cam-label {
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
  font-weight: 600;
  letter-spacing: 0.02em;
}

#hint {
  max-width: 520px;
  text-align: right;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  backdrop-filter: blur(12px);
}

#transport {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(14px);
  width: min(920px, calc(100% - 24px));
}

#transport button,
#calibrate button,
#btn-start {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  font: inherit;
}

#transport button:hover,
#calibrate button:hover,
#btn-start:hover:not(:disabled) {
  border-color: rgba(47, 214, 123, 0.55);
}

#btn-play {
  width: 42px;
  flex: 0 0 auto;
}

#seek {
  flex: 1;
  accent-color: var(--accent);
}

#time {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--muted);
  min-width: 110px;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

#cam-switch {
  display: flex;
  gap: 6px;
}

#cam-switch button.active {
  background: rgba(47, 214, 123, 0.18);
  border-color: rgba(47, 214, 123, 0.7);
  color: #d8ffe8;
}

#boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 30% 20%, rgba(47, 214, 123, 0.18), transparent 40%),
    radial-gradient(circle at 70% 80%, rgba(64, 140, 255, 0.16), transparent 42%),
    #07090d;
  z-index: 20;
}

.boot-card {
  width: min(440px, calc(100% - 32px));
  padding: 28px;
  border-radius: 20px;
  background: rgba(12, 16, 24, 0.88);
  border: 1px solid var(--line);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.boot-card h1 {
  margin: 0 0 8px;
  font-size: 28px;
}

.boot-card p,
#boot-status {
  color: var(--muted);
  line-height: 1.45;
}

#boot-status {
  margin: 14px 0 18px;
  min-height: 1.4em;
}

#btn-start {
  width: 100%;
  padding: 12px 16px;
  background: linear-gradient(180deg, #37e089, #1fad5f);
  border: none;
  color: #04150c;
  font-weight: 700;
}

#btn-start:disabled {
  opacity: 0.45;
  cursor: default;
}

#crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  pointer-events: none;
  z-index: 4;
}

#crosshair::before,
#crosshair::after {
  content: "";
  position: absolute;
  background: rgba(47, 214, 123, 0.95);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}

#crosshair::before {
  left: 50%;
  top: 0;
  width: 2px;
  height: 100%;
  margin-left: -1px;
}

#crosshair::after {
  top: 50%;
  left: 0;
  height: 2px;
  width: 100%;
  margin-top: -1px;
}

#crosshair.hidden {
  display: none;
}

#calibrate {
  position: absolute;
  top: 72px;
  right: 18px;
  width: min(380px, calc(100% - 36px));
  padding: 14px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
  z-index: 5;
}

#calibrate.hidden {
  display: none;
}

#calibrate h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

#calibrate p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

#calibrate kbd {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: #0d121a;
  font-size: 11px;
  color: var(--text);
}

#cal-slot {
  width: 100%;
  margin-bottom: 8px;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #0d121a;
  color: var(--text);
}

.cal-vals {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #0d121a;
  border: 1px solid var(--line);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: #9ef0c0;
}

.cal-row {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.cal-row button {
  flex: 1;
  padding: 8px 6px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #121821;
  color: var(--text);
  cursor: pointer;
}

.cal-row button:hover {
  border-color: rgba(47, 214, 123, 0.45);
}

#cal-out {
  margin: 0 0 10px;
  max-height: 180px;
  overflow: auto;
  font-size: 11px;
  line-height: 1.35;
  white-space: pre-wrap;
  color: #c7d2de;
}

#c.placing {
  cursor: move;
}

@media (max-width: 820px) {
  #hint {
    display: none;
  }

  #transport {
    flex-wrap: wrap;
  }

  #cam-switch {
    width: 100%;
  }

  #cam-switch button {
    flex: 1;
  }
}
