/* Drawing tab + canvas styles — owned by the drawing module. */

/* the draw panel docks right, exactly like its sibling tabs */
#draw-panel { right: 0; border-left: 1px solid var(--line); }
.draw-vis-top { padding-bottom: 2px; border-bottom: 1px solid var(--line-soft); }
.draw-vis-top .draw-vis-btn { width: 100%; justify-content: center; font-size: 15px; padding: 9px 10px; }
.dl-rename {
  width: 100%;
  background: #000;
  border: 1px solid var(--accent-line);
  border-radius: 2px;
  color: var(--ink);
  font-size: 14px;
  padding: 2px 6px;
}

/* ============ the canvas (inside #world, transforms ride along) ============ */
#draw-layer {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  pointer-events: none;         /* viewer routes all input; never intercept */
}
#draw-layer.drawings-off { display: none; }                    /* master toggle */
#world.alt-scan #draw-layer { display: none !important; }      /* text-scan plate */
#stage.draw-active { cursor: crosshair; }
#stage.draw-active:has(> #world.alt-scan) { cursor: grab; } /* tools sleep on the text scan */

/* ============ panel body ============ */
.draw-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.draw-sec { flex: none; }
.draw-body .panel-sub { margin-bottom: 9px; }

/* ---- tools ---- */
.draw-tool-row { display: flex; gap: 6px; }
.draw-tool {
  flex: 1;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg-2);
  color: var(--ink-dim);
  cursor: pointer;
  transition: border-color .18s var(--ease), color .18s var(--ease), background .18s var(--ease);
}
.draw-tool:hover { border-color: var(--accent-line); color: var(--accent-bright); }
.draw-tool.active {
  border-color: var(--accent-line);
  color: var(--accent);
  background: linear-gradient(180deg, var(--accent-soft), transparent);
}
.draw-tool .icon { width: 28px; height: 28px; }
.draw-tool { height: 46px; }

/* ---- width ---- */
.draw-width {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 14px;
}
.draw-width label {
  font-family: var(--smallcaps);
  font-size: 14px;
  letter-spacing: .14em;
  color: var(--ink-faint);
}
.draw-width input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
  cursor: pointer;
}
.draw-width-val {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--ink);
  min-width: 2ch;
  text-align: right;
}

/* ---- ink swatches ---- */
.draw-swatches {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.draw-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--sw);
  cursor: pointer;
  transition: box-shadow .15s var(--ease), border-color .15s var(--ease);
}
.draw-swatch:hover { border-color: var(--accent-line); }
.draw-swatch.active,
.draw-custom.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--bg-1), 0 0 0 3.5px var(--accent-line);
}
.draw-custom {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px dashed var(--ink-faint);
  overflow: hidden;
  cursor: pointer;
  background: conic-gradient(#c96f6f, #b0713f, #f2c94c, #97bd80, #7da7c9, #b48ec9, #c96f6f);
  position: relative;
}
.draw-custom:hover { border-color: var(--accent-line); }
.draw-custom input {
  position: absolute;
  inset: -6px;                   /* swallow the native swatch chrome */
  opacity: 0;
  cursor: pointer;
}

/* ---- layers ---- */
.draw-layers-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
}
.draw-layers-head .panel-sub { margin: 0; }
.draw-vis-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  letter-spacing: .06em;
  padding: 5px 9px 6px;
}
.draw-vis-btn .icon { width: 14px; height: 14px; color: var(--accent); }
.draw-vis-btn.active { border-color: var(--accent-line); color: var(--accent-bright); }

.draw-layer-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.draw-body.vis-off .draw-layer-list { opacity: .55; }
.draw-layer-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  background: var(--bg-2);
  cursor: pointer;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.draw-layer-row:hover { border-color: var(--line); }
.draw-layer-row.active {
  border-color: var(--accent-line);
  background: linear-gradient(180deg, rgba(242, 201, 76, .07), transparent);
}
.dl-name {
  flex: 1;
  font-size: 14px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.draw-layer-row.layer-off .dl-name { color: var(--ink-faint); font-style: italic; }
.dl-count {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--ink-faint);
}
.dl-eye,
.dl-del {
  position: relative;
  padding: 3px;
  border-radius: 3px;
  color: var(--ink-dim);
  cursor: pointer;
}
.dl-eye .icon,
.dl-del .icon { width: 15px; height: 15px; display: block; }
.dl-eye:hover { color: var(--accent); }
.dl-eye.off { color: var(--ink-faint); }
.dl-eye.off::after {                       /* struck-through eye = hidden */
  content: '';
  position: absolute;
  left: 3px;
  right: 3px;
  top: 50%;
  height: 1.5px;
  border-radius: 1px;
  background: currentColor;
  transform: rotate(-30deg);
}
.dl-del:hover,
.dl-del.confirming { color: var(--bad); }
.dl-del.confirming {
  font-family: var(--smallcaps);
  font-size: 14px;
  letter-spacing: .06em;
}
.draw-layer-none {
  font-size: 14px;
  color: var(--ink-faint);
  font-style: italic;
  padding: 7px 2px;
}

.draw-layer-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.draw-layer-actions .btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  letter-spacing: .06em;
  padding: 5px 10px 6px;
}
.draw-layer-actions .icon { width: 14px; height: 14px; color: var(--accent); }

/* ---- hint + empty state ---- */
.draw-hint {
  margin: 0;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-faint);
}
.draw-empty {
  display: none;
  padding: 30px 12px;
  text-align: center;
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink-dim);
}
.draw-body.draw-noimg > * { display: none; }
.draw-body.draw-noimg .draw-empty { display: block; }
