/* Edit mode for the skill tree: its toolbar, the guides it draws on the
   board, and the dialogs the editor opens. Split out of css/skilltree.css
   along its own section banners; both are loaded together. */
/* ============ Edit toolbar ============ */
.st-edit-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-mid);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 3px 8px 3px 6px;
  border-radius: 3px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  flex-shrink: 0;
}

.st-edit-btn .material-symbols-outlined {
  font-size: 16px;
}

.st-edit-btn:hover {
  border-color: var(--accent);
}

.st-edit-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--bg-active);
}

.st-edit-tools {
  display: none;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.skilltree-toolbar.editing .st-edit-tools {
  display: flex;
}

.st-tool-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-mid);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 3px 7px 3px 5px;
  border-radius: 3px;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
}

.st-tool-btn .material-symbols-outlined {
  font-size: 15px;
}

.st-tool-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--text-primary);
}

.st-tool-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--bg-active);
}

.st-tool-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.st-tool-sep {
  width: 1px;
  height: 18px;
  background: var(--border);
  flex-shrink: 0;
}

.st-spacing-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.st-spacing-input {
  width: 52px;
  background: var(--bg-mid);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 3px;
  padding: 2px 4px;
  font-size: 11px;
  font-family: inherit;
  outline: none;
}

.st-spacing-input:focus {
  border-color: var(--accent);
}

.st-toolbar-warn {
  display: none;
  font-size: 11px;
  color: var(--warning);
  white-space: nowrap;
  flex-shrink: 0;
}

.st-toolbar-warn.visible {
  display: block;
}

.st-toolbar-hint {
  flex: 1 1 40px;
  min-width: 0;
  text-align: right;
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.st-toolbar-msg {
  display: none;
  font-size: 11px;
  color: var(--success);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 30%;
  flex-shrink: 0;
}

.st-toolbar-msg.visible {
  display: block;
}

.st-toolbar-msg.error {
  color: var(--danger);
}

.st-export-sep {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ============ Edit mode: guides ============ */
.st-guides {
  pointer-events: none;
}

.st-guide-ring {
  fill: none;
  stroke: rgba(255,255,255,0.14);
  stroke-width: 1.5;
  stroke-dasharray: 7 9;
}

.st-guide-ring.hot {
  stroke: var(--accent);
  stroke-width: 2.5;
}

.st-guide-boundary {
  stroke: rgba(255,255,255,0.09);
  stroke-width: 1;
  stroke-dasharray: 4 9;
}

/* The category spokes of normal mode. They carry the separation on their own
   there, with no wedge or dragged card to justify them, so they sit at the
   rings' own weight instead of the fainter edit-only boundary. */
.st-guide-divider {
  stroke: rgba(255,255,255,0.1);
  stroke-width: 1.5;
  stroke-dasharray: 6 8;
}

.st-guide-wedge {
  stroke: none;
  fill-opacity: 0;
}

.st-card.editable {
  cursor: grab;
}

.st-card.editable:hover {
  box-shadow: 0 0 0 3px rgba(74,144,217,0.35), 0 4px 14px rgba(0,0,0,0.4);
}

.st-card.dragging {
  cursor: grabbing;
  pointer-events: none;
  opacity: 0.85;
  z-index: 6;
  box-shadow: 0 10px 26px rgba(0,0,0,0.5);
}

.st-card.link-source {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(74,144,217,0.3);
}

.st-card.link-target {
  border-color: var(--success);
  box-shadow: 0 0 0 4px rgba(80,176,112,0.35);
}

.st-category-label.editable {
  pointer-events: auto;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 3px;
}

.st-category-label.editable:hover {
  background: var(--bg-hover);
}

.st-category-icon {
  font-size: 14px;
}

.st-category-edit {
  font-size: 13px !important;
  color: var(--text-muted);
}

.st-link-preview {
  stroke: var(--accent);
  stroke-width: 2;
  stroke-dasharray: 6 4;
  opacity: 0.9;
}

.st-link-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 14;
  stroke-linecap: round;
}

.st-lines.link-tool .st-link-hit {
  pointer-events: stroke;
  cursor: pointer;
}

/* The wide blurred pass under a connector. It is never the pointer's target —
   the invisible hit copy is — so link mode can still grab the line. */
.st-connector-glow {
  pointer-events: none;
}

.st-connector {
  pointer-events: none;
}

.st-lines.link-tool .st-connector-glow.hot {
  stroke: var(--danger) !important;
}

.st-lines.link-tool .st-connector.hot {
  stroke: var(--danger) !important;
  stroke-width: 6 !important;
  stroke-dasharray: none !important;
  opacity: 1 !important;
}

.st-viewport.st-editing {
  cursor: default;
}

.st-viewport.st-linking {
  cursor: crosshair;
}

/* Sits under the pointer while a ring is hovered, so the glyph is nudged to
   the right of the cursor and the button stays the thing being clicked. */
.st-add-btn {
  position: absolute;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 22px;
  z-index: 8;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.45);
  user-select: none;
  animation: st-chip-pop 130ms ease-out;
}

/* The pop only ever scales up: shrinking the button would also shrink what the
   pointer can hit during the animation. */
