* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Malgun Gothic', 'Segoe UI', sans-serif;
  background: #f5f6f8;
  color: #202124;
}

#drop-zone {
  display: flex;
  min-height: 100vh;
  align-items: flex-start;
}

#drop-zone.dragover {
  outline: 3px dashed #4c8bf5;
  outline-offset: -8px;
}

#settings {
  width: 268px;
  flex: none;
  padding: 20px;
  background: #fff;
  border-right: 1px solid #dcdfe3;
  position: sticky;
  top: 0;
  max-height: 100vh;
  overflow-y: auto;
}

#settings h1 { font-size: 18px; margin: 0 0 8px; }
.hint { font-size: 13px; color: #5f6368; line-height: 1.5; }

#settings label {
  display: block;
  margin-top: 14px;
  font-size: 13px;
  color: #3c4043;
}

#settings label select {
  display: block;
  width: 100%;
  margin-top: 4px;
}

.readout { color: #5f6368; }

.range-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.range-row input[type='range'] { flex: 1; min-width: 0; }

.range-row input[type='number'] {
  width: 64px;
  flex: none;
  font-size: 12px;
  padding: 3px 4px;
  border: 1px solid #dcdfe3;
  border-radius: 4px;
}

#settings label.check {
  display: flex;
  align-items: center;
  gap: 6px;
}

#settings label.check input { margin: 0; }

#actions { margin-top: 22px; }

#actions button {
  padding: 9px 12px;
  border: 1px solid #dcdfe3;
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
  cursor: pointer;
}

#actions #copy-button {
  width: 100%;
  background: #1a73e8;
  border-color: #1a73e8;
  color: #fff;
  font-weight: 600;
}

#actions #copy-button:hover { background: #1765cc; }

.save-row { display: flex; gap: 6px; margin-top: 8px; }
.save-row button { flex: 1; }
.save-row select { flex: none; width: 84px; }

#action-message {
  font-size: 12px;
  line-height: 1.5;
  margin: 10px 0 0;
  color: #5f6368;
  min-height: 18px;
}

#action-message.warn { color: #b06000; }
#action-message.error { color: #d93025; }

#preview {
  flex: 1;
  min-width: 0;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

#empty-hint {
  margin: 80px auto;
  color: #80868b;
  font-size: 15px;
}

#preview-stage {
  position: relative;
  max-width: 100%;
  line-height: 0;
  display: none;
}

#preview-canvas {
  max-width: 100%;
  height: auto;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
  display: block;
}

#overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.ov-item {
  position: absolute;
  pointer-events: auto;
  cursor: grab;
  border: 2px solid transparent;
  border-radius: 2px;
  touch-action: none;
}

.ov-item:hover { border-color: rgba(26, 115, 232, 0.9); }

.ov-item.lifted { border-color: transparent; }
.ov-item.lifted .ov-remove { display: none; }

body.dragging-image { cursor: grabbing; }
body.dragging-image .ov-item { cursor: grabbing; }

.ov-ghost {
  position: fixed;
  left: 0;
  top: 0;
  transform: translate3d(-9999px, -9999px, 0);
  pointer-events: none;
  opacity: 0.9;
  border-radius: 3px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
  z-index: 999;
}

.ov-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  background: rgba(217, 48, 37, 0.92);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s;
}

.ov-item:hover .ov-remove { opacity: 1; }
.ov-remove:hover { background: #d93025; }

.ov-label {
  position: absolute;
  pointer-events: auto;
  border: 1px dashed transparent;
  border-radius: 3px;
  background: transparent;
  color: transparent;
  text-align: center;
  padding: 0;
  margin: 0;
  font-family: inherit;
  outline: none;
}

.ov-label::placeholder { color: transparent; }

/* 아직 안 채운 칸은 늘 옅은 점선으로 자리를 알려주고, 미리보기 위에
   마우스가 있는 동안에는 채운 칸까지 모두 보여준다. 마우스를 빼면
   완성된 모습만 남는다. */
.ov-label.empty { border-color: rgba(26, 115, 232, 0.32); }
#preview-stage:hover .ov-label { border-color: rgba(26, 115, 232, 0.25); }
#preview-stage:hover .ov-label.empty { border-color: rgba(26, 115, 232, 0.45); }

#preview-stage .ov-label:hover { border-color: rgba(26, 115, 232, 0.75); }
#preview-stage .ov-label:hover::placeholder { color: rgba(95, 99, 104, 0.75); }

#preview-stage .ov-label:focus {
  border: 1px solid #1a73e8;
  background: rgba(255, 255, 255, 0.97);
  color: #202124;
}

#preview-stage .ov-label:focus::placeholder { color: #9aa0a6; }

body.dragging-image #preview-stage .ov-label { border-color: transparent; }

#result-info {
  font-size: 13px;
  color: #5f6368;
  margin: 0;
  line-height: 1.5;
}
