/* Screenshot editor – tool area only (ported from the SpotBoard prototype).
   Uses the shared design tokens and buttons from /assets/css/main.css. */

.se {
  --se-highlight: #f2cd2e;
  position: relative;
}

.se-icon {
  width: 22px;
  height: 22px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.se-icon circle { fill: currentColor; stroke: none; opacity: 0.8; }
.se-icon .se-icon-marker-tip { fill: var(--se-highlight); }
.se-icon .se-icon-highlight { stroke: var(--se-highlight); stroke-width: 5; opacity: 0.8; }

/* ---------------------------------------------------------------- Toolbar */

.se-toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 64px;
  padding: var(--space-2) var(--space-3);
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  overflow-x: auto;
}

.se-tool-group,
.se-history-group,
.se-export-group { display: flex; align-items: center; gap: var(--space-1); }
.se-history-group { padding-left: var(--space-2); border-left: 1px solid var(--c-border); }
.se-export-group { margin-left: auto; gap: var(--space-2); }

.se-btn-new { --btn-bg: var(--c-surface); }

.se-tool {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 76px;
  height: 52px;
  padding: 4px 8px;
  border: 1.5px solid transparent;
  border-radius: 9px;
  background: transparent;
  font: inherit;
  font-size: 0.8rem;
  color: var(--c-text-muted);
  cursor: pointer;
}
.se-tool:not(:disabled):hover { background: var(--c-surface); border-color: var(--c-border); }
.se-tool[aria-pressed='true'],
.se-tool[aria-pressed='true']:hover {
  background: var(--c-surface-2);
  border-color: var(--c-primary);
  color: var(--c-text);
}
.se-tool:disabled { opacity: 0.4; cursor: not-allowed; }

.se-icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1.5px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--c-text-muted);
  cursor: pointer;
}
.se-icon-btn:not(:disabled):hover { background: var(--c-surface); border-color: var(--c-border); }
.se-icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* ---------------------------------------------------------------- Context bar */

.se-context-row { display: none; position: relative; height: 56px; }
.se-has-image .se-context-row { display: block; }

.se-context-bar {
  position: absolute;
  top: 6px;
  left: 0;
  z-index: 9;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
  min-height: 44px;
  padding: var(--space-1) var(--space-3);
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.se-context-section { display: flex; align-items: center; gap: var(--space-2); }
.se-context-label { font-size: 0.85rem; color: var(--c-text-muted); }
.se-swatches,
.se-choices { display: flex; gap: 6px; }

.se .swatch {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: 0 0 0 1.5px var(--c-border);
  cursor: pointer;
}
.se .swatch[aria-checked='true'] { box-shadow: 0 0 0 3px var(--c-text); }

.se .size,
.se .mode {
  min-width: 34px;
  height: 32px;
  padding: 0 10px;
  border: 1.5px solid var(--c-border);
  border-radius: 8px;
  background: var(--c-bg);
  color: var(--c-text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}
.se .mode { font-weight: 600; }
.se .size[aria-checked='true'],
.se .mode[aria-checked='true'] { background: var(--c-surface-2); border-color: var(--c-primary); }

.se-btn-auto { --btn-bg: var(--c-surface-2); --btn-border: var(--c-primary); }
.se-btn-auto[aria-busy='true'] { cursor: progress; opacity: 0.85; }
.se-btn-auto .auto-blur-label { min-width: 7.5em; text-align: left; }

.se-context-hint { max-width: 360px; margin: 0; font-size: 0.85rem; color: var(--c-text-muted); }

/* ---------------------------------------------------------------- Start (paste zone + how-to) */

.se-has-image .se-start { display: none; }

.se-paste-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: var(--space-4);
  padding: var(--space-8) var(--space-6) var(--space-6);
  text-align: center;
  border: 2.5px dashed var(--c-border);
  border-radius: var(--radius-lg);
  background: var(--c-surface);
}
.se-drag-over .se-paste-zone { border-color: var(--c-primary); background: var(--c-surface-2); }
.se-paste-icon {
  width: 44px;
  height: 44px;
  fill: none;
  stroke: var(--c-primary);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.se-paste-title { margin: 4px 0 0; font-size: 1.5rem; font-weight: 700; }
.se-paste-sub { margin: 0; color: var(--c-text-muted); }
.se-paste-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  margin-top: var(--space-3);
}
.se-privacy { margin: var(--space-3) 0 0; font-size: 0.9rem; color: var(--c-success); }

.se-btn-link {
  padding: 4px 2px;
  border: 0;
  background: none;
  font: inherit;
  color: var(--c-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.se-btn-link:hover { color: var(--c-primary-hover); }

.se-howto { padding-top: var(--space-8); }
.se-howto h2 { font-size: 1.35rem; }
.se-howto-lead { margin-top: -4px; color: var(--c-text-muted); }
.se-os-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}
.se .os-card {
  padding: 14px 16px;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
}
.se .os-card h3 { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 6px; font-size: 1rem; }
.se .os-card p { margin: 0; font-size: 0.92rem; color: var(--c-text-muted); }
.se .os-card.is-current { border: 2px solid var(--c-primary); background: var(--c-surface); }
.se .os-badge {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--c-primary);
  color: var(--c-primary-contrast);
  font-size: 0.75rem;
  font-weight: 600;
}

/* ---------------------------------------------------------------- Editor */

.se-editor {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2) 0 var(--space-4);
  overflow: hidden;
}
.se-stage {
  position: relative;
  flex: none;
  background: var(--c-bg);
  box-shadow: 0 2px 16px rgb(40 49 62 / 18%);
  touch-action: none;
}
.se-text-input {
  position: absolute;
  z-index: 2;
  min-width: 2ch;
  margin: 0;
  padding: 0;
  border: 1.5px dashed var(--c-primary);
  outline: none;
  background: rgb(255 255 255 / 60%);
  font-weight: 700;
  white-space: pre;
  resize: none;
  overflow: hidden;
}

/* While editing, the page text around the tool steps aside (it is still in the HTML for search
   engines and comes back after a reload). */
.se-has-image .tool-hero,
.se-has-image .prose-area,
.se-has-image .site-footer { display: none; }

/* ---------------------------------------------------------------- "New image" menu */

.se-menu {
  position: fixed;
  z-index: 25;
  display: flex;
  flex-direction: column;
  min-width: 230px;
  padding: 6px;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.se-menu [role='menuitem'] {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: none;
  font: inherit;
  color: var(--c-text);
  text-align: left;
  cursor: pointer;
}
.se-menu [role='menuitem']:hover,
.se-menu [role='menuitem']:focus-visible { background: var(--c-surface-2); }

/* ---------------------------------------------------------------- Toast */

.se-toast {
  position: fixed;
  left: 50%;
  bottom: var(--space-6);
  z-index: 50;
  max-width: min(560px, calc(100vw - 32px));
  padding: 12px 18px;
  transform: translateX(-50%);
  border-radius: var(--radius);
  background: var(--c-text);
  color: var(--c-bg);
  font-weight: 600;
  box-shadow: var(--shadow);
}
.se-toast[data-kind='error'] { background: var(--c-danger); color: #fff; }

/* ---------------------------------------------------------------- Drag and drop */

.se-drag-over::after {
  content: '';
  position: fixed;
  inset: 8px;
  z-index: 40;
  border: 3px dashed var(--c-primary);
  border-radius: 16px;
  background: rgb(79 70 229 / 8%);
  pointer-events: none;
}

@media (max-width: 720px) {
  .se-tool { min-width: 56px; }
  .se-tool span { font-size: 0.7rem; }
  .se-export-group span { display: none; }
}