@keyframes st-chip-pop {
  from { transform: scale(1.3); opacity: 0.45; }
  to { transform: scale(1); opacity: 1; }
}

.st-add-btn:hover {
  background: var(--accent-hover);
}

.st-add-btn[hidden] {
  display: none;
}

/* ============ Dialogs ============ */
.st-dialog {
  position: absolute;
  width: 300px;
  max-height: calc(100% - 16px);
  display: flex;
  flex-direction: column;
  background: var(--bg-light);
  border: 1px solid var(--cardBorders);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.5);
  z-index: 12;
  overflow: hidden;
}

.st-dialog-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: var(--bg-mid);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  flex-shrink: 0;
}

.st-dialog-header .material-symbols-outlined {
  font-size: 18px;
}

.st-dialog-title {
  flex: 1;
}

.st-dialog-close {
  cursor: pointer;
  font-size: 18px !important;
  color: var(--text-muted);
  border-radius: 3px;
  padding: 2px;
}

.st-dialog-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.st-dialog-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  overflow-y: auto;
}

.st-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.st-field > label {
  font-size: 11px;
  color: var(--text-muted);
}

.st-field.invalid .st-input {
  border-color: var(--danger);
}

.st-field.invalid .st-select {
  border-color: var(--danger);
}

/* The achievement editor's notification row: the kind, then a preview. */
.st-ach-notif-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.st-ach-notif-row .st-select {
  flex: 1;
  min-width: 0;
}

.st-ach-notif-row .st-ach-preview {
  flex-shrink: 0;
}

.st-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.st-btn:disabled:hover {
  border-color: var(--border);
}

/* The achievement editor's two-part next-step picker. */
.st-ach-nextstep {
  display: flex;
  align-items: center;
  gap: 6px;
}

.st-ach-nextstep .st-select {
  flex: 1;
  min-width: 0;
}

.st-ach-nextstep .st-select:first-child {
  flex: 0 0 42%;
}

.st-input,
.st-select {
  width: 100%;
  background: var(--bg-mid);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 3px;
  padding: 4px 7px;
  font-size: 12px;
  font-family: inherit;
  outline: none;
}

.st-input:focus,
.st-select:focus {
  border-color: var(--accent);
}

textarea.st-input {
  resize: vertical;
  min-height: 38px;
}

.st-icon-picker {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.st-icon-search {
  width: 100%;
  background: var(--bg-mid);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 3px;
  padding: 3px 7px;
  font-size: 11px;
  font-family: inherit;
  outline: none;
}

.st-icon-search:focus {
  border-color: var(--accent);
}

.st-icon-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  max-height: 116px;
  overflow-y: auto;
  padding: 3px;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.st-icon-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  background: none;
  border: 1px solid transparent;
  border-radius: 3px;
  color: var(--text-secondary);
  font-size: 17px;
  cursor: pointer;
  padding: 0;
}

.st-icon-cell:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* The random icon a new lesson starts with has to be findable at a
   glance, so the selection reads as a filled cell, not just a tinted glyph. */
.st-icon-cell.selected {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(74, 144, 217, 0.2);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.st-icon-cell[hidden] {
  display: none;
}

.st-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.st-color {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.st-color-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* The native control, stripped back to a plain chip: the browser's own frame
   and padding would make it twice the height of the swatches beside it. */
.st-color-picker {
  -webkit-appearance: none;
  appearance: none;
  width: 34px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: none;
  cursor: pointer;
  flex: none;
}

.st-color-picker::-webkit-color-swatch-wrapper {
  padding: 0;
}

.st-color-picker::-webkit-color-swatch {
  border: none;
  border-radius: 3px;
}

.st-color-picker::-moz-color-swatch {
  border: none;
  border-radius: 3px;
}

.st-color-picker:hover,
.st-color-picker:focus {
  border-color: var(--accent);
  outline: none;
}

.st-color-hex {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.st-swatch {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}

.st-swatch:hover {
  border-color: var(--accent);
}

.st-swatch.selected {
  border-color: var(--text-primary);
}

.st-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 18px;
}

.st-chips-empty {
  font-size: 11px;
  color: var(--text-muted);
}

.st-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px 2px 7px;
  border-radius: 10px;
  background: var(--bg-mid);
  border: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-secondary);
}

.st-chip-x {
  font-size: 13px !important;
  color: var(--text-muted);
  cursor: pointer;
}

.st-chip-x:hover {
  color: var(--danger);
}

.st-dialog-note {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

.st-dialog-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--bg-mid);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.st-dialog-row {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}

/* Cancel and Save are pushed to the right, leaving room for Delete on the left. */
.st-dialog-row .st-dialog-cancel {
  margin-left: auto;
}

.st-btn {
  padding: 4px 10px;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--bg-mid);
  color: var(--text-primary);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.st-btn:hover {
  border-color: var(--accent);
}

.st-btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.st-btn.primary:hover {
  background: var(--accent-hover);
}

.st-btn.danger {
  background: none;
  border-color: var(--danger);
  color: var(--danger);
}

.st-btn.danger.confirming {
  background: var(--danger);
  color: #fff;
}


