/* The visual editor (visual-editor.js): the switch Czat AI | Edytor over the chat's column, the layer over the stage
   (selection, handles, guides) and the inspector in the chat's place. The page's tokens (site.css, panel/panel.css). */
.ve-side { --ve-sel: #0a66ff; --ve-guide: #ff2d9b; }
.ve-host { --ve-sel: #0a66ff; --ve-guide: #ff2d9b; position: relative; }
.ve-side > [hidden] { display: none !important; }
.st-talk.ve-side { grid-template-rows: auto minmax(0, 1fr) auto; } /* the switch, then the conversation (or the inspector), then the field */

/* ---------- the switch ---------- */
.ve-modes { flex: none; display: flex; align-items: center; gap: 8px; max-height: 80px; padding: 12px 16px; overflow: hidden; border-bottom: .5px solid var(--hair); background: var(--surface); transition: opacity .2s ease, max-height .3s var(--st-ease, cubic-bezier(.2, 0, 0, 1)), padding .3s var(--st-ease, cubic-bezier(.2, 0, 0, 1)); }
.ve-modes .fx-seg { flex: 1; max-width: 320px; }
.ve-modes .fx-seg button { height: 34px; font-size: .875rem; font-weight: 550; }
.ve-modes.off { max-height: 0; padding-top: 0; padding-bottom: 0; border-bottom-width: 0; opacity: 0; pointer-events: none; } /* no design yet: folded away */
.ve-steps { display: flex; gap: 2px; margin-left: auto; }
.ve-steps[hidden] { display: none; }

/* ---------- small controls of the inspector ---------- */
.ve-icon { flex: none; width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent; color: var(--ink-2); display: grid; place-items: center; cursor: pointer; transition: background-color .2s ease, color .2s ease, opacity .2s ease, transform .15s ease; }
.ve-icon:hover { background: var(--bg-2); color: var(--ink); }
.ve-icon:active { transform: scale(.94); }
.ve-icon:disabled { opacity: .3; pointer-events: none; }
.ve-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 12px; border: 0; border-radius: 10px; background: var(--bg-2); color: var(--ink); font: inherit; font-size: .8125rem; font-weight: 550; cursor: pointer; white-space: nowrap; transition: background-color .2s ease, transform .15s ease; }
.ve-btn:hover { background: #ebebef; }
.ve-btn:active { transform: scale(.97); }
.ve-btn.ghost { background: transparent; color: var(--ink-2); }
.ve-btn.ghost:hover { background: var(--bg-2); color: var(--ink); }
.ve-btn svg { flex: none; }

/* ---------- the inspector ---------- */
.ve-panel { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; background: var(--surface); }
.ve-panel::-webkit-scrollbar { display: none; }
.ve-panel-in { padding: 16px; display: grid; gap: 8px; align-content: start; }
.ve-sel-head { display: flex; align-items: center; gap: 8px; min-height: 36px; }
.ve-sel-head h3 { margin: 0; flex: 1; min-width: 0; font-size: 1.0625rem; font-weight: 650; letter-spacing: -.01em; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ve-sec { display: grid; gap: 12px; padding: 16px 0; border-top: .5px solid var(--hair); }
.ve-sel-head + .ve-sec { margin-top: 8px; }
.ve-sec h4, .ve-sub { margin: 0; font-size: .75rem; font-weight: 600; letter-spacing: .02em; color: var(--ink-2); }
.ve-sub { margin-top: 4px; }
.ve-knob { display: grid; gap: 4px; }
.ve-knob .fx-head { display: flex; align-items: baseline; justify-content: space-between; }
.ve-knob .fx-val { font-size: .8125rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.ve-row { display: flex; gap: 8px; flex-wrap: wrap; }
.ve-row .ve-btn { flex: 1; }
.ve-note { margin: 0; font-size: .8125rem; line-height: 1.45; color: var(--ink-2); }
.ve-wide { width: 100%; margin-top: 4px; }

/* the animation presets: live tiles, the one on the part outlined */
.ve-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.ve-tile { display: grid; justify-items: center; gap: 6px; padding: 12px 6px 10px; border: 0; border-radius: 14px; background: var(--bg-2); color: var(--ink); font: inherit; font-size: .75rem; font-weight: 550; line-height: 1.2; text-align: center; cursor: pointer; box-shadow: inset 0 0 0 0 var(--ink); transition: box-shadow .2s ease, background-color .2s ease, transform .15s ease; }
.ve-tile:hover { background: #ebebef; }
.ve-tile:active { transform: scale(.97); }
.ve-tile[aria-checked="true"] { background: var(--surface); box-shadow: inset 0 0 0 2px var(--ink); }
.ve-tile .fx-chip-smp { width: 40px; height: 40px; background: #fff; }
.ve-tile span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ve-still { color: var(--ink-2); }
.ve-swatches { align-items: center; }
.ve-pick { position: relative; width: 32px; height: 32px; border-radius: 50%; background: conic-gradient(#f43f5e, #f97316, #e0a100, #10b981, #0a66ff, #7c3aed, #f43f5e); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); cursor: pointer; }
.ve-pick::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; box-shadow: 0 0 0 2px var(--ink); opacity: 0; transform: scale(.85); transition: opacity .2s ease, transform .2s ease; }
.ve-pick.on::after { opacity: 1; transform: none; }
.ve-pick input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }
.ve-fine { justify-self: start; }

/* nothing selected: a small scene of what to do, the parts to pick, the keys */
.ve-empty { display: grid; justify-items: center; gap: 10px; padding: 24px 8px 8px; text-align: center; }
.ve-empty h3 { margin: 0; font-size: 1.0625rem; font-weight: 650; letter-spacing: -.01em; }
.ve-empty p { margin: 0; max-width: 300px; font-size: .875rem; line-height: 1.5; color: var(--ink-2); }
.ve-empty .ve-keys { font-size: .75rem; color: var(--ink-3); }
.ve-parts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 6px 0; }
.ve-parts .st-chip, .ve-parts button { height: 34px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--bg-2); color: var(--ink); font: inherit; font-size: .8125rem; font-weight: 550; cursor: pointer; transition: background-color .2s ease, transform .15s ease; }
.ve-parts button:hover { background: #ebebef; }
.ve-art { position: relative; width: 132px; height: 84px; margin-bottom: 6px; }
.ve-art-card { position: absolute; inset: 10px 8px; display: grid; align-content: center; gap: 6px; padding: 0 14px; border-radius: 12px; background: var(--bg-2); }
.ve-art-card i { height: 6px; border-radius: 3px; background: #d9d9de; }
.ve-art-card i:first-child { width: 62%; height: 8px; background: var(--ink); }
.ve-art-card i:nth-child(2) { width: 80%; }
.ve-art-card i:nth-child(3) { width: 48%; }
.ve-art-sel { position: absolute; left: 18px; top: 26px; width: 58px; height: 14px; border-radius: 3px; box-shadow: 0 0 0 1.5px var(--ve-sel); animation: veArtSel 3.2s var(--st-ease, cubic-bezier(.2, 0, 0, 1)) infinite; }
.ve-art-ptr { position: absolute; left: 56px; top: 32px; color: var(--ink); animation: veArtPtr 3.2s var(--st-ease, cubic-bezier(.2, 0, 0, 1)) infinite; }
@keyframes veArtSel { 0%, 20% { transform: none; opacity: 0; } 28%, 60% { transform: none; opacity: 1; } 80%, 92% { transform: translate(26px, 10px); opacity: 1; } 100% { transform: translate(26px, 10px); opacity: 0; } }
@keyframes veArtPtr { 0% { transform: translate(30px, 30px); } 20%, 60% { transform: none; } 80%, 92% { transform: translate(26px, 10px); } 100% { transform: translate(30px, 30px); } }
@media (prefers-reduced-motion: reduce) { .ve-art-sel, .ve-art-ptr { animation: none; } .ve-art-sel { opacity: 1; } }

/* ---------- the layer over the stage ---------- */
.ve-layer { position: absolute; inset: 0; z-index: 4; touch-action: none; user-select: none; -webkit-user-select: none; overflow: hidden; }
.ve-layer[hidden] { display: none; }
.ve-host.ve-on .st-fx { position: relative; z-index: 5; } /* the animations' chips under the signature stay in reach */
.ve-host.ve-on .st-badge { z-index: 6; }
.ve-hover, .ve-sel { position: absolute; left: 0; top: 0; transform-origin: center; pointer-events: none; }
.ve-hover { border-radius: 3px; box-shadow: 0 0 0 1px var(--ve-sel); opacity: 0; transition: opacity .15s ease; }
.ve-hover.on { opacity: .7; }
.ve-sel { border-radius: 2px; box-shadow: 0 0 0 1.5px var(--ve-sel); }
.ve-sel.glide { transition: transform .26s cubic-bezier(.4, 0, .2, 1), width .26s cubic-bezier(.4, 0, .2, 1), height .26s cubic-bezier(.4, 0, .2, 1); }
.ve-h { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 3px; background: #fff; box-shadow: 0 0 0 1.5px var(--ve-sel), 0 1px 3px rgba(0, 0, 0, .2); pointer-events: auto; transition: transform .15s ease; }
.ve-h::before { content: ""; position: absolute; inset: -8px; } /* a 26 px hit area */
.ve-h:hover { transform: scale(1.2); }
.ve-h[data-h="nw"] { left: 0; top: 0; cursor: nwse-resize; }
.ve-h[data-h="ne"] { left: 100%; top: 0; cursor: nesw-resize; }
.ve-h[data-h="se"] { left: 100%; top: 100%; cursor: nwse-resize; }
.ve-h[data-h="sw"] { left: 0; top: 100%; cursor: nesw-resize; }
.ve-stem { position: absolute; left: 50%; top: 100%; width: 1.5px; height: 16px; margin-left: -.75px; background: var(--ve-sel); }
.ve-rot { position: absolute; left: 50%; top: calc(100% + 24px); width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1.5px var(--ve-sel), 0 1px 3px rgba(0, 0, 0, .2); pointer-events: auto; cursor: grab; transition: transform .15s ease; }
.ve-rot::before { content: ""; position: absolute; inset: -8px; border-radius: 50%; }
/* a phone: the signature is small – handles that reach no further than they show */
@media (max-width: 600px) { .ve-h::before, .ve-rot::before { inset: -3px; } .ve-stem { height: 12px; } .ve-rot { top: calc(100% + 18px); } }
.ve-rot:hover { transform: scale(1.15); }
.ve-layer.busy, .ve-layer.busy .ve-rot { cursor: grabbing; }
/* a tiny part: its corners outside it, so the part itself stays easy to grab */
.ve-sel.small .ve-h[data-h="nw"] { left: -6px; top: -6px; }
.ve-sel.small .ve-h[data-h="ne"] { left: calc(100% + 6px); top: -6px; }
.ve-sel.small .ve-h[data-h="se"] { left: calc(100% + 6px); top: calc(100% + 6px); }
.ve-sel.small .ve-h[data-h="sw"] { left: -6px; top: calc(100% + 6px); }
@media (pointer: coarse) {
  .ve-h { width: 14px; height: 14px; margin: -7px 0 0 -7px; }
  .ve-h::before { inset: -15px; } /* 44 px under a finger */
  .ve-rot { width: 20px; height: 20px; margin: -10px 0 0 -10px; top: calc(100% + 30px); }
  .ve-stem { height: 20px; }
  .ve-rot::before { inset: -12px; }
}
/* where a dragged part goes: a line across the gap in the row or column */
.ve-sel.editing .ve-h, .ve-sel.editing .ve-rot, .ve-sel.editing .ve-stem { opacity: 0; pointer-events: none; }
.ve-h, .ve-rot, .ve-stem { transition: transform .15s ease, opacity .15s ease; }
/* his words written in place: a field over the part, set as it is */
.ve-edit { position: absolute; left: 0; top: 0; transform-origin: center; display: flex; align-items: center; }
.ve-edit input { width: 100%; height: 100%; min-width: 0; margin: 0; padding: 0 2px; border: 0; border-radius: 3px; background: #fff; box-shadow: 0 0 0 1.5px var(--ve-sel), 0 4px 14px rgba(10, 102, 255, .14); line-height: 1; outline: none; user-select: text; -webkit-user-select: text; }
.ve-tip { position: absolute; left: 0; top: 0; padding: 3px 8px; border-radius: 6px; background: var(--ink); color: #fff; font-size: .75rem; font-weight: 550; font-variant-numeric: tabular-nums; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .15s ease; }
.ve-tip.on { opacity: 1; }

@media (max-width: 899px) {
  .ve-modes { padding: 8px 12px; }
  .ve-modes .fx-seg { max-width: none; }
  .ve-panel-in { padding: 12px 12px 16px; }
  .ve-empty { padding-top: 12px; }
  .ve-art { display: none; } /* the room is the stage's on a phone */
  .ve-tiles { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { .ve-sel.glide { transition: none; } }
