/* Contour — the design editor's own look. Independent of the site's tokens, so it stays legible on
   every design. Removable with editor.js (see index.html). */

#ed-panel, #ed-panel *, .ed-ui, .ed-ui * { box-sizing: border-box; }
#ed-panel {
  --e-bg: #17181b; --e-bg2: #202226; --e-bg3: #2a2d33; --e-line: #34373e; --e-ink: #ecebe6; --e-muted: #9b9a94;
  --e-accent: #ff7a45; --e-accent-2: #6fb3ff; --e-ok: #7bd88f; --e-warn: #ff5d5d;
  position: fixed; z-index: 2147483000; top: 14px; right: 14px;
  width: 372px; height: calc(100vh - 28px); min-width: 300px; min-height: 180px; max-width: 92vw; max-height: calc(100vh - 16px);
  display: flex; flex-direction: column;
  background: var(--e-bg); color: var(--e-ink);
  border: 1px solid var(--e-line); border-radius: 8px; box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
  font: 12px/1.4 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  resize: both; overflow: hidden; letter-spacing: 0; text-transform: none; text-align: left;
}
#ed-panel.ed-min { height: auto !important; min-height: 0; resize: none; }
#ed-panel.ed-min #ed-body, #ed-panel.ed-min #ed-tools, #ed-panel.ed-min #ed-search { display: none; }
#ed-panel.ed-hidden { display: none; }
#ed-panel button, #ed-panel input, #ed-panel select, #ed-panel textarea { font: inherit; color: inherit; letter-spacing: 0; text-transform: none; }
#ed-panel ::selection { background: var(--e-accent); color: #111; }

