/* -------------------------------------------------------------------------- */
/* d's editor (v280, editor.js): the bar with the tools and the line of what  */
/* is selected, and the layer the marks and arrows are drawn on while they    */
/* are edited. Fixed to the viewport, like d's HUD, and never printed.        */
/* -------------------------------------------------------------------------- */

#ed-bar {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 41;
  display: none;
  width: 380px;
  max-width: calc(100vw - 24px);
  font: 13px/1.4 var(--skin-font-prose, sans-serif);
  color: #fff;
  background: #2a2a33;
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}
html.ed-on #ed-bar { display: block; }

.ed-tools {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  background: #34343f;
}
.ed-title { flex: 1; opacity: 0.85; cursor: move; touch-action: none; user-select: none; }
#ed-bar button {
  border: 1px solid #4a4a58;
  background: #3b3b47;
  color: inherit;
  font: inherit;
  border-radius: 4px;
  padding: 2px 7px;
  cursor: pointer;
}
#ed-bar button:hover { background: #474756; }
#ed-bar button.on { background: #e60; border-color: #e60; color: #fff; }
#ed-bar .ed-tool { width: 30px; height: 28px; padding: 3px; }
#ed-bar .ed-tool svg {
  width: 20px; height: 20px;
  fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}

.ed-panel:empty { display: none; }
.ed-panel { padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.ed-hint { opacity: 0.8; }
.ed-line { display: flex; align-items: flex-start; gap: 6px; }
.ed-line code {
  flex: 1;
  font: 12.5px/1.35 ui-monospace, monospace;
  background: #1d1d24;
  padding: 4px 6px;
  border-radius: 4px;
  white-space: pre-wrap;
  word-break: break-all;
  user-select: all;
}
.ed-where { color: #ffd7a8; }
.ed-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.ed-k { width: 64px; opacity: 0.75; }
#ed-bar .ed-row i {
  display: inline-block;
  width: 9px; height: 9px;
  margin-right: 4px;
  border-radius: 50%;
  vertical-align: baseline;
}
.ed-foot { opacity: 0.85; }
.ed-foot:empty { display: none; }

/* The layer: the whole window, under the bar, above the slide. It takes no */
/* pointer of its own (editor.js tests what is under the pointer itself).    */
#ed-layer {
  position: fixed;
  left: 0; top: 0;
  width: 100vw; height: 100vh;
  z-index: 39;
  pointer-events: none;
  overflow: visible;
  display: none;
}
html.ed-on #ed-layer { display: block; }

#ed-layer .ed-pic { fill: none; stroke: #e60; stroke-width: 1; stroke-dasharray: 4 4; }
#ed-layer .ed-shape { stroke: currentColor; stroke-width: 1.5; stroke-dasharray: 5 4; fill: none; }
#ed-layer .ed-wash { fill: currentColor; fill-opacity: 0.18; }
#ed-layer .ed-hatch { fill-opacity: 0.6; }
#ed-layer .ed-changed .ed-shape,
#ed-layer .ed-sel .ed-shape { stroke-width: 3; stroke-dasharray: none; }
#ed-layer .ed-line { stroke: currentColor; stroke-width: 1.5; stroke-dasharray: 5 4; }
#ed-layer .ed-head { fill: currentColor; }
#ed-layer .ed-changed .ed-line,
#ed-layer .ed-sel .ed-line { stroke-width: 3; stroke-dasharray: none; }
#ed-layer .ed-handle { fill: #fff; stroke: #2a7de1; stroke-width: 2; }
#ed-layer .ed-label {
  font: 12px ui-monospace, monospace;
  fill: #fff;
  paint-order: stroke;
  stroke: #222;
  stroke-width: 3px;
}
#ed-layer .ed-rubber { fill: none; stroke: #e60; stroke-width: 2; stroke-dasharray: 6 4; }

/* While a mark or an arrow of the deck is being changed, the editor draws  */
/* it; the deck's own copy keeps out of the way (a deleted one, too).       */
.spot-mark.spot-area.ed-gone,
.arrow.ed-gone,
.drawing .at.ed-gone { visibility: hidden !important; }

/* Pointers: a cross to draw, a hand over what can be moved. */
html[data-ed-tool="box"].ed-on .slide.current img,
html[data-ed-tool="ring"].ed-on .slide.current img,
html[data-ed-tool="arrow"].ed-on .slide.current img { cursor: crosshair; touch-action: none; }
html.ed-on.ed-over[data-ed-tool="select"] .slide.current { cursor: move; }
html.ed-on.ed-over-handle[data-ed-tool="select"] .slide.current { cursor: nwse-resize; }

/* The slide's Markdown with the changes (Shift+V, while d is on). */
#source-pane .ed-pl { display: block; min-height: 1.35em; }
#source-pane .ed-n {
  display: inline-block;
  min-width: 3.2em;
  margin-right: 0.8em;
  text-align: right;
  opacity: 0.45;
  user-select: none;
}
#source-pane .ed-new { background: rgba(60, 170, 80, 0.22); }
#source-pane .ed-chg { background: rgba(230, 102, 0, 0.22); }
#source-pane .ed-del { text-decoration: line-through; opacity: 0.55; }

