* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: black;
  font-family: Arial, sans-serif;
  overflow: hidden;
}

#projection-area {
  width: 100vw;
  height: 100vh;
  background: black;
  position: relative;
  overflow: hidden;
}

#projection-border {
  position: absolute;
  inset: 0;
  border: 8px solid red;
  pointer-events: none;
  z-index: 1;
}

#overlay-img {
  position: absolute;
  width: 600px;
  height: 600px;
  object-fit: contain;
  left: 50%;
  top: 50%;
  transform-origin: center center;
  display: none;
  pointer-events: none;
  z-index: 5;
}

#calibration-layer {
  position: absolute;
  width: 600px;
  height: 600px;
  left: 50%;
  top: 50%;
  transform-origin: center center;
  display: block;
  cursor: move;
  touch-action: none;
  z-index: 10;
}

#calibration-box {
  position: absolute;
  inset: 0;
  border: 6px solid red;
  pointer-events: none;
}

#calibration-x {
  position: absolute;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.x-line {
  position: absolute;
  width: 140%;
  height: 6px;
  background: red;
  left: -20%;
  top: 50%;
  transform-origin: center;
  pointer-events: none;
}

.line-1 {
  transform: rotate(45deg);
}

.line-2 {
  transform: rotate(-45deg);
}

#resize-handle {
  position: absolute;
  width: 16px;
  height: 16px;
  left: -8px;
  top: -8px;
  background: red;
  border: 2px solid white;
  border-radius: 50%;
  cursor: nwse-resize;
  z-index: 30;
}

#compass-rose {
  position: absolute;
  left: 40px;
  top: 40px;
  width: 160px;
  height: 160px;
  color: red;
  font-weight: bold;
  cursor: move;
  user-select: none;
  touch-action: none;
  z-index: 80;
}

#compass-symbol {
  position: absolute;
  inset: 0;
  color: red;
  font-size: 56px;
  font-weight: bold;
  line-height: 1;
  pointer-events: none;
}

.compass-n {
  position: absolute;
  font-size: 58px;
  font-weight: bold;
  line-height: 58px;
}

.compass-arrow {
  position: absolute;
  font-size: 62px;
  font-weight: bold;
  line-height: 62px;
}

.compass-up .compass-arrow {
  left: 50%;
  top: 0;
  transform: translateX(-50%);
}

.compass-up .compass-n {
  left: 50%;
  top: 78px;
  transform: translateX(-50%);
}

.compass-right .compass-n {
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
}

.compass-right .compass-arrow {
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
}

.compass-down .compass-n {
  left: 50%;
  top: 10px;
  transform: translateX(-50%);
}

.compass-down .compass-arrow {
  left: 50%;
  bottom: 5px;
  transform: translateX(-50%);
}

.compass-left .compass-arrow {
  left: 5px;
  top: 50%;
  transform: translateY(-50%);
}

.compass-left .compass-n {
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
}

#control-panel {
  position: fixed;
  right: 20px;
  top: 20px;
  width: 420px;
  background: rgba(20, 20, 20, 0.95);
  color: white;
  padding: 26px;
  border-radius: 12px;
  z-index: 100;
  font-size: 34px;
  font-weight: bold;
  cursor: move;
  user-select: none;
  touch-action: none;
  max-height: 86vh;
  overflow-y: auto;
}

#control-panel h2 {
  font-size: 42px;
  margin-top: 0;
  margin-bottom: 28px;
}

button {
  width: 100%;
  margin: 14px 0;
  padding: 26px;
  cursor: pointer;
  font-size: 34px;
  font-weight: bold;
  border-radius: 12px;
}