/* Unified text editor — placement + content, typography preserved. */

.text-edit-toggle {
  position: absolute;
  z-index: 40;
  left: 34px;
  bottom: 32px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.72);
  color: var(--soft-ink, #535250);
  padding: 8px 14px;
  cursor: pointer;
  font: 11px var(--label);
  letter-spacing: 0.13em;
  text-transform: uppercase;
  transition: 160ms ease;
}
.text-edit-toggle:hover { border-color: var(--accent); color: var(--accent); }
.text-edit-toggle[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--white); }

body.text-editing [data-editable] { pointer-events: all; cursor: grab; }
body.text-editing [data-editable].selected { filter: drop-shadow(0 0 5px rgba(155, 47, 37, 0.6)); }
body.text-editing .tm-territory { pointer-events: none; }

.text-edit-panel label {
  display: block;
  margin-top: 14px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.text-edit-panel select,
.text-edit-panel textarea {
  width: 100%;
  margin: 6px 0 0;
  padding: 8px;
  border: 1px solid var(--line-strong);
  background: var(--white);
  font: 13px var(--label);
}
.text-edit-panel textarea { min-height: 62px; resize: vertical; }
.text-edit-panel .annotation-status { margin-top: 10px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.text-edit-panel button { width: 100%; text-align: left; }

/* SVG line positioning is generated as tspans; CSS keeps the editor controls legible. */
.text-edit-panel textarea { white-space: pre-wrap; }
.te-type-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.te-type-controls input { display: block; width: 100%; margin-top: 6px; padding: 8px; border: 1px solid var(--line-strong); background: var(--white); font: 13px var(--label); }
.text-edit-panel button:disabled { opacity: .45; cursor: default; }
/* Keep the scaled stage reachable while editing on a portrait phone. */
@media (max-width: 600px) and (orientation: portrait) {
  .text-edit-panel { top: auto; bottom: 8px; max-height: calc(50vh - 28.125vw - 16px); }
}
body.text-editing [data-editable] { touch-action: none; }