@media print {
  #ed-bar, #ed-layer { display: none !important; }
}

/* Drawings (v284): their blocks, the guides and what pulls. */
#ed-layer .ed-piece { color: #1a9; }
#ed-layer .ed-guide { stroke: #2bd; stroke-width: 1; stroke-dasharray: 6 4; opacity: .8; }
#ed-layer .ed-guide-handle { fill: #2bd; stroke: #fff; stroke-width: 1; }
#ed-layer .ed-snap { stroke: #e0d; stroke-width: 1; }
#ed-bar .ed-guides { margin-left: 6px; font-weight: 700; }
#ed-bar input.ed-text,
#ed-bar input.ed-sfile,
#ed-bar input.ed-sname,
#ed-bar input.ed-svgfile {
  flex: 1;
  font: inherit;
  color: #fff;
  background: #1d1d24;
  border: 1px solid #4a4a58;
  border-radius: 4px;
  padding: 2px 6px;
}

/* "Save group as..." (v291): the file wider than the name. */
#ed-bar input.ed-sfile { flex: 3; min-width: 8em; }
#ed-bar input.ed-sname { flex: 2; min-width: 5em; }
#ed-bar input.ed-svgfile { flex: 5; min-width: 8em; }

/* The arrows of drawings (v285): the one selected, and where a drag ends. */
#ed-layer .ed-linksel { fill: none; stroke: #e60; stroke-width: 7; stroke-opacity: .35;
                        stroke-linejoin: round; stroke-linecap: round; }
#ed-layer .ed-target { fill: rgba(238, 102, 0, .12); stroke: #e60; stroke-width: 2; }

/* Several blocks, aligning, stacking, the step of the guides (v289). */
#ed-bar .ed-gstep { display: inline-flex; align-items: center; gap: 2px; margin-left: 4px;
                    font-size: 12px; color: #bbb; }
#ed-bar .ed-gstep input {
  width: 3.2em;
  font: inherit;
  color: #fff;
  background: #1d1d24;
  border: 1px solid #4a4a58;
  border-radius: 4px;
  padding: 1px 3px;
}

/* -------------------------------------------------------------------------- */
/* d's master editor (v302, master.js): the "Master" button in the bar, the   */
/* panel it takes over, and the outlines of the master's parts.               */
/* -------------------------------------------------------------------------- */

#ed-bar .ed-master { margin-left: 6px; }
/* (v309) Health brings d's list back; x closes d, the editor with it */
#ed-bar .ed-health { margin-left: 4px; }
#ed-bar .ed-close { margin-left: 4px; padding: 0 7px; font-size: 16px; line-height: 1.3; }
/* a long panel scrolls, wherever the bar has been moved to */
html.ms-on #ed-bar .ed-panel,
html.sk-on #ed-bar .ed-panel { max-height: calc(100vh - 80px); overflow-y: auto; }
#ed-bar.ed-mastering .ed-tool,
#ed-bar.ed-mastering .ed-guides,
#ed-bar.ed-mastering .ed-gstep { display: none; }
#ed-bar .ms-kinds .ed-k { width: auto; margin-right: 4px; opacity: 1; font-weight: 600; }
#ed-bar .ms-field .ed-k { width: 170px; }
#ed-bar .ms-field input,
#ed-bar .ms-field select {
  font: inherit;
  color: #fff;
  background: #1d1d24;
  border: 1px solid #4a4a58;
  border-radius: 4px;
  padding: 1px 4px;
}
#ed-bar .ms-field input[type=number] { width: 80px; }
#ed-bar .ms-field input[type=text] { flex: 1; min-width: 0; }
/* the unit, beside the value it is the unit of (Rony, 15/10 20:26) */
#ed-bar .ms-field select.ms-unit { margin-left: 4px; padding: 1px 2px; }
#ed-bar .ms-field .ms-px { margin-left: 6px; opacity: 0.7; }
#ed-bar .ms-changed .ed-k { color: #ffb36b; opacity: 1; }
#ed-bar .ms-note { opacity: 0.7; font-style: italic; }

