/* Vector Studio (/vector-editor and its task pages). It wears Video Studio's
   frame and panels (video-studio.css): menus and Export along the top, the
   tool's options under them, then the tools, the layers, the canvas and the
   settings in a row. On a phone the tools run along the bottom and the
   layers and settings become sheets opened from tabs. */

/* ---- Start screen ---- */
.vx-new .st-new-row + .st-new-row { margin-top: 12px; }
.vx-new .st-new-row > .st-field { flex: 0 0 auto; }
.vx-new .st-new-row > .st-field .input { width: 96px; }
.vx-new .vx-new-sizefield { flex: 1 1 220px; }
.vx-new .vx-new-sizefield .st-select { width: 100%; }
.vx-new-colourfield .vs-colour { width: 44px; height: 34px; }

/* ---- The frame ---- */
.vx-work { grid-template-rows: auto auto minmax(0, 1fr); }
.vx-body { grid-template-columns: 46px 250px minmax(0, 1fr) 290px; }
.vx-main { position: relative; display: grid; min-width: 0; min-height: 0; }
.vx-menu { max-height: 74vh; overflow-y: auto; scrollbar-width: thin; }
.vx-app .vs-menubar { flex: 0 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.vx-app .vs-menubar::-webkit-scrollbar { display: none; }
.vx-menu-head { margin: 6px 10px 2px; color: var(--accent-strong); font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.08em; text-transform: uppercase; }

/* ---- The tools and their options ---- */
.vx-tools { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--border); scrollbar-width: none; }
.vx-tools::-webkit-scrollbar { display: none; }
.vx-tool { flex: none; width: 34px; height: 34px; }
.vx-tools-gap { flex: none; width: 22px; height: 1px; margin: 4px 0; background: var(--border); }
.vx-bar { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 40px; padding: 3px 8px; background: var(--surface); border-bottom: 1px solid var(--border); }
.vx-opts { display: flex; align-items: center; gap: 10px; flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.vx-opts::-webkit-scrollbar { display: none; }
.vx-opts-name { flex: none; color: var(--accent-strong); font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.08em; text-transform: uppercase; }
.vx-opt { display: inline-flex; align-items: center; gap: 5px; flex: none; color: var(--muted); font-size: 0.76rem; }
.vx-opt-num { width: 70px; padding: 3px 6px; }
.vx-opt-font { width: auto; min-width: 140px; flex: none; }
.vx-opt-seg { flex: none; }
.vx-opts .vs-ib { flex: none; }
.vx-view-btns { display: flex; align-items: center; gap: 3px; flex: none; margin-left: auto; }
.vx-zoom { width: auto; min-width: 92px; padding-top: 3px; padding-bottom: 3px; }

/* ---- The canvas ---- */
.vx-view { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #2b2b31; outline: none; touch-action: none; }
.vx-view:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.vx-canvas, .vx-over { position: absolute; left: 0; top: 0; display: block; }
.vx-over { z-index: 1; pointer-events: none; overflow: visible; }
.vx-view.is-space, .vx-view.is-space * { cursor: grab !important; }
.vx-view.is-panning, .vx-view.is-panning * { cursor: grabbing !important; }
.vx-page { fill: #ffffff; }
.vx-page-shadow { fill: rgba(0, 0, 0, 0.45); }
.vx-view.is-outline .vx-canvas svg svg :is(path, rect, circle, ellipse, line, polyline, polygon, text, tspan) { fill: none !important; stroke: #1b1b22 !important; stroke-width: 1px !important; vector-effect: non-scaling-stroke; filter: none !important; opacity: 1 !important; marker: none !important; }
.vx-view.is-outline .vx-canvas svg svg image { opacity: 0.3; }
.vx-msg { position: absolute; left: 10px; right: 140px; bottom: 8px; z-index: 3; margin: 0; pointer-events: none; }
.vx-msg:not(:empty) { width: fit-content; max-width: calc(100% - 150px); padding: 6px 10px; color: var(--text); background: rgba(20, 17, 31, 0.86); border: 1px solid var(--border); }
.vx-msg[data-kind="warn"] { border-color: #e8b44f; }
.vx-msg[data-kind="ok"] { border-color: #2ec4b6; }
.vx-coords { position: absolute; right: 10px; bottom: 8px; z-index: 3; margin: 0; padding: 3px 7px; color: #c9c4dc; background: rgba(20, 17, 31, 0.6); font: 0.68rem/1.2 var(--mono); font-variant-numeric: tabular-nums; pointer-events: none; }
.vx-coords:empty { display: none; }

/* What the tools draw over the canvas, in screen pixels. */
.vx-over { --vx-a: #8b5cf6; }
.vx-h { fill: #ffffff; stroke: var(--vx-a); stroke-width: 1.5; }
.vx-h-rot { fill: var(--vx-a); stroke: #ffffff; }
.vx-selbox { fill: none; stroke: var(--vx-a); stroke-width: 1; stroke-dasharray: 4 3; }
.vx-sel-outline { fill: none; stroke: var(--vx-a); stroke-width: 1; }
.vx-hover { fill: none; stroke: #22d3ee; stroke-width: 1.5; }
.vx-band { fill: rgba(139, 92, 246, 0.12); stroke: var(--vx-a); stroke-width: 1; stroke-dasharray: 3 3; }
.vx-context { fill: none; stroke: #facc15; stroke-width: 1; stroke-dasharray: 6 4; }
.vx-rotline { stroke: var(--vx-a); stroke-width: 1; }
.vx-readout { fill: #ffffff; font: 600 11px var(--mono); text-anchor: middle; paint-order: stroke; stroke: #14111f; stroke-width: 3px; }
.vx-guide { stroke: #22d3ee; stroke-width: 1; }
.vx-snapline { stroke: #f472b6; stroke-width: 1; stroke-dasharray: 5 3; }
.vx-snapmark { fill: none; stroke: #f472b6; stroke-width: 2; }
.vx-grid { stroke: rgba(120, 120, 160, 0.2); stroke-width: 1; }
.vx-grid-major { stroke: rgba(120, 120, 160, 0.45); stroke-width: 1; }
.vx-node-path { fill: none; stroke: var(--vx-a); stroke-width: 1; }
.vx-node-seg { fill: none; stroke: #22d3ee; stroke-width: 3; }
.vx-node { fill: #ffffff; stroke: var(--vx-a); stroke-width: 1.5; }
.vx-node.is-on { fill: var(--vx-a); stroke: #ffffff; }
.vx-node.is-end { stroke-width: 2.5; }
.vx-node.is-close { fill: #facc15; }
.vx-hd { fill: var(--vx-a); stroke: #ffffff; stroke-width: 1; }
.vx-handle-line { stroke: var(--vx-a); stroke-width: 1; }
.vx-rubber { fill: none; stroke: var(--vx-a); stroke-width: 1; stroke-dasharray: 4 3; }
.vx-gradline { stroke: #ffffff; stroke-width: 1.5; stroke-dasharray: 4 3; }

/* Text typed on the canvas. */
.vx-text-edit { position: absolute; z-index: 4; min-width: 24px; margin: 0; padding: 0; overflow: hidden; background: rgba(255, 255, 255, 0.04); border: 0; outline: 1px dashed var(--accent); resize: none; white-space: pre; }

/* ---- Library ---- */
.vx-lib-body { padding: 8px 10px 16px; }
.vx-tree-bar { display: flex; gap: 2px; margin-bottom: 6px; }
.vx-tree { margin: 0 0 8px; padding: 0; list-style: none; }
.vx-tree-row { display: flex; align-items: center; gap: 4px; min-height: 28px; padding: 2px 4px 2px calc(2px + var(--depth, 0) * 14px); color: var(--muted); font-size: 0.78rem; cursor: pointer; }
.vx-tree-row:hover { background: rgba(255, 255, 255, 0.04); }
.vx-tree-row.is-layer { color: var(--text); font-weight: 600; border-top: 1px solid var(--border); }
.vx-tree-row.is-current { box-shadow: inset 3px 0 0 #ffd060; }
.vx-tree-row.is-sel { color: var(--text); background: var(--tint); }
.vx-tree-row.is-hidden .vx-tree-name { opacity: 0.45; }
.vx-tree-row.is-drop { box-shadow: inset 0 0 0 1px var(--accent); }
.vx-tree-row:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.vx-tree-fold { display: grid; place-items: center; flex: none; width: 18px; height: 18px; padding: 0; color: var(--muted); background: none; border: 0; cursor: pointer; transition: transform 140ms ease; }
.vx-tree-fold.is-open { transform: rotate(90deg); }
.vx-tree-icon { display: grid; place-items: center; flex: none; color: var(--accent-strong); }
.vx-tree-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vx-tree-btn { display: grid; place-items: center; flex: none; width: 24px; height: 22px; padding: 0; color: var(--faint); background: none; border: 0; cursor: pointer; opacity: 0.6; }
.vx-tree-row:hover .vx-tree-btn, .vx-tree-btn.is-on { opacity: 1; }
.vx-tree-btn.is-on { color: var(--text); }
.vx-tree-btn:hover { color: var(--text); }
.vx-rename { flex: 1 1 auto; min-width: 0; padding: 1px 5px; color: var(--text); background: var(--surface-2); border: 1px solid var(--accent); border-radius: 0; font: inherit; }

.vx-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(26px, 1fr)); gap: 4px; margin: 4px 0 10px; }
.vx-swatch { aspect-ratio: 1; min-width: 0; padding: 0; background: var(--sw, #fff); border: 1px solid var(--edge); border-radius: 0; cursor: pointer; transition: transform 120ms ease; }
.vx-swatch:hover { transform: translateY(-2px); box-shadow: 2px 2px 0 var(--edge); }
.vx-swatch:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.vx-swatch.is-none { background: linear-gradient(to top right, #ffffff calc(50% - 1.5px), #e53935 calc(50% - 1px), #e53935 calc(50% + 1px), #ffffff calc(50% + 1.5px)); }

.vx-icon-search { width: 100%; margin-bottom: 4px; }
.vx-icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 4px; margin-bottom: 10px; }
.vx-icon-tile { display: grid; place-items: center; aspect-ratio: 1; padding: 0; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 0; cursor: pointer; transition: border-color 140ms ease, color 140ms ease; }
.vx-icon-tile:hover, .vx-icon-tile.is-on { color: var(--tint-text); border-color: var(--accent); }
.vx-icon-tile.is-on { background: var(--tint); }
.vx-icon-tile:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* ---- Settings ---- */
.vx-row2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px; align-items: end; }
.vx-row2 > .vs-field { gap: 6px; min-width: 0; }
.vx-row2 > .vs-field .vs-field-label { flex: 0 0 auto; min-width: 12px; }
.vx-row2 > .vs-field .vs-numwrap { flex: 1 1 auto; min-width: 0; }
.vx-row2 .st-num { width: 100%; min-width: 0; }
.vx-row2 > .vs-field > .st-select { flex: 1 1 auto; min-width: 0; width: 100%; }
.vs-insp .vs-seg .seg-btn { flex: 1 1 auto; padding-left: 6px; padding-right: 6px; }
.vx-wh { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
.vx-turn { grid-template-columns: minmax(0, 1fr) auto; }
.vx-btns { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 8px; }
.vx-btns .btn { display: inline-flex; align-items: center; gap: 5px; }
.vx-gradbar { height: 16px; margin: 6px 0; border: 1px solid var(--edge); }
.vx-stops { display: grid; gap: 4px; }
.vx-stop { display: grid; grid-template-columns: 34px minmax(0, 1fr) minmax(0, 1fr) 26px; gap: 4px; align-items: center; }
.vx-stop .vs-colour { width: 34px; height: 28px; }
.vx-stop .st-num { width: 100%; min-width: 0; }
.vx-input { width: 100%; min-width: 0; padding: 5px 9px; border-radius: 0; font-size: 0.8rem; }

/* ---- Windows ---- */
.vx-ex-form .vs-field { margin-bottom: 8px; }
.vx-ex-size { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.vx-help p { margin: 0 0 10px; }
.vx-trace { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 14px; }
.vx-trace-view { display: grid; place-items: center; min-height: 260px; max-height: 60vh; overflow: hidden; background: repeating-conic-gradient(#e9e6f2 0 25%, #ffffff 0 50%) 0 0 / 16px 16px; border: 1px solid var(--edge); }
.vx-trace-view svg { width: 100%; height: 100%; max-height: 60vh; }
.vx-trace-form { min-width: 0; }

.vx-mk { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; }
.vx-mk-side { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.vx-mk-stage { display: grid; place-items: center; min-height: 260px; padding: 12px; background: repeating-conic-gradient(#e9e6f2 0 25%, #ffffff 0 50%) 0 0 / 16px 16px; border: 1px solid var(--edge); }
.vx-mk-art { display: grid; place-items: center; width: 100%; }
.vx-mk-art svg { width: 100%; height: auto; max-height: 52vh; }
.vx-mk-form { max-height: 62vh; min-width: 0; overflow-y: auto; scrollbar-width: thin; }
.vx-mk-form .vs-field { margin-bottom: 8px; }
.vx-mk-icons { display: grid; grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); gap: 4px; margin: 4px 0 10px; max-height: 160px; overflow-y: auto; }

/* ---- Phones ---- */
@media (max-width: 760px) {
  .vx-new .st-new-row > .st-field { flex: 1 1 40%; }
  .vx-new .st-new-row > .st-field .input { width: 100%; }
  .vx-new .seg { flex-wrap: wrap; }
  .vx-work { grid-template-rows: auto auto minmax(0, 1fr) auto auto; }
  .vx-body { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .vx-main { grid-row: 1; height: 100%; }
  .vx-tools { grid-row: 2; flex-direction: row; justify-content: flex-start; padding: 3px 4px; overflow-x: auto; overflow-y: hidden; border-right: 0; border-top: 1px solid var(--border); }
  .vx-tool { width: 38px; height: 38px; }
  .vx-tools-gap { width: 1px; height: 22px; margin: 0 4px; }
  .vx-bar { gap: 4px; padding: 3px 6px; }
  .vx-app .vs-menubtn:nth-child(n + 4) { display: inline-block; }
  .vx-app .vs-top { flex-wrap: wrap; row-gap: 2px; }
  .vx-app .vs-menubar { order: 1; flex: 1 0 100%; }
  #vx-snap, .vx-zoom { display: none; }
  .vx-msg { right: 8px; bottom: 8px; }
  .vx-msg:not(:empty) { max-width: calc(100% - 16px); }
  .vx-coords { display: none; }
  .vx-trace, .vx-mk { grid-template-columns: minmax(0, 1fr); }
  .vx-mk-stage { min-height: 160px; }
  .vx-mk-art svg { max-height: 30vh; }
  .vx-mk-form { max-height: none; overflow: visible; }
  .vx-trace-view { min-height: 180px; max-height: 36vh; }
}