#ed-bar { display: flex; align-items: center; gap: 6px; padding: 8px 8px 8px 12px; background: var(--e-bg2); border-bottom: 1px solid var(--e-line); cursor: grab; user-select: none; }
#ed-bar.ed-drag { cursor: grabbing; }
#ed-title { flex: 1; font-weight: 600; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#ed-title small { color: var(--e-muted); font-weight: 400; margin-left: 6px; }
.ed-dirty { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--e-accent); margin-left: 6px; vertical-align: 1px; }
.ed-ib { width: 26px; height: 24px; border-radius: 5px; border: 1px solid var(--e-line); background: var(--e-bg3); color: var(--e-ink); cursor: pointer; display: inline-grid; place-items: center; padding: 0; line-height: 1; }
.ed-ib:hover { border-color: var(--e-accent); }
.ed-ib[disabled] { opacity: 0.35; cursor: default; }
.ed-ib.on { background: var(--e-accent); color: #111; border-color: var(--e-accent); }

#ed-tools { display: flex; flex-wrap: wrap; gap: 5px; padding: 8px 10px; border-bottom: 1px solid var(--e-line); }
#ed-search { padding: 6px 10px 8px; border-bottom: 1px solid var(--e-line); }
#ed-search input { width: 100%; }
.ed-tool { padding: 5px 8px; border-radius: 5px; border: 1px solid var(--e-line); background: var(--e-bg3); cursor: pointer; font-size: 11px; white-space: nowrap; }
.ed-tool:hover { border-color: var(--e-accent); }
.ed-tool.on { background: var(--e-accent); color: #111; border-color: var(--e-accent); }
.ed-tool select { background: transparent; border: 0; color: inherit; font-size: 11px; }
.ed-tool.ed-warn { color: #ffb4a8; }
.ed-keep { display: inline-flex; align-items: center; gap: 4px; }
.ed-keep input { margin: 0; accent-color: var(--e-accent); }

#ed-body { flex: 1; overflow-y: auto; padding: 8px 10px 40px; scrollbar-width: thin; scrollbar-color: var(--e-line) transparent; }

.ed-sec { border: 1px solid var(--e-line); border-radius: 6px; margin-bottom: 6px; background: var(--e-bg); }
.ed-sec > summary { padding: 8px 10px; cursor: pointer; list-style: none; font-weight: 600; display: flex; align-items: center; gap: 6px; user-select: none; }
.ed-sec > summary::-webkit-details-marker { display: none; }
.ed-sec > summary::before { content: "▸"; color: var(--e-muted); width: 10px; font-size: 10px; }
.ed-sec[open] > summary::before { content: "▾"; }
.ed-sec > summary:hover { color: var(--e-accent); }
.ed-sec > summary .ed-count { margin-left: auto; color: var(--e-muted); font-weight: 400; font-size: 11px; }
.ed-sec .ed-sec { background: var(--e-bg2); }
.ed-sec .ed-sec > summary { font-weight: 500; padding: 6px 8px; }
.ed-secbody { padding: 4px 10px 10px; }

.ed-row { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; min-height: 24px; }
.ed-row > label { flex: 0 0 118px; color: var(--e-muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-row.ed-set > label { color: var(--e-ink); }
.ed-row.ed-set > label::before { content: "● "; color: var(--e-accent); font-size: 8px; vertical-align: 1px; }
.ed-row > .ed-ctl { flex: 1; display: flex; gap: 5px; align-items: center; min-width: 0; }
#ed-panel input[type=text], #ed-panel input[type=number], #ed-panel select, #ed-panel textarea {
  flex: 1; min-width: 0; background: var(--e-bg3); border: 1px solid var(--e-line); color: var(--e-ink); border-radius: 4px; padding: 4px 6px; font-size: 11px;
}
#ed-panel input[type=number] { flex: 0 0 64px; }
#ed-panel textarea { width: 100%; resize: vertical; font-family: ui-monospace, Menlo, monospace; }
#ed-panel input:focus, #ed-panel select:focus, #ed-panel textarea:focus { outline: 1px solid var(--e-accent); border-color: var(--e-accent); }
#ed-panel input::placeholder, #ed-panel textarea::placeholder { color: #6f6e69; }
#ed-panel input[type=color] { width: 26px; height: 22px; padding: 0; border: 1px solid var(--e-line); background: none; border-radius: 4px; cursor: pointer; flex: 0 0 26px; }
#ed-panel input[type=range] { flex: 1; min-width: 40px; accent-color: var(--e-accent); }
#ed-panel input[type=checkbox] { accent-color: var(--e-accent); cursor: pointer; }
.ed-def { flex: 0 0 auto; cursor: pointer; color: var(--e-muted); font-size: 12px; width: 18px; height: 18px; border-radius: 4px; display: grid; place-items: center; border: 1px solid transparent; }
.ed-def:hover { color: var(--e-warn); border-color: var(--e-line); }
.ed-def.off { visibility: hidden; }
.ed-val { color: var(--e-muted); font-size: 10.5px; min-width: 34px; text-align: right; font-variant-numeric: tabular-nums; }
.ed-note { color: var(--e-muted); font-size: 11px; line-height: 1.45; margin: 2px 0 8px; }
.ed-note b { color: var(--e-ink); font-weight: 600; }
.ed-tgt { color: var(--e-accent-2); word-break: break-all; font: 11px ui-monospace, Menlo, monospace; margin-bottom: 8px; }
.ed-h { font-weight: 600; margin: 10px 0 6px; color: var(--e-ink); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }

.ed-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 9px; margin: 0 4px 5px 0; background: var(--e-bg3); border: 1px solid var(--e-line); border-radius: 5px; color: var(--e-ink); cursor: pointer; font-size: 11px; }
.ed-btn:hover { border-color: var(--e-accent); }
.ed-btn.ed-primary { background: var(--e-accent); border-color: var(--e-accent); color: #111; font-weight: 600; }
.ed-btn.ed-warn { color: var(--e-warn); }
.ed-btn.ed-wide { display: flex; width: 100%; margin-right: 0; }
.ed-btns { display: flex; flex-wrap: wrap; }

/* design switcher */
.ed-designs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
.ed-design { position: relative; display: flex; flex-direction: column; gap: 5px; padding: 7px 8px; border: 1px solid var(--e-line); border-radius: 6px; background: var(--e-bg2); cursor: pointer; text-align: left; color: var(--e-ink); min-height: 50px; }
.ed-design:hover { border-color: var(--e-accent); }
.ed-design.on { border-color: var(--e-accent); box-shadow: inset 0 0 0 1px var(--e-accent); }
.ed-design b { font-weight: 600; font-size: 11.5px; line-height: 1.2; }
.ed-design i { position: absolute; top: 6px; right: 7px; font-style: normal; color: var(--e-muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.ed-design.edited b::after { content: " •"; color: var(--e-accent); }
.ed-sw { display: flex; gap: 3px; }
.ed-sw span { width: 14px; height: 10px; border-radius: 2px; border: 1px solid rgba(255, 255, 255, 0.15); }
.ed-design-note { color: var(--e-muted); font-size: 11px; margin: 6px 0 8px; min-height: 30px; }

/* lists (program steps, blocks, paths) */
.ed-list { display: flex; flex-direction: column; gap: 5px; margin-bottom: 8px; }
.ed-li { border: 1px solid var(--e-line); border-radius: 5px; background: var(--e-bg2); padding: 6px 7px; }
.ed-li.on { border-color: var(--e-accent); }
.ed-li-head { display: flex; align-items: center; gap: 5px; }
.ed-li-head .ed-n { color: var(--e-muted); font-variant-numeric: tabular-nums; width: 18px; }
.ed-li-head select { flex: 1; }
.ed-li-body { margin-top: 6px; }
.ed-li-body .ed-row > label { flex-basis: 96px; }
.ed-mini { width: 22px; height: 22px; border-radius: 4px; border: 1px solid var(--e-line); background: var(--e-bg3); color: var(--e-ink); cursor: pointer; padding: 0; line-height: 1; flex: 0 0 22px; }
.ed-mini:hover { border-color: var(--e-accent); }

/* inspect mode */
body.ed-inspect #site * { cursor: crosshair !important; }
#ed-halo { position: fixed; z-index: 2147482000; pointer-events: none; border: 1.5px solid #ff7a45; background: rgba(255, 122, 69, 0.08); display: none; border-radius: 2px; }
#ed-halo::after { content: attr(data-label); position: absolute; left: -1px; top: -19px; background: #ff7a45; color: #111; font: 10px ui-monospace, Menlo, monospace; padding: 2px 6px; white-space: nowrap; border-radius: 3px 3px 0 0; max-width: 60vw; overflow: hidden; text-overflow: ellipsis; }
#ed-halo.picked { border-color: #6fb3ff; background: rgba(111, 179, 255, 0.08); }
#ed-halo.picked::after { background: #6fb3ff; }

/* text editing on the page */
body.ed-textedit [data-k] { outline: 1px dashed rgba(255, 122, 69, 0.55); outline-offset: 2px; cursor: text; }
body.ed-textedit [data-k]:hover, body.ed-textedit [data-k]:focus { outline: 1.5px solid #ff7a45; }

/* path recorder overlay */
.ed-ui.ed-recorder { position: fixed; inset: 0; z-index: 2147482500; cursor: crosshair; background: rgba(20, 30, 60, 0.06); }
.ed-recorder-hint { position: fixed; left: 50%; top: 16px; transform: translateX(-50%); z-index: 2147482600; background: #17181b; color: #ecebe6; font: 12px system-ui, sans-serif; padding: 8px 12px; border-radius: 6px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35); pointer-events: none; }

/* perch editing */
.ed-ui.ed-perches { position: fixed; inset: 0; z-index: 2147482500; cursor: copy; background: rgba(20, 30, 60, 0.05); }
.ed-perch { position: fixed; width: 0; height: 0; font: 10px/1 ui-monospace, Menlo, monospace; }
.ed-perch::before { content: ""; position: absolute; left: -7px; top: -7px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid #ff7a45; background: rgba(255, 122, 69, 0.18); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.7); }
.ed-perch.custom::before { border-color: #6fb3ff; background: #6fb3ff; cursor: grab; }
.ed-perch.custom { cursor: grab; }
.ed-perch.off::before { border-style: dashed; border-color: #9b9a94; background: none; }
.ed-perch-name { position: absolute; left: 10px; top: -20px; background: #17181b; color: #ecebe6; padding: 2px 5px; border-radius: 3px; white-space: nowrap; pointer-events: none; }
.ed-perch.off .ed-perch-name { color: #9b9a94; text-decoration: line-through; }
.ed-perch-x { position: absolute; left: 8px; top: 3px; width: 16px; height: 16px; padding: 0; border-radius: 50%; border: 1px solid #34373e; background: #17181b; color: #ecebe6; font: 11px/1 system-ui, sans-serif; cursor: pointer; display: grid; place-items: center; }
.ed-perch-x:hover { background: #ff5d5d; color: #111; }
.ed-li.ed-off { opacity: 0.55; }
.ed-pname { flex: 1; font: 11px ui-monospace, Menlo, monospace; }
.ed-pkind { color: var(--e-muted); font-size: 10.5px; white-space: nowrap; }

/* reopen tab when hidden */
#ed-reopen { position: fixed; z-index: 2147483000; right: 14px; bottom: 14px; display: none; padding: 7px 11px; border-radius: 6px; border: 1px solid #34373e; background: #17181b; color: #ecebe6; font: 12px system-ui, sans-serif; cursor: pointer; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35); }
#ed-reopen.show { display: block; }

.ed-toast { position: fixed; z-index: 2147483600; left: 50%; bottom: 24px; transform: translateX(-50%); background: #17181b; color: #ecebe6; border: 1px solid #34373e; padding: 8px 14px; border-radius: 6px; font: 12px system-ui, sans-serif; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35); opacity: 0; transition: opacity 0.2s; pointer-events: none; }
.ed-toast.show { opacity: 1; }
.ed-hide-search { display: none !important; }
.ed-optnote { flex: 1 0 100%; margin: 3px 0 2px 124px; color: var(--e-muted); font-size: 10.5px; line-height: 1.4; }
.ed-row:has(.ed-optnote) { flex-wrap: wrap; }
.ed-tip {
  position: fixed; z-index: 2147483600; pointer-events: none; opacity: 0; transform: translateY(3px); transition: opacity 0.12s, transform 0.12s;
  background: #ecebe6; color: #17181b; font: 11.5px/1.45 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  padding: 7px 10px; border-radius: 6px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); letter-spacing: 0; text-transform: none;
}
.ed-tip.show { opacity: 1; transform: none; }

/* ---------- spotlight: what the hovered setting changes ----------
   A bright flash that settles into a warm glowing outline, a point of light running round the edge and
   four-pointed sparks twinkling along it, for as long as the setting is hovered. */
@property --ed-spin { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
.ed-ui.ed-spot { position: fixed; inset: 0; z-index: 2147482900; pointer-events: none; transition: opacity 0.18s ease; }
.ed-ui.ed-spot.out { opacity: 0; }
.ed-spot-box { position: fixed; pointer-events: none; border-radius: 4px; }
.ed-spot-box::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: rgba(255, 214, 120, 0.08);
  box-shadow: 0 0 0 1.5px rgba(255, 238, 200, 0.95), 0 0 0 3.5px rgba(30, 18, 0, 0.35), 0 0 22px 5px rgba(255, 186, 64, 0.55), inset 0 0 16px rgba(255, 210, 120, 0.3);
  animation: ed-flash 0.75s cubic-bezier(0.2, 0.8, 0.2, 1) both, ed-breathe 1.8s ease-in-out 0.75s infinite;
}
.ed-spot-box::after {
  content: ""; position: absolute; inset: -2px; padding: 2px; border-radius: inherit;
  background: conic-gradient(from var(--ed-spin), transparent 0 60%, rgba(255, 214, 120, 0.15) 70%, #fff6dc 84%, #ffcf5a 88%, transparent 96%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: ed-spin 1.6s linear infinite;
}
@keyframes ed-flash {
  0% { background: rgba(255, 240, 190, 0.6); transform: scale(1.04);
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(30, 18, 0, 0.35), 0 0 70px 26px rgba(255, 200, 90, 0.9), inset 0 0 40px rgba(255, 236, 170, 0.7); }
  100% { transform: none; }
}
@keyframes ed-breathe { 50% { box-shadow: 0 0 0 1.5px rgba(255, 244, 214, 1), 0 0 0 3.5px rgba(30, 18, 0, 0.35), 0 0 34px 9px rgba(255, 186, 64, 0.75), inset 0 0 22px rgba(255, 210, 120, 0.42); } }
@keyframes ed-spin { to { --ed-spin: 360deg; } }
/* the whole window (the background): a frame just inside its edges, glowing inwards */
.ed-spot-box.ed-frame { border-radius: 10px; }
.ed-spot-box.ed-frame::before { background: none; animation: ed-frame 1.8s ease-in-out infinite; box-shadow: 0 0 0 2px rgba(255, 238, 200, 0.95), inset 0 0 0 1px rgba(30, 18, 0, 0.3), inset 0 0 70px 14px rgba(255, 186, 64, 0.45), 0 0 26px 6px rgba(255, 186, 64, 0.5); }
@keyframes ed-frame { 0% { box-shadow: 0 0 0 3px #fff, inset 0 0 0 1px rgba(30, 18, 0, 0.3), inset 0 0 140px 40px rgba(255, 200, 90, 0.7), 0 0 40px 10px rgba(255, 200, 90, 0.7); } 50% { box-shadow: 0 0 0 2px rgba(255, 238, 200, 0.95), inset 0 0 0 1px rgba(30, 18, 0, 0.3), inset 0 0 90px 22px rgba(255, 186, 64, 0.5), 0 0 30px 8px rgba(255, 186, 64, 0.55); } }
.ed-spark {
  position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px; opacity: 0;
  background: radial-gradient(circle, #ffffff 0 16%, #ffe7a8 30%, rgba(255, 190, 70, 0.75) 46%, transparent 66%);
  clip-path: polygon(50% 0, 58% 42%, 100% 50%, 58% 58%, 50% 100%, 42% 58%, 0 50%, 42% 42%);
  filter: drop-shadow(0 0 3px rgba(255, 200, 90, 0.9));
  animation: ed-spark 1.4s ease-in-out infinite;
}
@keyframes ed-spark {
  0% { opacity: 0; transform: translate(0, 0) scale(0.1) rotate(0deg); }
  35% { opacity: 1; transform: translate(calc(var(--dx) * 0.5), calc(var(--dy) * 0.5)) scale(var(--s, 1)) rotate(45deg); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0.1) rotate(120deg); }
}
.ed-spot-note {
  position: fixed; z-index: 2147483600; left: 50%; top: 18px; transform: translate(-50%, -6px); opacity: 0; pointer-events: none;
  background: #17181b; color: #ffe2a0; border: 1px solid rgba(255, 200, 100, 0.55); padding: 7px 12px; border-radius: 6px;
  font: 12px system-ui, sans-serif; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35), 0 0 18px rgba(255, 190, 70, 0.25); transition: opacity 0.15s, transform 0.15s;
}
.ed-spot-note.show { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .ed-spot-box::before, .ed-spot-box::after, .ed-spark { animation-duration: 0.01s; animation-iteration-count: 1; } }
