* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Outfit", system-ui, sans-serif;
  background: #eef2f7;
  color: #10233d;
}

.toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  background: #fff;
  border-bottom: 1px solid #d8e2ef;
}

.toolbar h1 {
  margin: 0;
  font-size: 1.1rem;
}

.toolbar p {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
  color: #5a6f88;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.toolbar a,
.toolbar button {
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.55rem 1rem;
  border-radius: 8px;
  border: 1px solid #c5d4e8;
  background: #fff;
  color: #0b6bcb;
  cursor: pointer;
  text-decoration: none;
}

.toolbar button.primary {
  background: #0b6bcb;
  color: #fff;
  border-color: #0b6bcb;
}

.save-status {
  min-width: 12rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #5a6f88;
}

.save-status[data-type="success"] {
  color: #15803d;
}

.save-status[data-type="error"] {
  color: #b91c1c;
}

.workspace {
  max-width: 920px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

.panel {
  background: #fff;
  border: 1px solid #d8e2ef;
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.65rem;
}

.panel label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.78rem;
  font-weight: 600;
}

.panel input {
  padding: 0.45rem 0.55rem;
  border: 1px solid #c5d4e8;
  border-radius: 6px;
  font: inherit;
}

.page {
  position: relative;
  width: 100%;
  aspect-ratio: 744 / 1024;
  margin-bottom: 1.5rem;
  background: #fff;
  box-shadow: 0 8px 28px rgba(15, 34, 56, 0.12);
  overflow: hidden;
}

.page img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
}

.hotspot {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--w);
  height: var(--h);
  border: 2px solid rgba(220, 38, 38, 0.75);
  background: rgba(255, 255, 255, 0.12);
  cursor: grab;
  z-index: 1;
  overflow: hidden;
  --scale: 1;
  --font-px: calc(var(--size-pt, 11) * var(--scale) * 1px);
  --pad-px: calc(2 * var(--scale) * 1px);
}

.hotspot__preview {
  position: absolute;
  font-family: Helvetica, Arial, sans-serif;
  font-size: var(--font-px);
  font-weight: 400;
  line-height: 1;
  color: rgb(13, 31, 56);
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(100% - var(--pad-px) * 2);
  left: var(--pad-px);
  bottom: calc(22% + var(--font-px) * 0.35 - var(--font-px) * 0.85);
}

.hotspot--multiline .hotspot__preview {
  top: calc(3 * var(--scale) * 1px);
  bottom: auto;
  white-space: normal;
  line-height: calc((var(--size-pt, 10) + 2) * var(--scale) * 1px);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 6;
  overflow: hidden;
}

.hotspot--mark .hotspot__preview {
  left: 50%;
  bottom: calc(22% + var(--font-px) * 0.35 - var(--font-px) * 0.85 - 1 * var(--scale) * 1px);
  transform: translateX(calc(-50% - var(--font-px) * 0.35));
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
  max-width: none;
}

.hotspot__tag {
  position: absolute;
  top: 0;
  right: 0;
  max-width: 100%;
  padding: 1px 3px;
  font-family: "Outfit", system-ui, sans-serif;
  font-size: 8px;
  font-weight: 600;
  line-height: 1.2;
  color: #b91c1c;
  background: rgba(255, 255, 255, 0.82);
  border-bottom-left-radius: 4px;
  pointer-events: none;
  opacity: 0.55;
}

.hotspot.is-selected {
  border-color: #0b6bcb;
  background: rgba(11, 107, 203, 0.08);
  z-index: 2;
}

.hotspot.is-selected .hotspot__tag {
  color: #0b6bcb;
  opacity: 1;
}

body.dragging .hotspot {
  cursor: grabbing;
}

.help {
  font-size: 0.85rem;
  color: #5a6f88;
  margin: 0;
}