#ms-layer {
  position: fixed;
  left: 0; top: 0;
  width: 100vw; height: 100vh;
  z-index: 39;
  pointer-events: none;
  overflow: visible;
  display: none;
}
html.ed-on.ms-on #ms-layer { display: block; }
/* (v402; Rony, 15/11) every outline dotted, over a white line so that it  */
/* shows on any ground; its shade, by depth, is set on it by master.js.     */
#ms-layer .ms-halo { fill: none; stroke: #fff; stroke-width: 3; opacity: 0.85; }
#ms-layer .ms-box { fill: none; stroke: #000; stroke-width: 1.5; stroke-dasharray: 1.5 3; stroke-linecap: round; }
#ms-layer .ms-sel .ms-box { fill: rgba(238, 102, 0, 0.10); stroke: #e60; stroke-width: 2; stroke-dasharray: none; }
/* The names: black on white, monospace, with no outline of their own. */
#ms-layer text.ms-label {
  font: 12px ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace !important;
  fill: #000 !important;
  stroke: none !important;
  paint-order: normal;
}
#ms-layer .ms-label-bg { fill: #fff; stroke: #000; stroke-width: 0.75; }
#ms-layer .ms-handle { fill: #fff; stroke: #e60; stroke-width: 2; }
@media print {
  #ms-layer { display: none !important; }
}

/* The master editor's expert mode (v305): the master's rules for an element. */
#ed-bar .ms-target { font: 12px ui-monospace, monospace; background: #1d1d24; padding: 2px 6px; border-radius: 4px; }
#ed-bar .ms-kids button { font: 11.5px ui-monospace, monospace !important; padding: 1px 5px !important; }
#ed-bar .ms-group { margin-top: 4px; font-weight: 600; opacity: 0.85; }
#ed-bar .ms-rule { display: flex; flex-direction: column; gap: 2px; }
#ed-bar .ms-selector { font: 12px ui-monospace, monospace; color: #9fd0ff; word-break: break-all; }
#ed-bar .ms-from { color: #aaa; font-family: inherit; }
#ed-bar .ms-rule textarea,
#ed-bar .ms-new input {
  font: 12px/1.4 ui-monospace, monospace;
  color: #fff;
  background: #1d1d24;
  border: 1px solid #4a4a58;
  border-radius: 4px;
  padding: 3px 5px;
  resize: vertical;
}
#ed-bar .ms-rule.ms-changed textarea { border-color: #e60; }
#ed-bar .ms-rule textarea.ms-red { border-color: #e33; }
#ed-bar .ms-bad { color: #ff8a8a; }
#ed-bar .ms-bad:empty { display: none; }

/* The whole master as text (v306): a wider bar, and room to type. */
#ed-bar.ms-wide { width: 640px; }
#ed-bar .ms-sheet {
  font: 12px/1.45 ui-monospace, monospace;
  color: #fff;
  background: #1d1d24;
  border: 1px solid #4a4a58;
  border-radius: 4px;
  padding: 4px 6px;
  height: calc(100vh - 220px);
  min-height: 200px;
  resize: vertical;
  white-space: pre;
  tab-size: 2;
}
#ed-bar .ms-count { opacity: 0.7; }

/* The skin editor (v313, skin.js): the values in groups, a control each.     */
#ed-bar .ed-skin { margin-left: 4px; }
#ed-bar .sk-group { margin: 2px 0; }
#ed-bar .sk-group > summary { cursor: pointer; padding: 3px 0; font-weight: 600; user-select: none; }
#ed-bar .sk-count { font-weight: 400; opacity: 0.6; font-size: 12px; }
#ed-bar .sk-field { gap: 4px; }
#ed-bar .sk-field .ed-k { width: 160px; flex: none; }
#ed-bar .sk-field input,
#ed-bar .sk-field select {
  font: inherit; color: #fff; background: #1d1d24;
  border: 1px solid #4a4a58; border-radius: 4px; padding: 1px 4px; min-width: 0;
}
#ed-bar .sk-field input[type=text] { flex: 1; }
#ed-bar .sk-field input[type=color] { width: 30px; height: 22px; padding: 0 1px; flex: none; }
#ed-bar .sk-field input[type=range] { flex: 1; padding: 0; }
#ed-bar .sk-field input.sk-px { width: 60px; flex: none; }
#ed-bar .sk-field .sk-num { opacity: 0.75; white-space: nowrap; }
#ed-bar .sk-default .ed-k { opacity: 0.55; }
#ed-bar .sk-changed .ed-k { color: #ffb36b; opacity: 1; }
#ed-bar .sk-inline { margin-left: 6px; }
html.sk-on #ed-bar { width: 440px; }
#ed-bar .sk-field select.sk-unit { flex: none; padding: 1px 2px; }
/* (v314) Edit mode: Simple | Expert, one segmented control in both editors */
#ed-bar .ed-mode { flex-wrap: nowrap; padding-bottom: 4px; border-bottom: 1px solid #44444f; margin-bottom: 4px; }
#ed-bar .ed-mode .ed-what { width: auto; margin-right: 6px; opacity: 1; font-weight: 600; }
#ed-bar .ed-mode .ed-file { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: 0.85; }
#ed-bar .ed-seg { display: inline-flex; margin-left: auto; flex: none; }
#ed-bar .ed-seg button { border-radius: 0; margin: 0; }
#ed-bar .ed-seg button:first-child { border-radius: 4px 0 0 4px; }
#ed-bar .ed-seg button:last-child { border-radius: 0 4px 4px 0; border-left: 0; }
